stdlib: Improve tst-realpath compatibility with source fortification

This commit is contained in:
liqingqing_1229 2023-09-11 09:04:51 +08:00
parent acf591e872
commit 107ed1e8d8
2 changed files with 48 additions and 1 deletions

View File

@ -67,7 +67,7 @@
############################################################################## ##############################################################################
Name: glibc Name: glibc
Version: 2.38 Version: 2.38
Release: 5 Release: 6
Summary: The GNU libc libraries Summary: The GNU libc libraries
License: %{all_license} License: %{all_license}
URL: http://www.gnu.org/software/glibc/ URL: http://www.gnu.org/software/glibc/
@ -86,6 +86,7 @@ Source8: testsuite_whitelist
%endif %endif
Patch0: glibc-1070416.patch Patch0: glibc-1070416.patch
Patch1: stdlib-Improve-tst-realpath-compatibility-with-sourc.patch
Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch Patch9000: turn-default-value-of-x86_rep_stosb_threshold_form_2K_to_1M.patch
Patch9001: locale-delete-no-hard-link-to-avoid-all_language-pac.patch Patch9001: locale-delete-no-hard-link-to-avoid-all_language-pac.patch
@ -1300,6 +1301,9 @@ fi
%endif %endif
%changelog %changelog
* Mon Sep 11 2023 Qingqing Li <liqingqing3@huawei.com> - 2.38-6
- stdlib: Improve tst-realpath compatibility with source fortification
* Mon Aug 21 2023 longwei<longwei27@huawei.com> - 2.38-5 * Mon Aug 21 2023 longwei<longwei27@huawei.com> - 2.38-5
- add libc.so relocation file for sysboost - add libc.so relocation file for sysboost

View File

@ -0,0 +1,43 @@
From d97cca1e5df812be0e4de1e38091f02bb1e7ec4e Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 1 Aug 2023 10:27:15 +0200
Subject: [PATCH] stdlib: Improve tst-realpath compatibility with source
fortification
On GCC before 11, IPA can make the fortified realpath aware that the
buffer size is not large enough (8 bytes instead of PATH_MAX bytes).
Fix this by using a buffer that is large enough.
(cherry picked from commit 510fc20d73de12c85823d9996faac74666e9c2e7)
---
stdlib/tst-realpath.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/stdlib/tst-realpath.c b/stdlib/tst-realpath.c
index f325c95a44..3694ecd8af 100644
--- a/stdlib/tst-realpath.c
+++ b/stdlib/tst-realpath.c
@@ -24,6 +24,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
@@ -50,7 +51,11 @@ void dealloc (void *p)
char* alloc (void)
{
- return (char *)malloc (8);
+#ifdef PATH_MAX
+ return (char *)malloc (PATH_MAX);
+#else
+ return (char *)malloc (4096);
+#endif
}
static int
--
2.33.0