diff options
3 files changed, 63 insertions, 1 deletions
diff --git a/meta/recipes-core/glibc/glibc/0026-x86-Fix-define-STRCPY-guard-in-strcpy-sse2.S.patch b/meta/recipes-core/glibc/glibc/0026-x86-Fix-define-STRCPY-guard-in-strcpy-sse2.S.patch new file mode 100644 index 0000000000..2d14a4c619 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0026-x86-Fix-define-STRCPY-guard-in-strcpy-sse2.S.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | From 1d4d09d9dff96f46674262534ce1f0e51a8252cb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Noah Goldstein <goldstein.w.n@gmail.com> | ||
| 3 | Date: Sun, 7 Aug 2022 22:42:30 +0800 | ||
| 4 | Subject: [PATCH] x86: Fix `#define STRCPY` guard in strcpy-sse2.S | ||
| 5 | |||
| 6 | `#ifndef STPCPY` is incorrect for checking if `STRCPY` is already | ||
| 7 | defined. It doesn't end up mattering as the whole check is | ||
| 8 | guarded by `#if IS_IN (libc)` but is incorrect none the less. | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=29454 https://sourceware.org/pipermail/libc-alpha/2022-August/141289.html] | ||
| 11 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 12 | --- | ||
| 13 | sysdeps/x86_64/multiarch/strcpy-sse2.S | 2 +- | ||
| 14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 15 | |||
| 16 | diff --git a/sysdeps/x86_64/multiarch/strcpy-sse2.S b/sysdeps/x86_64/multiarch/strcpy-sse2.S | ||
| 17 | index e29b411314..d6b9bae5f8 100644 | ||
| 18 | --- a/sysdeps/x86_64/multiarch/strcpy-sse2.S | ||
| 19 | +++ b/sysdeps/x86_64/multiarch/strcpy-sse2.S | ||
| 20 | @@ -22,7 +22,7 @@ | ||
| 21 | |||
| 22 | # include <sysdep.h> | ||
| 23 | |||
| 24 | -# ifndef STPCPY | ||
| 25 | +# ifndef STRCPY | ||
| 26 | # define STRCPY __strcpy_sse2 | ||
| 27 | # endif | ||
| 28 | |||
diff --git a/meta/recipes-core/glibc/glibc/0027-elf-Replace-strcpy-call-with-memcpy-BZ-29454.patch b/meta/recipes-core/glibc/glibc/0027-elf-Replace-strcpy-call-with-memcpy-BZ-29454.patch new file mode 100644 index 0000000000..1b347b3322 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0027-elf-Replace-strcpy-call-with-memcpy-BZ-29454.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From f0e36cf0b348dbc990af9f869196710ca89c28c2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Noah Goldstein <goldstein.w.n@gmail.com> | ||
| 3 | Date: Sun, 7 Aug 2022 23:54:19 +0800 | ||
| 4 | Subject: [PATCH] elf: Replace `strcpy` call with `memcpy` [BZ #29454] | ||
| 5 | |||
| 6 | GCC normally does this optimization for us in | ||
| 7 | strlen_pass::handle_builtin_strcpy but only for optimized | ||
| 8 | build. To avoid needing to include strcpy.S in the rtld build to | ||
| 9 | support the debug build, just do the optimization by hand. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=29454 https://sourceware.org/pipermail/libc-alpha/2022-August/141290.html] | ||
| 12 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 13 | --- | ||
| 14 | elf/dl-cache.c | 5 +++-- | ||
| 15 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/elf/dl-cache.c b/elf/dl-cache.c | ||
| 18 | index c02a95d9b5..03a6d236e8 100644 | ||
| 19 | --- a/elf/dl-cache.c | ||
| 20 | +++ b/elf/dl-cache.c | ||
| 21 | @@ -513,8 +513,9 @@ _dl_load_cache_lookup (const char *name) | ||
| 22 | we are accessing. Therefore we must make the copy of the | ||
| 23 | mapping data without using malloc. */ | ||
| 24 | char *temp; | ||
| 25 | - temp = alloca (strlen (best) + 1); | ||
| 26 | - strcpy (temp, best); | ||
| 27 | + size_t best_len = strlen (best) + 1; | ||
| 28 | + temp = alloca (best_len); | ||
| 29 | + memcpy (temp, best, best_len); | ||
| 30 | return __strdup (temp); | ||
| 31 | } | ||
| 32 | |||
diff --git a/meta/recipes-core/glibc/glibc_2.36.bb b/meta/recipes-core/glibc/glibc_2.36.bb index c64b65db3e..2db3994cf7 100644 --- a/meta/recipes-core/glibc/glibc_2.36.bb +++ b/meta/recipes-core/glibc/glibc_2.36.bb | |||
| @@ -51,7 +51,9 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
| 51 | file://0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ | 51 | file://0023-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ |
| 52 | file://0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ | 52 | file://0024-Avoid-hardcoded-build-time-paths-in-the-output-binar.patch \ |
| 53 | file://0025-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ | 53 | file://0025-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ |
| 54 | " | 54 | file://0026-x86-Fix-define-STRCPY-guard-in-strcpy-sse2.S.patch \ |
| 55 | file://0027-elf-Replace-strcpy-call-with-memcpy-BZ-29454.patch \ | ||
| 56 | " | ||
| 55 | S = "${WORKDIR}/git" | 57 | S = "${WORKDIR}/git" |
| 56 | B = "${WORKDIR}/build-${TARGET_SYS}" | 58 | B = "${WORKDIR}/build-${TARGET_SYS}" |
| 57 | 59 | ||
