diff options
Diffstat (limited to 'patches/binutils-2.40/0011-libctf-fix-assertion-failure-with-no-system-qsort_r.patch')
-rw-r--r-- | patches/binutils-2.40/0011-libctf-fix-assertion-failure-with-no-system-qsort_r.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/patches/binutils-2.40/0011-libctf-fix-assertion-failure-with-no-system-qsort_r.patch b/patches/binutils-2.40/0011-libctf-fix-assertion-failure-with-no-system-qsort_r.patch new file mode 100644 index 0000000..21fb5fa --- /dev/null +++ b/patches/binutils-2.40/0011-libctf-fix-assertion-failure-with-no-system-qsort_r.patch @@ -0,0 +1,37 @@ +From: Nick Alcock <nick.alcock@oracle.com> +Date: Mon, 23 Jan 2023 13:11:32 +0000 +Subject: [PATCH] libctf: fix assertion failure with no system qsort_r + +If no suitable qsort_r is found in libc, we fall back to an +implementation in ctf-qsort.c. But this implementation routinely calls +the comparison function with two identical arguments. The comparison +function that ensures that the order of output types is stable is not +ready for this, misinterprets it as a type appearing more that once (a +can-never-happen condition) and fails with an assertion failure. + +Fixed, audited for further instances of the same failure (none found) +and added a no-qsort test to my regular testsuite run. + +libctf/: + PR libctf/30013 + * ctf-dedup.c (sort_output_mapping): Inputs are always equal to + themselves. +--- + libctf/ctf-dedup.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c +index c46f69e7449f..6297c45c84d6 100644 +--- a/libctf/ctf-dedup.c ++++ b/libctf/ctf-dedup.c +@@ -2306,6 +2306,10 @@ sort_output_mapping (const ctf_next_hkv_t *one, const ctf_next_hkv_t *two, + ctf_id_t one_type; + ctf_id_t two_type; + ++ /* Inputs are always equal to themselves. */ ++ if (one == two) ++ return 0; ++ + one_gid = ctf_dynhash_lookup (d->cd_output_first_gid, one_hval); + two_gid = ctf_dynhash_lookup (d->cd_output_first_gid, two_hval); + |