Auto-sync with upstream branch master

- Drop glibc-rh2248502.patch; fix applied upstream.

Upstream commit: 9469261cf1924d350feeec64d2c80cafbbdcdd4d

- elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup
- Move CVE information into advisories directory
- powerpc: Optimized strcmp for power10
- elf: Fix wrong break removal from 8ee878592c
- localedata: Convert day names in nn_NO locale to UTF-8
- localedata: Remove trailing whitespace in weekday names in nn_NO locale
- elf: Refactor process_envvars
- elf: Ignore LD_BIND_NOW and LD_BIND_NOT for setuid binaries
- elf: Ignore loader debug env vars for setuid
- Adapt the security policy for the security page
- aarch64: correct CFI in rawmemchr (bug 31113)
- math: Add new exp10 implementation
- aarch64: fix tested ifunc variants
- stdlib: Fix array bounds protection in insertion sort phase of qsort
- Revert "Update code to handle the new ABI for sending inlined port rights."
- Revert "hurd: Fix build"
- hurd: Fix build
- Update code to handle the new ABI for sending inlined port rights.
- hurd: [!__USE_MISC] Do not #undef BSD macros in ioctls
- linux: Make fdopendir fail with O_PATH (BZ 30373)
- Avoid padding in _init and _fini. [BZ #31042]
- aarch64: Improve special-case handling in AdvSIMD double-precision libmvec routines
- malloc: Improve MAP_HUGETLB with glibc.malloc.hugetlb=2
- elf: Add a way to check if tunable is set (BZ 27069)
This commit is contained in:
Carlos O'Donell 2023-12-08 16:54:07 -05:00
parent e1c3cc05d0
commit 37a93f1685
3 changed files with 32 additions and 106 deletions

View File

@ -1,102 +0,0 @@
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Nov 23 08:34:30 2023 +0100
stdlib: Fix array bounds protection in insertion sort phase of qsort
The previous check did not do anything because tmp_ptr already
points before run_ptr due to the way it is initialized.
Fixes commit e4d8117b82065dc72e8df80097360e7c05a349b9
("stdlib: Avoid another self-comparison in qsort").
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 6194d1cb22cee59c..0b154e57c586f65b 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -216,6 +216,7 @@ tests := \
tst-qsort2 \
tst-qsort3 \
tst-qsort5 \
+ tst-qsort6 \
tst-quick_exit \
tst-rand48 \
tst-rand48-2 \
diff --git a/stdlib/qsort.c b/stdlib/qsort.c
index be01fb5598de2257..62477010b6270246 100644
--- a/stdlib/qsort.c
+++ b/stdlib/qsort.c
@@ -238,7 +238,7 @@ insertion_sort_qsort_partitions (void *const pbase, size_t total_elems,
while ((run_ptr += size) <= end_ptr)
{
tmp_ptr = run_ptr - size;
- while (run_ptr != tmp_ptr && cmp (run_ptr, tmp_ptr, arg) < 0)
+ while (tmp_ptr != base_ptr && cmp (run_ptr, tmp_ptr, arg) < 0)
tmp_ptr -= size;
tmp_ptr += size;
diff --git a/stdlib/tst-qsort6.c b/stdlib/tst-qsort6.c
new file mode 100644
index 0000000000000000..8ec0a6b633bc8398
--- /dev/null
+++ b/stdlib/tst-qsort6.c
@@ -0,0 +1,60 @@
+/* Test qsort with invalid comparison functions.
+ Copyright (C) 2023 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <array_length.h>
+#include <stdlib.h>
+#include <support/check.h>
+
+/* Invalid comparison function that always returns -1. */
+static int
+invalid_compare_1 (const void *a1, const void *b1)
+{
+ const int *a = a1;
+ const int *b = b1;
+ /* Check that the marker value matches, which means that we are
+ likely within the array. */
+ TEST_COMPARE (*a, 842523635);
+ TEST_COMPARE (*b, 842523635);
+ TEST_VERIFY_EXIT (*a == 842523635);
+ TEST_VERIFY_EXIT (*b == 842523635);
+ return -1;
+}
+
+/* Invalid comparison function that always returns 1. */
+static int
+invalid_compare_2 (const void *a1, const void *b1)
+{
+ const int *a = a1;
+ const int *b = b1;
+ TEST_COMPARE (*a, 842523635);
+ TEST_COMPARE (*b, 842523635);
+ TEST_VERIFY_EXIT (*a == 842523635);
+ TEST_VERIFY_EXIT (*b == 842523635);
+ return 1;
+}
+
+static int
+do_test (void)
+{
+ int array[] = {842523635, 842523635, 842523635, 842523635, 842523635};
+ qsort (array, array_length (array), sizeof (array[0]), invalid_compare_1);
+ qsort (array, array_length (array), sizeof (array[0]), invalid_compare_2);
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -1,4 +1,4 @@
%global glibcsrcdir glibc-2.38.9000-304-g9469261cf1
%global glibcsrcdir glibc-2.38.9000-328-gb3bee76c5f
%global glibcversion 2.38.9000
# Pre-release tarballs are pulled in from git using a command that is
# effectively:
@ -159,7 +159,7 @@ Version: %{glibcversion}
# - It allows using the Release number without the %%dist tag in the dependency
# generator to make the generated requires interchangeable between Rawhide
# and ELN (.elnYY < .fcXX).
%global baserelease 26
%global baserelease 27
Release: %{baserelease}%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
@ -230,7 +230,6 @@ Patch9: glibc-rh827510.patch
Patch13: glibc-fedora-localedata-rh61908.patch
Patch17: glibc-cs-path.patch
Patch23: glibc-python3.patch
Patch24: glibc-rh2248502.patch
##############################################################################
# Continued list of core "glibc" package information:
@ -2201,6 +2200,35 @@ update_gconv_modules_cache ()
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Fri Dec 08 2023 Carlos O'Donell <carlos@redhat.com> - 2.38.9000-27
- Drop glibc-rh2248502.patch; fix applied upstream, and
- Auto-sync with upstream branch master,
commit b3bee76c5f59498b9c189608f0a3132e2013fa1a:
- elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup
- Move CVE information into advisories directory
- powerpc: Optimized strcmp for power10
- elf: Fix wrong break removal from 8ee878592c
- localedata: Convert day names in nn_NO locale to UTF-8
- localedata: Remove trailing whitespace in weekday names in nn_NO locale
- elf: Refactor process_envvars
- elf: Ignore LD_BIND_NOW and LD_BIND_NOT for setuid binaries
- elf: Ignore loader debug env vars for setuid
- Adapt the security policy for the security page
- aarch64: correct CFI in rawmemchr (bug 31113)
- math: Add new exp10 implementation
- aarch64: fix tested ifunc variants
- stdlib: Fix array bounds protection in insertion sort phase of qsort
- Revert "Update code to handle the new ABI for sending inlined port rights."
- Revert "hurd: Fix build"
- hurd: Fix build
- Update code to handle the new ABI for sending inlined port rights.
- hurd: [!__USE_MISC] Do not #undef BSD macros in ioctls
- linux: Make fdopendir fail with O_PATH (BZ 30373)
- Avoid padding in _init and _fini. [BZ #31042]
- aarch64: Improve special-case handling in AdvSIMD double-precision libmvec routines
- malloc: Improve MAP_HUGETLB with glibc.malloc.hugetlb=2
- elf: Add a way to check if tunable is set (BZ 27069)
* Tue Nov 28 2023 Arjun Shankar <arjun@redhat.com> - 2.38.9000-26
- Drop glibc-benchtests-aarch64.patch; fix applied upstream, and
- Auto-sync with upstream branch master,

View File

@ -1 +1 @@
SHA512 (glibc-2.38.9000-304-g9469261cf1.tar.xz) = e30e3ac47f672a992a05ef591b6657784f5c474e66d7533c3ae6b492aa13e48408170884ebd215a59e180bb3a44942bdfe68ca34f3981a0274db23b9dce3ec09
SHA512 (glibc-2.38.9000-328-gb3bee76c5f.tar.xz) = 8acf46e988bc8c6a315ee4167deb39254648dec3bc627a552e97394c74f4c6d269b598c54904b37d4590ba9e1a13d95d859c3d6473b9d3783ca034f83af51883