diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-04-19 18:53:00 -0700 | 
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2022-04-20 10:58:01 -0700 | 
| commit | 89bc6331f4bfefcc9459c484dfa39970a042ddf2 (patch) | |
| tree | ff3d8f97d85d313b22eabb3e085bd8221db8abfb | |
| parent | cf260fb4ed6b5423b7d1906483e0195c445ff95e (diff) | |
| download | meta-openembedded-89bc6331f4bfefcc9459c484dfa39970a042ddf2.tar.gz | |
ltrace: Fix build on ppc64 with gcc12
gcc-12 has a better static analyser and finds additional use-after-free
case, addressed by removing the double free
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-devtools/ltrace/ltrace/0001-ppc-plt-do-not-free-symbol-libsym.patch | 29 | ||||
| -rw-r--r-- | meta-oe/recipes-devtools/ltrace/ltrace_git.bb | 1 | 
2 files changed, 30 insertions, 0 deletions
| diff --git a/meta-oe/recipes-devtools/ltrace/ltrace/0001-ppc-plt-do-not-free-symbol-libsym.patch b/meta-oe/recipes-devtools/ltrace/ltrace/0001-ppc-plt-do-not-free-symbol-libsym.patch new file mode 100644 index 0000000000..4793e561c0 --- /dev/null +++ b/meta-oe/recipes-devtools/ltrace/ltrace/0001-ppc-plt-do-not-free-symbol-libsym.patch | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | From f47672bed5905ae382e80b09dafca9a8da45aa67 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 19 Apr 2022 18:44:36 -0700 | ||
| 4 | Subject: [PATCH] ppc/plt: do not free symbol libsym | ||
| 5 | |||
| 6 | delete_symbol_chain() will call free as well if sybol is non-null | ||
| 7 | it also fixes use-after-free warnings that compiler emits | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/2] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | sysdeps/linux-gnu/ppc/plt.c | 1 - | ||
| 13 | 1 file changed, 1 deletion(-) | ||
| 14 | |||
| 15 | diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c | ||
| 16 | index 5f81889..7c1c025 100644 | ||
| 17 | --- a/sysdeps/linux-gnu/ppc/plt.c | ||
| 18 | +++ b/sysdeps/linux-gnu/ppc/plt.c | ||
| 19 | @@ -687,7 +687,6 @@ arch_elf_add_func_entry(struct process *proc, struct ltelf *lte, | ||
| 20 | if (libsym == NULL | ||
| 21 | || library_symbol_init(libsym, addr, full_name, 1, | ||
| 22 | LS_TOPLT_NONE) < 0) { | ||
| 23 | - free(libsym); | ||
| 24 | delete_symbol_chain(libsym); | ||
| 25 | libsym = NULL; | ||
| 26 | fprintf(stderr, "Couldn't add symbol %s" | ||
| 27 | -- | ||
| 28 | 2.36.0 | ||
| 29 | |||
| diff --git a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb index ad58428718..72bec301fb 100644 --- a/meta-oe/recipes-devtools/ltrace/ltrace_git.bb +++ b/meta-oe/recipes-devtools/ltrace/ltrace_git.bb | |||
| @@ -30,6 +30,7 @@ SRC_URI = "git://github.com/sparkleholic/ltrace.git;branch=master;protocol=http; | |||
| 30 | file://0001-ensure-the-struct-pointers-are-null-initilized.patch \ | 30 | file://0001-ensure-the-struct-pointers-are-null-initilized.patch \ | 
| 31 | file://0001-ppc-Remove-unused-host_powerpc64-function.patch \ | 31 | file://0001-ppc-Remove-unused-host_powerpc64-function.patch \ | 
| 32 | file://0001-mips-Use-hardcodes-values-for-ABI-syscall-bases.patch \ | 32 | file://0001-mips-Use-hardcodes-values-for-ABI-syscall-bases.patch \ | 
| 33 | file://0001-ppc-plt-do-not-free-symbol-libsym.patch \ | ||
| 33 | " | 34 | " | 
| 34 | SRC_URI:append:libc-musl = " file://add_ppc64le.patch" | 35 | SRC_URI:append:libc-musl = " file://add_ppc64le.patch" | 
| 35 | 36 | ||
