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

library broken with glibc 2.41 #214

Open
cowlicks opened this issue Feb 5, 2025 · 2 comments
Open

library broken with glibc 2.41 #214

cowlicks opened this issue Feb 5, 2025 · 2 comments

Comments

@cowlicks
Copy link

cowlicks commented Feb 5, 2025

I'm on arch linux, I upgraded my system yesterday, and this library stopped working. It looks like it is do to a change in glibc.

I've copied some info about my system below. I've created a small repo to reproduce this bug here. At the end I show the error I get from running node index.js in the repo (the code is just the example from this repo).

$ uname -a
Linux banjo 6.13.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 02 Feb 2025 01:02:29 +0000 x86_64 GNU/Linux

$ pacman -Q glibc libsodium nodejs
glibc 2.41+r2+g0a7c7a3e283a-1
libsodium 1.0.20-1
nodejs 23.7.0-1
ldd (GNU libc) 2.41

$ ldd --version
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

$ ldd node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node
ldd: warning: you do not have execution permission for `node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node'
	linux-vdso.so.1 (0x00007461eb4bd000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007461eb196000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007461eb4bf000)


$ ls -l node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node
-rw-r--r-- 1 blake blake 1047056 Feb  5 11:24 node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node

$ grep 'glibc' /var/log/pacman.log | tail -n 4
[2024-08-10T13:11:27-0400] [ALPM] upgraded lib32-glibc (2.39+r52+gf8e4623421-1 -> 2.40+r16+gaa533d58ff-2)
[2025-02-04T12:02:35-0500] [ALPM] upgraded glibc (2.40+r16+gaa533d58ff-2 -> 2.41+r2+g0a7c7a3e283a-1)
[2025-02-04T12:03:28-0500] [ALPM] upgraded lib32-glibc (2.40+r16+gaa533d58ff-2 -> 2.41+r2+g0a7c7a3e283a-1)

$ nvm current
system

$ node --version
v23.7.0

$ cat package.json
{
  "dependencies": {
    "sodium-native": "^4.3.1"
  }
}

$ cat package-lock.json
{
  "name": "sodium_native_test",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "dependencies": {
        "sodium-native": "^4.3.1"
      }
    },
    "node_modules/node-gyp-build": {
      "version": "4.8.4",
      "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz",
      "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==",
      "license": "MIT",
      "bin": {
        "node-gyp-build": "bin.js",
        "node-gyp-build-optional": "optional.js",
        "node-gyp-build-test": "build-test.js"
      }
    },
    "node_modules/sodium-native": {
      "version": "4.3.1",
      "resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-4.3.1.tgz",
      "integrity": "sha512-YdP64gAdpIKHfL4ttuX4aIfjeunh9f+hNeQJpE9C8UMndB3zkgZ7YmmGT4J2+v6Ibyp6Wem8D1TcSrtdW0bqtg==",
      "license": "MIT",
      "dependencies": {
        "node-gyp-build": "^4.8.0"
      }
    }
  }
}

$ node index.js

node:internal/modules/cjs/loader:1914
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /home/blake/tmp/borkedsodium/sodium_native_test/node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node: cannot enable executable stack as shared object requires: Invalid argument
    at Object..node (node:internal/modules/cjs/loader:1914:18)
    at Module.load (node:internal/modules/cjs/loader:1458:32)
    at Function._load (node:internal/modules/cjs/loader:1275:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
    at Module.require (node:internal/modules/cjs/loader:1480:12)
    at require (node:internal/modules/helpers:135:16)
    at load (/home/blake/tmp/borkedsodium/sodium_native_test/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/home/blake/tmp/borkedsodium/sodium_native_test/node_modules/sodium-native/index.js:1:43)
    at Module._compile (node:internal/modules/cjs/loader:1723:14) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v23.7.0

@cowlicks
Copy link
Author

cowlicks commented Feb 5, 2025

It seems to be the same issue as this bug in julia

@pevey
Copy link

pevey commented Feb 9, 2025

@cowlicks Ty so much for linking that Julia thread. There, I was able to find this tip.

If you're on Arch and updated to glibc 2.41+ and don't want to risk attempting to downgrade, you can use execstack as a workaround.

  1. Install execstack AUR
yay -S execstack
  1. use execstack on sodium-native inside your node_modules folder. E.g.,
execstack -c ./node_modules/.pnpm/sodium-native@4.3.1/node_modules/sodium-native/prebuilds/linux-x64/sodium-native.node

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants