blob: 6f8f3fbcdf68c4316e29e78d9f806cc1917d1694 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
$NetBSD: patch-toolkit_modules_subprocess_subprocess__shared__unix.js,v 1.3 2022/06/06 20:59:40 ryoon Exp $
Fix broken native messaging on NetBSD and possibly other BSDs too:
https://bugzilla.mozilla.org/show_bug.cgi?id=1543602
Please remove this patch when the upstream issue is resolved.
--- toolkit/modules/subprocess/subprocess_shared_unix.js.orig 2022-05-20 10:44:23.277253777 +0000
+++ toolkit/modules/subprocess/subprocess_shared_unix.js
@@ -13,7 +13,15 @@
var LIBC = OS.Constants.libc;
-const LIBC_CHOICES = ["libc.so", "libSystem.B.dylib", "a.out"];
+/* libc.so isn't meant to be dlopen'ed. On Linux it's usually an ld
+ * script so one cannot dlopen it. On NetBSD (and possibly other
+ * BSDs too) dlopen'ing libc.so will succeed, but some global symbols,
+ * especially environ(7), are pointing to unused memory regions
+ * because they are meant to be overridden by the main executable.
+ * So the most portable way to access libc symbols is to do it through
+ * the NULL handle, i.e. the one which NSPR calls "a.out".
+ */
+const LIBC_CHOICES = ["a.out"];
const unix = {
pid_t: ctypes.int32_t,
|