use getauxval to fix build failure in node_main.cc
This commit is contained in:
parent
33d841761d
commit
ac773aef58
60
0005-use-getauxval-in-node_main_cc.patch
Normal file
60
0005-use-getauxval-in-node_main_cc.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
From 7232c2a1604d241ce0455d919ba9b0b8e9959f81 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Bevenius <daniel.bevenius@gmail.com>
|
||||||
|
Date: Tue, 2 Jun 2020 05:33:25 +0200
|
||||||
|
Subject: [PATCH] src: use getauxval in node_main.cc
|
||||||
|
|
||||||
|
This commit suggests using getauxval in node_main.cc.
|
||||||
|
|
||||||
|
The motivation for this is that getauxval was introduced in glibc 2.16
|
||||||
|
and looking at BUILDING.md, in the 'Platform list' section, it looks
|
||||||
|
like we now support glibc >= 2.17 and perhaps this change would be
|
||||||
|
alright now.
|
||||||
|
|
||||||
|
PR-URL: https://github.com/nodejs/node/pull/33693
|
||||||
|
Refs: https://github.com/nodejs/node/pull/12548
|
||||||
|
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
|
||||||
|
Reviewed-By: David Carlier <devnexen@gmail.com>
|
||||||
|
Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
||||||
|
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
|
||||||
|
Reviewed-By: James M Snell <jasnell@gmail.com>
|
||||||
|
---
|
||||||
|
src/node_main.cc | 18 ++----------------
|
||||||
|
1 file changed, 2 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/node_main.cc b/src/node_main.cc
|
||||||
|
index 9f4ea22d12c6..6bac10759325 100644
|
||||||
|
--- a/src/node_main.cc
|
||||||
|
+++ b/src/node_main.cc
|
||||||
|
@@ -89,13 +89,7 @@ int wmain(int argc, wchar_t* wargv[]) {
|
||||||
|
#else
|
||||||
|
// UNIX
|
||||||
|
#ifdef __linux__
|
||||||
|
-#include <elf.h>
|
||||||
|
-#ifdef __LP64__
|
||||||
|
-#define Elf_auxv_t Elf64_auxv_t
|
||||||
|
-#else
|
||||||
|
-#define Elf_auxv_t Elf32_auxv_t
|
||||||
|
-#endif // __LP64__
|
||||||
|
-extern char** environ;
|
||||||
|
+#include <sys/auxv.h>
|
||||||
|
#endif // __linux__
|
||||||
|
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
|
||||||
|
#include <string.h>
|
||||||
|
@@ -124,15 +118,7 @@ int main(int argc, char* argv[]) {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__)
|
||||||
|
- char** envp = environ;
|
||||||
|
- while (*envp++ != nullptr) {}
|
||||||
|
- Elf_auxv_t* auxv = reinterpret_cast<Elf_auxv_t*>(envp);
|
||||||
|
- for (; auxv->a_type != AT_NULL; auxv++) {
|
||||||
|
- if (auxv->a_type == AT_SECURE) {
|
||||||
|
- node::per_process::linux_at_secure = auxv->a_un.a_val;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ node::per_process::linux_at_secure = getauxval(AT_SECURE);
|
||||||
|
#endif
|
||||||
|
// Disable stdio buffering, it interacts poorly with printf()
|
||||||
|
// calls elsewhere in the program (e.g., any logging from V8.)
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
%bcond_with bootstrap
|
%bcond_with bootstrap
|
||||||
%global baserelease 5
|
%global baserelease 6
|
||||||
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
%{?!_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}}
|
||||||
%global nodejs_epoch 1
|
%global nodejs_epoch 1
|
||||||
%global nodejs_major 12
|
%global nodejs_major 12
|
||||||
@ -91,6 +91,7 @@ Patch0007: CVE-2020-8287-2.patch
|
|||||||
Patch0008: CVE-2021-22883.patch
|
Patch0008: CVE-2021-22883.patch
|
||||||
Patch0009: CVE-2021-22884.patch
|
Patch0009: CVE-2021-22884.patch
|
||||||
Patch00010: CVE-2021-22918.patch
|
Patch00010: CVE-2021-22918.patch
|
||||||
|
Patch00011: 0005-use-getauxval-in-node_main_cc.patch
|
||||||
|
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
BuildRequires: zlib-devel
|
BuildRequires: zlib-devel
|
||||||
@ -493,6 +494,9 @@ end
|
|||||||
%{_pkgdocdir}/npm/docs
|
%{_pkgdocdir}/npm/docs
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 16 2021 zhouwenpei <zhouwenpei1@huawei.com> - 1:12.18.4-6
|
||||||
|
- use getauxval to fix build failure in node_main.cc
|
||||||
|
|
||||||
* Thu Jul 20 2021 zhouwenpei <zhouwenpei1@huawei.com> - 1:12.18.4-5
|
* Thu Jul 20 2021 zhouwenpei <zhouwenpei1@huawei.com> - 1:12.18.4-5
|
||||||
- fix CVE-2021-22918
|
- fix CVE-2021-22918
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user