diff options
-rw-r--r-- | meta/recipes-core/glibc/glibc-version.inc | 2 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc/0025-CVE-2025-4802.patch | 250 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc_2.35.bb | 2 |
3 files changed, 2 insertions, 252 deletions
diff --git a/meta/recipes-core/glibc/glibc-version.inc b/meta/recipes-core/glibc/glibc-version.inc index b269518af4..0b06005b25 100644 --- a/meta/recipes-core/glibc/glibc-version.inc +++ b/meta/recipes-core/glibc/glibc-version.inc | |||
@@ -1,6 +1,6 @@ | |||
1 | SRCBRANCH ?= "release/2.35/master" | 1 | SRCBRANCH ?= "release/2.35/master" |
2 | PV = "2.35" | 2 | PV = "2.35" |
3 | SRCREV_glibc ?= "80401002011f470d9c6eb604bf734715e9b3a8c2" | 3 | SRCREV_glibc ?= "a66bc3941ff298e474d5f02d0c3303401951141f" |
4 | SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87" | 4 | SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87" |
5 | 5 | ||
6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" | 6 | GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git" |
diff --git a/meta/recipes-core/glibc/glibc/0025-CVE-2025-4802.patch b/meta/recipes-core/glibc/glibc/0025-CVE-2025-4802.patch deleted file mode 100644 index a1197c0318..0000000000 --- a/meta/recipes-core/glibc/glibc/0025-CVE-2025-4802.patch +++ /dev/null | |||
@@ -1,250 +0,0 @@ | |||
1 | From 32917e7ee972e7a01127a04454f12ef31dc312ed Mon Sep 17 00:00:00 2001 | ||
2 | From: Adhemerval Zanella <adhemerval.zanella@linaro.org> | ||
3 | Date: Wed, 11 Jun 2025 03:19:10 -0700 | ||
4 | Subject: [PATCH] elf: Ignore LD_LIBRARY_PATH and debug env var for setuid for | ||
5 | static | ||
6 | |||
7 | It mimics the ld.so behavior. | ||
8 | Checked on x86_64-linux-gnu. | ||
9 | |||
10 | [New Test Case] | ||
11 | elf: Test case for bug 32976 | ||
12 | [https://sourceware.org/bugzilla/show_bug.cgi?id=32976] | ||
13 | |||
14 | Check that LD_LIBRARY_PATH is ignored for AT_SECURE statically | ||
15 | linked binaries, using support_capture_subprogram_self_sgid. | ||
16 | |||
17 | Upstream-Status: Backport [https://sourceware.org/cgit/glibc/commit/?id=5451fa962cd0a90a0e2ec1d8910a559ace02bba0 && | ||
18 | https://sourceware.org/cgit/glibc/commit/?id=d8f7a79335b0d861c12c42aec94c04cd5bb181e2] | ||
19 | |||
20 | CVE: CVE-2025-4802 | ||
21 | |||
22 | Co-authored-by: Florian Weimer <fweimer@redhat.com> | ||
23 | Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com> | ||
24 | --- | ||
25 | elf/Makefile | 4 ++ | ||
26 | elf/dl-support.c | 46 ++++++++--------- | ||
27 | elf/tst-dlopen-sgid-mod.c | 1 + | ||
28 | elf/tst-dlopen-sgid.c | 104 ++++++++++++++++++++++++++++++++++++++ | ||
29 | 4 files changed, 132 insertions(+), 23 deletions(-) | ||
30 | create mode 100644 elf/tst-dlopen-sgid-mod.c | ||
31 | create mode 100644 elf/tst-dlopen-sgid.c | ||
32 | |||
33 | diff --git a/elf/Makefile b/elf/Makefile | ||
34 | index 61c41ea6..3ad66ab6 100644 | ||
35 | --- a/elf/Makefile | ||
36 | +++ b/elf/Makefile | ||
37 | @@ -274,6 +274,7 @@ tests-static-normal := \ | ||
38 | tst-array1-static \ | ||
39 | tst-array5-static \ | ||
40 | tst-dl-iter-static \ | ||
41 | + tst-dlopen-sgid \ | ||
42 | tst-dst-static \ | ||
43 | tst-env-setuid \ | ||
44 | tst-env-setuid-tunables \ | ||
45 | @@ -807,6 +808,7 @@ modules-names = \ | ||
46 | tst-dlmopen-gethostbyname-mod \ | ||
47 | tst-dlmopen-twice-mod1 \ | ||
48 | tst-dlmopen-twice-mod2 \ | ||
49 | + tst-dlopen-sgid-mod \ | ||
50 | tst-dlopenfaillinkmod \ | ||
51 | tst-dlopenfailmod1 \ | ||
52 | tst-dlopenfailmod2 \ | ||
53 | @@ -2913,3 +2915,5 @@ $(objpfx)tst-recursive-tls.out: \ | ||
54 | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) | ||
55 | $(objpfx)tst-recursive-tlsmod%.os: tst-recursive-tlsmodN.c | ||
56 | $(compile-command.c) -DVAR=thread_$* -DFUNC=get_threadvar_$* | ||
57 | + | ||
58 | +$(objpfx)tst-dlopen-sgid.out: $(objpfx)tst-dlopen-sgid-mod.so | ||
59 | diff --git a/elf/dl-support.c b/elf/dl-support.c | ||
60 | index 09079c12..c2baed69 100644 | ||
61 | --- a/elf/dl-support.c | ||
62 | +++ b/elf/dl-support.c | ||
63 | @@ -272,8 +272,6 @@ _dl_non_dynamic_init (void) | ||
64 | _dl_main_map.l_phdr = GL(dl_phdr); | ||
65 | _dl_main_map.l_phnum = GL(dl_phnum); | ||
66 | |||
67 | - _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1; | ||
68 | - | ||
69 | /* Set up the data structures for the system-supplied DSO early, | ||
70 | so they can influence _dl_init_paths. */ | ||
71 | setup_vdso (NULL, NULL); | ||
72 | @@ -281,27 +279,6 @@ _dl_non_dynamic_init (void) | ||
73 | /* With vDSO setup we can initialize the function pointers. */ | ||
74 | setup_vdso_pointers (); | ||
75 | |||
76 | - /* Initialize the data structures for the search paths for shared | ||
77 | - objects. */ | ||
78 | - _dl_init_paths (getenv ("LD_LIBRARY_PATH"), "LD_LIBRARY_PATH", | ||
79 | - /* No glibc-hwcaps selection support in statically | ||
80 | - linked binaries. */ | ||
81 | - NULL, NULL); | ||
82 | - | ||
83 | - /* Remember the last search directory added at startup. */ | ||
84 | _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;- _dl_init_all_dirs = GL(dl_all_dirs); | ||
85 | - | ||
86 | - _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0'; | ||
87 | - | ||
88 | - _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0'; | ||
89 | - | ||
90 | - _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0'; | ||
91 | - | ||
92 | - _dl_profile_output = getenv ("LD_PROFILE_OUTPUT"); | ||
93 | - if (_dl_profile_output == NULL || _dl_profile_output[0] == '\0') | ||
94 | - _dl_profile_output | ||
95 | - = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0]; | ||
96 | - | ||
97 | if (__libc_enable_secure) | ||
98 | { | ||
99 | static const char unsecure_envvars[] = | ||
100 | setup_vdso_pointers (); | ||
101 | @@ -324,6 +301,29 @@ _dl_non_dynamic_init (void) | ||
102 | #endif | ||
103 | } | ||
104 | |||
105 | + _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1; | ||
106 | + | ||
107 | + /* Initialize the data structures for the search paths for shared | ||
108 | + objects. */ | ||
109 | + _dl_init_paths (getenv ("LD_LIBRARY_PATH"), "LD_LIBRARY_PATH", | ||
110 | + /* No glibc-hwcaps selection support in statically | ||
111 | + linked binaries. */ | ||
112 | + NULL, NULL); | ||
113 | + | ||
114 | + /* Remember the last search directory added at startup. */ | ||
115 | + _dl_init_all_dirs = GL(dl_all_dirs); | ||
116 | + | ||
117 | + _dl_lazy = *(getenv ("LD_BIND_NOW") ?: "") == '\0'; | ||
118 | + | ||
119 | + _dl_bind_not = *(getenv ("LD_BIND_NOT") ?: "") != '\0'; | ||
120 | + | ||
121 | + _dl_dynamic_weak = *(getenv ("LD_DYNAMIC_WEAK") ?: "") == '\0'; | ||
122 | + | ||
123 | + _dl_profile_output = getenv ("LD_PROFILE_OUTPUT"); | ||
124 | + if (_dl_profile_output == NULL || _dl_profile_output[0] == '\0') | ||
125 | + _dl_profile_output | ||
126 | + = &"/var/tmp\0/var/profile"[__libc_enable_secure ? 9 : 0]; | ||
127 | + | ||
128 | #ifdef DL_PLATFORM_INIT | ||
129 | DL_PLATFORM_INIT; | ||
130 | #endif | ||
131 | diff --git a/elf/tst-dlopen-sgid-mod.c b/elf/tst-dlopen-sgid-mod.c | ||
132 | new file mode 100644 | ||
133 | index 00000000..5eb79eef | ||
134 | --- /dev/null | ||
135 | +++ b/elf/tst-dlopen-sgid-mod.c | ||
136 | @@ -0,0 +1 @@ | ||
137 | +/* Opening this object should not succeed. */ | ||
138 | diff --git a/elf/tst-dlopen-sgid.c b/elf/tst-dlopen-sgid.c | ||
139 | new file mode 100644 | ||
140 | index 00000000..47829a40 | ||
141 | --- /dev/null | ||
142 | +++ b/elf/tst-dlopen-sgid.c | ||
143 | @@ -0,0 +1,104 @@ | ||
144 | +/* Test case for ignored LD_LIBRARY_PATH in static startug (bug 32976). | ||
145 | + Copyright (C) 2025 Free Software Foundation, Inc. | ||
146 | + This file is part of the GNU C Library. | ||
147 | + | ||
148 | + The GNU C Library is free software; you can redistribute it and/or | ||
149 | + modify it under the terms of the GNU Lesser General Public | ||
150 | + License as published by the Free Software Foundation; either | ||
151 | + version 2.1 of the License, or (at your option) any later version. | ||
152 | + | ||
153 | + The GNU C Library is distributed in the hope that it will be useful, | ||
154 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
155 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
156 | + Lesser General Public License for more details. | ||
157 | + | ||
158 | + You should have received a copy of the GNU Lesser General Public | ||
159 | + License along with the GNU C Library; if not, see | ||
160 | + <https://www.gnu.org/licenses/>. */ | ||
161 | + | ||
162 | +#include <dlfcn.h> | ||
163 | +#include <gnu/lib-names.h> | ||
164 | +#include <stddef.h> | ||
165 | +#include <stdint.h> | ||
166 | +#include <stdlib.h> | ||
167 | +#include <string.h> | ||
168 | +#include <support/capture_subprocess.h> | ||
169 | +#include <support/check.h> | ||
170 | +#include <support/support.h> | ||
171 | +#include <support/temp_file.h> | ||
172 | +#include <unistd.h> | ||
173 | + | ||
174 | +/* This is the name of our test object. Use a custom module for | ||
175 | + testing, so that this object does not get picked up from the system | ||
176 | + path. */ | ||
177 | +static const char dso_name[] = "tst-dlopen-sgid-mod.so"; | ||
178 | + | ||
179 | +/* Used to mark the recursive invocation. */ | ||
180 | +static const char magic_argument[] = "run-actual-test"; | ||
181 | + | ||
182 | +static int | ||
183 | +do_test (void) | ||
184 | +{ | ||
185 | +/* Pathname of the directory that receives the shared objects this | ||
186 | + test attempts to load. */ | ||
187 | + char *libdir = support_create_temp_directory ("tst-dlopen-sgid-"); | ||
188 | + | ||
189 | + /* This is supposed to be ignored and stripped. */ | ||
190 | + TEST_COMPARE (setenv ("LD_LIBRARY_PATH", libdir, 1), 0); | ||
191 | + | ||
192 | + /* Copy of libc.so.6. */ | ||
193 | + { | ||
194 | + char *from = xasprintf ("%s/%s", support_objdir_root, LIBC_SO); | ||
195 | + char *to = xasprintf ("%s/%s", libdir, LIBC_SO); | ||
196 | + add_temp_file (to); | ||
197 | + support_copy_file (from, to); | ||
198 | + free (to); | ||
199 | + free (from); | ||
200 | + } | ||
201 | + | ||
202 | + /* Copy of the test object. */ | ||
203 | + { | ||
204 | + char *from = xasprintf ("%s/elf/%s", support_objdir_root, dso_name); | ||
205 | + char *to = xasprintf ("%s/%s", libdir, dso_name); | ||
206 | + add_temp_file (to); | ||
207 | + support_copy_file (from, to); | ||
208 | + free (to); | ||
209 | + free (from); | ||
210 | + } | ||
211 | + | ||
212 | + TEST_COMPARE (support_capture_subprogram_self_sgid (magic_argument), 0); | ||
213 | + | ||
214 | + free (libdir); | ||
215 | + | ||
216 | + return 0; | ||
217 | +} | ||
218 | + | ||
219 | +static void | ||
220 | +alternative_main (int argc, char **argv) | ||
221 | +{ | ||
222 | + if (argc == 2 && strcmp (argv[1], magic_argument) == 0) | ||
223 | + { | ||
224 | + if (getgid () == getegid ()) | ||
225 | + /* This can happen if the file system is mounted nosuid. */ | ||
226 | + FAIL_UNSUPPORTED ("SGID failed: GID and EGID match (%jd)\n", | ||
227 | + (intmax_t) getgid ()); | ||
228 | + | ||
229 | + /* Should be removed due to SGID. */ | ||
230 | + TEST_COMPARE_STRING (getenv ("LD_LIBRARY_PATH"), NULL); | ||
231 | + | ||
232 | + TEST_VERIFY (dlopen (dso_name, RTLD_NOW) == NULL); | ||
233 | + { | ||
234 | + const char *message = dlerror (); | ||
235 | + TEST_COMPARE_STRING (message, | ||
236 | + "tst-dlopen-sgid-mod.so:" | ||
237 | + " cannot open shared object file:" | ||
238 | + " No such file or directory"); | ||
239 | + } | ||
240 | + | ||
241 | + support_record_failure_barrier (); | ||
242 | + exit (EXIT_SUCCESS); | ||
243 | + } | ||
244 | +} | ||
245 | + | ||
246 | +#define PREPARE alternative_main | ||
247 | +#include <support/test-driver.c> | ||
248 | -- | ||
249 | 2.49.0 | ||
250 | |||
diff --git a/meta/recipes-core/glibc/glibc_2.35.bb b/meta/recipes-core/glibc/glibc_2.35.bb index df5f14984a..265dcb9129 100644 --- a/meta/recipes-core/glibc/glibc_2.35.bb +++ b/meta/recipes-core/glibc/glibc_2.35.bb | |||
@@ -27,7 +27,7 @@ CVE_CHECK_IGNORE += "CVE-2023-4527" | |||
27 | CVE_CHECK_IGNORE += " \ | 27 | CVE_CHECK_IGNORE += " \ |
28 | CVE-2023-0687 CVE-2023-4813 CVE-2023-4806 CVE-2023-4911 CVE-2023-5156 \ | 28 | CVE-2023-0687 CVE-2023-4813 CVE-2023-4806 CVE-2023-4911 CVE-2023-5156 \ |
29 | CVE-2024-2961 CVE-2024-33599 CVE-2024-33600 CVE-2024-33601 CVE-2024-33602 \ | 29 | CVE-2024-2961 CVE-2024-33599 CVE-2024-33600 CVE-2024-33601 CVE-2024-33602 \ |
30 | CVE-2025-4802 \ | 30 | CVE-2025-0395 CVE-2025-4802 CVE-2025-8058 \ |
31 | " | 31 | " |
32 | 32 | ||
33 | DEPENDS += "gperf-native bison-native" | 33 | DEPENDS += "gperf-native bison-native" |