forked from canonical/snapd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
snapcraft.yaml: ignore LD_* variables
There are potential issues where some users having broken `LD_LIBRARY_PATH`, `LD_PRELOAD` or `LD_AUDIT` would break execution of the snapd dynamic linker because that would try to force loading binaries with a different ABI. So we rename the `LD_*` variables as `SNAPD_LD_*`.
- Loading branch information
1 parent
2873a5d
commit 80baecc
Showing
3 changed files
with
96 additions
and
24 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
build-aux/snap/local/rename-dynamic-loader-variables.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
diff -ur glibc-2.35.old/elf/dl-environ.c glibc-2.35/elf/dl-environ.c | ||
--- glibc-2.35.old/elf/dl-environ.c 2024-09-16 12:34:26.933137126 +0200 | ||
+++ glibc-2.35/elf/dl-environ.c 2024-09-16 12:45:01.558071825 +0200 | ||
@@ -31,10 +31,21 @@ | ||
|
||
while (*current != NULL) | ||
{ | ||
- if (__builtin_expect ((*current)[0] == 'L', 0) | ||
- && (*current)[1] == 'D' && (*current)[2] == '_') | ||
+ if (__builtin_expect ((*current)[0] == 'S', 0) | ||
+ && (*current)[1] == 'N' | ||
+ && (*current)[2] == 'A' | ||
+ && (*current)[3] == 'P' | ||
+ && (*current)[4] == 'D' | ||
+ && (*current)[5] == '_') { | ||
+ } else { | ||
+ ++current; | ||
+ continue ; | ||
+ } | ||
+ | ||
+ if (__builtin_expect ((*current)[6] == 'L', 0) | ||
+ && (*current)[7] == 'D' && (*current)[8] == '_') | ||
{ | ||
- result = &(*current)[3]; | ||
+ result = &(*current)[9]; | ||
|
||
/* Save current position for next visit. */ | ||
*position = ++current; | ||
diff -ur glibc-2.35.old/elf/dl-support.c glibc-2.35/elf/dl-support.c | ||
--- glibc-2.35.old/elf/dl-support.c 2024-09-16 12:34:26.934137133 +0200 | ||
+++ glibc-2.35/elf/dl-support.c 2024-09-16 12:47:39.969907345 +0200 | ||
@@ -350,7 +350,7 @@ | ||
|
||
/* Initialize the data structures for the search paths for shared | ||
objects. */ | ||
- _dl_init_paths (getenv ("LD_LIBRARY_PATH"), "LD_LIBRARY_PATH", | ||
+ _dl_init_paths (getenv ("SNAPD_LD_LIBRARY_PATH"), "SNAPD_LD_LIBRARY_PATH", | ||
/* No glibc-hwcaps selection support in statically | ||
linked binaries. */ | ||
NULL, NULL); | ||
diff -ur glibc-2.35.old/sysdeps/generic/unsecvars.h glibc-2.35/sysdeps/generic/unsecvars.h | ||
--- glibc-2.35.old/sysdeps/generic/unsecvars.h 2024-09-16 12:34:27.709142902 +0200 | ||
+++ glibc-2.35/sysdeps/generic/unsecvars.h 2024-09-20 10:11:02.416382981 +0200 | ||
@@ -30,5 +30,16 @@ | ||
"NLSPATH\0" \ | ||
"RESOLV_HOST_CONF\0" \ | ||
"RES_OPTIONS\0" \ | ||
+ "SNAPD_LD_AUDIT\0" \ | ||
+ "SNAPD_LD_DEBUG\0" \ | ||
+ "SNAPD_LD_DEBUG_OUTPUT\0" \ | ||
+ "SNAPD_LD_DYNAMIC_WEAK\0" \ | ||
+ "SNAPD_LD_HWCAP_MASK\0" \ | ||
+ "SNAPD_LD_LIBRARY_PATH\0" \ | ||
+ "SNAPD_LD_ORIGIN_PATH\0" \ | ||
+ "SNAPD_LD_PRELOAD\0" \ | ||
+ "SNAPD_LD_PROFILE\0" \ | ||
+ "SNAPD_LD_SHOW_AUXV\0" \ | ||
+ "SNAPD_LD_USE_LOAD_BIAS\0" \ | ||
"TMPDIR\0" \ | ||
"TZDIR\0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters