Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable usage of <sys/random.h> in older version of glibc #54

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/NodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const pkg = require('../package.json');

const isWindows = process.platform === 'win32';
const isDarwin = process.platform === 'darwin';
const isLinux = process.platform === 'linux';

const prettyPlatform = {
win32: 'windows',
Expand Down Expand Up @@ -214,10 +215,14 @@ class NodeJsBuilder {
await patchFile(
this.nodePath('src', 'node_credentials.cc'),
join(this.patchDir, 'node_credentials.cc.patch'));

await patchFile(
this.nodePath('deps','v8','src','heap','base','asm','arm64','push_registers_asm.cc'),
join(this.patchDir, 'push_registers_asm.cc.patch'));
join(this.patchDir, 'push_registers_asm.cc.patch'));

isLinux && await patchFile(
this.nodePath('deps','cares','config','linux','ares_config.h'),
join(this.patchDir, 'no_rand_on_glibc.patch'));
}

async applyPatches() {
Expand Down
24 changes: 24 additions & 0 deletions src/patch/18.20.2/no_rand_on_glibc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
disable usage of <sys/random.h>

--- /dev/null
+++ deps/cares/config/linux/ares_config.h
@@ -116,7 +116,9 @@
#define HAVE_GETNAMEINFO 1

/* Define to 1 if you have `getrandom` */
+#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 25
#define HAVE_GETRANDOM 1
+#endif

/* Define to 1 if you have `getservbyport_r` */
#define HAVE_GETSERVBYPORT_R 1
@@ -329,7 +331,9 @@
#define HAVE_SYS_PARAM_H 1

/* Define to 1 if you have the <sys/random.h> header file. */
+#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 25
#define HAVE_SYS_RANDOM_H 1
+#endif

/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1