Projects
openEuler:24.03:SP1:Everything:64G
glibc
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
_service:tar_scm:glibc.spec
Changed
@@ -67,7 +67,7 @@ ############################################################################## Name: glibc Version: 2.38 -Release: 35 +Release: 40 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -214,33 +214,33 @@ Patch125: 0012-resolv-Fix-tst-resolv-short-response-for-older-GCC-b.patch Patch126: Fix-name-space-violation-in-fortify-wrappers-bug-320.patch Patch127: x86-Fix-bug-in-strchrnul-evex512-BZ-32078.patch +Patch128: 19614-locale-Handle-loading-a-missing-locale-twice-Bug-14.patch +Patch129: support-Add-FAIL-test-failure-helper.patch +Patch130: stdio-common-Add-test-for-vfscanf-with-matches-longe.patch +Patch131: Make-tst-ungetc-use-libsupport.patch +Patch132: ungetc-Fix-uninitialized-read-when-putting-into-unus.patch +Patch133: ungetc-Fix-backup-buffer-leak-on-program-exit-BZ-278.patch +Patch134: posix-Use-support-check.h-facilities-in-tst-truncate.patch +Patch135: nptl-Use-support-check.h-facilities-in-tst-setuid3.patch +Patch136: libio-Attempt-wide-backup-free-only-for-non-legacy-c.patch +Patch137: Add-crt1-2.0.o-for-glibc-2.0-compatibility-tests.patch +Patch138: elf-Change-ldconfig-auxcache-magic-number-bug-32231.patch #openEuler patch list 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 -#Patch9002: 0001-add-base-files-for-libphtread-condition-family.patch -#Patch9003: 0002-add-header-files-for-libphtread_2_17_so.patch -#Patch9004: 0003-add-build-script-and-files-of-libpthread_2_17_so.patch -#Patch9005: 0004-add-two-header-files-with-some-deleted-macros.patch -#Patch9006: 0005-add-pthread-functions_h.patch -#Patch9007: 0006-add-elsion-function-which-moved-to-libc-in-glibc-2.34.patch -#Patch9008: 0007-add-lowlevellock_2_17_c.patch -#Patch9009: 0008-add-pause_nocancel_2_17.patch -#Patch9010: 0009-add-unwind-with-longjmp.patch -Patch9011: use-region-to-instead-of-country-for-extract-timezon.patch -Patch9012: malloc-use-__get_nprocs-replace-__get_nprocs_sched.patch -Patch9013: x86-use-total-l3cache-for-non_temporal_threshold.patch -Patch9014: strcmp-delete-align-for-loop_aligned.patch -Patch9015: add-pthread_cond_clockwait-GLIBC_2_28.patch -Patch9016: add-GB18030-2022-charmap-BZ-30243.patch -Patch9017: fix-Segmentation-fault-in-nss-module.patch -Patch9018: fix_nss_database_check_reload_and_get_memleak.patch -Patch9019: 0001-fix-glibc-build-error-on-x86.patch +Patch9002: use-region-to-instead-of-country-for-extract-timezon.patch +Patch9003: strcmp-delete-align-for-loop_aligned.patch +Patch9004: add-pthread_cond_clockwait-GLIBC_2_28.patch +Patch9005: add-GB18030-2022-charmap-BZ-30243.patch +Patch9006: fix-Segmentation-fault-in-nss-module.patch +Patch9007: fix_nss_database_check_reload_and_get_memleak.patch +Patch9008: 0001-fix-glibc-build-error-on-x86.patch %if %{ENABLE_RELOC} -Patch9021: reserve-relocation-information-for-sysboost.patch +Patch9009: reserve-relocation-information-for-sysboost.patch %endif -Patch9022: add-Wl-z-noseparate-code-for-so.patch +Patch9010: add-Wl-z-noseparate-code-for-so.patch Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) @@ -959,7 +959,7 @@ ############################################################################## # nss modules sub-package ############################################################################## -grep -E "/libnss_(db|hesiod)(\.so\.0-9.+|-0-9.+\.so)$" \ +grep -E "%{_lib}/libnss_(db|hesiod)(\.so\.0-9.+|-0-9.+\.so)$" \ master.filelist > nss_modules.filelist ############################################################################## @@ -971,7 +971,7 @@ # libnsl subpackage ############################################################################## %ifnarch loongarch64 -grep -E '/libnsl\.so\.0-9+$' master.filelist > libnsl.filelist +grep -E '%{_lib}/libnsl\.so\.0-9+$' master.filelist > libnsl.filelist test $(wc -l < libnsl.filelist) -eq 1 %endif @@ -1424,7 +1424,6 @@ %ifnarch loongarch64 %files -f libnsl.filelist -n libnsl -/%{_lib}/libnsl.so.1 %endif %files -f debugutils.filelist debugutils @@ -1447,6 +1446,29 @@ %endif %changelog +* Tue Nov 5 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-40 +- elf: Change ldconfig auxcache magic number (bug 32231) +- Add crt1-2.0.o for glibc 2.0 compatibility tests +- libio: Attempt wide backup free only for non-legacy code + +* Fri Sep 20 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-39 +- clean code, remove some oe patches which already fixed in upstream + +* Mon Sep 9 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-38 +- nptl: Use <support/check.h> facilities in tst-setuid3 +- posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64 +- ungetc: Fix backup buffer leak on program exit BZ #27821 +- ungetc: Fix uninitialized read when putting into unused streams BZ #27821 +- Make tst-ungetc use libsupport +- stdio-common: Add test for vfscanf with matches longer than INT_MAX BZ #27650 +- support: Add FAIL test failure helper + +* Wed Sep 4 2024 Zhaoshuang <zhaoshuang@uniontech.com> - 2.38-37 +- Fix issue that loading a missing locale twice BZ #14247 + +* Tue Aug 27 2024 YunQiang Su <yunqiang@isrc.iscas.ac.cn> - 2.38-36 +- Fix libnsl.so and libnss_.so filelist process (PR 877) + * Thu Aug 22 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-35 - x86: Fix bug in strchrnul-evex512 BZ #32078 @@ -1474,14 +1496,14 @@ - fix bug "info command cannot index the glibc help documentation" - add the install-info libc.info.gz step during the glibc-help installation process -* Wed Jun 5 Qingqing Li <liqingqing3@huawei.com> - 2.38-30 +* Wed Jun 5 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-30 - misc: Add support for Linux uio.h RWF_NOAPPEND flag - Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782) -* Mon May 13 Qingqing Li <liqingqing3@huawei.com> - 2.38-29 +* Mon May 13 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-29 - Force DT_RPATH for --enable-hardcoded-path-in-tests -* Fri May 10 Qingqing Li <liqingqing3@huawei.com> - 2.38-28 +* Fri May 10 2024 Qingqing Li <liqingqing3@huawei.com> - 2.38-28 - backport glibc upstream 2.38 branch, here is the 26 patches: - resolv: Fix some unaligned accesses in resolver BZ #30750 - nscd: Use time_t for return type of addgetnetgrentX
View file
_service:tar_scm:19614-locale-Handle-loading-a-missing-locale-twice-Bug-14.patch
Added
@@ -0,0 +1,274 @@ +From 684fbab755e727a8c15f8b621648d66694cd1f53 Mon Sep 17 00:00:00 2001 +From: Carlos O'Donell <carlos@redhat.com> +Date: Mon, 22 Apr 2024 08:16:09 -0400 +Subject: locale: Handle loading a missing locale twice (Bug 14247) + +Delay setting file->decided until the data has been successfully loaded +by _nl_load_locale(). If the function fails to load the data then we +must return and error and leave decided untouched to allow the caller to +attempt to load the data again at a later time. We should not set +decided to 1 early in the function since doing so may prevent attempting +to load it again. We want to try loading it again because that allows an +open to fail and set errno correctly. + +On the other side of this problem is that if we are called again with +the same inputs we will fetch the cached version of the object and carry +out no open syscalls and that fails to set errno so we must set errno to +ENOENT in that case. There is a second code path that has to be handled +where the name of the locale matches but the codeset doesn't match. + +These changes ensure that errno is correctly set on failure in all the +return paths in _nl_find_locale(). + +Adds tst-locale-loadlocale to cover the bug. + +No regressions on x86_64. + +Co-authored-by: Jeff Law <law@redhat.com> +Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> +--- + gen-locales.mk | 13 +++++- + locale/findlocale.c | 19 +++++++-- + locale/loadlocale.c | 2 +- + localedata/Makefile | 4 ++ + localedata/gen-locale.sh | 24 ++++++++--- + localedata/tst-locale-loadlocale.c | 67 ++++++++++++++++++++++++++++++ + 6 files changed, 119 insertions(+), 10 deletions(-) + create mode 100644 localedata/tst-locale-loadlocale.c + +diff --git a/gen-locales.mk b/gen-locales.mk +index 9c523d2a..b005a728 100644 +--- a/gen-locales.mk ++++ b/gen-locales.mk +@@ -1,8 +1,19 @@ + # defines target $(gen-locales) that generates the locales given in $(LOCALES) + + LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\(^ .*\)^@ *\(@^ *\)\?/\1\2/g') ++# The CHARMAPS dependency handling must be able to process: ++# 1. No character map e.g. eo, en_US ++# 2. Character maps e.g. en_US.UTF-8 ++# 3. Character maps with modifier e.g. tt_RU.UTF-8@iqtelif ++# This complicates the processing slightly so we do it in multiple edits, ++# the first captures the character map with the anchoring period while ++# the rest of the edits remove the period to get a valid file or adjust ++# the name to match the true name. + CHARMAPS := $(shell echo "$(LOCALES)" | \ +- sed -e 's/^ .*.\(^@ *\)\(@^@ *\)*/\1/g' -e s/SJIS/SHIFT_JIS/g) ++ sed -e 's/\(^ .*\)\(^@ *\)\(@^@ *\)*/\2/g' \ ++ -e 's/^\./ /g' \ ++ -e 's/ \./ /g' \ ++ -e s/SJIS/SHIFT_JIS/g) + CTYPE_FILES = $(addsuffix /LC_CTYPE,$(LOCALES)) + gen-locales := $(addprefix $(common-objpfx)localedata/,$(CTYPE_FILES)) + +diff --git a/locale/findlocale.c b/locale/findlocale.c +index 1b703434..df74fbae 100644 +--- a/locale/findlocale.c ++++ b/locale/findlocale.c +@@ -244,7 +244,14 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, + locale_file = locale_file->successorcnt; + + if (locale_file == NULL) +- return NULL; ++ { ++ /* If this is the second time we tried to load a failed ++ locale then the locale_file value comes from the cache ++ and we will not carry out any actual filesystem ++ operations so we must set ENOENT here. */ ++ __set_errno (ENOENT); ++ return NULL; ++ } + } + + /* The LC_CTYPE category allows to check whether a locale is really +@@ -291,8 +298,14 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, + if (__gconv_compare_alias (upstr (ccodeset, ccodeset), + upstr (clocale_codeset, + clocale_codeset)) != 0) +- /* The codesets are not identical, don't use the locale. */ +- return NULL; ++ { ++ /* The codesets are not identical, don't use the locale. ++ If this is the second time we tried to load a locale ++ whose codeset doesn't match then the result came from ++ the cache and must set ENOENT here. */ ++ __set_errno (ENOENT); ++ return NULL; ++ } + } + + /* Determine the locale name for which loading succeeded. This +diff --git a/locale/loadlocale.c b/locale/loadlocale.c +index 671e71cf..1b4d0b05 100644 +--- a/locale/loadlocale.c ++++ b/locale/loadlocale.c +@@ -237,7 +237,6 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) + int save_err; + int alloc = ld_mapped; + +- file->decided = 1; + file->data = NULL; + + fd = __open_nocancel (file->filename, O_RDONLY | O_CLOEXEC); +@@ -345,6 +344,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category) + newdata->alloc = alloc; + + file->data = newdata; ++ file->decided = 1; + } + + void +diff --git a/localedata/Makefile b/localedata/Makefile +index 3453b8c9..888634b3 100644 +--- a/localedata/Makefile ++++ b/localedata/Makefile +@@ -166,6 +166,7 @@ tests = \ + tst-digits \ + tst-iconv-math-trans \ + tst-leaks \ ++ tst-locale-loadlocale \ + tst-mbswcs1 \ + tst-mbswcs2 \ + tst-mbswcs3 \ +@@ -243,6 +244,7 @@ LOCALES := \ + dsb_DE.UTF-8 \ + dz_BT.UTF-8 \ + en_GB.UTF-8 \ ++ en_US \ + en_US.ANSI_X3.4-1968 \ + en_US.ISO-8859-1\ + en_US.UTF-8 \ +@@ -321,6 +323,8 @@ LOCALES := \ + include ../gen-locales.mk + + $(objpfx)tst-iconv-math-trans.out: $(gen-locales) ++# tst-locale-loadlocale: Needs an en_US-named locale for the test. ++$(objpfx)tst-locale-loadlocale.out: $(gen-locales) + endif + + include ../Rules +diff --git a/localedata/gen-locale.sh b/localedata/gen-locale.sh +index 7a9e8556..740b6500 100644 +--- a/localedata/gen-locale.sh ++++ b/localedata/gen-locale.sh +@@ -48,9 +48,9 @@ generate_locale () + } + + locfile=`echo $locfile|sed 's|.*/\(^/*/LC_CTYPE\)|\1|'` +-locale=`echo $locfile|sed 's|\(^.*\)..*/LC_CTYPE|\1|'` +-charmap=`echo $locfile|sed 's|^.*.\(^@ *\)\(@^ *\)\?/LC_CTYPE|\1|'` +-modifier=`echo $locfile|sed 's|^.*.\(^@ *\)\(@^ *\)\?/LC_CTYPE|\2|'` ++locale=`echo $locfile|sed 's|\(^.*\).*/LC_CTYPE|\1|'` ++charmap=`echo $locfile|sed -e 's|^.*\(^@ *\)\(@^ *\)\?/LC_CTYPE|\1|' -e 's|^\.||g'` ++modifier=`echo $locfile|sed 's|^.*\(^@ *\)\(@^ *\)\?/LC_CTYPE|\2|'` + + echo "Generating locale $locale.$charmap: this might take a while..." + +@@ -63,10 +63,16 @@ echo "Generating locale $locale.$charmap: this might take a while..." + # you to develop in-progress locales. + flags="" + ++charmap_real="$charmap" ++ ++# If no character map is specified then we fall back to UTF-8. ++if -z "$charmap" ; then ++ charmap_real="UTF-8" ++fi ++ + # For SJIS the charmap is SHIFT_JIS. We just want the locale to have + # a slightly nicer name instead of using "*.SHIFT_SJIS", but that + # means we need a mapping here. +-charmap_real="$charmap" + if "$charmap" = "SJIS" ; then + charmap_real="SHIFT_JIS" + fi +@@ -80,4 +86,12 @@ if "$charmap_real" = 'SHIFT_JIS' \ + flags="$flags --no-warnings=ascii" + fi + +-generate_locale $charmap_real $locale$modifier $locale.$charmap$modifier "$flags" ++# If the character map is not specified then we output a locale ++# with the just the name of the locale e.g. eo, en_US. This is ++# used for test locales that act as fallbacks. ++output_file="$locale.$charmap$modifier" ++if -z "$charmap" ; then ++ output_file="$locale" ++fi ++ ++generate_locale $charmap_real $locale$modifier $output_file "$flags" +diff --git a/localedata/tst-locale-loadlocale.c b/localedata/tst-locale-loadlocale.c
View file
_service:tar_scm:Add-crt1-2.0.o-for-glibc-2.0-compatibility-tests.patch
Added
@@ -0,0 +1,231 @@ +From 4dd8641461463b667b5503ab0ea4abcf261378a9 Mon Sep 17 00:00:00 2001 +From: "H.J. Lu" <hjl.tools@gmail.com> +Date: Tue, 30 Apr 2024 09:57:12 -0700 +Subject: PATCH Add crt1-2.0.o for glibc 2.0 compatibility tests + +Starting from glibc 2.1, crt1.o contains _IO_stdin_used which is checked +by _IO_check_libio to provide binary compatibility for glibc 2.0. Add +crt1-2.0.o for tests against glibc 2.0. Define tests-2.0 for glibc 2.0 +compatibility tests. Add and update glibc 2.0 compatibility tests for +stderr, matherr and pthread_kill. +Reviewed-by: Carlos O'Donell <carlos@redhat.com> + +(cherry picked from commit 5f245f3bfbe61b2182964dafb94907e38284b806) +--- + Makeconfig | 21 ++++++++++++++++ + Rules | 13 +++++++++- + csu/Makefile | 5 +++- + libio/Makefile | 6 +++++ + libio/tst-stderr-compat.c | 52 +++++++++++++++++++++++++++++++++++++++ + math/Makefile | 3 +++ + sysdeps/pthread/Makefile | 4 +++ + 7 files changed, 102 insertions(+), 2 deletions(-) + create mode 100644 libio/tst-stderr-compat.c + +diff --git a/Makeconfig b/Makeconfig +index 3f8acff459..3a2c864b04 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -360,6 +360,8 @@ whole-archive = -Wl,--whole-archive + # Installed name of the startup code. + # The ELF convention is that the startfile is called crt1.o + start-installed-name = crt1.o ++# Similar to crt1.o, but without _IO_stdin_used. ++start-name-2.0 = crt1-2.0.o + # On systems that do not need a special startfile for statically linked + # binaries, simply set it to the normal name. + ifndef static-start-installed-name +@@ -537,6 +539,25 @@ else # build-static + endif # build-shared + endif # +link + ++# Command for linking test programs with crt1.o from glibc 2.0. +++link-2.0-before-inputs = -nostdlib -nostartfiles $(no-pie-ldflag) \ ++ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ ++ $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ ++ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-name-2.0)) \ ++ $(+preinit) $(+prector) +++link-2.0-before-libc = -o $@ $(+link-2.0-before-inputs) \ ++ $(filter-out $(addprefix $(csu-objpfx),start.o \ ++ $(start-name-2.0))\ ++ $(+preinit) $(link-extra-libs) \ ++ $(common-objpfx)libc% $(+postinit),$^) \ ++ $(link-extra-libs) +++link-after-libc = $(+postctor) $(+postinit) ++define +link-2.0-tests ++$(CC) $(+link-2.0-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ ++ $(+link-after-libc) ++$(call after-link,$@) ++endef ++ + # The pretty printer test programs need to be compiled without optimizations + # so they won't confuse gdb. We could use either the 'GCC optimize' pragma + # or the 'optimize' function attribute to achieve this; however, at least on +diff --git a/Rules b/Rules +index 279ae490ac..e8096cb285 100644 +--- a/Rules ++++ b/Rules +@@ -188,6 +188,7 @@ binaries-all = $(binaries-all-notests) $(binaries-all-tests) + binaries-static-notests = $(others-static) + binaries-static-tests = $(tests-static) $(xtests-static) + binaries-static = $(binaries-static-notests) $(binaries-static-tests) ++binaries-shared-2.0-tests = $(tests-2.0) + ifeq (yesyes,$(have-fpie)$(build-shared)) + binaries-pie-tests = $(tests-pie) $(xtests-pie) + binaries-pie-notests = $(others-pie) +@@ -215,7 +216,8 @@ binaries-malloc-hugetlb2-tests = + endif + + binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests) +-binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static), \ ++binaries-shared-tests = $(filter-out $(binaries-pie) $(binaries-static) \ ++ $(binaries-shared-2.0-tests), \ + $(binaries-all-tests)) + binaries-shared-notests = $(filter-out $(binaries-pie) $(binaries-static), \ + $(binaries-all-notests)) +@@ -235,6 +237,15 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \ + $(+link-tests) + endif + ++# Linking test programs with crt1.o from glibc 2.0. ++ifneq "$(strip $(binaries-shared-2.0-tests))" "" ++$(addprefix $(objpfx),$(binaries-shared-2.0-tests)): %: %.o \ ++ $(link-extra-libs-tests) \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-2.0-tests) ++endif ++ + ifneq "$(strip $(binaries-mcheck-tests))" "" + $(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \ + $(link-extra-libs-tests) \ +diff --git a/csu/Makefile b/csu/Makefile +index fcd277e6d3..c2b1c4013f 100644 +--- a/csu/Makefile ++++ b/csu/Makefile +@@ -33,7 +33,7 @@ elide-routines.os = libc-tls + csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o) + extra-objs = start.o \ + $(start-installed-name) g$(start-installed-name) $(csu-dummies) \ +- S$(start-installed-name) ++ S$(start-installed-name) $(start-name-2.0) + omit-deps = $(patsubst %.o,%,$(start-installed-name) g$(start-installed-name) \ + b$(start-installed-name) $(csu-dummies) \ + S$(start-installed-name) \ +@@ -138,6 +138,9 @@ ifndef start-installed-name-rule + $(objpfx)$(start-installed-name): $(objpfx)start.o $(objpfx)abi-note.o \ + $(objpfx)init.o $(objpfx)static-reloc.o + $(link-relocatable) ++$(objpfx)$(start-name-2.0): $(objpfx)start.o $(objpfx)abi-note.o \ ++ $(objpfx)static-reloc.o ++ $(link-relocatable) + $(objpfx)r$(start-installed-name): $(objpfx)start.o $(objpfx)abi-note.o \ + $(objpfx)init.o + $(link-relocatable) +diff --git a/libio/Makefile b/libio/Makefile +index 287ec11338..8f9f302807 100644 +--- a/libio/Makefile ++++ b/libio/Makefile +@@ -212,6 +212,12 @@ aux := fileops genops stdfiles stdio strops + ifeq ($(build-shared),yes) + generated += tst-bz24228.mtrace tst-bz24228.check + aux += oldfileops oldstdfiles ++tests += \ ++ tst-stderr-compat \ ++# tests ++tests-2.0 += \ ++ tst-stderr-compat \ ++# tests-2.0 + endif + + shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \ +diff --git a/libio/tst-stderr-compat.c b/libio/tst-stderr-compat.c +new file mode 100644 +index 0000000000..8221415cd4 +--- /dev/null ++++ b/libio/tst-stderr-compat.c +@@ -0,0 +1,52 @@ ++/* Test that fclose works on stderr from glibc 2.0. ++ Copyright (C) 2024 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 ++ <https://www.gnu.org/licenses/>. */ ++ ++#include <shlib-compat.h> ++ ++#if TEST_COMPAT (libc, GLIBC_2_0, GLIBC_2_1) ++# define _LIBC ++# define _IO_USE_OLD_IO_FILE ++# include <stdio.h> ++# include <support/check.h> ++ ++extern FILE _IO_stderr_; ++compat_symbol_reference (libc, _IO_stderr_, _IO_stderr_, GLIBC_2_0); ++compat_symbol_reference (libc, fclose, fclose, GLIBC_2_0); ++ ++__attribute__ ((weak, noclone, noinline)) ++void ++do_fclose (FILE *fp) ++{ ++ TEST_VERIFY_EXIT (fclose (fp) == 0); ++} ++ ++static int ++do_test (void) ++{ ++ do_fclose (&_IO_stderr_); ++ return 0; ++} ++#else ++static int ++do_test (void) ++{ ++ return 0; ++} ++#endif ++ ++#include <support/test-driver.c>
View file
_service:tar_scm:Make-tst-ungetc-use-libsupport.patch
Added
@@ -0,0 +1,147 @@ +From 87a1968a72e4b4e5436f3e2be1ed8a8d5a5862c7 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar <siddhesh@sourceware.org> +Date: Wed, 14 Aug 2024 19:20:04 -0400 +Subject: PATCH Make tst-ungetc use libsupport + +Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> +Reviewed-by: Carlos O'Donell <carlos@redhat.com> +(cherry picked from commit 3f7df7e757f4efec38e45d4068e5492efcac4856) +--- + stdio-common/tst-ungetc.c | 112 +++++++++++++++++++------------------- + 1 file changed, 57 insertions(+), 55 deletions(-) + +diff --git a/stdio-common/tst-ungetc.c b/stdio-common/tst-ungetc.c +index 1344b2b591..5c808f0734 100644 +--- a/stdio-common/tst-ungetc.c ++++ b/stdio-common/tst-ungetc.c +@@ -1,70 +1,72 @@ +-/* Test for ungetc bugs. */ ++/* Test for ungetc bugs. ++ Copyright (C) 1996-2024 Free Software Foundation, Inc. ++ Copyright The GNU Toolchain Authors. ++ 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 ++ <https://www.gnu.org/licenses/>. */ + + #include <stdio.h> + #include <stdlib.h> +-#include <unistd.h> +- +-#undef assert +-#define assert(x) \ +- if (!(x)) \ +- { \ +- fputs ("test failed: " #x "\n", stderr); \ +- retval = 1; \ +- goto the_end; \ +- } ++#include <support/check.h> ++#include <support/support.h> ++#include <support/temp_file.h> ++#include <support/xstdio.h> ++#include <support/xunistd.h> + +-int +-main (int argc, char *argv) ++static int ++do_test (void) + { +- char name = "/tmp/tst-ungetc.XXXXXX"; ++ char *name = NULL; + FILE *fp = NULL; +- int retval = 0; + int c; + char buffer64; + +- int fd = mkstemp (name); ++ int fd = create_temp_file ("tst-ungetc.", &name); + if (fd == -1) +- { +- printf ("mkstemp failed: %m\n"); +- return 1; +- } +- close (fd); +- fp = fopen (name, "w"); +- assert (fp != NULL) +- fputs ("bla", fp); +- fclose (fp); +- fp = NULL; ++ FAIL_EXIT1 ("cannot create temporary file: %m"); ++ xclose (fd); + +- fp = fopen (name, "r"); +- assert (fp != NULL); +- assert (ungetc ('z', fp) == 'z'); +- assert (getc (fp) == 'z'); +- assert (getc (fp) == 'b'); +- assert (getc (fp) == 'l'); +- assert (ungetc ('m', fp) == 'm'); +- assert (getc (fp) == 'm'); +- assert ((c = getc (fp)) == 'a'); +- assert (getc (fp) == EOF); +- assert (ungetc (c, fp) == c); +- assert (feof (fp) == 0); +- assert (getc (fp) == c); +- assert (getc (fp) == EOF); +- fclose (fp); +- fp = NULL; ++ fp = xfopen (name, "w"); ++ fputs ("bla", fp); ++ xfclose (fp); + +- fp = fopen (name, "r"); +- assert (fp != NULL); +- assert (getc (fp) == 'b'); +- assert (getc (fp) == 'l'); +- assert (ungetc ('b', fp) == 'b'); +- assert (fread (buffer, 1, 64, fp) == 2); +- assert (buffer0 == 'b'); +- assert (buffer1 == 'a'); ++ fp = xfopen (name, "r"); ++ TEST_VERIFY_EXIT (ungetc ('z', fp) == 'z'); ++ TEST_VERIFY_EXIT (getc (fp) == 'z'); ++ TEST_VERIFY_EXIT (getc (fp) == 'b'); ++ TEST_VERIFY_EXIT (getc (fp) == 'l'); ++ TEST_VERIFY_EXIT (ungetc ('m', fp) == 'm'); ++ TEST_VERIFY_EXIT (getc (fp) == 'm'); ++ TEST_VERIFY_EXIT ((c = getc (fp)) == 'a'); ++ TEST_VERIFY_EXIT (getc (fp) == EOF); ++ TEST_VERIFY_EXIT (ungetc (c, fp) == c); ++ TEST_VERIFY_EXIT (feof (fp) == 0); ++ TEST_VERIFY_EXIT (getc (fp) == c); ++ TEST_VERIFY_EXIT (getc (fp) == EOF); ++ xfclose (fp); + +-the_end: +- if (fp != NULL) +- fclose (fp); +- unlink (name); ++ fp = xfopen (name, "r"); ++ TEST_VERIFY_EXIT (getc (fp) == 'b'); ++ TEST_VERIFY_EXIT (getc (fp) == 'l'); ++ TEST_VERIFY_EXIT (ungetc ('b', fp) == 'b'); ++ TEST_VERIFY_EXIT (fread (buffer, 1, 64, fp) == 2); ++ TEST_VERIFY_EXIT (buffer0 == 'b'); ++ TEST_VERIFY_EXIT (buffer1 == 'a'); ++ xfclose (fp); + +- return retval; ++ return 0; + } ++ ++#include <support/test-driver.c> +-- +2.33.0 +
View file
_service:tar_scm:elf-Change-ldconfig-auxcache-magic-number-bug-32231.patch
Added
@@ -0,0 +1,49 @@ +From fa4ad104063204add2144df8151aa1135fffdd2d Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Mon, 28 Oct 2024 14:45:30 +0100 +Subject: PATCH elf: Change ldconfig auxcache magic number (bug 32231) + +In commit c628c2296392ed3bf2cb8d8470668e64fe53389f (elf: Remove +ldconfig kernel version check), the layout of auxcache entries +changed because the osversion field was removed from +struct aux_cache_file_entry. However, AUX_CACHEMAGIC was not +changed, so existing files are still used, potentially leading +to unintended ldconfig behavior. This commit changes AUX_CACHEMAGIC, +so that the file is regenerated. + +Reported-by: DJ Delorie <dj@redhat.com> +Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> +(cherry picked from commit 0a536f6e2f76e3ef581b3fd9af1e5cf4ddc7a5a2) +--- + NEWS | 1 + + elf/cache.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index a2adce11ff..8feb39f1ba 100644 +--- a/NEWS ++++ b/NEWS +@@ -59,6 +59,7 @@ The following bugs are resolved with this release: + 31968 mremap implementation in C does not handle arguments correctly + 32052 Name space violation in fortify wrappers + 32137 libio: Attempt wide backup free only for non-legacy code ++ 32231 elf: Change ldconfig auxcache magic number +  + Version 2.38 + +diff --git a/elf/cache.c b/elf/cache.c +index 8149f889ba..5de69ec4ca 100644 +--- a/elf/cache.c ++++ b/elf/cache.c +@@ -823,7 +823,7 @@ struct aux_cache_entry + struct aux_cache_entry *next; + }; + +-#define AUX_CACHEMAGIC "glibc-ld.so.auxcache-1.0" ++#define AUX_CACHEMAGIC "glibc-ld.so.auxcache-2.0" + + struct aux_cache_file_entry + { +-- +2.27.0 +
View file
_service:tar_scm:libio-Attempt-wide-backup-free-only-for-non-legacy-c.patch
Added
@@ -0,0 +1,54 @@ +From 370be858928c2c537c112859ccd54cd1b0d56715 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar <siddhesh@sourceware.org> +Date: Tue, 3 Sep 2024 14:58:33 -0400 +Subject: PATCH libio: Attempt wide backup free only for non-legacy code + +_wide_data and _mode are not available in legacy code, so do not attempt +to free the wide backup buffer in legacy code. + +Resolves: BZ #32137 and BZ #27821 + +Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> +Reviewed-by: Florian Weimer <fweimer@redhat.com> +(cherry picked from commit ae4d44b1d501421ad9a3af95279b8f4d1546f1ce) +--- + NEWS | 2 ++ + libio/genops.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 7a9a4b7ea3..a2adce11ff 100644 +--- a/NEWS ++++ b/NEWS +@@ -36,6 +36,7 @@ Security related changes: + + The following bugs are resolved with this release: + ++ 27821 ungetc: Fix backup buffer leak on program exit + 29039 Corrupt DTV after reuse of a TLS module ID following dlclose with unused TLS + 30081 resolv: Do not wait for non-existing second DNS response after error + 30694 The iconv program no longer tells the user which given encoding name was wrong +@@ -57,6 +58,7 @@ The following bugs are resolved with this release: + 31965 rseq extension mechanism does not work as intended + 31968 mremap implementation in C does not handle arguments correctly + 32052 Name space violation in fortify wrappers ++ 32137 libio: Attempt wide backup free only for non-legacy code +  + Version 2.38 + +diff --git a/libio/genops.c b/libio/genops.c +index fb06245467..7b30aab095 100644 +--- a/libio/genops.c ++++ b/libio/genops.c +@@ -792,7 +792,7 @@ _IO_unbuffer_all (void) + /* Free up the backup area if it was ever allocated. */ + if (_IO_have_backup (fp)) + _IO_free_backup_area (fp); +- if (fp->_mode > 0 && _IO_have_wbackup (fp)) ++ if (!legacy && fp->_mode > 0 && _IO_have_wbackup (fp)) + _IO_free_wbackup_area (fp); + + if (! (fp->_flags & _IO_UNBUFFERED) +-- +2.27.0 +
View file
_service:tar_scm:malloc-Use-__get_nprocs-on-arena_get2-BZ-30945.patch
Changed
@@ -1,4 +1,4 @@ -From 0ba0f3c749211d2888ee310b2b58ff6401eae624 Mon Sep 17 00:00:00 2001 +From 506e47da1d66b33e24440a495eeef85daf7f2a78 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Wed, 11 Oct 2023 13:43:56 -0300 Subject: PATCH malloc: Use __get_nprocs on arena_get2 (BZ 30945) @@ -20,10 +20,11 @@ (cherry picked from commit 472894d2cfee5751b44c0aaa71ed87df81c8e62e) --- include/sys/sysinfo.h | 4 ---- + malloc/arena.c | 2 +- misc/getsysstats.c | 6 ------ sysdeps/mach/getsysstats.c | 6 ------ sysdeps/unix/sysv/linux/getsysstats.c | 2 +- - 4 files changed, 1 insertion(+), 17 deletions(-) + 5 files changed, 2 insertions(+), 18 deletions(-) diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h index c490561581..65742b1036 100644 @@ -40,6 +41,19 @@ /* Return number of physical pages of memory in the system. */ extern long int __get_phys_pages (void); libc_hidden_proto (__get_phys_pages) +diff --git a/malloc/arena.c b/malloc/arena.c +index 6f03955ff2..82b09adb47 100644 +--- a/malloc/arena.c ++++ b/malloc/arena.c +@@ -820,7 +820,7 @@ arena_get2 (size_t size, mstate avoid_arena) + narenas_limit = mp_.arena_max; + else if (narenas > mp_.arena_test) + { +- int n = __get_nprocs_sched (); ++ int n = __get_nprocs (); + + if (n >= 1) + narenas_limit = NARENAS_FROM_NCORES (n); diff --git a/misc/getsysstats.c b/misc/getsysstats.c index 5f36adc0e8..23cc112074 100644 --- a/misc/getsysstats.c @@ -88,5 +102,5 @@ { enum -- -2.23.0 +2.33.0
View file
_service:tar_scm:malloc-use-__get_nprocs-replace-__get_nprocs_sched.patch
Deleted
@@ -1,25 +0,0 @@ -From f5545d74d6dc4d5036bee6a91cda14a51e2a0676 Mon Sep 17 00:00:00 2001 -From: Yang Yanchao <yangyanchao6@huawei.com> -Date: Sat, 12 Mar 2022 15:30:17 +0800 -Subject: PATCH malloc: use __get_nprocs replace __get_nprocs_sched. - ---- - malloc/arena.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/malloc/arena.c b/malloc/arena.c -index f1f0af86..66748463 100644 ---- a/malloc/arena.c -+++ b/malloc/arena.c -@@ -879,7 +879,7 @@ arena_get2 (size_t size, mstate avoid_arena) - narenas_limit = mp_.arena_max; - else if (narenas > mp_.arena_test) - { -- int n = __get_nprocs_sched (); -+ int n = __get_nprocs (); - - if (n >= 1) - narenas_limit = NARENAS_FROM_NCORES (n); --- -2.33.0 -
View file
_service:tar_scm:nptl-Use-support-check.h-facilities-in-tst-setuid3.patch
Added
@@ -0,0 +1,134 @@ +From f30501ca7557a194a53af22ff5b47b3189c48216 Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" <macro@redhat.com> +Date: Fri, 26 Jul 2024 13:21:34 +0100 +Subject: PATCH nptl: Use <support/check.h> facilities in tst-setuid3 + +Remove local FAIL macro in favor to FAIL_EXIT1 from <support/check.h>, +which provides equivalent reporting, with the name of the file and the +line number within of the failure site additionally included. Remove +FAIL_ERR altogether and include ": %m" explicitly with the format string +supplied to FAIL_EXIT1 as there seems little value to have a separate +macro just for this. + +Reviewed-by: DJ Delorie <dj@redhat.com> +(cherry picked from commit 8c98195af6e6f1ce21743fc26c723e0f7e45bcf2) +--- + sysdeps/pthread/tst-setuid3.c | 37 +++++++++++++++-------------------- + 1 file changed, 16 insertions(+), 21 deletions(-) + +diff --git a/sysdeps/pthread/tst-setuid3.c b/sysdeps/pthread/tst-setuid3.c +index 58b78d3116..d13848a647 100644 +--- a/sysdeps/pthread/tst-setuid3.c ++++ b/sysdeps/pthread/tst-setuid3.c +@@ -15,24 +15,19 @@ + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +-#include <stdio.h> + #include <errno.h> + #include <pthread.h> + #include <stdbool.h> + #include <unistd.h> + ++#include <support/check.h> ++ + /* The test must run under a non-privileged user ID. */ + static const uid_t test_uid = 1; + + static pthread_barrier_t barrier1; + static pthread_barrier_t barrier2; + +-#define FAIL(fmt, ...) \ +- do { printf ("FAIL: " fmt "\n", __VA_ARGS__); _exit (1); } while (0) +- +-#define FAIL_ERR(fmt, ...) \ +- do { printf ("FAIL: " fmt ": %m\n", __VA_ARGS__); _exit (1); } while (0) +- + /* True if x is not a successful return code from pthread_barrier_wait. */ + static inline bool + is_invalid_barrier_ret (int x) +@@ -45,10 +40,10 @@ thread_func (void *ctx __attribute__ ((unused))) + { + int ret = pthread_barrier_wait (&barrier1); + if (is_invalid_barrier_ret (ret)) +- FAIL ("pthread_barrier_wait (barrier1) (on thread): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_wait (barrier1) (on thread): %d", ret); + ret = pthread_barrier_wait (&barrier2); + if (is_invalid_barrier_ret (ret)) +- FAIL ("pthread_barrier_wait (barrier2) (on thread): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_wait (barrier2) (on thread): %d", ret); + return NULL; + } + +@@ -59,13 +54,13 @@ setuid_failure (int phase) + switch (ret) + { + case 0: +- FAIL ("setuid succeeded unexpectedly in phase %d", phase); ++ FAIL_EXIT1 ("setuid succeeded unexpectedly in phase %d", phase); + case -1: + if (errno != EPERM) +- FAIL_ERR ("setuid phase %d", phase); ++ FAIL_EXIT1 ("setuid phase %d: %m", phase); + break; + default: +- FAIL ("invalid setuid return value in phase %d: %d", phase, ret); ++ FAIL_EXIT1 ("invalid setuid return value in phase %d: %d", phase, ret); + } + } + +@@ -74,42 +69,42 @@ do_test (void) + { + if (getuid () == 0) + if (setuid (test_uid) != 0) +- FAIL_ERR ("setuid (%u)", (unsigned) test_uid); ++ FAIL_EXIT1 ("setuid (%u): %m", (unsigned) test_uid); + if (setuid (getuid ())) +- FAIL_ERR ("setuid (%s)", "getuid ()"); ++ FAIL_EXIT1 ("setuid (%s): %m", "getuid ()"); + setuid_failure (1); + + int ret = pthread_barrier_init (&barrier1, NULL, 2); + if (ret != 0) +- FAIL ("pthread_barrier_init (barrier1): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_init (barrier1): %d", ret); + ret = pthread_barrier_init (&barrier2, NULL, 2); + if (ret != 0) +- FAIL ("pthread_barrier_init (barrier2): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_init (barrier2): %d", ret); + + pthread_t thread; + ret = pthread_create (&thread, NULL, thread_func, NULL); + if (ret != 0) +- FAIL ("pthread_create: %d", ret); ++ FAIL_EXIT1 ("pthread_create: %d", ret); + + /* Ensure that the thread is running properly. */ + ret = pthread_barrier_wait (&barrier1); + if (is_invalid_barrier_ret (ret)) +- FAIL ("pthread_barrier_wait (barrier1): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_wait (barrier1): %d", ret); + + setuid_failure (2); + + /* Check success case. */ + if (setuid (getuid ()) != 0) +- FAIL_ERR ("setuid (%s)", "getuid ()"); ++ FAIL_EXIT1 ("setuid (%s): %m", "getuid ()"); + + /* Shutdown. */ + ret = pthread_barrier_wait (&barrier2); + if (is_invalid_barrier_ret (ret)) +- FAIL ("pthread_barrier_wait (barrier2): %d", ret); ++ FAIL_EXIT1 ("pthread_barrier_wait (barrier2): %d", ret); + + ret = pthread_join (thread, NULL); + if (ret != 0) +- FAIL ("pthread_join: %d", ret); ++ FAIL_EXIT1 ("pthread_join: %d", ret); + + return 0; + } +-- +2.33.0 +
View file
_service:tar_scm:posix-Use-support-check.h-facilities-in-tst-truncate.patch
Added
@@ -0,0 +1,89 @@ +From 15ca66303f7a7ce463bb41a83d88474996e46efd Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" <macro@redhat.com> +Date: Fri, 26 Jul 2024 13:21:34 +0100 +Subject: PATCH posix: Use <support/check.h> facilities in tst-truncate + and tst-truncate64 + +Remove local FAIL macro in favor to FAIL_RET from <support/check.h>, +which provides equivalent reporting, with the name of the file of the +failure site additionally included, for the tst-truncate-common core +shared between the tst-truncate and tst-truncate64 tests. + +Reviewed-by: DJ Delorie <dj@redhat.com> +(cherry picked from commit fe47595504a55e7bb992f8928533df154b510383) +--- + posix/tst-truncate-common.c | 25 ++++++++++++------------- + 1 file changed, 12 insertions(+), 13 deletions(-) + +diff --git a/posix/tst-truncate-common.c b/posix/tst-truncate-common.c +index 9a8163fdfe..fd32eb73c5 100644 +--- a/posix/tst-truncate-common.c ++++ b/posix/tst-truncate-common.c +@@ -21,6 +21,8 @@ + #include <sys/stat.h> + #include <unistd.h> + ++#include <support/check.h> ++ + static void do_prepare (void); + #define PREPARE(argc, argv) do_prepare () + static int do_test (void); +@@ -42,9 +44,6 @@ do_prepare (void) + } + } + +-#define FAIL(str) \ +- do { printf ("error: %s (line %d)\n", str, __LINE__); return 1; } while (0) +- + static int + do_test_with_offset (off_t offset) + { +@@ -54,35 +53,35 @@ do_test_with_offset (off_t offset) + memset (buf, 0xcf, sizeof (buf)); + + if (pwrite (temp_fd, buf, sizeof (buf), offset) != sizeof (buf)) +- FAIL ("write failed"); ++ FAIL_RET ("write failed"); + if (fstat (temp_fd, &st) < 0 || st.st_size != (offset + sizeof (buf))) +- FAIL ("initial size wrong"); ++ FAIL_RET ("initial size wrong"); + + if (ftruncate (temp_fd, offset + 800) < 0) +- FAIL ("size reduction with ftruncate failed"); ++ FAIL_RET ("size reduction with ftruncate failed"); + if (fstat (temp_fd, &st) < 0 || st.st_size != (offset + 800)) +- FAIL ("size after reduction with ftruncate is incorrect"); ++ FAIL_RET ("size after reduction with ftruncate is incorrect"); + + /* The following test covers more than POSIX. POSIX does not require + that ftruncate() can increase the file size. But we are testing + Unix systems. */ + if (ftruncate (temp_fd, offset + 1200) < 0) +- FAIL ("size increate with ftruncate failed"); ++ FAIL_RET ("size increate with ftruncate failed"); + if (fstat (temp_fd, &st) < 0 || st.st_size != (offset + 1200)) +- FAIL ("size after increase is incorrect"); ++ FAIL_RET ("size after increase is incorrect"); + + if (truncate (temp_filename, offset + 800) < 0) +- FAIL ("size reduction with truncate failed"); ++ FAIL_RET ("size reduction with truncate failed"); + if (fstat (temp_fd, &st) < 0 || st.st_size != (offset + 800)) +- FAIL ("size after reduction with truncate incorrect"); ++ FAIL_RET ("size after reduction with truncate incorrect"); + + /* The following test covers more than POSIX. POSIX does not require + that truncate() can increase the file size. But we are testing + Unix systems. */ + if (truncate (temp_filename, (offset + 1200)) < 0) +- FAIL ("size increase with truncate failed"); ++ FAIL_RET ("size increase with truncate failed"); + if (fstat (temp_fd, &st) < 0 || st.st_size != (offset + 1200)) +- FAIL ("size increase with truncate is incorrect"); ++ FAIL_RET ("size increase with truncate is incorrect"); + + return 0; + } +-- +2.33.0 +
View file
_service:tar_scm:stdio-common-Add-test-for-vfscanf-with-matches-longe.patch
Added
@@ -0,0 +1,176 @@ +From 99ffa84bdcdc3d81e82f448279f0c8278dd30964 Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" <macro@redhat.com> +Date: Fri, 26 Jul 2024 13:21:34 +0100 +Subject: PATCH stdio-common: Add test for vfscanf with matches longer + than INT_MAX BZ #27650 + +Complement commit b03e4d7bd25b ("stdio: fix vfscanf with matches longer +than INT_MAX (bug 27650)") and add a test case for the issue, inspired +by the reproducer provided with the bug report. + +This has been verified to succeed as from the commit referred and fail +beforehand. + +As the test requires 2GiB of data to be passed around its performance +has been evaluated using a choice of systems and the execution time +determined to be respectively in the range of 9s for POWER9@2.166GHz, +24s for FU740@1.2GHz, and 40s for 74Kf@950MHz. As this is on the verge +of and beyond the default timeout it has been increased by the factor of +8. Regardless, following recent practice the test has been added to the +standard rather than extended set. + +Reviewed-by: DJ Delorie <dj@redhat.com> +(cherry picked from commit 89cddc8a7096f3d9225868304d2bc0a1aaf07d63) +--- + stdio-common/Makefile | 5 ++ + stdio-common/tst-scanf-bz27650.c | 108 +++++++++++++++++++++++++++++++ + 2 files changed, 113 insertions(+) + create mode 100644 stdio-common/tst-scanf-bz27650.c + +diff --git a/stdio-common/Makefile b/stdio-common/Makefile +index 3866362bae..2bcbaf754a 100644 +--- a/stdio-common/Makefile ++++ b/stdio-common/Makefile +@@ -243,6 +243,7 @@ tests := \ + tst-scanf-binary-c2x \ + tst-scanf-binary-gnu11 \ + tst-scanf-binary-gnu89 \ ++ tst-scanf-bz27650 \ + tst-scanf-round \ + tst-scanf-to_inpunct \ + tst-setvbuf1 \ +@@ -312,6 +313,7 @@ generated += \ + tst-printf-fp-free.mtrace \ + tst-printf-fp-leak-mem.out \ + tst-printf-fp-leak.mtrace \ ++ tst-scanf-bz27650.mtrace \ + tst-vfprintf-width-prec-mem.out \ + tst-vfprintf-width-prec.mtrace \ + # generated +@@ -398,6 +400,9 @@ tst-printf-fp-free-ENV = \ + tst-printf-fp-leak-ENV = \ + MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace \ + LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so ++tst-scanf-bz27650-ENV = \ ++ MALLOC_TRACE=$(objpfx)tst-scanf-bz27650.mtrace \ ++ LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so + + $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc + $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ +diff --git a/stdio-common/tst-scanf-bz27650.c b/stdio-common/tst-scanf-bz27650.c +new file mode 100644 +index 0000000000..3a742bc865 +--- /dev/null ++++ b/stdio-common/tst-scanf-bz27650.c +@@ -0,0 +1,108 @@ ++/* Test for BZ #27650, formatted input matching beyond INT_MAX. ++ Copyright (C) 2024 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 ++ <https://www.gnu.org/licenses/>. */ ++ ++#include <error.h> ++#include <errno.h> ++#include <limits.h> ++#include <mcheck.h> ++#include <stddef.h> ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++ ++#include <sys/types.h> ++ ++#include <support/check.h> ++#include <support/test-driver.h> ++ ++/* Produce a stream of more than INT_MAX characters via buffer BUF of ++ size SIZE according to bookkeeping in COOKIE and then return EOF. */ ++ ++static ssize_t ++io_read (void *cookie, char *buf, size_t size) ++{ ++ unsigned int *written = cookie; ++ unsigned int w = *written; ++ ++ if (w > INT_MAX) ++ return 0; ++ ++ memset (buf, 'a', size); ++ *written = w + size; ++ return size; ++} ++ ++/* Consume a stream of more than INT_MAX characters from an artificial ++ input stream of which none is the new line character. The call to ++ fscanf is supposed to complete upon the EOF condition of input, ++ however in the presence of BZ #27650 it will terminate prematurely ++ with characters still outstanding in input. Diagnose the condition ++ and return status accordingly. */ ++ ++int ++do_test (void) ++{ ++ static cookie_io_functions_t io_funcs = { .read = io_read }; ++ unsigned int written = 0; ++ FILE *in; ++ int v; ++ ++ mtrace (); ++ ++ in = fopencookie (&written, "r", io_funcs); ++ if (in == NULL) ++ { ++ FAIL ("fopencookie: %m"); ++ goto out; ++ } ++ ++ v = fscanf (in, "%*^\n"); ++ if (ferror (in)) ++ { ++ FAIL ("fscanf: input failure, at %u: %m", written); ++ goto out_close; ++ } ++ else if (v == EOF) ++ { ++ FAIL ("fscanf: unexpected end of file, at %u", written); ++ goto out_close; ++ } ++ ++ if (!feof (in)) ++ { ++ v = fgetc (in); ++ if (ferror (in)) ++ FAIL ("fgetc: input failure: %m"); ++ else if (v == EOF) ++ FAIL ("fgetc: unexpected end of file after missing end of file"); ++ else if (v == '\n') ++ FAIL ("unexpected new line character received"); ++ else ++ FAIL ("character received after end of file expected: \\x%02x", v); ++ } ++ ++out_close: ++ if (fclose (in) != 0) ++ FAIL ("fclose: %m"); ++ ++out: ++ return EXIT_SUCCESS; ++} ++ ++#define TIMEOUT (DEFAULT_TIMEOUT * 8) ++#include <support/test-driver.c> +-- +2.33.0 +
View file
_service:tar_scm:support-Add-FAIL-test-failure-helper.patch
Added
@@ -0,0 +1,201 @@ +From 28f358bc4209ab0425170cdccf65bb1fe861148f Mon Sep 17 00:00:00 2001 +From: "Maciej W. Rozycki" <macro@redhat.com> +Date: Fri, 26 Jul 2024 13:21:34 +0100 +Subject: PATCH support: Add FAIL test failure helper + +Add a FAIL test failure helper analogous to FAIL_RET, that does not +cause the current function to return, providing a standardized way to +report a test failure with a message supplied while permitting the +caller to continue executing, for further reporting, cleaning up, etc. + +Update existing test cases that provide a conflicting definition of FAIL +by removing the local FAIL definition and then as follows: + +- tst-fortify-syslog: provide a meaningful message in addition to the + file name already added by <support/check.h>; 'support_record_failure' + is already called by 'support_print_failure_impl' invoked by the new + FAIL test failure helper. + +- tst-ctype: no update to FAIL calls required, with the name of the file + and the line number within of the failure site additionally included + by the new FAIL test failure helper, and error counting plus count + reporting upon test program termination also already provided by + 'support_record_failure' and 'support_report_failure' respectively, + called by 'support_print_failure_impl' and 'adjust_exit_status' also + respectively. However in a number of places 'printf' is called and + the error count adjusted by hand, so update these places to make use + of FAIL instead. And last but not least adjust the final summary just + to report completion, with any error count following as reported by + the test driver. + +- test-tgmath2: no update to FAIL calls required, with the name of the + file of the failure site additionally included by the new FAIL test + failure helper. Also there is no need to track the return status by + hand as any call to FAIL will eventually cause the test case to return + an unsuccesful exit status regardless of the return status from the + test function, via a call to 'adjust_exit_status' made by the test + driver. + +Reviewed-by: DJ Delorie <dj@redhat.com> +(cherry picked from commit 1b97a9f23bf605ca608162089c94187573fb2a9e) +--- + localedata/tst-ctype.c | 40 +++++++++------------------------------- + math/test-tgmath2.c | 13 +++---------- + support/check.h | 5 +++++ + 3 files changed, 17 insertions(+), 41 deletions(-) + +diff --git a/localedata/tst-ctype.c b/localedata/tst-ctype.c +index 098bf51335..355b666866 100644 +--- a/localedata/tst-ctype.c ++++ b/localedata/tst-ctype.c +@@ -21,6 +21,8 @@ + #include <stdio.h> + #include <string.h> + ++#include <support/check.h> ++ + + static const char lower = "abcdefghijklmnopqrstuvwxyz"; + static const char upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +@@ -53,19 +55,11 @@ static struct classes + #define nclasses (sizeof (classes) / sizeof (classes0)) + + +-#define FAIL(str, args...) \ +- { \ +- printf (" " str "\n", ##args); \ +- ++errors; \ +- } +- +- + static int + do_test (void) + { + const char *cp; + const char *cp2; +- int errors = 0; + char *inpline = NULL; + size_t inplinelen = 0; + char *resline = NULL; +@@ -394,11 +388,8 @@ punct = %04x alnum = %04x\n", + { + if (((__ctype_b(unsigned int) *inp & classesn.mask) != 0) + != (*resp != '0')) +- { +- printf (" is%s('%c' = '\\x%02x') %s true\n", inpline, +- *inp, *inp, *resp == '1' ? "not" : "is"); +- ++errors; +- } ++ FAIL (" is%s('%c' = '\\x%02x') %s true\n", inpline, ++ *inp, *inp, *resp == '1' ? "not" : "is"); + ++inp; + ++resp; + } +@@ -408,11 +399,8 @@ punct = %04x alnum = %04x\n", + while (*inp != '\0') + { + if (tolower (*inp) != *resp) +- { +- printf (" tolower('%c' = '\\x%02x') != '%c'\n", +- *inp, *inp, *resp); +- ++errors; +- } ++ FAIL (" tolower('%c' = '\\x%02x') != '%c'\n", ++ *inp, *inp, *resp); + ++inp; + ++resp; + } +@@ -422,11 +410,8 @@ punct = %04x alnum = %04x\n", + while (*inp != '\0') + { + if (toupper (*inp) != *resp) +- { +- printf (" toupper('%c' = '\\x%02x') != '%c'\n", +- *inp, *inp, *resp); +- ++errors; +- } ++ FAIL (" toupper('%c' = '\\x%02x') != '%c'\n", ++ *inp, *inp, *resp); + ++inp; + ++resp; + } +@@ -436,14 +421,7 @@ punct = %04x alnum = %04x\n", + } + + +- if (errors != 0) +- { +- printf (" %d error%s for `%s' locale\n\n\n", errors, +- errors == 1 ? "" : "s", setlocale (LC_ALL, NULL)); +- return 1; +- } +- +- printf (" No errors for `%s' locale\n\n\n", setlocale (LC_ALL, NULL)); ++ printf ("Completed testing for `%s' locale\n\n\n", setlocale (LC_ALL, NULL)); + return 0; + } + +diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c +index 6dd0d64da5..deba439e0c 100644 +--- a/math/test-tgmath2.c ++++ b/math/test-tgmath2.c +@@ -24,6 +24,8 @@ + #include <string.h> + #include <tgmath.h> + ++#include <support/check.h> ++ + //#define DEBUG + + typedef complex float cfloat; +@@ -87,13 +89,6 @@ enum + int count; + int countsTlastC_last; + +-#define FAIL(str) \ +- do \ +- { \ +- printf ("%s failure on line %d\n", (str), __LINE__); \ +- result = 1; \ +- } \ +- while (0) + #define TEST_TYPE_ONLY(expr, rettype) \ + do \ + { \ +@@ -133,8 +128,6 @@ int countsTlastC_last; + int + test_cos (const int Vint4, const long long int Vllong4) + { +- int result = 0; +- + TEST (cos (vfloat1), float, cos); + TEST (cos (vdouble1), double, cos); + TEST (cos (vldouble1), ldouble, cos); +@@ -152,7 +145,7 @@ test_cos (const int Vint4, const long long int Vllong4) + TEST (cos (Vcdouble1), cdouble, cos); + TEST (cos (Vcldouble1), cldouble, cos); + +- return result; ++ return 0; + } + + int +diff --git a/support/check.h b/support/check.h +index e6ae39f1a1..0a9fff484f 100644 +--- a/support/check.h ++++ b/support/check.h +@@ -24,6 +24,11 @@ + + __BEGIN_DECLS + ++/* Record a test failure, print the failure message to standard output ++ and pass the result of 1 through. */ ++#define FAIL(...) \ ++ support_print_failure_impl (__FILE__, __LINE__, __VA_ARGS__) ++ + /* Record a test failure, print the failure message to standard output + and return 1. */ + #define FAIL_RET(...) \ +--
View file
_service:tar_scm:ungetc-Fix-backup-buffer-leak-on-program-exit-BZ-278.patch
Added
@@ -0,0 +1,145 @@ +From b9f72bd5de931eac39219018c2fa319a449bb2cf Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar <siddhesh@sourceware.org> +Date: Tue, 13 Aug 2024 21:08:49 -0400 +Subject: PATCH ungetc: Fix backup buffer leak on program exit BZ + #27821 + +If a file descriptor is left unclosed and is cleaned up by _IO_cleanup +on exit, its backup buffer remains unfreed, registering as a leak in +valgrind. This is not strictly an issue since (1) the program should +ideally be closing the stream once it's not in use and (2) the program +is about to exit anyway, so keeping the backup buffer around a wee bit +longer isn't a real problem. Free it anyway to keep valgrind happy +when the streams in question are the standard ones, i.e. stdout, stdin +or stderr. + +Also, the _IO_have_backup macro checks for _IO_save_base, +which is a roundabout way to check for a backup buffer instead of +directly looking for _IO_backup_base. The roundabout check breaks when +the main get area has not been used and user pushes a char into the +backup buffer with ungetc. Fix this to use the _IO_backup_base +directly. + +Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> +Reviewed-by: Carlos O'Donell <carlos@redhat.com> +(cherry picked from commit 3e1d8d1d1dca24ae90df2ea826a8916896fc7e77) +--- + libio/genops.c | 6 ++++++ + libio/libioP.h | 4 ++-- + stdio-common/Makefile | 7 +++++++ + stdio-common/tst-ungetc-leak.c | 32 ++++++++++++++++++++++++++++++++ + 4 files changed, 47 insertions(+), 2 deletions(-) + create mode 100644 stdio-common/tst-ungetc-leak.c + +diff --git a/libio/genops.c b/libio/genops.c +index c673c0acec..fb06245467 100644 +--- a/libio/genops.c ++++ b/libio/genops.c +@@ -789,6 +789,12 @@ _IO_unbuffer_all (void) + legacy = 1; + #endif + ++ /* Free up the backup area if it was ever allocated. */ ++ if (_IO_have_backup (fp)) ++ _IO_free_backup_area (fp); ++ if (fp->_mode > 0 && _IO_have_wbackup (fp)) ++ _IO_free_wbackup_area (fp); ++ + if (! (fp->_flags & _IO_UNBUFFERED) + /* Iff stream is un-orientated, it wasn't used. */ + && (legacy || fp->_mode != 0)) +diff --git a/libio/libioP.h b/libio/libioP.h +index 745278e076..e75ee770bc 100644 +--- a/libio/libioP.h ++++ b/libio/libioP.h +@@ -577,8 +577,8 @@ extern void _IO_old_init (FILE *fp, int flags) __THROW; + ((__fp)->_wide_data->_IO_write_base \ + = (__fp)->_wide_data->_IO_write_ptr = __p, \ + (__fp)->_wide_data->_IO_write_end = (__ep)) +-#define _IO_have_backup(fp) ((fp)->_IO_save_base != NULL) +-#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_save_base != NULL) ++#define _IO_have_backup(fp) ((fp)->_IO_backup_base != NULL) ++#define _IO_have_wbackup(fp) ((fp)->_wide_data->_IO_backup_base != NULL) + #define _IO_in_backup(fp) ((fp)->_flags & _IO_IN_BACKUP) + #define _IO_have_markers(fp) ((fp)->_markers != NULL) + #define _IO_blen(fp) ((fp)->_IO_buf_end - (fp)->_IO_buf_base) +diff --git a/stdio-common/Makefile b/stdio-common/Makefile +index 2bcbaf754a..381040570b 100644 +--- a/stdio-common/Makefile ++++ b/stdio-common/Makefile +@@ -256,6 +256,7 @@ tests := \ + tst-swscanf \ + tst-tmpnam \ + tst-ungetc \ ++ tst-ungetc-leak \ + tst-unlockedio \ + tst-vfprintf-mbs-prec \ + tst-vfprintf-user-type \ +@@ -300,6 +301,7 @@ tests-special += \ + $(objpfx)tst-printfsz-islongdouble.out \ + $(objpfx)tst-setvbuf1-cmp.out \ + $(objpfx)tst-unbputc.out \ ++ $(objpfx)tst-ungetc-leak-mem.out \ + $(objpfx)tst-vfprintf-width-prec-mem.out \ + # tests-special + +@@ -314,6 +316,8 @@ generated += \ + tst-printf-fp-leak-mem.out \ + tst-printf-fp-leak.mtrace \ + tst-scanf-bz27650.mtrace \ ++ tst-ungetc-leak-mem.out \ ++ tst-ungetc-leak.mtrace \ + tst-vfprintf-width-prec-mem.out \ + tst-vfprintf-width-prec.mtrace \ + # generated +@@ -403,6 +407,9 @@ tst-printf-fp-leak-ENV = \ + tst-scanf-bz27650-ENV = \ + MALLOC_TRACE=$(objpfx)tst-scanf-bz27650.mtrace \ + LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so ++tst-ungetc-leak-ENV = \ ++ MALLOC_TRACE=$(objpfx)tst-ungetc-leak.mtrace \ ++ LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so + + $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc + $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \ +diff --git a/stdio-common/tst-ungetc-leak.c b/stdio-common/tst-ungetc-leak.c +new file mode 100644 +index 0000000000..6c5152b43f +--- /dev/null ++++ b/stdio-common/tst-ungetc-leak.c +@@ -0,0 +1,32 @@ ++/* Test for memory leak with ungetc when stream is unused. ++ Copyright The GNU Toolchain Authors. ++ 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 ++ <https://www.gnu.org/licenses/>. */ ++ ++#include <stdio.h> ++#include <mcheck.h> ++#include <support/check.h> ++#include <support/support.h> ++ ++static int ++do_test (void) ++{ ++ mtrace (); ++ TEST_COMPARE (ungetc('y', stdin), 'y'); ++ return 0; ++} ++ ++#include <support/test-driver.c> +-- +2.33.0 +
View file
_service:tar_scm:ungetc-Fix-uninitialized-read-when-putting-into-unus.patch
Added
@@ -0,0 +1,78 @@ +From 804d3c8db79db204154dcf5e11a76f14fdddc570 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar <siddhesh@sourceware.org> +Date: Tue, 13 Aug 2024 21:00:06 -0400 +Subject: PATCH ungetc: Fix uninitialized read when putting into unused + streams BZ #27821 + +When ungetc is called on an unused stream, the backup buffer is +allocated without the main get area being present. This results in +every subsequent ungetc (as the stream remains in the backup area) +checking uninitialized memory in the backup buffer when trying to put a +character back into the stream. + +Avoid comparing the input character with buffer contents when in backup +to avoid this uninitialized read. The uninitialized read is harmless in +this context since the location is promptly overwritten with the input +character, thus fulfilling ungetc functionality. + +Also adjust wording in the manual to drop the paragraph that says glibc +cannot do multiple ungetc back to back since with this change, ungetc +can actually do this. + +Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> +Reviewed-by: Carlos O'Donell <carlos@redhat.com> +(cherry picked from commit cdf0f88f97b0aaceb894cc02b21159d148d7065c) +--- + libio/genops.c | 2 +- + manual/stdio.texi | 8 +++----- + stdio-common/tst-ungetc.c | 2 ++ + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/libio/genops.c b/libio/genops.c +index fbd8dd9e75..c673c0acec 100644 +--- a/libio/genops.c ++++ b/libio/genops.c +@@ -635,7 +635,7 @@ _IO_sputbackc (FILE *fp, int c) + { + int result; + +- if (fp->_IO_read_ptr > fp->_IO_read_base ++ if (fp->_IO_read_ptr > fp->_IO_read_base && !_IO_in_backup (fp) + && (unsigned char)fp->_IO_read_ptr-1 == (unsigned char)c) + { + fp->_IO_read_ptr--; +diff --git a/manual/stdio.texi b/manual/stdio.texi +index 9cf622403f..a54cd369db 100644 +--- a/manual/stdio.texi ++++ b/manual/stdio.texi +@@ -1474,11 +1474,9 @@ program; usually @code{ungetc} is used only to unread a character that + was just read from the same stream. @Theglibc{} supports this + even on files opened in binary mode, but other systems might not. + +-@Theglibc{} only supports one character of pushback---in other +-words, it does not work to call @code{ungetc} twice without doing input +-in between. Other systems might let you push back multiple characters; +-then reading from the stream retrieves the characters in the reverse +-order that they were pushed. ++@Theglibc{} supports pushing back multiple characters; subsequently ++reading from the stream retrieves the characters in the reverse order ++that they were pushed. + + Pushing back characters doesn't alter the file; only the internal + buffering for the stream is affected. If a file positioning function +diff --git a/stdio-common/tst-ungetc.c b/stdio-common/tst-ungetc.c +index 5c808f0734..388b202493 100644 +--- a/stdio-common/tst-ungetc.c ++++ b/stdio-common/tst-ungetc.c +@@ -48,6 +48,8 @@ do_test (void) + TEST_VERIFY_EXIT (getc (fp) == 'b'); + TEST_VERIFY_EXIT (getc (fp) == 'l'); + TEST_VERIFY_EXIT (ungetc ('m', fp) == 'm'); ++ TEST_VERIFY_EXIT (ungetc ('n', fp) == 'n'); ++ TEST_VERIFY_EXIT (getc (fp) == 'n'); + TEST_VERIFY_EXIT (getc (fp) == 'm'); + TEST_VERIFY_EXIT ((c = getc (fp)) == 'a'); + TEST_VERIFY_EXIT (getc (fp) == EOF); +-- +2.33.0 +
View file
_service:tar_scm:x86-use-total-l3cache-for-non_temporal_threshold.patch
Deleted
@@ -1,74 +0,0 @@ -From af0606f5d626b92d6e59da3a797548e9daab5580 Mon Sep 17 00:00:00 2001 -From: Qingqing Li <liqingqing3@huawei.com> -Date: Sat, 25 Jun 2022 15:36:44 +0800 -Subject: PATCH x86: use total l3cache for non_temporal_threshold - -Below glibc upstream patch modified the default behavoir for large size of memcpy, -such as 1M~10M. revert it and use GLIBC_TUNABLES="glibc.cpu.x86_non_temporal_threshold=xxx" -to tune the application when needed. - -d3c57027470b78dba79c6d931e4e409b1fecfc80 -Author: Patrick McGehearty <patrick.mcgehearty@oracle.com> -Date: Mon Sep 28 20:11:28 2020 +0000 - - Reversing calculation of __x86_shared_non_temporal_threshold - - The __x86_shared_non_temporal_threshold determines when memcpy on x86 - uses non_temporal stores to avoid pushing other data out of the last - level cache. - uses non_temporal stores to avoid pushing other data out of the last - level cache. - - This patch proposes to revert the calculation change made by H.J. Lu's - patch of June 2, 2017. - - H.J. Lu's patch selected a threshold suitable for a single thread - getting maximum performance. It was tuned using the single threaded - large memcpy micro benchmark on an 8 core processor. The last change - changes the threshold from using 3/4 of one thread's share of the - cache to using 3/4 of the entire cache of a multi-threaded system - before switching to non-temporal stores. Multi-threaded systems with - more than a few threads are server-class and typically have many - active threads. If one thread consumes 3/4 of the available cache for - all threads, it will cause other active threads to have data removed - from the cache. Two examples show the range of the effect. John - McCalpin's widely parallel Stream benchmark, which runs in parallel - and fetches data sequentially, saw a 20% slowdown with this patch on - an internal system test of 128 threads. This regression was discovered - when comparing OL8 performance to OL7. An example that compares - normal stores to non-temporal stores may be found at - https://vgatherps.github.io/2018-09-02-nontemporal/. A simple test - shows performance loss of 400 to 500% due to a failure to use - nontemporal stores. These performance losses are most likely to occur - when the system load is heaviest and good performance is critical. - - The tunable x86_non_temporal_threshold can be used to override the - default for the knowledgable user who really wants maximum cache - allocation to a single thread in a multi-threaded system. - The manual entry for the tunable has been expanded to provide - more information about its purpose. - - modified: sysdeps/x86/cacheinfo.c - modified: manual/tunables.texi ---- - sysdeps/x86/dl-cacheinfo.h | 4 ++++++ - 1 file changed, 4 insertions(+) - -diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h -index e6c94dfd..c5e8deb3 100644 ---- a/sysdeps/x86/dl-cacheinfo.h -+++ b/sysdeps/x86/dl-cacheinfo.h -@@ -926,6 +926,10 @@ dl_init_cacheinfo (struct cpu_features *cpu_features) - if (tunable_size != 0) - shared = tunable_size; - -+ /* keep x86 to use the same non_temporal_threshold like glibc2.28 */ -+ if (threads != 0) -+ non_temporal_threshold *= threads; -+ - tunable_size = TUNABLE_GET (x86_non_temporal_threshold, long int, NULL); - if (tunable_size > minimum_non_temporal_threshold - && tunable_size <= maximum_non_temporal_threshold) --- -2.30.0 -
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2