forked from rpms/glibc
import glibc-2.34-7.el9_b
This commit is contained in:
commit
3b7d21b7cf
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
SOURCES/glibc-2.34.tar.xz
|
1
.glibc.metadata
Normal file
1
.glibc.metadata
Normal file
@ -0,0 +1 @@
|
||||
7c3b8890a6346793b6334cc5f2fea5d437d307b8 SOURCES/glibc-2.34.tar.xz
|
7374
SOURCES/ChangeLog.old
Normal file
7374
SOURCES/ChangeLog.old
Normal file
File diff suppressed because it is too large
Load Diff
77
SOURCES/bench.mk
Normal file
77
SOURCES/bench.mk
Normal file
@ -0,0 +1,77 @@
|
||||
objpfx = $(prefix)/$(ver)/usr/libexec/glibc-benchtests/
|
||||
|
||||
bench-math := acos acosh asin asinh atan atanh cos cosh exp exp2 ffs ffsll \
|
||||
log log2 modf pow rint sin sincos sinh sqrt tan tanh
|
||||
|
||||
bench-pthread := pthread_once
|
||||
|
||||
bench := $(bench-math) $(bench-pthread)
|
||||
|
||||
run-bench := $(prefix)/$(ver)/lib64/ld-linux-x86-64.so.2 --library-path $(prefix)/$(ver)/lib64 $${run}
|
||||
|
||||
# String function benchmarks.
|
||||
string-bench := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
|
||||
mempcpy memset rawmemchr stpcpy stpncpy strcasecmp strcasestr \
|
||||
strcat strchr strchrnul strcmp strcpy strcspn strlen \
|
||||
strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
|
||||
strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok
|
||||
string-bench-all := $(string-bench)
|
||||
|
||||
stdlib-bench := strtod
|
||||
|
||||
benchset := $(string-bench-all) $(stdlib-bench)
|
||||
|
||||
bench-malloc := malloc-thread
|
||||
|
||||
binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
|
||||
binaries-benchset := $(addprefix $(objpfx)bench-,$(benchset))
|
||||
binaries-bench-malloc := $(addprefix $(objpfx)bench-,$(bench-malloc))
|
||||
|
||||
DETAILED_OPT :=
|
||||
|
||||
ifdef DETAILED
|
||||
DETAILED_OPT := -d
|
||||
endif
|
||||
|
||||
bench: bench-set bench-func bench-malloc
|
||||
|
||||
bench-set: $(binaries-benchset)
|
||||
for run in $^; do \
|
||||
outfile=$(prefix)/$$(basename $${run}.$(ver).out); \
|
||||
echo "Running $${run}"; \
|
||||
$(run-bench) > $${outfile}.tmp; \
|
||||
mv $${outfile}{.tmp,}; \
|
||||
done
|
||||
|
||||
bench-malloc: $(binaries-bench-malloc)
|
||||
run=$(objpfx)bench-malloc-thread; \
|
||||
outfile=$(prefix)/$$(basename $${run}.$(ver).out); \
|
||||
for thr in 1 8 16 32; do \
|
||||
echo "Running $${run} $${thr}"; \
|
||||
$(run-bench) $${thr} > $${outfile}.tmp; \
|
||||
mv $${outfile}{.tmp,}; \
|
||||
done
|
||||
|
||||
# Build and execute the benchmark functions. This target generates JSON
|
||||
# formatted bench.out. Each of the programs produce independent JSON output,
|
||||
# so one could even execute them individually and process it using any JSON
|
||||
# capable language or tool.
|
||||
bench-func: $(binaries-bench)
|
||||
{ echo "{\"timing_type\": \"hp-timing\","; \
|
||||
echo " \"functions\": {"; \
|
||||
for run in $^; do \
|
||||
if ! [ "x$${run}" = "x$<" ]; then \
|
||||
echo ","; \
|
||||
fi; \
|
||||
echo "Running $${run}" >&2; \
|
||||
$(run-bench) $(DETAILED_OPT); \
|
||||
done; \
|
||||
echo; \
|
||||
echo " }"; \
|
||||
echo "}"; } > $(prefix)/bench.$(ver).out-tmp; \
|
||||
if [ -f $(prefix)/bench.$(ver).out ]; then \
|
||||
mv -f $(prefix)/bench.$(ver).out{,.old}; \
|
||||
fi; \
|
||||
mv -f $(prefix)/bench.$(ver).out{-tmp,}
|
||||
# scripts/validate_benchout.py bench.out \
|
||||
# scripts/benchout.schema.json
|
153
SOURCES/glibc-bench-compare
Executable file
153
SOURCES/glibc-bench-compare
Executable file
@ -0,0 +1,153 @@
|
||||
#!/usr/bin/bash
|
||||
# This script can be invoked as follows:
|
||||
#
|
||||
# glibc-bench-compare [options] <BUILD> [BUILD]
|
||||
#
|
||||
# Options may be one of the following:
|
||||
#
|
||||
# -t The BUILD arguments are task ids and not a version-release string
|
||||
# -a ARCH Do comparison for ARCH architecture
|
||||
#
|
||||
# If any of the above options are given, both BUILD arguments must be given.
|
||||
# Otherwise, if only one BUILD is specified, then it is compared against the
|
||||
# installed glibc.
|
||||
|
||||
# Silence the pushd/popd messages
|
||||
pushd() {
|
||||
command pushd "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
popd() {
|
||||
command popd "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
# Clean up any downloaded files before we exit
|
||||
trap "rm -rf /tmp/glibc-bench-compare.$BASHPID.*" EXIT
|
||||
|
||||
task=0
|
||||
arch=$(uname -i)
|
||||
options=0
|
||||
path=0
|
||||
installed=
|
||||
|
||||
# Look for any commandline options
|
||||
while getopts ":tpa:" opt; do
|
||||
case $opt in
|
||||
p)
|
||||
path=1
|
||||
;;
|
||||
t)
|
||||
task=1
|
||||
options=1
|
||||
echo "Not implemented."
|
||||
exit 1
|
||||
;;
|
||||
a)
|
||||
arch=$OPTARG
|
||||
options=1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Done, now shift all option arguments out.
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [ $# -gt 2 ] || [ $# -eq 0 ] || [ $# -lt 2 -a $options -eq 1 ]; then
|
||||
echo "Usage: $0 [OPTIONS] <old> [new]"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo -e "\t-t\tCompare two brew tasks"
|
||||
echo -e "\t-a ARCH\tGet rpms for the ARCH architecture"
|
||||
echo -e "\t-p\tCompare built rpms in two paths."
|
||||
echo -e "\t\tThis minimally needs glibc, glibc-common and glibc-benchtests"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z $2 ]; then
|
||||
new="$1"
|
||||
old=$(rpm --queryformat "%{VERSION}-%{RELEASE}\n" -q glibc | head -1)
|
||||
installed=$old
|
||||
else
|
||||
new="$2"
|
||||
old="$1"
|
||||
fi
|
||||
|
||||
decompress_rpms() {
|
||||
# We were given a path to the rpms. Figure out the version-release and
|
||||
# decompress the rpms.
|
||||
if [ -n $1 ]; then
|
||||
vr=$(rpm --queryformat="%{VERSION}-%{RELEASE}" -qp $1/glibc-2*.rpm | head -1)
|
||||
mkdir $vr && pushd $vr
|
||||
fi
|
||||
|
||||
for r in $1*.rpm; do
|
||||
( rpm2cpio $r | cpio -di ) > /dev/null
|
||||
done
|
||||
|
||||
if [ -n $1 ]; then
|
||||
popd
|
||||
echo $vr
|
||||
fi
|
||||
}
|
||||
|
||||
# Get rpms for a build and decompress them
|
||||
get_build() {
|
||||
echo "Processing build $1"
|
||||
mkdir $1 && pushd $1
|
||||
brew buildinfo "glibc-$1" |
|
||||
sed -n -e "s|/mnt/koji\(.\+$arch.\+\)|http://kojipkgs.fedoraproject.org\1|p" |
|
||||
while read url; do
|
||||
echo "Downloading $url"
|
||||
wget -q $url
|
||||
done
|
||||
decompress_rpms
|
||||
|
||||
echo "Removing rpms"
|
||||
rm -f $1/*.rpm
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
# Run benchmarks for a build
|
||||
run_bench() {
|
||||
if [ -z $1 ]; then
|
||||
make DETAILED=1 ver=$installed prefix= -f /usr/libexec/glibc-benchtests/bench.mk bench
|
||||
else
|
||||
make DETAILED=1 ver=$1 prefix=$PWD -f $1/usr/libexec/glibc-benchtests/bench.mk bench
|
||||
fi
|
||||
}
|
||||
|
||||
# Get absolute paths if needed, since we will change into the working directory
|
||||
# next.
|
||||
if [ $path -eq 1 ]; then
|
||||
old_path=$(realpath $old)/
|
||||
new_path=$(realpath $new)/
|
||||
fi
|
||||
|
||||
tmpdir=$(mktemp -p /tmp -d glibc-bench-compare.$$.XXXX)
|
||||
pushd $tmpdir
|
||||
|
||||
# Get both builds.
|
||||
if [ $path -eq 0 ]; then
|
||||
if [ -z $installed ]; then
|
||||
get_build $old
|
||||
fi
|
||||
get_build $new
|
||||
else
|
||||
old=$(decompress_rpms $old_path)
|
||||
new=$(decompress_rpms $new_path)
|
||||
fi
|
||||
|
||||
# make bench for each of those.
|
||||
if [ -z $installed ]; then
|
||||
run_bench $old
|
||||
else
|
||||
run_bench
|
||||
fi
|
||||
run_bench $new
|
||||
|
||||
# Now run the comparison script.
|
||||
$old/usr/libexec/glibc-benchtests/compare_bench.py $old/usr/libexec/glibc-benchtests/benchout.schema.json \
|
||||
bench.$old.out bench.$new.out
|
980
SOURCES/glibc-c-utf8-locale-1.patch
Normal file
980
SOURCES/glibc-c-utf8-locale-1.patch
Normal file
@ -0,0 +1,980 @@
|
||||
commit f5117c6504888fab5423282a4607c552b90fd3f9
|
||||
Author: Carlos O'Donell <carlos@redhat.com>
|
||||
Date: Thu Jul 29 22:45:39 2021 -0400
|
||||
|
||||
Add 'codepoint_collation' support for LC_COLLATE.
|
||||
|
||||
Support a new directive 'codepoint_collation' in the LC_COLLATE
|
||||
section of a locale source file. This new directive causes all
|
||||
collation rules to be dropped and instead STRCMP (strcmp or
|
||||
wcscmp) is used for collation of the input character set. This
|
||||
is required to allow for a C.UTF-8 that contains zero collation
|
||||
rules (minimal size) and sorts using code point sorting.
|
||||
|
||||
To date the only implementation of a locale with zero collation
|
||||
rules is the C/POSIX locale. The C/POSIX locale provides
|
||||
identity tables for _NL_COLLATE_COLLSEQMB and
|
||||
_NL_COLLATE_COLLSEQWC that map to ASCII even though it has zero
|
||||
rules. This has lead to existing fnmatch, regexec, and regcomp
|
||||
implementations that require these tables. It is not correct
|
||||
to use these tables when nrules == 0, but the conservative fix
|
||||
is to provide these tables when nrules == 0. This assures that
|
||||
existing static applications using a new C.UTF-8 locale with
|
||||
'codepoint_collation' at least have functional range expressions
|
||||
with ASCII e.g. [0-9] or [a-z]. Such static applications would
|
||||
not have the fixes to fnmatch, regexec and regcomp that avoid
|
||||
the use of the tables when nrules == 0. Future fixes to fnmatch,
|
||||
regexec, and regcomp would allow range expressions to use the
|
||||
full set of code points for such ranges.
|
||||
|
||||
Tested on x86_64 and i686 without regression.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
diff --git a/locale/C-collate-seq.c b/locale/C-collate-seq.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..4fb82cb8357936b6
|
||||
--- /dev/null
|
||||
+++ b/locale/C-collate-seq.c
|
||||
@@ -0,0 +1,100 @@
|
||||
+/* Copyright (C) 1995-2021 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 <stdint.h>
|
||||
+
|
||||
+static const char collseqmb[] =
|
||||
+{
|
||||
+ '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
||||
+ '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
|
||||
+ '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
|
||||
+ '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
|
||||
+ '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
|
||||
+ '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
|
||||
+ '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
|
||||
+ '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
|
||||
+ '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47',
|
||||
+ '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f',
|
||||
+ '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57',
|
||||
+ '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f',
|
||||
+ '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67',
|
||||
+ '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f',
|
||||
+ '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77',
|
||||
+ '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f',
|
||||
+ '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87',
|
||||
+ '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f',
|
||||
+ '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97',
|
||||
+ '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f',
|
||||
+ '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7',
|
||||
+ '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf',
|
||||
+ '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7',
|
||||
+ '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf',
|
||||
+ '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7',
|
||||
+ '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf',
|
||||
+ '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7',
|
||||
+ '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf',
|
||||
+ '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7',
|
||||
+ '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef',
|
||||
+ '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7',
|
||||
+ '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
|
||||
+};
|
||||
+
|
||||
+/* This table must be 256 bytes in size. We index bytes into the
|
||||
+ table to find the collation sequence. */
|
||||
+_Static_assert (sizeof (collseqmb) == 256);
|
||||
+
|
||||
+static const uint32_t collseqwc[] =
|
||||
+{
|
||||
+ 8, 1, 8, 0x0, 0xff,
|
||||
+ /* 1st-level table */
|
||||
+ 6 * sizeof (uint32_t),
|
||||
+ /* 2nd-level table */
|
||||
+ 7 * sizeof (uint32_t),
|
||||
+ /* 3rd-level table */
|
||||
+ L'\x00', L'\x01', L'\x02', L'\x03', L'\x04', L'\x05', L'\x06', L'\x07',
|
||||
+ L'\x08', L'\x09', L'\x0a', L'\x0b', L'\x0c', L'\x0d', L'\x0e', L'\x0f',
|
||||
+ L'\x10', L'\x11', L'\x12', L'\x13', L'\x14', L'\x15', L'\x16', L'\x17',
|
||||
+ L'\x18', L'\x19', L'\x1a', L'\x1b', L'\x1c', L'\x1d', L'\x1e', L'\x1f',
|
||||
+ L'\x20', L'\x21', L'\x22', L'\x23', L'\x24', L'\x25', L'\x26', L'\x27',
|
||||
+ L'\x28', L'\x29', L'\x2a', L'\x2b', L'\x2c', L'\x2d', L'\x2e', L'\x2f',
|
||||
+ L'\x30', L'\x31', L'\x32', L'\x33', L'\x34', L'\x35', L'\x36', L'\x37',
|
||||
+ L'\x38', L'\x39', L'\x3a', L'\x3b', L'\x3c', L'\x3d', L'\x3e', L'\x3f',
|
||||
+ L'\x40', L'\x41', L'\x42', L'\x43', L'\x44', L'\x45', L'\x46', L'\x47',
|
||||
+ L'\x48', L'\x49', L'\x4a', L'\x4b', L'\x4c', L'\x4d', L'\x4e', L'\x4f',
|
||||
+ L'\x50', L'\x51', L'\x52', L'\x53', L'\x54', L'\x55', L'\x56', L'\x57',
|
||||
+ L'\x58', L'\x59', L'\x5a', L'\x5b', L'\x5c', L'\x5d', L'\x5e', L'\x5f',
|
||||
+ L'\x60', L'\x61', L'\x62', L'\x63', L'\x64', L'\x65', L'\x66', L'\x67',
|
||||
+ L'\x68', L'\x69', L'\x6a', L'\x6b', L'\x6c', L'\x6d', L'\x6e', L'\x6f',
|
||||
+ L'\x70', L'\x71', L'\x72', L'\x73', L'\x74', L'\x75', L'\x76', L'\x77',
|
||||
+ L'\x78', L'\x79', L'\x7a', L'\x7b', L'\x7c', L'\x7d', L'\x7e', L'\x7f',
|
||||
+ L'\x80', L'\x81', L'\x82', L'\x83', L'\x84', L'\x85', L'\x86', L'\x87',
|
||||
+ L'\x88', L'\x89', L'\x8a', L'\x8b', L'\x8c', L'\x8d', L'\x8e', L'\x8f',
|
||||
+ L'\x90', L'\x91', L'\x92', L'\x93', L'\x94', L'\x95', L'\x96', L'\x97',
|
||||
+ L'\x98', L'\x99', L'\x9a', L'\x9b', L'\x9c', L'\x9d', L'\x9e', L'\x9f',
|
||||
+ L'\xa0', L'\xa1', L'\xa2', L'\xa3', L'\xa4', L'\xa5', L'\xa6', L'\xa7',
|
||||
+ L'\xa8', L'\xa9', L'\xaa', L'\xab', L'\xac', L'\xad', L'\xae', L'\xaf',
|
||||
+ L'\xb0', L'\xb1', L'\xb2', L'\xb3', L'\xb4', L'\xb5', L'\xb6', L'\xb7',
|
||||
+ L'\xb8', L'\xb9', L'\xba', L'\xbb', L'\xbc', L'\xbd', L'\xbe', L'\xbf',
|
||||
+ L'\xc0', L'\xc1', L'\xc2', L'\xc3', L'\xc4', L'\xc5', L'\xc6', L'\xc7',
|
||||
+ L'\xc8', L'\xc9', L'\xca', L'\xcb', L'\xcc', L'\xcd', L'\xce', L'\xcf',
|
||||
+ L'\xd0', L'\xd1', L'\xd2', L'\xd3', L'\xd4', L'\xd5', L'\xd6', L'\xd7',
|
||||
+ L'\xd8', L'\xd9', L'\xda', L'\xdb', L'\xdc', L'\xdd', L'\xde', L'\xdf',
|
||||
+ L'\xe0', L'\xe1', L'\xe2', L'\xe3', L'\xe4', L'\xe5', L'\xe6', L'\xe7',
|
||||
+ L'\xe8', L'\xe9', L'\xea', L'\xeb', L'\xec', L'\xed', L'\xee', L'\xef',
|
||||
+ L'\xf0', L'\xf1', L'\xf2', L'\xf3', L'\xf4', L'\xf5', L'\xf6', L'\xf7',
|
||||
+ L'\xf8', L'\xf9', L'\xfa', L'\xfb', L'\xfc', L'\xfd', L'\xfe', L'\xff'
|
||||
+};
|
||||
diff --git a/locale/C-collate.c b/locale/C-collate.c
|
||||
index 76d9373683314943..120ce0a40aeb9a0f 100644
|
||||
--- a/locale/C-collate.c
|
||||
+++ b/locale/C-collate.c
|
||||
@@ -20,83 +20,7 @@
|
||||
#include <stdint.h>
|
||||
#include "localeinfo.h"
|
||||
|
||||
-static const char collseqmb[] =
|
||||
-{
|
||||
- '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07',
|
||||
- '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f',
|
||||
- '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
|
||||
- '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f',
|
||||
- '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27',
|
||||
- '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f',
|
||||
- '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37',
|
||||
- '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f',
|
||||
- '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47',
|
||||
- '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f',
|
||||
- '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57',
|
||||
- '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f',
|
||||
- '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67',
|
||||
- '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f',
|
||||
- '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77',
|
||||
- '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f',
|
||||
- '\x80', '\x81', '\x82', '\x83', '\x84', '\x85', '\x86', '\x87',
|
||||
- '\x88', '\x89', '\x8a', '\x8b', '\x8c', '\x8d', '\x8e', '\x8f',
|
||||
- '\x90', '\x91', '\x92', '\x93', '\x94', '\x95', '\x96', '\x97',
|
||||
- '\x98', '\x99', '\x9a', '\x9b', '\x9c', '\x9d', '\x9e', '\x9f',
|
||||
- '\xa0', '\xa1', '\xa2', '\xa3', '\xa4', '\xa5', '\xa6', '\xa7',
|
||||
- '\xa8', '\xa9', '\xaa', '\xab', '\xac', '\xad', '\xae', '\xaf',
|
||||
- '\xb0', '\xb1', '\xb2', '\xb3', '\xb4', '\xb5', '\xb6', '\xb7',
|
||||
- '\xb8', '\xb9', '\xba', '\xbb', '\xbc', '\xbd', '\xbe', '\xbf',
|
||||
- '\xc0', '\xc1', '\xc2', '\xc3', '\xc4', '\xc5', '\xc6', '\xc7',
|
||||
- '\xc8', '\xc9', '\xca', '\xcb', '\xcc', '\xcd', '\xce', '\xcf',
|
||||
- '\xd0', '\xd1', '\xd2', '\xd3', '\xd4', '\xd5', '\xd6', '\xd7',
|
||||
- '\xd8', '\xd9', '\xda', '\xdb', '\xdc', '\xdd', '\xde', '\xdf',
|
||||
- '\xe0', '\xe1', '\xe2', '\xe3', '\xe4', '\xe5', '\xe6', '\xe7',
|
||||
- '\xe8', '\xe9', '\xea', '\xeb', '\xec', '\xed', '\xee', '\xef',
|
||||
- '\xf0', '\xf1', '\xf2', '\xf3', '\xf4', '\xf5', '\xf6', '\xf7',
|
||||
- '\xf8', '\xf9', '\xfa', '\xfb', '\xfc', '\xfd', '\xfe', '\xff'
|
||||
-};
|
||||
-
|
||||
-static const uint32_t collseqwc[] =
|
||||
-{
|
||||
- 8, 1, 8, 0x0, 0xff,
|
||||
- /* 1st-level table */
|
||||
- 6 * sizeof (uint32_t),
|
||||
- /* 2nd-level table */
|
||||
- 7 * sizeof (uint32_t),
|
||||
- /* 3rd-level table */
|
||||
- L'\x00', L'\x01', L'\x02', L'\x03', L'\x04', L'\x05', L'\x06', L'\x07',
|
||||
- L'\x08', L'\x09', L'\x0a', L'\x0b', L'\x0c', L'\x0d', L'\x0e', L'\x0f',
|
||||
- L'\x10', L'\x11', L'\x12', L'\x13', L'\x14', L'\x15', L'\x16', L'\x17',
|
||||
- L'\x18', L'\x19', L'\x1a', L'\x1b', L'\x1c', L'\x1d', L'\x1e', L'\x1f',
|
||||
- L'\x20', L'\x21', L'\x22', L'\x23', L'\x24', L'\x25', L'\x26', L'\x27',
|
||||
- L'\x28', L'\x29', L'\x2a', L'\x2b', L'\x2c', L'\x2d', L'\x2e', L'\x2f',
|
||||
- L'\x30', L'\x31', L'\x32', L'\x33', L'\x34', L'\x35', L'\x36', L'\x37',
|
||||
- L'\x38', L'\x39', L'\x3a', L'\x3b', L'\x3c', L'\x3d', L'\x3e', L'\x3f',
|
||||
- L'\x40', L'\x41', L'\x42', L'\x43', L'\x44', L'\x45', L'\x46', L'\x47',
|
||||
- L'\x48', L'\x49', L'\x4a', L'\x4b', L'\x4c', L'\x4d', L'\x4e', L'\x4f',
|
||||
- L'\x50', L'\x51', L'\x52', L'\x53', L'\x54', L'\x55', L'\x56', L'\x57',
|
||||
- L'\x58', L'\x59', L'\x5a', L'\x5b', L'\x5c', L'\x5d', L'\x5e', L'\x5f',
|
||||
- L'\x60', L'\x61', L'\x62', L'\x63', L'\x64', L'\x65', L'\x66', L'\x67',
|
||||
- L'\x68', L'\x69', L'\x6a', L'\x6b', L'\x6c', L'\x6d', L'\x6e', L'\x6f',
|
||||
- L'\x70', L'\x71', L'\x72', L'\x73', L'\x74', L'\x75', L'\x76', L'\x77',
|
||||
- L'\x78', L'\x79', L'\x7a', L'\x7b', L'\x7c', L'\x7d', L'\x7e', L'\x7f',
|
||||
- L'\x80', L'\x81', L'\x82', L'\x83', L'\x84', L'\x85', L'\x86', L'\x87',
|
||||
- L'\x88', L'\x89', L'\x8a', L'\x8b', L'\x8c', L'\x8d', L'\x8e', L'\x8f',
|
||||
- L'\x90', L'\x91', L'\x92', L'\x93', L'\x94', L'\x95', L'\x96', L'\x97',
|
||||
- L'\x98', L'\x99', L'\x9a', L'\x9b', L'\x9c', L'\x9d', L'\x9e', L'\x9f',
|
||||
- L'\xa0', L'\xa1', L'\xa2', L'\xa3', L'\xa4', L'\xa5', L'\xa6', L'\xa7',
|
||||
- L'\xa8', L'\xa9', L'\xaa', L'\xab', L'\xac', L'\xad', L'\xae', L'\xaf',
|
||||
- L'\xb0', L'\xb1', L'\xb2', L'\xb3', L'\xb4', L'\xb5', L'\xb6', L'\xb7',
|
||||
- L'\xb8', L'\xb9', L'\xba', L'\xbb', L'\xbc', L'\xbd', L'\xbe', L'\xbf',
|
||||
- L'\xc0', L'\xc1', L'\xc2', L'\xc3', L'\xc4', L'\xc5', L'\xc6', L'\xc7',
|
||||
- L'\xc8', L'\xc9', L'\xca', L'\xcb', L'\xcc', L'\xcd', L'\xce', L'\xcf',
|
||||
- L'\xd0', L'\xd1', L'\xd2', L'\xd3', L'\xd4', L'\xd5', L'\xd6', L'\xd7',
|
||||
- L'\xd8', L'\xd9', L'\xda', L'\xdb', L'\xdc', L'\xdd', L'\xde', L'\xdf',
|
||||
- L'\xe0', L'\xe1', L'\xe2', L'\xe3', L'\xe4', L'\xe5', L'\xe6', L'\xe7',
|
||||
- L'\xe8', L'\xe9', L'\xea', L'\xeb', L'\xec', L'\xed', L'\xee', L'\xef',
|
||||
- L'\xf0', L'\xf1', L'\xf2', L'\xf3', L'\xf4', L'\xf5', L'\xf6', L'\xf7',
|
||||
- L'\xf8', L'\xf9', L'\xfa', L'\xfb', L'\xfc', L'\xfd', L'\xfe', L'\xff'
|
||||
-};
|
||||
+#include "C-collate-seq.c"
|
||||
|
||||
const struct __locale_data _nl_C_LC_COLLATE attribute_hidden =
|
||||
{
|
||||
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
|
||||
index b6406b775d3a81ad..0f314e40c4305dea 100644
|
||||
--- a/locale/programs/ld-collate.c
|
||||
+++ b/locale/programs/ld-collate.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <wchar.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/param.h>
|
||||
+#include <array_length.h>
|
||||
|
||||
#include "localedef.h"
|
||||
#include "charmap.h"
|
||||
@@ -195,6 +196,9 @@ struct name_list
|
||||
/* The real definition of the struct for the LC_COLLATE locale. */
|
||||
struct locale_collate_t
|
||||
{
|
||||
+ /* Does the locale use code points to compare the encoding? */
|
||||
+ bool codepoint_collation;
|
||||
+
|
||||
int col_weight_max;
|
||||
int cur_weight_max;
|
||||
|
||||
@@ -1510,6 +1514,7 @@ collate_startup (struct linereader *ldfile, struct localedef_t *locale,
|
||||
obstack_init (&collate->mempool);
|
||||
|
||||
collate->col_weight_max = -1;
|
||||
+ collate->codepoint_collation = false;
|
||||
}
|
||||
else
|
||||
/* Reuse the copy_locale's data structures. */
|
||||
@@ -1568,6 +1573,10 @@ collate_finish (struct localedef_t *locale, const struct charmap_t *charmap)
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* No data required. */
|
||||
+ if (collate->codepoint_collation)
|
||||
+ return;
|
||||
+
|
||||
/* If this assertion is hit change the type in `element_t'. */
|
||||
assert (nrules <= sizeof (runp->used_in_level) * 8);
|
||||
|
||||
@@ -2092,6 +2101,10 @@ add_to_tablewc (uint32_t ch, struct element_t *runp)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Include the C locale identity tables for _NL_COLLATE_COLLSEQMB and
|
||||
+ _NL_COLLATE_COLLSEQWC. */
|
||||
+#include "C-collate-seq.c"
|
||||
+
|
||||
void
|
||||
collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
const char *output_path)
|
||||
@@ -2115,7 +2128,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
add_locale_uint32 (&file, nrules);
|
||||
|
||||
/* If we have no LC_COLLATE data emit only the number of rules as zero. */
|
||||
- if (collate == NULL)
|
||||
+ if (collate == NULL || collate->codepoint_collation)
|
||||
{
|
||||
size_t idx;
|
||||
for (idx = 1; idx < nelems; idx++)
|
||||
@@ -2123,6 +2136,17 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
||||
/* The words have to be handled specially. */
|
||||
if (idx == _NL_ITEM_INDEX (_NL_COLLATE_SYMB_HASH_SIZEMB))
|
||||
add_locale_uint32 (&file, 0);
|
||||
+ else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_CODESET)
|
||||
+ && collate != NULL)
|
||||
+ /* A valid LC_COLLATE must have a code set name. */
|
||||
+ add_locale_string (&file, charmap->code_set_name);
|
||||
+ else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_COLLSEQMB)
|
||||
+ && collate != NULL)
|
||||
+ add_locale_raw_data (&file, collseqmb, sizeof (collseqmb));
|
||||
+ else if (idx == _NL_ITEM_INDEX (_NL_COLLATE_COLLSEQWC)
|
||||
+ && collate != NULL)
|
||||
+ add_locale_uint32_array (&file, collseqwc,
|
||||
+ array_length (collseqwc));
|
||||
else
|
||||
add_locale_empty (&file);
|
||||
}
|
||||
@@ -2672,6 +2696,10 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
|
||||
|
||||
switch (nowtok)
|
||||
{
|
||||
+ case tok_codepoint_collation:
|
||||
+ collate->codepoint_collation = true;
|
||||
+ break;
|
||||
+
|
||||
case tok_copy:
|
||||
/* Allow copying other locales. */
|
||||
now = lr_token (ldfile, charmap, result, NULL, verbose);
|
||||
@@ -3742,9 +3770,11 @@ error while adding equivalent collating symbol"));
|
||||
/* Next we assume `LC_COLLATE'. */
|
||||
if (!ignore_content)
|
||||
{
|
||||
- if (state == 0 && copy_locale == NULL)
|
||||
+ if (state == 0
|
||||
+ && copy_locale == NULL
|
||||
+ && !collate->codepoint_collation)
|
||||
/* We must either see a copy statement or have
|
||||
- ordering values. */
|
||||
+ ordering values, or codepoint_collation. */
|
||||
lr_error (ldfile,
|
||||
_("%s: empty category description not allowed"),
|
||||
"LC_COLLATE");
|
||||
diff --git a/locale/programs/locfile-kw.gperf b/locale/programs/locfile-kw.gperf
|
||||
index bcded15ddb4c44bb..2e59eb9ac014134b 100644
|
||||
--- a/locale/programs/locfile-kw.gperf
|
||||
+++ b/locale/programs/locfile-kw.gperf
|
||||
@@ -54,6 +54,7 @@ translit_end, tok_translit_end, 0
|
||||
translit_ignore, tok_translit_ignore, 0
|
||||
default_missing, tok_default_missing, 0
|
||||
LC_COLLATE, tok_lc_collate, 0
|
||||
+codepoint_collation, tok_codepoint_collation, 0
|
||||
coll_weight_max, tok_coll_weight_max, 0
|
||||
section-symbol, tok_section_symbol, 0
|
||||
collating-element, tok_collating_element, 0
|
||||
diff --git a/locale/programs/locfile-kw.h b/locale/programs/locfile-kw.h
|
||||
index bc1cb8f0845852ad..fe6335692bd422cd 100644
|
||||
--- a/locale/programs/locfile-kw.h
|
||||
+++ b/locale/programs/locfile-kw.h
|
||||
@@ -54,7 +54,7 @@
|
||||
#line 24 "locfile-kw.gperf"
|
||||
struct keyword_t ;
|
||||
|
||||
-#define TOTAL_KEYWORDS 178
|
||||
+#define TOTAL_KEYWORDS 179
|
||||
#define MIN_WORD_LENGTH 3
|
||||
#define MAX_WORD_LENGTH 22
|
||||
#define MIN_HASH_VALUE 3
|
||||
@@ -134,92 +134,92 @@ locfile_hash (register const char *str, register size_t len)
|
||||
#line 31 "locfile-kw.gperf"
|
||||
{"END", tok_end, 0},
|
||||
{""}, {""},
|
||||
-#line 70 "locfile-kw.gperf"
|
||||
+#line 71 "locfile-kw.gperf"
|
||||
{"IGNORE", tok_ignore, 0},
|
||||
-#line 129 "locfile-kw.gperf"
|
||||
+#line 130 "locfile-kw.gperf"
|
||||
{"LC_TIME", tok_lc_time, 0},
|
||||
#line 30 "locfile-kw.gperf"
|
||||
{"LC_CTYPE", tok_lc_ctype, 0},
|
||||
{""},
|
||||
-#line 168 "locfile-kw.gperf"
|
||||
+#line 169 "locfile-kw.gperf"
|
||||
{"LC_ADDRESS", tok_lc_address, 0},
|
||||
-#line 153 "locfile-kw.gperf"
|
||||
+#line 154 "locfile-kw.gperf"
|
||||
{"LC_MESSAGES", tok_lc_messages, 0},
|
||||
-#line 161 "locfile-kw.gperf"
|
||||
+#line 162 "locfile-kw.gperf"
|
||||
{"LC_NAME", tok_lc_name, 0},
|
||||
-#line 158 "locfile-kw.gperf"
|
||||
+#line 159 "locfile-kw.gperf"
|
||||
{"LC_PAPER", tok_lc_paper, 0},
|
||||
-#line 186 "locfile-kw.gperf"
|
||||
+#line 187 "locfile-kw.gperf"
|
||||
{"LC_MEASUREMENT", tok_lc_measurement, 0},
|
||||
#line 56 "locfile-kw.gperf"
|
||||
{"LC_COLLATE", tok_lc_collate, 0},
|
||||
{""},
|
||||
-#line 188 "locfile-kw.gperf"
|
||||
+#line 189 "locfile-kw.gperf"
|
||||
{"LC_IDENTIFICATION", tok_lc_identification, 0},
|
||||
-#line 201 "locfile-kw.gperf"
|
||||
+#line 202 "locfile-kw.gperf"
|
||||
{"revision", tok_revision, 0},
|
||||
-#line 69 "locfile-kw.gperf"
|
||||
+#line 70 "locfile-kw.gperf"
|
||||
{"UNDEFINED", tok_undefined, 0},
|
||||
-#line 125 "locfile-kw.gperf"
|
||||
+#line 126 "locfile-kw.gperf"
|
||||
{"LC_NUMERIC", tok_lc_numeric, 0},
|
||||
-#line 82 "locfile-kw.gperf"
|
||||
+#line 83 "locfile-kw.gperf"
|
||||
{"LC_MONETARY", tok_lc_monetary, 0},
|
||||
-#line 181 "locfile-kw.gperf"
|
||||
+#line 182 "locfile-kw.gperf"
|
||||
{"LC_TELEPHONE", tok_lc_telephone, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 75 "locfile-kw.gperf"
|
||||
+#line 76 "locfile-kw.gperf"
|
||||
{"define", tok_define, 0},
|
||||
-#line 154 "locfile-kw.gperf"
|
||||
+#line 155 "locfile-kw.gperf"
|
||||
{"yesexpr", tok_yesexpr, 0},
|
||||
-#line 141 "locfile-kw.gperf"
|
||||
+#line 142 "locfile-kw.gperf"
|
||||
{"era_year", tok_era_year, 0},
|
||||
{""},
|
||||
#line 54 "locfile-kw.gperf"
|
||||
{"translit_ignore", tok_translit_ignore, 0},
|
||||
-#line 156 "locfile-kw.gperf"
|
||||
+#line 157 "locfile-kw.gperf"
|
||||
{"yesstr", tok_yesstr, 0},
|
||||
{""},
|
||||
-#line 89 "locfile-kw.gperf"
|
||||
+#line 90 "locfile-kw.gperf"
|
||||
{"negative_sign", tok_negative_sign, 0},
|
||||
{""},
|
||||
-#line 137 "locfile-kw.gperf"
|
||||
+#line 138 "locfile-kw.gperf"
|
||||
{"t_fmt", tok_t_fmt, 0},
|
||||
-#line 159 "locfile-kw.gperf"
|
||||
+#line 160 "locfile-kw.gperf"
|
||||
{"height", tok_height, 0},
|
||||
{""}, {""},
|
||||
#line 52 "locfile-kw.gperf"
|
||||
{"translit_start", tok_translit_start, 0},
|
||||
-#line 136 "locfile-kw.gperf"
|
||||
+#line 137 "locfile-kw.gperf"
|
||||
{"d_fmt", tok_d_fmt, 0},
|
||||
{""},
|
||||
#line 53 "locfile-kw.gperf"
|
||||
{"translit_end", tok_translit_end, 0},
|
||||
-#line 94 "locfile-kw.gperf"
|
||||
+#line 95 "locfile-kw.gperf"
|
||||
{"n_cs_precedes", tok_n_cs_precedes, 0},
|
||||
-#line 144 "locfile-kw.gperf"
|
||||
+#line 145 "locfile-kw.gperf"
|
||||
{"era_t_fmt", tok_era_t_fmt, 0},
|
||||
#line 39 "locfile-kw.gperf"
|
||||
{"space", tok_space, 0},
|
||||
-#line 72 "locfile-kw.gperf"
|
||||
- {"reorder-end", tok_reorder_end, 0},
|
||||
#line 73 "locfile-kw.gperf"
|
||||
+ {"reorder-end", tok_reorder_end, 0},
|
||||
+#line 74 "locfile-kw.gperf"
|
||||
{"reorder-sections-after", tok_reorder_sections_after, 0},
|
||||
{""},
|
||||
-#line 142 "locfile-kw.gperf"
|
||||
+#line 143 "locfile-kw.gperf"
|
||||
{"era_d_fmt", tok_era_d_fmt, 0},
|
||||
-#line 189 "locfile-kw.gperf"
|
||||
+#line 190 "locfile-kw.gperf"
|
||||
{"title", tok_title, 0},
|
||||
{""}, {""},
|
||||
-#line 149 "locfile-kw.gperf"
|
||||
+#line 150 "locfile-kw.gperf"
|
||||
{"timezone", tok_timezone, 0},
|
||||
{""},
|
||||
-#line 74 "locfile-kw.gperf"
|
||||
+#line 75 "locfile-kw.gperf"
|
||||
{"reorder-sections-end", tok_reorder_sections_end, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 95 "locfile-kw.gperf"
|
||||
+#line 96 "locfile-kw.gperf"
|
||||
{"n_sep_by_space", tok_n_sep_by_space, 0},
|
||||
{""}, {""},
|
||||
-#line 100 "locfile-kw.gperf"
|
||||
+#line 101 "locfile-kw.gperf"
|
||||
{"int_n_cs_precedes", tok_int_n_cs_precedes, 0},
|
||||
{""}, {""}, {""},
|
||||
#line 26 "locfile-kw.gperf"
|
||||
@@ -233,147 +233,147 @@ locfile_hash (register const char *str, register size_t len)
|
||||
{"print", tok_print, 0},
|
||||
#line 44 "locfile-kw.gperf"
|
||||
{"xdigit", tok_xdigit, 0},
|
||||
-#line 110 "locfile-kw.gperf"
|
||||
+#line 111 "locfile-kw.gperf"
|
||||
{"duo_n_cs_precedes", tok_duo_n_cs_precedes, 0},
|
||||
-#line 127 "locfile-kw.gperf"
|
||||
+#line 128 "locfile-kw.gperf"
|
||||
{"thousands_sep", tok_thousands_sep, 0},
|
||||
-#line 197 "locfile-kw.gperf"
|
||||
+#line 198 "locfile-kw.gperf"
|
||||
{"territory", tok_territory, 0},
|
||||
#line 36 "locfile-kw.gperf"
|
||||
{"digit", tok_digit, 0},
|
||||
{""}, {""},
|
||||
-#line 92 "locfile-kw.gperf"
|
||||
+#line 93 "locfile-kw.gperf"
|
||||
{"p_cs_precedes", tok_p_cs_precedes, 0},
|
||||
{""}, {""},
|
||||
-#line 62 "locfile-kw.gperf"
|
||||
+#line 63 "locfile-kw.gperf"
|
||||
{"script", tok_script, 0},
|
||||
#line 29 "locfile-kw.gperf"
|
||||
{"include", tok_include, 0},
|
||||
{""},
|
||||
-#line 78 "locfile-kw.gperf"
|
||||
+#line 79 "locfile-kw.gperf"
|
||||
{"else", tok_else, 0},
|
||||
-#line 184 "locfile-kw.gperf"
|
||||
+#line 185 "locfile-kw.gperf"
|
||||
{"int_select", tok_int_select, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 132 "locfile-kw.gperf"
|
||||
+#line 133 "locfile-kw.gperf"
|
||||
{"week", tok_week, 0},
|
||||
#line 33 "locfile-kw.gperf"
|
||||
{"upper", tok_upper, 0},
|
||||
{""}, {""},
|
||||
-#line 194 "locfile-kw.gperf"
|
||||
+#line 195 "locfile-kw.gperf"
|
||||
{"tel", tok_tel, 0},
|
||||
-#line 93 "locfile-kw.gperf"
|
||||
+#line 94 "locfile-kw.gperf"
|
||||
{"p_sep_by_space", tok_p_sep_by_space, 0},
|
||||
-#line 160 "locfile-kw.gperf"
|
||||
+#line 161 "locfile-kw.gperf"
|
||||
{"width", tok_width, 0},
|
||||
{""},
|
||||
-#line 98 "locfile-kw.gperf"
|
||||
+#line 99 "locfile-kw.gperf"
|
||||
{"int_p_cs_precedes", tok_int_p_cs_precedes, 0},
|
||||
{""}, {""},
|
||||
#line 41 "locfile-kw.gperf"
|
||||
{"punct", tok_punct, 0},
|
||||
{""}, {""},
|
||||
-#line 101 "locfile-kw.gperf"
|
||||
+#line 102 "locfile-kw.gperf"
|
||||
{"int_n_sep_by_space", tok_int_n_sep_by_space, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 108 "locfile-kw.gperf"
|
||||
+#line 109 "locfile-kw.gperf"
|
||||
{"duo_p_cs_precedes", tok_duo_p_cs_precedes, 0},
|
||||
#line 48 "locfile-kw.gperf"
|
||||
{"charconv", tok_charconv, 0},
|
||||
{""},
|
||||
#line 47 "locfile-kw.gperf"
|
||||
{"class", tok_class, 0},
|
||||
-#line 114 "locfile-kw.gperf"
|
||||
- {"duo_int_n_cs_precedes", tok_duo_int_n_cs_precedes, 0},
|
||||
#line 115 "locfile-kw.gperf"
|
||||
+ {"duo_int_n_cs_precedes", tok_duo_int_n_cs_precedes, 0},
|
||||
+#line 116 "locfile-kw.gperf"
|
||||
{"duo_int_n_sep_by_space", tok_duo_int_n_sep_by_space, 0},
|
||||
-#line 111 "locfile-kw.gperf"
|
||||
+#line 112 "locfile-kw.gperf"
|
||||
{"duo_n_sep_by_space", tok_duo_n_sep_by_space, 0},
|
||||
-#line 119 "locfile-kw.gperf"
|
||||
+#line 120 "locfile-kw.gperf"
|
||||
{"duo_int_n_sign_posn", tok_duo_int_n_sign_posn, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 58 "locfile-kw.gperf"
|
||||
+#line 59 "locfile-kw.gperf"
|
||||
{"section-symbol", tok_section_symbol, 0},
|
||||
-#line 185 "locfile-kw.gperf"
|
||||
+#line 186 "locfile-kw.gperf"
|
||||
{"int_prefix", tok_int_prefix, 0},
|
||||
{""}, {""}, {""}, {""},
|
||||
#line 42 "locfile-kw.gperf"
|
||||
{"graph", tok_graph, 0},
|
||||
{""}, {""},
|
||||
-#line 99 "locfile-kw.gperf"
|
||||
+#line 100 "locfile-kw.gperf"
|
||||
{"int_p_sep_by_space", tok_int_p_sep_by_space, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 112 "locfile-kw.gperf"
|
||||
- {"duo_int_p_cs_precedes", tok_duo_int_p_cs_precedes, 0},
|
||||
#line 113 "locfile-kw.gperf"
|
||||
+ {"duo_int_p_cs_precedes", tok_duo_int_p_cs_precedes, 0},
|
||||
+#line 114 "locfile-kw.gperf"
|
||||
{"duo_int_p_sep_by_space", tok_duo_int_p_sep_by_space, 0},
|
||||
-#line 109 "locfile-kw.gperf"
|
||||
+#line 110 "locfile-kw.gperf"
|
||||
{"duo_p_sep_by_space", tok_duo_p_sep_by_space, 0},
|
||||
-#line 118 "locfile-kw.gperf"
|
||||
+#line 119 "locfile-kw.gperf"
|
||||
{"duo_int_p_sign_posn", tok_duo_int_p_sign_posn, 0},
|
||||
-#line 157 "locfile-kw.gperf"
|
||||
+#line 158 "locfile-kw.gperf"
|
||||
{"nostr", tok_nostr, 0},
|
||||
{""}, {""},
|
||||
-#line 140 "locfile-kw.gperf"
|
||||
+#line 141 "locfile-kw.gperf"
|
||||
{"era", tok_era, 0},
|
||||
{""},
|
||||
-#line 84 "locfile-kw.gperf"
|
||||
+#line 85 "locfile-kw.gperf"
|
||||
{"currency_symbol", tok_currency_symbol, 0},
|
||||
{""},
|
||||
-#line 167 "locfile-kw.gperf"
|
||||
+#line 168 "locfile-kw.gperf"
|
||||
{"name_ms", tok_name_ms, 0},
|
||||
-#line 165 "locfile-kw.gperf"
|
||||
- {"name_mrs", tok_name_mrs, 0},
|
||||
#line 166 "locfile-kw.gperf"
|
||||
+ {"name_mrs", tok_name_mrs, 0},
|
||||
+#line 167 "locfile-kw.gperf"
|
||||
{"name_miss", tok_name_miss, 0},
|
||||
-#line 83 "locfile-kw.gperf"
|
||||
+#line 84 "locfile-kw.gperf"
|
||||
{"int_curr_symbol", tok_int_curr_symbol, 0},
|
||||
-#line 190 "locfile-kw.gperf"
|
||||
+#line 191 "locfile-kw.gperf"
|
||||
{"source", tok_source, 0},
|
||||
-#line 164 "locfile-kw.gperf"
|
||||
+#line 165 "locfile-kw.gperf"
|
||||
{"name_mr", tok_name_mr, 0},
|
||||
-#line 163 "locfile-kw.gperf"
|
||||
+#line 164 "locfile-kw.gperf"
|
||||
{"name_gen", tok_name_gen, 0},
|
||||
-#line 202 "locfile-kw.gperf"
|
||||
+#line 203 "locfile-kw.gperf"
|
||||
{"date", tok_date, 0},
|
||||
{""}, {""},
|
||||
-#line 191 "locfile-kw.gperf"
|
||||
+#line 192 "locfile-kw.gperf"
|
||||
{"address", tok_address, 0},
|
||||
-#line 162 "locfile-kw.gperf"
|
||||
+#line 163 "locfile-kw.gperf"
|
||||
{"name_fmt", tok_name_fmt, 0},
|
||||
#line 32 "locfile-kw.gperf"
|
||||
{"copy", tok_copy, 0},
|
||||
-#line 103 "locfile-kw.gperf"
|
||||
+#line 104 "locfile-kw.gperf"
|
||||
{"int_n_sign_posn", tok_int_n_sign_posn, 0},
|
||||
{""}, {""},
|
||||
-#line 131 "locfile-kw.gperf"
|
||||
+#line 132 "locfile-kw.gperf"
|
||||
{"day", tok_day, 0},
|
||||
-#line 105 "locfile-kw.gperf"
|
||||
+#line 106 "locfile-kw.gperf"
|
||||
{"duo_currency_symbol", tok_duo_currency_symbol, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 150 "locfile-kw.gperf"
|
||||
+#line 151 "locfile-kw.gperf"
|
||||
{"date_fmt", tok_date_fmt, 0},
|
||||
-#line 64 "locfile-kw.gperf"
|
||||
+#line 65 "locfile-kw.gperf"
|
||||
{"order_end", tok_order_end, 0},
|
||||
-#line 117 "locfile-kw.gperf"
|
||||
+#line 118 "locfile-kw.gperf"
|
||||
{"duo_n_sign_posn", tok_duo_n_sign_posn, 0},
|
||||
{""},
|
||||
-#line 170 "locfile-kw.gperf"
|
||||
+#line 171 "locfile-kw.gperf"
|
||||
{"country_name", tok_country_name, 0},
|
||||
-#line 71 "locfile-kw.gperf"
|
||||
+#line 72 "locfile-kw.gperf"
|
||||
{"reorder-after", tok_reorder_after, 0},
|
||||
{""}, {""},
|
||||
-#line 155 "locfile-kw.gperf"
|
||||
+#line 156 "locfile-kw.gperf"
|
||||
{"noexpr", tok_noexpr, 0},
|
||||
#line 50 "locfile-kw.gperf"
|
||||
{"tolower", tok_tolower, 0},
|
||||
-#line 198 "locfile-kw.gperf"
|
||||
+#line 199 "locfile-kw.gperf"
|
||||
{"audience", tok_audience, 0},
|
||||
{""}, {""}, {""},
|
||||
#line 49 "locfile-kw.gperf"
|
||||
{"toupper", tok_toupper, 0},
|
||||
-#line 68 "locfile-kw.gperf"
|
||||
+#line 69 "locfile-kw.gperf"
|
||||
{"position", tok_position, 0},
|
||||
{""},
|
||||
#line 40 "locfile-kw.gperf"
|
||||
@@ -381,196 +381,197 @@ locfile_hash (register const char *str, register size_t len)
|
||||
{""},
|
||||
#line 27 "locfile-kw.gperf"
|
||||
{"comment_char", tok_comment_char, 0},
|
||||
-#line 88 "locfile-kw.gperf"
|
||||
+#line 89 "locfile-kw.gperf"
|
||||
{"positive_sign", tok_positive_sign, 0},
|
||||
{""}, {""}, {""}, {""},
|
||||
-#line 61 "locfile-kw.gperf"
|
||||
+#line 62 "locfile-kw.gperf"
|
||||
{"symbol-equivalence", tok_symbol_equivalence, 0},
|
||||
{""},
|
||||
-#line 102 "locfile-kw.gperf"
|
||||
+#line 103 "locfile-kw.gperf"
|
||||
{"int_p_sign_posn", tok_int_p_sign_posn, 0},
|
||||
-#line 175 "locfile-kw.gperf"
|
||||
+#line 176 "locfile-kw.gperf"
|
||||
{"country_car", tok_country_car, 0},
|
||||
{""}, {""},
|
||||
-#line 104 "locfile-kw.gperf"
|
||||
+#line 105 "locfile-kw.gperf"
|
||||
{"duo_int_curr_symbol", tok_duo_int_curr_symbol, 0},
|
||||
{""}, {""},
|
||||
-#line 135 "locfile-kw.gperf"
|
||||
+#line 136 "locfile-kw.gperf"
|
||||
{"d_t_fmt", tok_d_t_fmt, 0},
|
||||
{""}, {""},
|
||||
-#line 116 "locfile-kw.gperf"
|
||||
+#line 117 "locfile-kw.gperf"
|
||||
{"duo_p_sign_posn", tok_duo_p_sign_posn, 0},
|
||||
-#line 187 "locfile-kw.gperf"
|
||||
+#line 188 "locfile-kw.gperf"
|
||||
{"measurement", tok_measurement, 0},
|
||||
-#line 176 "locfile-kw.gperf"
|
||||
+#line 177 "locfile-kw.gperf"
|
||||
{"country_isbn", tok_country_isbn, 0},
|
||||
#line 37 "locfile-kw.gperf"
|
||||
{"outdigit", tok_outdigit, 0},
|
||||
{""}, {""},
|
||||
-#line 143 "locfile-kw.gperf"
|
||||
+#line 144 "locfile-kw.gperf"
|
||||
{"era_d_t_fmt", tok_era_d_t_fmt, 0},
|
||||
{""}, {""}, {""},
|
||||
#line 34 "locfile-kw.gperf"
|
||||
{"lower", tok_lower, 0},
|
||||
-#line 183 "locfile-kw.gperf"
|
||||
+#line 184 "locfile-kw.gperf"
|
||||
{"tel_dom_fmt", tok_tel_dom_fmt, 0},
|
||||
-#line 171 "locfile-kw.gperf"
|
||||
+#line 172 "locfile-kw.gperf"
|
||||
{"country_post", tok_country_post, 0},
|
||||
-#line 148 "locfile-kw.gperf"
|
||||
+#line 149 "locfile-kw.gperf"
|
||||
{"cal_direction", tok_cal_direction, 0},
|
||||
- {""},
|
||||
-#line 139 "locfile-kw.gperf"
|
||||
+#line 57 "locfile-kw.gperf"
|
||||
+ {"codepoint_collation", tok_codepoint_collation, 0},
|
||||
+#line 140 "locfile-kw.gperf"
|
||||
{"t_fmt_ampm", tok_t_fmt_ampm, 0},
|
||||
-#line 91 "locfile-kw.gperf"
|
||||
+#line 92 "locfile-kw.gperf"
|
||||
{"frac_digits", tok_frac_digits, 0},
|
||||
{""}, {""},
|
||||
-#line 177 "locfile-kw.gperf"
|
||||
+#line 178 "locfile-kw.gperf"
|
||||
{"lang_name", tok_lang_name, 0},
|
||||
-#line 90 "locfile-kw.gperf"
|
||||
+#line 91 "locfile-kw.gperf"
|
||||
{"int_frac_digits", tok_int_frac_digits, 0},
|
||||
{""},
|
||||
-#line 121 "locfile-kw.gperf"
|
||||
+#line 122 "locfile-kw.gperf"
|
||||
{"uno_valid_to", tok_uno_valid_to, 0},
|
||||
-#line 126 "locfile-kw.gperf"
|
||||
+#line 127 "locfile-kw.gperf"
|
||||
{"decimal_point", tok_decimal_point, 0},
|
||||
{""},
|
||||
-#line 133 "locfile-kw.gperf"
|
||||
+#line 134 "locfile-kw.gperf"
|
||||
{"abmon", tok_abmon, 0},
|
||||
{""}, {""}, {""}, {""},
|
||||
-#line 107 "locfile-kw.gperf"
|
||||
+#line 108 "locfile-kw.gperf"
|
||||
{"duo_frac_digits", tok_duo_frac_digits, 0},
|
||||
-#line 182 "locfile-kw.gperf"
|
||||
+#line 183 "locfile-kw.gperf"
|
||||
{"tel_int_fmt", tok_tel_int_fmt, 0},
|
||||
-#line 123 "locfile-kw.gperf"
|
||||
+#line 124 "locfile-kw.gperf"
|
||||
{"duo_valid_to", tok_duo_valid_to, 0},
|
||||
-#line 146 "locfile-kw.gperf"
|
||||
+#line 147 "locfile-kw.gperf"
|
||||
{"first_weekday", tok_first_weekday, 0},
|
||||
{""},
|
||||
-#line 130 "locfile-kw.gperf"
|
||||
+#line 131 "locfile-kw.gperf"
|
||||
{"abday", tok_abday, 0},
|
||||
{""},
|
||||
-#line 200 "locfile-kw.gperf"
|
||||
+#line 201 "locfile-kw.gperf"
|
||||
{"abbreviation", tok_abbreviation, 0},
|
||||
-#line 147 "locfile-kw.gperf"
|
||||
+#line 148 "locfile-kw.gperf"
|
||||
{"first_workday", tok_first_workday, 0},
|
||||
{""}, {""},
|
||||
-#line 97 "locfile-kw.gperf"
|
||||
+#line 98 "locfile-kw.gperf"
|
||||
{"n_sign_posn", tok_n_sign_posn, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 145 "locfile-kw.gperf"
|
||||
+#line 146 "locfile-kw.gperf"
|
||||
{"alt_digits", tok_alt_digits, 0},
|
||||
{""}, {""},
|
||||
-#line 128 "locfile-kw.gperf"
|
||||
+#line 129 "locfile-kw.gperf"
|
||||
{"grouping", tok_grouping, 0},
|
||||
{""},
|
||||
#line 45 "locfile-kw.gperf"
|
||||
{"blank", tok_blank, 0},
|
||||
{""}, {""},
|
||||
-#line 196 "locfile-kw.gperf"
|
||||
+#line 197 "locfile-kw.gperf"
|
||||
{"language", tok_language, 0},
|
||||
-#line 120 "locfile-kw.gperf"
|
||||
+#line 121 "locfile-kw.gperf"
|
||||
{"uno_valid_from", tok_uno_valid_from, 0},
|
||||
{""},
|
||||
-#line 199 "locfile-kw.gperf"
|
||||
+#line 200 "locfile-kw.gperf"
|
||||
{"application", tok_application, 0},
|
||||
{""},
|
||||
-#line 80 "locfile-kw.gperf"
|
||||
+#line 81 "locfile-kw.gperf"
|
||||
{"elifndef", tok_elifndef, 0},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 122 "locfile-kw.gperf"
|
||||
+#line 123 "locfile-kw.gperf"
|
||||
{"duo_valid_from", tok_duo_valid_from, 0},
|
||||
-#line 57 "locfile-kw.gperf"
|
||||
+#line 58 "locfile-kw.gperf"
|
||||
{"coll_weight_max", tok_coll_weight_max, 0},
|
||||
{""},
|
||||
-#line 79 "locfile-kw.gperf"
|
||||
+#line 80 "locfile-kw.gperf"
|
||||
{"elifdef", tok_elifdef, 0},
|
||||
-#line 67 "locfile-kw.gperf"
|
||||
+#line 68 "locfile-kw.gperf"
|
||||
{"backward", tok_backward, 0},
|
||||
-#line 106 "locfile-kw.gperf"
|
||||
+#line 107 "locfile-kw.gperf"
|
||||
{"duo_int_frac_digits", tok_duo_int_frac_digits, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 96 "locfile-kw.gperf"
|
||||
+#line 97 "locfile-kw.gperf"
|
||||
{"p_sign_posn", tok_p_sign_posn, 0},
|
||||
{""},
|
||||
-#line 203 "locfile-kw.gperf"
|
||||
+#line 204 "locfile-kw.gperf"
|
||||
{"category", tok_category, 0},
|
||||
{""}, {""}, {""}, {""},
|
||||
-#line 134 "locfile-kw.gperf"
|
||||
+#line 135 "locfile-kw.gperf"
|
||||
{"mon", tok_mon, 0},
|
||||
{""},
|
||||
-#line 124 "locfile-kw.gperf"
|
||||
+#line 125 "locfile-kw.gperf"
|
||||
{"conversion_rate", tok_conversion_rate, 0},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 63 "locfile-kw.gperf"
|
||||
+#line 64 "locfile-kw.gperf"
|
||||
{"order_start", tok_order_start, 0},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 178 "locfile-kw.gperf"
|
||||
+#line 179 "locfile-kw.gperf"
|
||||
{"lang_ab", tok_lang_ab, 0},
|
||||
-#line 180 "locfile-kw.gperf"
|
||||
+#line 181 "locfile-kw.gperf"
|
||||
{"lang_lib", tok_lang_lib, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 192 "locfile-kw.gperf"
|
||||
+#line 193 "locfile-kw.gperf"
|
||||
{"contact", tok_contact, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 173 "locfile-kw.gperf"
|
||||
+#line 174 "locfile-kw.gperf"
|
||||
{"country_ab3", tok_country_ab3, 0},
|
||||
{""}, {""}, {""},
|
||||
-#line 193 "locfile-kw.gperf"
|
||||
+#line 194 "locfile-kw.gperf"
|
||||
{"email", tok_email, 0},
|
||||
-#line 172 "locfile-kw.gperf"
|
||||
+#line 173 "locfile-kw.gperf"
|
||||
{"country_ab2", tok_country_ab2, 0},
|
||||
{""}, {""}, {""},
|
||||
#line 55 "locfile-kw.gperf"
|
||||
{"default_missing", tok_default_missing, 0},
|
||||
{""}, {""},
|
||||
-#line 195 "locfile-kw.gperf"
|
||||
+#line 196 "locfile-kw.gperf"
|
||||
{"fax", tok_fax, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 174 "locfile-kw.gperf"
|
||||
+#line 175 "locfile-kw.gperf"
|
||||
{"country_num", tok_country_num, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""},
|
||||
#line 51 "locfile-kw.gperf"
|
||||
{"map", tok_map, 0},
|
||||
-#line 65 "locfile-kw.gperf"
|
||||
+#line 66 "locfile-kw.gperf"
|
||||
{"from", tok_from, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 86 "locfile-kw.gperf"
|
||||
+#line 87 "locfile-kw.gperf"
|
||||
{"mon_thousands_sep", tok_mon_thousands_sep, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""},
|
||||
-#line 81 "locfile-kw.gperf"
|
||||
+#line 82 "locfile-kw.gperf"
|
||||
{"endif", tok_endif, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 151 "locfile-kw.gperf"
|
||||
+#line 152 "locfile-kw.gperf"
|
||||
{"alt_mon", tok_alt_mon, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 76 "locfile-kw.gperf"
|
||||
+#line 77 "locfile-kw.gperf"
|
||||
{"undef", tok_undef, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 59 "locfile-kw.gperf"
|
||||
+#line 60 "locfile-kw.gperf"
|
||||
{"collating-element", tok_collating_element, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 152 "locfile-kw.gperf"
|
||||
+#line 153 "locfile-kw.gperf"
|
||||
{"ab_alt_mon", tok_ab_alt_mon, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 66 "locfile-kw.gperf"
|
||||
+#line 67 "locfile-kw.gperf"
|
||||
{"forward", tok_forward, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 85 "locfile-kw.gperf"
|
||||
+#line 86 "locfile-kw.gperf"
|
||||
{"mon_decimal_point", tok_mon_decimal_point, 0},
|
||||
{""}, {""},
|
||||
-#line 169 "locfile-kw.gperf"
|
||||
+#line 170 "locfile-kw.gperf"
|
||||
{"postal_fmt", tok_postal_fmt, 0},
|
||||
{""}, {""}, {""}, {""}, {""},
|
||||
-#line 60 "locfile-kw.gperf"
|
||||
+#line 61 "locfile-kw.gperf"
|
||||
{"collating-symbol", tok_collating_symbol, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
@@ -583,15 +584,15 @@ locfile_hash (register const char *str, register size_t len)
|
||||
#line 38 "locfile-kw.gperf"
|
||||
{"alnum", tok_alnum, 0},
|
||||
{""},
|
||||
-#line 87 "locfile-kw.gperf"
|
||||
+#line 88 "locfile-kw.gperf"
|
||||
{"mon_grouping", tok_mon_grouping, 0},
|
||||
{""},
|
||||
-#line 179 "locfile-kw.gperf"
|
||||
+#line 180 "locfile-kw.gperf"
|
||||
{"lang_term", tok_lang_term, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
-#line 77 "locfile-kw.gperf"
|
||||
+#line 78 "locfile-kw.gperf"
|
||||
{"ifdef", tok_ifdef, 0},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
@@ -599,7 +600,7 @@ locfile_hash (register const char *str, register size_t len)
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
|
||||
{""}, {""}, {""}, {""},
|
||||
-#line 138 "locfile-kw.gperf"
|
||||
+#line 139 "locfile-kw.gperf"
|
||||
{"am_pm", tok_am_pm, 0}
|
||||
};
|
||||
|
||||
diff --git a/locale/programs/locfile-token.h b/locale/programs/locfile-token.h
|
||||
index 414ad3076223e971..f57d594e8d25c06f 100644
|
||||
--- a/locale/programs/locfile-token.h
|
||||
+++ b/locale/programs/locfile-token.h
|
||||
@@ -91,6 +91,7 @@ enum token_t
|
||||
tok_translit_ignore,
|
||||
tok_default_missing,
|
||||
tok_lc_collate,
|
||||
+ tok_codepoint_collation,
|
||||
tok_coll_weight_max,
|
||||
tok_section_symbol,
|
||||
tok_collating_element,
|
1437
SOURCES/glibc-c-utf8-locale-2.patch
Normal file
1437
SOURCES/glibc-c-utf8-locale-2.patch
Normal file
File diff suppressed because it is too large
Load Diff
15
SOURCES/glibc-cs-path.patch
Normal file
15
SOURCES/glibc-cs-path.patch
Normal file
@ -0,0 +1,15 @@
|
||||
Short description: Adjust CS_PATH return value.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
In Fedora we should return only /usr/bin because /bin is just a symlink
|
||||
to /usr/bin after MoveToUsr transition (which glibc has not really
|
||||
completed).
|
||||
|
||||
diff -pruN a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h
|
||||
--- a/sysdeps/unix/confstr.h 2012-12-25 08:32:13.000000000 +0530
|
||||
+++ b/sysdeps/unix/confstr.h 2014-09-05 20:02:55.698275219 +0530
|
||||
@@ -1 +1 @@
|
||||
-#define CS_PATH "/bin:/usr/bin"
|
||||
+#define CS_PATH "/usr/bin"
|
20
SOURCES/glibc-deprecated-selinux-makedb.patch
Normal file
20
SOURCES/glibc-deprecated-selinux-makedb.patch
Normal file
@ -0,0 +1,20 @@
|
||||
This is necessary to get things building again after libselinux changes.
|
||||
A proper fix is under discussion upstream:
|
||||
|
||||
<https://sourceware.org/pipermail/libc-alpha/2020-July/116504.html>
|
||||
|
||||
diff --git a/nss/makedb.c b/nss/makedb.c
|
||||
index 8e389a1683747cf1..9d81aed57d384a22 100644
|
||||
--- a/nss/makedb.c
|
||||
+++ b/nss/makedb.c
|
||||
@@ -17,6 +17,10 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+/* This file uses deprecated declarations from libselinux. */
|
||||
+#include <libc-diag.h>
|
||||
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
|
||||
+
|
||||
#include <argp.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
17
SOURCES/glibc-deprecated-selinux-nscd.patch
Normal file
17
SOURCES/glibc-deprecated-selinux-nscd.patch
Normal file
@ -0,0 +1,17 @@
|
||||
This patch works around deprecated libselinux features used by nscd.
|
||||
|
||||
diff --git a/nscd/selinux.c b/nscd/selinux.c
|
||||
index a4ea8008e201b939..0acca4639202a75a 100644
|
||||
--- a/nscd/selinux.c
|
||||
+++ b/nscd/selinux.c
|
||||
@@ -17,6 +17,10 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+/* This file uses deprecated declarations from libselinux. */
|
||||
+#include <libc-diag.h>
|
||||
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
|
||||
+
|
||||
#include "config.h"
|
||||
#include <error.h>
|
||||
#include <errno.h>
|
61
SOURCES/glibc-fedora-linux-tcsetattr.patch
Normal file
61
SOURCES/glibc-fedora-linux-tcsetattr.patch
Normal file
@ -0,0 +1,61 @@
|
||||
Short description: Fedora-specific workaround for kernel pty bug.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-submitted
|
||||
|
||||
This is a Fedora-specific workaround for a kernel bug where calling
|
||||
ioctl on a pty will silently ignore the invalid c_cflag. The
|
||||
workaround is to use TCGETS to verify the setting matches. This is
|
||||
not upstream and needs to either be removed or submitted upstream
|
||||
after analysis.
|
||||
|
||||
Index: b/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
===================================================================
|
||||
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
|
||||
@@ -45,6 +45,7 @@ __tcsetattr (int fd, int optional_action
|
||||
{
|
||||
struct __kernel_termios k_termios;
|
||||
unsigned long int cmd;
|
||||
+ int retval;
|
||||
|
||||
switch (optional_actions)
|
||||
{
|
||||
@@ -75,7 +76,36 @@ __tcsetattr (int fd, int optional_action
|
||||
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
|
||||
__KERNEL_NCCS * sizeof (cc_t));
|
||||
|
||||
- return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
||||
+ retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios);
|
||||
+
|
||||
+ if (retval == 0 && cmd == TCSETS)
|
||||
+ {
|
||||
+ /* The Linux kernel has a bug which silently ignore the invalid
|
||||
+ c_cflag on pty. We have to check it here. */
|
||||
+ int save = errno;
|
||||
+ retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios);
|
||||
+ if (retval)
|
||||
+ {
|
||||
+ /* We cannot verify if the setting is ok. We don't return
|
||||
+ an error (?). */
|
||||
+ __set_errno (save);
|
||||
+ retval = 0;
|
||||
+ }
|
||||
+ else if ((termios_p->c_cflag & (PARENB | CREAD))
|
||||
+ != (k_termios.c_cflag & (PARENB | CREAD))
|
||||
+ || ((termios_p->c_cflag & CSIZE)
|
||||
+ && ((termios_p->c_cflag & CSIZE)
|
||||
+ != (k_termios.c_cflag & CSIZE))))
|
||||
+ {
|
||||
+ /* It looks like the Linux kernel silently changed the
|
||||
+ PARENB/CREAD/CSIZE bits in c_cflag. Report it as an
|
||||
+ error. */
|
||||
+ __set_errno (EINVAL);
|
||||
+ retval = -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
}
|
||||
weak_alias (__tcsetattr, tcsetattr)
|
||||
libc_hidden_def (tcsetattr)
|
49
SOURCES/glibc-fedora-localedata-rh61908.patch
Normal file
49
SOURCES/glibc-fedora-localedata-rh61908.patch
Normal file
@ -0,0 +1,49 @@
|
||||
Short description: Add 4 ISO-8859-15 locales to SUPPORTED for Euro symbol.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Bug-RHEL: #61908
|
||||
Upstream status: not-needed
|
||||
|
||||
Very early RHL 7.3 requirement to add these locales so users can
|
||||
get access to Euro symbol. We should review this bug and decide if
|
||||
the UTF-8 locales are now serving the same purpose and drop the
|
||||
additional locales.
|
||||
|
||||
* Tue Mar 26 2002 Jakub Jelinek <jakub@redhat.com> 2.2.5-28
|
||||
- add a couple of .ISO-8859-15 locales (#61908)
|
||||
|
||||
diff -Nrup a/localedata/SUPPORTED b/localedata/SUPPORTED
|
||||
--- a/localedata/SUPPORTED 2012-11-25 12:59:31.000000000 -0700
|
||||
+++ b/localedata/SUPPORTED 2012-11-26 12:58:43.298223018 -0700
|
||||
@@ -89,6 +89,7 @@ cy_GB.UTF-8/UTF-8 \
|
||||
cy_GB/ISO-8859-14 \
|
||||
da_DK.UTF-8/UTF-8 \
|
||||
da_DK/ISO-8859-1 \
|
||||
+da_DK.ISO-8859-15/ISO-8859-15 \
|
||||
de_AT.UTF-8/UTF-8 \
|
||||
de_AT/ISO-8859-1 \
|
||||
de_AT@euro/ISO-8859-15 \
|
||||
@@ -121,6 +122,7 @@ en_DK.UTF-8/UTF-8 \
|
||||
en_DK/ISO-8859-1 \
|
||||
en_GB.UTF-8/UTF-8 \
|
||||
en_GB/ISO-8859-1 \
|
||||
+en_GB.ISO-8859-15/ISO-8859-15 \
|
||||
en_HK.UTF-8/UTF-8 \
|
||||
en_HK/ISO-8859-1 \
|
||||
en_IE.UTF-8/UTF-8 \
|
||||
@@ -136,6 +138,7 @@ en_SG.UTF-8/UTF-8 \
|
||||
en_SG/ISO-8859-1 \
|
||||
en_US.UTF-8/UTF-8 \
|
||||
en_US/ISO-8859-1 \
|
||||
+en_US.ISO-8859-15/ISO-8859-15 \
|
||||
en_ZA.UTF-8/UTF-8 \
|
||||
en_ZA/ISO-8859-1 \
|
||||
en_ZM/UTF-8 \
|
||||
@@ -385,6 +388,7 @@ sv_FI/ISO-8859-1 \
|
||||
sv_FI@euro/ISO-8859-15 \
|
||||
sv_SE.UTF-8/UTF-8 \
|
||||
sv_SE/ISO-8859-1 \
|
||||
+sv_SE.ISO-8859-15/ISO-8859-15 \
|
||||
sw_KE/UTF-8 \
|
||||
sw_TZ/UTF-8 \
|
||||
szl_PL/UTF-8 \
|
21
SOURCES/glibc-fedora-localedef.patch
Normal file
21
SOURCES/glibc-fedora-localedef.patch
Normal file
@ -0,0 +1,21 @@
|
||||
Short description: Fedora-specific glibc install locale changes.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
The Fedora glibc build and install does not need the normal install
|
||||
behaviour which updates the locale archive. The Fedora install phase
|
||||
in the spec file of the rpm will handle this manually.
|
||||
|
||||
diff --git a/localedata/Makefile b/localedata/Makefile
|
||||
index 0eea396ad86da956..54caabda33728207 100644
|
||||
--- a/localedata/Makefile
|
||||
+++ b/localedata/Makefile
|
||||
@@ -413,6 +413,7 @@ define build-one-locale
|
||||
echo -n '...'; \
|
||||
input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
|
||||
$(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
|
||||
+ --no-archive \
|
||||
-i locales/$$input -f charmaps/$$charset \
|
||||
$(addprefix --prefix=,$(install_root)) $$locale \
|
||||
&& echo ' done';
|
31
SOURCES/glibc-fedora-manual-dircategory.patch
Normal file
31
SOURCES/glibc-fedora-manual-dircategory.patch
Normal file
@ -0,0 +1,31 @@
|
||||
Short description: Place glibc info into "Libraries" category.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
The category names for libraries is completely random including
|
||||
"Libraries", "GNU Libraries", "GNU libraries", and "Software libraries."
|
||||
In the GNU info manual the "Software libraries" category is given as an
|
||||
example, but really we need to standardize on a category for upstream.
|
||||
I suggest we drop this change after some upstream discussion.
|
||||
|
||||
From 4820b9175535e13df79ce816106016040014916e Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Jelinek <jakub@redhat.com>
|
||||
Date: Fri, 3 Nov 2006 16:31:21 +0000
|
||||
Subject: [PATCH] Change @dircategory.
|
||||
|
||||
---
|
||||
manual/libc.texinfo | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
--- a/manual/libc.texinfo
|
||||
+++ b/manual/libc.texinfo
|
||||
@@ -7,7 +7,7 @@
|
||||
@include macros.texi
|
||||
|
||||
@comment Tell install-info what to do.
|
||||
-@dircategory Software libraries
|
||||
+@dircategory Libraries
|
||||
@direntry
|
||||
* Libc: (libc). C library.
|
||||
@end direntry
|
20
SOURCES/glibc-fedora-nscd.patch
Normal file
20
SOURCES/glibc-fedora-nscd.patch
Normal file
@ -0,0 +1,20 @@
|
||||
Short description: NSCD must use nscd user.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
Fedora-specific configuration adjustment to introduce the nscd user.
|
||||
(Upstream does not assume this user exists.)
|
||||
|
||||
diff -Nrup a/nscd/nscd.conf b/nscd/nscd.conf
|
||||
--- a/nscd/nscd.conf 2012-06-05 07:42:49.000000000 -0600
|
||||
+++ b/nscd/nscd.conf 2012-06-07 12:15:21.818318670 -0600
|
||||
@@ -33,7 +33,7 @@
|
||||
# logfile /var/log/nscd.log
|
||||
# threads 4
|
||||
# max-threads 32
|
||||
-# server-user nobody
|
||||
+ server-user nscd
|
||||
# stat-user somebody
|
||||
debug-level 0
|
||||
# reload-count 5
|
46
SOURCES/glibc-fedora-nsswitch.patch
Normal file
46
SOURCES/glibc-fedora-nsswitch.patch
Normal file
@ -0,0 +1,46 @@
|
||||
The Fedora /etc/nsswitch.conf is based largely on the upstream
|
||||
version with minor downstream distribution modifications for
|
||||
use with SSSD and systemd.
|
||||
|
||||
diff --git a/nss/nsswitch.conf b/nss/nsswitch.conf
|
||||
index 4a6bcb1f7bc0b1f4..980a68e32e6a04b8 100644
|
||||
--- a/nss/nsswitch.conf
|
||||
+++ b/nss/nsswitch.conf
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# /etc/nsswitch.conf
|
||||
#
|
||||
-# An example Name Service Switch config file. This file should be
|
||||
+# Name Service Switch config file. This file should be
|
||||
# sorted with the most-used services at the beginning.
|
||||
#
|
||||
# Valid databases are: aliases, ethers, group, gshadow, hosts,
|
||||
@@ -52,19 +52,21 @@
|
||||
# shadow: db files
|
||||
# group: db files
|
||||
|
||||
-# In alphabetical order. Re-order as required to optimize peformance.
|
||||
+# In order of likelihood of use to accelerate lookup.
|
||||
+passwd: sss files
|
||||
+shadow: files
|
||||
+group: sss files
|
||||
+hosts: files dns myhostname
|
||||
+services: files sss
|
||||
+netgroup: sss
|
||||
+automount: files sss
|
||||
+
|
||||
aliases: files
|
||||
ethers: files
|
||||
-group: files
|
||||
gshadow: files
|
||||
-hosts: files dns
|
||||
# Allow initgroups to default to the setting for group.
|
||||
# initgroups: files
|
||||
-netgroup: files
|
||||
networks: files dns
|
||||
-passwd: files
|
||||
protocols: files
|
||||
publickey: files
|
||||
rpc: files
|
||||
-shadow: files
|
||||
-services: files
|
21
SOURCES/glibc-nscd-sysconfig.patch
Normal file
21
SOURCES/glibc-nscd-sysconfig.patch
Normal file
@ -0,0 +1,21 @@
|
||||
Short description: Provide options to nscd startup.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Upstream status: not-needed
|
||||
|
||||
Fedora-specific nscd startup configuration file.
|
||||
|
||||
diff --git a/nscd/nscd.service b/nscd/nscd.service
|
||||
index b7428a3..19ba185 100644
|
||||
--- a/nscd/nscd.service
|
||||
+++ b/nscd/nscd.service
|
||||
@@ -5,7 +5,8 @@ Description=Name Service Cache Daemon
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
-ExecStart=/usr/sbin/nscd
|
||||
+EnvironmentFile=-/etc/sysconfig/nscd
|
||||
+ExecStart=/usr/sbin/nscd $NSCD_OPTIONS
|
||||
ExecStop=/usr/sbin/nscd --shutdown
|
||||
ExecReload=/usr/sbin/nscd -i passwd
|
||||
ExecReload=/usr/sbin/nscd -i group
|
30
SOURCES/glibc-python3.patch
Normal file
30
SOURCES/glibc-python3.patch
Normal file
@ -0,0 +1,30 @@
|
||||
Use python3 for installed executable python scripts.
|
||||
|
||||
Fedora is a Python3-only distribution:
|
||||
https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
|
||||
|
||||
This fixes build failures where builders may strictly enforce only
|
||||
python3 during a transitional phase.
|
||||
|
||||
Author: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
diff --git a/benchtests/scripts/compare_bench.py b/benchtests/scripts/compare_bench.py
|
||||
index 6fcbd0803808e5ca..d43db393d63433bc 100755
|
||||
--- a/benchtests/scripts/compare_bench.py
|
||||
+++ b/benchtests/scripts/compare_bench.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
# Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
||||
diff --git a/benchtests/scripts/import_bench.py b/benchtests/scripts/import_bench.py
|
||||
index a799b4e1b7dc6f30..3286e267168e83bf 100644
|
||||
--- a/benchtests/scripts/import_bench.py
|
||||
+++ b/benchtests/scripts/import_bench.py
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/usr/bin/python
|
||||
+#!/usr/bin/python3
|
||||
# Copyright (C) 2015-2021 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
#
|
38
SOURCES/glibc-rh1070416.patch
Normal file
38
SOURCES/glibc-rh1070416.patch
Normal file
@ -0,0 +1,38 @@
|
||||
Short description: Add syslog.target dependency.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Bug-Fedora: #1070416
|
||||
Upstream status: not-needed
|
||||
|
||||
Fedora-specific changes to the nscd.service file.
|
||||
See also: glibc-nscd-sysconfig.patch.
|
||||
|
||||
--- a/nscd/nscd.service
|
||||
+++ b/nscd/nscd.service
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[Unit]
|
||||
Description=Name Service Cache Daemon
|
||||
+After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
@@ -17,3 +18,4 @@
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+Also=nscd.socket
|
||||
diff --git a/nscd/nscd.socket b/nscd/nscd.socket
|
||||
new file mode 100644
|
||||
index 0000000..7e512d5
|
||||
--- /dev/null
|
||||
+++ b/nscd/nscd.socket
|
||||
@@ -0,0 +1,8 @@
|
||||
+[Unit]
|
||||
+Description=Name Service Cache Daemon Socket
|
||||
+
|
||||
+[Socket]
|
||||
+ListenDatagram=/var/run/nscd/socket
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=sockets.target
|
37
SOURCES/glibc-rh827510.patch
Normal file
37
SOURCES/glibc-rh827510.patch
Normal file
@ -0,0 +1,37 @@
|
||||
Short description: Fix newlocale error return.
|
||||
Author(s): Fedora glibc team <glibc@lists.fedoraproject.org>
|
||||
Origin: PATCH
|
||||
Bug-RHEL: #832516
|
||||
Bug-Fedora: #827510
|
||||
Bug-Upstream: #14247
|
||||
Upstream status: not-submitted
|
||||
|
||||
This needs to go upstream right away to fix the error case for
|
||||
newlocale not correctly returning an error.
|
||||
|
||||
2012-06-14 Jeff Law <law@redhat.com>
|
||||
|
||||
* locale/loadlocale.c (_nl_load_locale): Delay setting
|
||||
file->decided until we have successfully loaded the file's
|
||||
data.
|
||||
|
||||
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
|
||||
index e3fa187..9fd9216 100644
|
||||
--- a/locale/loadlocale.c
|
||||
+++ b/locale/loadlocale.c
|
||||
@@ -169,7 +169,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);
|
||||
@@ -278,6 +277,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
|
||||
newdata->alloc = alloc;
|
||||
|
||||
file->data = newdata;
|
||||
+ file->decided = 1;
|
||||
}
|
||||
|
||||
void
|
26
SOURCES/glibc-upstream-2.34-1.patch
Normal file
26
SOURCES/glibc-upstream-2.34-1.patch
Normal file
@ -0,0 +1,26 @@
|
||||
commit 0b03996304f86d6dba8f0d4b7048b9bb7186f17d
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Tue Aug 3 21:10:10 2021 +0530
|
||||
|
||||
ldconfig: avoid leak on empty paths in config file
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit b0234d79e7d82475d1666f25326ec045c045b3ed)
|
||||
|
||||
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
|
||||
index 1037e8d0cf8d28b6..b8893637f8aaea8d 100644
|
||||
--- a/elf/ldconfig.c
|
||||
+++ b/elf/ldconfig.c
|
||||
@@ -503,7 +503,11 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
|
||||
entry->path[--i] = '\0';
|
||||
|
||||
if (i == 0)
|
||||
- return;
|
||||
+ {
|
||||
+ free (entry->path);
|
||||
+ free (entry);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
char *path = entry->path;
|
||||
if (opt_chroot != NULL)
|
34
SOURCES/glibc-upstream-2.34-10.patch
Normal file
34
SOURCES/glibc-upstream-2.34-10.patch
Normal file
@ -0,0 +1,34 @@
|
||||
commit f2413f2710d5d5cc884b413b83fcf8198e3717fa
|
||||
Author: H.J. Lu <hjl.tools@gmail.com>
|
||||
Date: Sat Aug 28 06:10:38 2021 -0700
|
||||
|
||||
x86-64: Use testl to check __x86_string_control
|
||||
|
||||
Use testl, instead of andl, to check __x86_string_control to avoid
|
||||
updating __x86_string_control.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 3c8b9879cab6d41787bc5b14c1748f62fd6d0e5f)
|
||||
|
||||
diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
||||
index 9f02624375c07b26..abde8438d41f2320 100644
|
||||
--- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
||||
+++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
|
||||
@@ -325,7 +325,7 @@ L(movsb):
|
||||
/* Avoid slow backward REP MOVSB. */
|
||||
jb L(more_8x_vec_backward)
|
||||
# if AVOID_SHORT_DISTANCE_REP_MOVSB
|
||||
- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
|
||||
+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
|
||||
jz 3f
|
||||
movq %rdi, %rcx
|
||||
subq %rsi, %rcx
|
||||
@@ -333,7 +333,7 @@ L(movsb):
|
||||
# endif
|
||||
1:
|
||||
# if AVOID_SHORT_DISTANCE_REP_MOVSB
|
||||
- andl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
|
||||
+ testl $X86_STRING_CONTROL_AVOID_SHORT_DISTANCE_REP_MOVSB, __x86_string_control(%rip)
|
||||
jz 3f
|
||||
movq %rsi, %rcx
|
||||
subq %rdi, %rcx
|
62
SOURCES/glibc-upstream-2.34-11.patch
Normal file
62
SOURCES/glibc-upstream-2.34-11.patch
Normal file
@ -0,0 +1,62 @@
|
||||
commit 52d0119743180164d1664b6773ac5d873f224608
|
||||
Author: Jiaxun Yang <jiaxun.yang@flygoat.com>
|
||||
Date: Tue Sep 7 13:31:42 2021 +0800
|
||||
|
||||
MIPS: Setup errno for {f,l,}xstat
|
||||
|
||||
{f,l,}xstat stub for MIPS is using INTERNAL_SYSCALL
|
||||
to do xstat syscall for glibc ver, However it leaves
|
||||
errno untouched and thus giving bad errno output.
|
||||
|
||||
Setup errno properly when syscall returns non-zero.
|
||||
|
||||
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
|
||||
(cherry picked from commit 66016ec8aeefd40e016d7040d966484c764b0e9c)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/fxstat.c b/sysdeps/unix/sysv/linux/mips/fxstat.c
|
||||
index 11511d30b38708ce..4a6016ff123e8dd9 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/fxstat.c
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/fxstat.c
|
||||
@@ -35,7 +35,9 @@ __fxstat (int vers, int fd, struct stat *buf)
|
||||
{
|
||||
struct kernel_stat kbuf;
|
||||
int r = INTERNAL_SYSCALL_CALL (fstat, fd, &kbuf);
|
||||
- return r ?: __xstat_conv (vers, &kbuf, buf);
|
||||
+ if (r == 0)
|
||||
+ return __xstat_conv (vers, &kbuf, buf);
|
||||
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/lxstat.c b/sysdeps/unix/sysv/linux/mips/lxstat.c
|
||||
index 871fb6c6c5886665..54f990a250677091 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/lxstat.c
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/lxstat.c
|
||||
@@ -35,7 +35,9 @@ __lxstat (int vers, const char *name, struct stat *buf)
|
||||
{
|
||||
struct kernel_stat kbuf;
|
||||
int r = INTERNAL_SYSCALL_CALL (lstat, name, &kbuf);
|
||||
- return r ?: __xstat_conv (vers, &kbuf, buf);
|
||||
+ if (r == 0)
|
||||
+ return __xstat_conv (vers, &kbuf, buf);
|
||||
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/xstat.c b/sysdeps/unix/sysv/linux/mips/xstat.c
|
||||
index 9d810b6f653b964b..86f4dc31a82ff1bb 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/xstat.c
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/xstat.c
|
||||
@@ -35,7 +35,9 @@ __xstat (int vers, const char *name, struct stat *buf)
|
||||
{
|
||||
struct kernel_stat kbuf;
|
||||
int r = INTERNAL_SYSCALL_CALL (stat, name, &kbuf);
|
||||
- return r ?: __xstat_conv (vers, &kbuf, buf);
|
||||
+ if (r == 0)
|
||||
+ return __xstat_conv (vers, &kbuf, buf);
|
||||
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (-r);
|
||||
}
|
||||
}
|
||||
}
|
117
SOURCES/glibc-upstream-2.34-12.patch
Normal file
117
SOURCES/glibc-upstream-2.34-12.patch
Normal file
@ -0,0 +1,117 @@
|
||||
commit addc9d62d61eea790a35328cbfce53333a07bd3e
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Aug 30 13:43:56 2021 +0200
|
||||
|
||||
support: Add support_wait_for_thread_exit
|
||||
|
||||
(cherry picked from commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60)
|
||||
|
||||
diff --git a/support/Makefile b/support/Makefile
|
||||
index a462781718426d35..ef2b1a980a407f8f 100644
|
||||
--- a/support/Makefile
|
||||
+++ b/support/Makefile
|
||||
@@ -82,9 +82,10 @@ libsupport-routines = \
|
||||
support_test_compare_blob \
|
||||
support_test_compare_failure \
|
||||
support_test_compare_string \
|
||||
- support_write_file_string \
|
||||
support_test_main \
|
||||
support_test_verify_impl \
|
||||
+ support_wait_for_thread_exit \
|
||||
+ support_write_file_string \
|
||||
temp_file \
|
||||
timespec \
|
||||
timespec-time64 \
|
||||
diff --git a/support/support.h b/support/support.h
|
||||
index 834dba909770a992..a5978b939af2fb41 100644
|
||||
--- a/support/support.h
|
||||
+++ b/support/support.h
|
||||
@@ -174,6 +174,10 @@ timer_t support_create_timer (uint64_t sec, long int nsec, bool repeat,
|
||||
/* Disable the timer TIMER. */
|
||||
void support_delete_timer (timer_t timer);
|
||||
|
||||
+/* Wait until all threads except the current thread have exited (as
|
||||
+ far as the kernel is concerned). */
|
||||
+void support_wait_for_thread_exit (void);
|
||||
+
|
||||
struct support_stack
|
||||
{
|
||||
void *stack;
|
||||
diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..658a81381006ea62
|
||||
--- /dev/null
|
||||
+++ b/support/support_wait_for_thread_exit.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Wait until all threads except the current thread has exited.
|
||||
+ Copyright (C) 2021 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 <dirent.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+void
|
||||
+support_wait_for_thread_exit (void)
|
||||
+{
|
||||
+#ifdef __linux__
|
||||
+ DIR *proc_self_task = opendir ("/proc/self/task");
|
||||
+ TEST_VERIFY_EXIT (proc_self_task != NULL);
|
||||
+
|
||||
+ while (true)
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ struct dirent *e = readdir (proc_self_task);
|
||||
+ if (e == NULL && errno != 0)
|
||||
+ FAIL_EXIT1 ("readdir: %m");
|
||||
+ if (e == NULL)
|
||||
+ {
|
||||
+ /* Only the main thread remains. Testing may continue. */
|
||||
+ closedir (proc_self_task);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0)
|
||||
+ continue;
|
||||
+
|
||||
+ int task_tid = atoi (e->d_name);
|
||||
+ if (task_tid <= 0)
|
||||
+ FAIL_EXIT1 ("Invalid /proc/self/task entry: %s", e->d_name);
|
||||
+
|
||||
+ if (task_tid == gettid ())
|
||||
+ /* The current thread. Keep scanning for other
|
||||
+ threads. */
|
||||
+ continue;
|
||||
+
|
||||
+ /* task_tid does not refer to this thread here, i.e., there is
|
||||
+ another running thread. */
|
||||
+
|
||||
+ /* Small timeout to give the thread a chance to exit. */
|
||||
+ usleep (50 * 1000);
|
||||
+
|
||||
+ /* Start scanning the directory from the start. */
|
||||
+ rewinddir (proc_self_task);
|
||||
+ }
|
||||
+#else
|
||||
+ /* Use a large timeout because we cannot verify that the thread has
|
||||
+ exited. */
|
||||
+ usleep (5 * 1000 * 1000);
|
||||
+#endif
|
||||
+}
|
279
SOURCES/glibc-upstream-2.34-13.patch
Normal file
279
SOURCES/glibc-upstream-2.34-13.patch
Normal file
@ -0,0 +1,279 @@
|
||||
commit 3abf3bd4edc86fb28c099cc85203cb46a811e0b8
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Sep 13 11:06:08 2021 +0200
|
||||
|
||||
nptl: pthread_kill, pthread_cancel should not fail after exit (bug 19193)
|
||||
|
||||
This closes one remaining race condition related to bug 12889: if
|
||||
the thread already exited on the kernel side, returning ESRCH
|
||||
is not correct because that error is reserved for the thread IDs
|
||||
(pthread_t values) whose lifetime has ended. In case of a
|
||||
kernel-side exit and a valid thread ID, no signal needs to be sent
|
||||
and cancellation does not have an effect, so just return 0.
|
||||
|
||||
sysdeps/pthread/tst-kill4.c triggers undefined behavior and is
|
||||
removed with this commit.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 8af8456004edbab71f8903a60a3cae442cf6fe69)
|
||||
|
||||
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
|
||||
index cc25ff21f364e8a4..9bac6e3b76a20312 100644
|
||||
--- a/nptl/pthread_cancel.c
|
||||
+++ b/nptl/pthread_cancel.c
|
||||
@@ -62,10 +62,11 @@ __pthread_cancel (pthread_t th)
|
||||
{
|
||||
volatile struct pthread *pd = (volatile struct pthread *) th;
|
||||
|
||||
- /* Make sure the descriptor is valid. */
|
||||
- if (INVALID_TD_P (pd))
|
||||
- /* Not a valid thread handle. */
|
||||
- return ESRCH;
|
||||
+ if (pd->tid == 0)
|
||||
+ /* The thread has already exited on the kernel side. Its outcome
|
||||
+ (regular exit, other cancelation) has already been
|
||||
+ determined. */
|
||||
+ return 0;
|
||||
|
||||
static int init_sigcancel = 0;
|
||||
if (atomic_load_relaxed (&init_sigcancel) == 0)
|
||||
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
|
||||
index f79a2b26fc7f72e5..5d4c86f9205a6fb5 100644
|
||||
--- a/nptl/pthread_kill.c
|
||||
+++ b/nptl/pthread_kill.c
|
||||
@@ -46,7 +46,12 @@ __pthread_kill_internal (pthread_t threadid, int signo)
|
||||
? INTERNAL_SYSCALL_ERRNO (val) : 0);
|
||||
}
|
||||
else
|
||||
- val = ESRCH;
|
||||
+ /* The kernel reports that the thread has exited. POSIX specifies
|
||||
+ the ESRCH error only for the case when the lifetime of a thread
|
||||
+ ID has ended, but calling pthread_kill on such a thread ID is
|
||||
+ undefined in glibc. Therefore, do not treat kernel thread exit
|
||||
+ as an error. */
|
||||
+ val = 0;
|
||||
|
||||
return val;
|
||||
}
|
||||
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||
index 42f9fc507263657d..dedfa0d290da4949 100644
|
||||
--- a/sysdeps/pthread/Makefile
|
||||
+++ b/sysdeps/pthread/Makefile
|
||||
@@ -89,7 +89,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||
tst-join8 tst-join9 tst-join10 tst-join11 tst-join12 tst-join13 \
|
||||
tst-join14 tst-join15 \
|
||||
tst-key1 tst-key2 tst-key3 tst-key4 \
|
||||
- tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
|
||||
+ tst-kill1 tst-kill2 tst-kill3 tst-kill5 tst-kill6 \
|
||||
tst-locale1 tst-locale2 \
|
||||
tst-memstream \
|
||||
tst-mutex-errorcheck tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 \
|
||||
@@ -118,6 +118,9 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||
tst-unload \
|
||||
tst-unwind-thread \
|
||||
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
|
||||
+ tst-pthread_cancel-exited \
|
||||
+ tst-pthread_kill-exited \
|
||||
+ # tests
|
||||
|
||||
tests-time64 := \
|
||||
tst-abstime-time64 \
|
||||
diff --git a/sysdeps/pthread/tst-kill4.c b/sysdeps/pthread/tst-kill4.c
|
||||
deleted file mode 100644
|
||||
index 9563939792b96ebd..0000000000000000
|
||||
--- a/sysdeps/pthread/tst-kill4.c
|
||||
+++ /dev/null
|
||||
@@ -1,90 +0,0 @@
|
||||
-/* Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
- This file is part of the GNU C Library.
|
||||
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
|
||||
-
|
||||
- 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 <errno.h>
|
||||
-#include <pthread.h>
|
||||
-#include <signal.h>
|
||||
-#include <stdio.h>
|
||||
-#include <stdlib.h>
|
||||
-#include <unistd.h>
|
||||
-
|
||||
-
|
||||
-static void *
|
||||
-tf (void *a)
|
||||
-{
|
||||
- return NULL;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-int
|
||||
-do_test (void)
|
||||
-{
|
||||
- pthread_attr_t at;
|
||||
- if (pthread_attr_init (&at) != 0)
|
||||
- {
|
||||
- puts ("attr_create failed");
|
||||
- exit (1);
|
||||
- }
|
||||
-
|
||||
- /* Limit thread stack size, because if it is too large, pthread_join
|
||||
- will free it immediately rather than put it into stack cache. */
|
||||
- if (pthread_attr_setstacksize (&at, 2 * 1024 * 1024) != 0)
|
||||
- {
|
||||
- puts ("setstacksize failed");
|
||||
- exit (1);
|
||||
- }
|
||||
-
|
||||
- pthread_t th;
|
||||
- if (pthread_create (&th, &at, tf, NULL) != 0)
|
||||
- {
|
||||
- puts ("create failed");
|
||||
- exit (1);
|
||||
- }
|
||||
-
|
||||
- pthread_attr_destroy (&at);
|
||||
-
|
||||
- if (pthread_join (th, NULL) != 0)
|
||||
- {
|
||||
- puts ("join failed");
|
||||
- exit (1);
|
||||
- }
|
||||
-
|
||||
- /* The following only works because we assume here something about
|
||||
- the implementation. Namely, that the memory allocated for the
|
||||
- thread descriptor is not going away, that the TID field is
|
||||
- cleared and therefore the signal is sent to process 0, and that
|
||||
- we can savely assume there is no other process with this ID at
|
||||
- that time. */
|
||||
- int e = pthread_kill (th, 0);
|
||||
- if (e == 0)
|
||||
- {
|
||||
- puts ("pthread_kill succeeded");
|
||||
- exit (1);
|
||||
- }
|
||||
- if (e != ESRCH)
|
||||
- {
|
||||
- puts ("pthread_kill didn't return ESRCH");
|
||||
- exit (1);
|
||||
- }
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-#define TEST_FUNCTION do_test ()
|
||||
-#include "../test-skeleton.c"
|
||||
diff --git a/sysdeps/pthread/tst-pthread_cancel-exited.c b/sysdeps/pthread/tst-pthread_cancel-exited.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..811c9bee07ab2638
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread_cancel-exited.c
|
||||
@@ -0,0 +1,45 @@
|
||||
+/* Test that pthread_kill succeeds for an exited thread.
|
||||
+ Copyright (C) 2021 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/>. */
|
||||
+
|
||||
+/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
|
||||
+ a thread that has exited on the kernel side. */
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <support/support.h>
|
||||
+#include <support/xthread.h>
|
||||
+
|
||||
+static void *
|
||||
+noop_thread (void *closure)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ pthread_t thr = xpthread_create (NULL, noop_thread, NULL);
|
||||
+
|
||||
+ support_wait_for_thread_exit ();
|
||||
+
|
||||
+ xpthread_cancel (thr);
|
||||
+ xpthread_join (thr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..7575fb6d58cae99c
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread_kill-exited.c
|
||||
@@ -0,0 +1,46 @@
|
||||
+/* Test that pthread_kill succeeds for an exited thread.
|
||||
+ Copyright (C) 2021 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/>. */
|
||||
+
|
||||
+/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
|
||||
+ a thread that has exited on the kernel side. */
|
||||
+
|
||||
+#include <signal.h>
|
||||
+#include <stddef.h>
|
||||
+#include <support/support.h>
|
||||
+#include <support/xthread.h>
|
||||
+
|
||||
+static void *
|
||||
+noop_thread (void *closure)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ pthread_t thr = xpthread_create (NULL, noop_thread, NULL);
|
||||
+
|
||||
+ support_wait_for_thread_exit ();
|
||||
+
|
||||
+ xpthread_kill (thr, SIGUSR1);
|
||||
+ xpthread_join (thr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
411
SOURCES/glibc-upstream-2.34-14.patch
Normal file
411
SOURCES/glibc-upstream-2.34-14.patch
Normal file
@ -0,0 +1,411 @@
|
||||
commit a8ac8c4725ddb1119764126a8674a04c9dd5aea8
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Sep 13 11:06:08 2021 +0200
|
||||
|
||||
nptl: Fix race between pthread_kill and thread exit (bug 12889)
|
||||
|
||||
A new thread exit lock and flag are introduced. They are used to
|
||||
detect that the thread is about to exit or has exited in
|
||||
__pthread_kill_internal, and the signal is not sent in this case.
|
||||
|
||||
The test sysdeps/pthread/tst-pthread_cancel-select-loop.c is derived
|
||||
from a downstream test originally written by Marek Polacek.
|
||||
|
||||
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
(cherry picked from commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be)
|
||||
|
||||
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
|
||||
index cfe37a3443b69454..50065bc9bd8a28e5 100644
|
||||
--- a/nptl/allocatestack.c
|
||||
+++ b/nptl/allocatestack.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <futex-internal.h>
|
||||
#include <kernel-features.h>
|
||||
#include <nptl-stack.h>
|
||||
+#include <libc-lock.h>
|
||||
|
||||
/* Default alignment of stack. */
|
||||
#ifndef STACK_ALIGN
|
||||
@@ -127,6 +128,8 @@ get_cached_stack (size_t *sizep, void **memp)
|
||||
/* No pending event. */
|
||||
result->nextevent = NULL;
|
||||
|
||||
+ result->exiting = false;
|
||||
+ __libc_lock_init (result->exit_lock);
|
||||
result->tls_state = (struct tls_internal_t) { 0 };
|
||||
|
||||
/* Clear the DTV. */
|
||||
diff --git a/nptl/descr.h b/nptl/descr.h
|
||||
index c85778d44941a42f..4de84138fb960fa4 100644
|
||||
--- a/nptl/descr.h
|
||||
+++ b/nptl/descr.h
|
||||
@@ -396,6 +396,12 @@ struct pthread
|
||||
PTHREAD_CANCEL_ASYNCHRONOUS). */
|
||||
unsigned char canceltype;
|
||||
|
||||
+ /* Used in __pthread_kill_internal to detected a thread that has
|
||||
+ exited or is about to exit. exit_lock must only be acquired
|
||||
+ after blocking signals. */
|
||||
+ bool exiting;
|
||||
+ int exit_lock; /* A low-level lock (for use with __libc_lock_init etc). */
|
||||
+
|
||||
/* Used on strsignal. */
|
||||
struct tls_internal_t tls_state;
|
||||
|
||||
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
||||
index d8ec299cb1661e82..33b426fc682300dc 100644
|
||||
--- a/nptl/pthread_create.c
|
||||
+++ b/nptl/pthread_create.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <sys/single_threaded.h>
|
||||
#include <version.h>
|
||||
#include <clone_internal.h>
|
||||
+#include <futex-internal.h>
|
||||
|
||||
#include <shlib-compat.h>
|
||||
|
||||
@@ -485,6 +486,19 @@ start_thread (void *arg)
|
||||
/* This was the last thread. */
|
||||
exit (0);
|
||||
|
||||
+ /* This prevents sending a signal from this thread to itself during
|
||||
+ its final stages. This must come after the exit call above
|
||||
+ because atexit handlers must not run with signals blocked. */
|
||||
+ __libc_signal_block_all (NULL);
|
||||
+
|
||||
+ /* Tell __pthread_kill_internal that this thread is about to exit.
|
||||
+ If there is a __pthread_kill_internal in progress, this delays
|
||||
+ the thread exit until the signal has been queued by the kernel
|
||||
+ (so that the TID used to send it remains valid). */
|
||||
+ __libc_lock_lock (pd->exit_lock);
|
||||
+ pd->exiting = true;
|
||||
+ __libc_lock_unlock (pd->exit_lock);
|
||||
+
|
||||
#ifndef __ASSUME_SET_ROBUST_LIST
|
||||
/* If this thread has any robust mutexes locked, handle them now. */
|
||||
# if __PTHREAD_MUTEX_HAVE_PREV
|
||||
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
|
||||
index 5d4c86f9205a6fb5..fb7862eff787a94f 100644
|
||||
--- a/nptl/pthread_kill.c
|
||||
+++ b/nptl/pthread_kill.c
|
||||
@@ -16,6 +16,7 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
+#include <libc-lock.h>
|
||||
#include <unistd.h>
|
||||
#include <pthreadP.h>
|
||||
#include <shlib-compat.h>
|
||||
@@ -23,37 +24,51 @@
|
||||
int
|
||||
__pthread_kill_internal (pthread_t threadid, int signo)
|
||||
{
|
||||
- pid_t tid;
|
||||
struct pthread *pd = (struct pthread *) threadid;
|
||||
-
|
||||
if (pd == THREAD_SELF)
|
||||
- /* It is a special case to handle raise() implementation after a vfork
|
||||
- call (which does not update the PD tid field). */
|
||||
- tid = INLINE_SYSCALL_CALL (gettid);
|
||||
- else
|
||||
- /* Force load of pd->tid into local variable or register. Otherwise
|
||||
- if a thread exits between ESRCH test and tgkill, we might return
|
||||
- EINVAL, because pd->tid would be cleared by the kernel. */
|
||||
- tid = atomic_forced_read (pd->tid);
|
||||
-
|
||||
- int val;
|
||||
- if (__glibc_likely (tid > 0))
|
||||
{
|
||||
- pid_t pid = __getpid ();
|
||||
-
|
||||
- val = INTERNAL_SYSCALL_CALL (tgkill, pid, tid, signo);
|
||||
- val = (INTERNAL_SYSCALL_ERROR_P (val)
|
||||
- ? INTERNAL_SYSCALL_ERRNO (val) : 0);
|
||||
+ /* Use the actual TID from the kernel, so that it refers to the
|
||||
+ current thread even if called after vfork. There is no
|
||||
+ signal blocking in this case, so that the signal is delivered
|
||||
+ immediately, before __pthread_kill_internal returns: a signal
|
||||
+ sent to the thread itself needs to be delivered
|
||||
+ synchronously. (It is unclear if Linux guarantees the
|
||||
+ delivery of all pending signals after unblocking in the code
|
||||
+ below. POSIX only guarantees delivery of a single signal,
|
||||
+ which may not be the right one.) */
|
||||
+ pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
|
||||
+ int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
|
||||
+ return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
|
||||
}
|
||||
+
|
||||
+ /* Block all signals, as required by pd->exit_lock. */
|
||||
+ sigset_t old_mask;
|
||||
+ __libc_signal_block_all (&old_mask);
|
||||
+ __libc_lock_lock (pd->exit_lock);
|
||||
+
|
||||
+ int ret;
|
||||
+ if (pd->exiting)
|
||||
+ /* The thread is about to exit (or has exited). Sending the
|
||||
+ signal is either not observable (the target thread has already
|
||||
+ blocked signals at this point), or it will fail, or it might be
|
||||
+ delivered to a new, unrelated thread that has reused the TID.
|
||||
+ So do not actually send the signal. Do not report an error
|
||||
+ because the threadid argument is still valid (the thread ID
|
||||
+ lifetime has not ended), and ESRCH (for example) would be
|
||||
+ misleading. */
|
||||
+ ret = 0;
|
||||
else
|
||||
- /* The kernel reports that the thread has exited. POSIX specifies
|
||||
- the ESRCH error only for the case when the lifetime of a thread
|
||||
- ID has ended, but calling pthread_kill on such a thread ID is
|
||||
- undefined in glibc. Therefore, do not treat kernel thread exit
|
||||
- as an error. */
|
||||
- val = 0;
|
||||
+ {
|
||||
+ /* Using tgkill is a safety measure. pd->exit_lock ensures that
|
||||
+ the target thread cannot exit. */
|
||||
+ ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
|
||||
+ ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
|
||||
+ }
|
||||
+
|
||||
+ __libc_lock_unlock (pd->exit_lock);
|
||||
+ __libc_signal_restore_set (&old_mask);
|
||||
|
||||
- return val;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||
index dedfa0d290da4949..48dba717a1cdc20a 100644
|
||||
--- a/sysdeps/pthread/Makefile
|
||||
+++ b/sysdeps/pthread/Makefile
|
||||
@@ -119,7 +119,9 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||
tst-unwind-thread \
|
||||
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
|
||||
tst-pthread_cancel-exited \
|
||||
+ tst-pthread_cancel-select-loop \
|
||||
tst-pthread_kill-exited \
|
||||
+ tst-pthread_kill-exiting \
|
||||
# tests
|
||||
|
||||
tests-time64 := \
|
||||
diff --git a/sysdeps/pthread/tst-pthread_cancel-select-loop.c b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..a62087589cee24b5
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread_cancel-select-loop.c
|
||||
@@ -0,0 +1,87 @@
|
||||
+/* Test that pthread_cancel succeeds during thread exit.
|
||||
+ Copyright (C) 2021 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/>. */
|
||||
+
|
||||
+/* This test tries to trigger an internal race condition in
|
||||
+ pthread_cancel, where the cancellation signal is sent after the
|
||||
+ thread has begun the cancellation process. This can result in a
|
||||
+ spurious ESRCH error. For the original bug 12889, the window is
|
||||
+ quite small, so the bug was not reproduced in every run. */
|
||||
+
|
||||
+#include <stdbool.h>
|
||||
+#include <stddef.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xthread.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <sys/select.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+/* Set to true by timeout_thread_function when the test should
|
||||
+ terminate. */
|
||||
+static bool timeout;
|
||||
+
|
||||
+static void *
|
||||
+timeout_thread_function (void *unused)
|
||||
+{
|
||||
+ usleep (5 * 1000 * 1000);
|
||||
+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Used for blocking the select function below. */
|
||||
+static int pipe_fds[2];
|
||||
+
|
||||
+static void *
|
||||
+canceled_thread_function (void *unused)
|
||||
+{
|
||||
+ while (true)
|
||||
+ {
|
||||
+ fd_set rfs;
|
||||
+ fd_set wfs;
|
||||
+ fd_set efs;
|
||||
+ FD_ZERO (&rfs);
|
||||
+ FD_ZERO (&wfs);
|
||||
+ FD_ZERO (&efs);
|
||||
+ FD_SET (pipe_fds[0], &rfs);
|
||||
+
|
||||
+ /* If the cancellation request is recognized early, the thread
|
||||
+ begins exiting while the cancellation signal arrives. */
|
||||
+ select (FD_SETSIZE, &rfs, &wfs, &efs, NULL);
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ xpipe (pipe_fds);
|
||||
+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
|
||||
+
|
||||
+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
|
||||
+ {
|
||||
+ pthread_t thr = xpthread_create (NULL, canceled_thread_function, NULL);
|
||||
+ xpthread_cancel (thr);
|
||||
+ TEST_VERIFY (xpthread_join (thr) == PTHREAD_CANCELED);
|
||||
+ }
|
||||
+
|
||||
+ xpthread_join (thr_timeout);
|
||||
+ xclose (pipe_fds[0]);
|
||||
+ xclose (pipe_fds[1]);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/pthread/tst-pthread_kill-exiting.c b/sysdeps/pthread/tst-pthread_kill-exiting.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..f803e94f1195f204
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread_kill-exiting.c
|
||||
@@ -0,0 +1,123 @@
|
||||
+/* Test that pthread_kill succeeds during thread exit.
|
||||
+ Copyright (C) 2021 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/>. */
|
||||
+
|
||||
+/* This test verifies that pthread_kill for a thread that is exiting
|
||||
+ succeeds (with or without actually delivering the signal). */
|
||||
+
|
||||
+#include <array_length.h>
|
||||
+#include <stdbool.h>
|
||||
+#include <stddef.h>
|
||||
+#include <support/xsignal.h>
|
||||
+#include <support/xthread.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+/* Set to true by timeout_thread_function when the test should
|
||||
+ terminate. */
|
||||
+static bool timeout;
|
||||
+
|
||||
+static void *
|
||||
+timeout_thread_function (void *unused)
|
||||
+{
|
||||
+ usleep (1000 * 1000);
|
||||
+ __atomic_store_n (&timeout, true, __ATOMIC_RELAXED);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+/* Used to synchronize the sending threads with the target thread and
|
||||
+ main thread. */
|
||||
+static pthread_barrier_t barrier_1;
|
||||
+static pthread_barrier_t barrier_2;
|
||||
+
|
||||
+/* The target thread to which signals are to be sent. */
|
||||
+static pthread_t target_thread;
|
||||
+
|
||||
+/* Set by the main thread to true after timeout has been set to
|
||||
+ true. */
|
||||
+static bool exiting;
|
||||
+
|
||||
+static void *
|
||||
+sender_thread_function (void *unused)
|
||||
+{
|
||||
+ while (true)
|
||||
+ {
|
||||
+ /* Wait until target_thread has been initialized. The target
|
||||
+ thread and main thread participate in this barrier. */
|
||||
+ xpthread_barrier_wait (&barrier_1);
|
||||
+
|
||||
+ if (exiting)
|
||||
+ break;
|
||||
+
|
||||
+ xpthread_kill (target_thread, SIGUSR1);
|
||||
+
|
||||
+ /* Communicate that the signal has been sent. The main thread
|
||||
+ participates in this barrier. */
|
||||
+ xpthread_barrier_wait (&barrier_2);
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void *
|
||||
+target_thread_function (void *unused)
|
||||
+{
|
||||
+ target_thread = pthread_self ();
|
||||
+ xpthread_barrier_wait (&barrier_1);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ xsignal (SIGUSR1, SIG_IGN);
|
||||
+
|
||||
+ pthread_t thr_timeout = xpthread_create (NULL, timeout_thread_function, NULL);
|
||||
+
|
||||
+ pthread_t threads[4];
|
||||
+ xpthread_barrier_init (&barrier_1, NULL, array_length (threads) + 2);
|
||||
+ xpthread_barrier_init (&barrier_2, NULL, array_length (threads) + 1);
|
||||
+
|
||||
+ for (int i = 0; i < array_length (threads); ++i)
|
||||
+ threads[i] = xpthread_create (NULL, sender_thread_function, NULL);
|
||||
+
|
||||
+ while (!__atomic_load_n (&timeout, __ATOMIC_RELAXED))
|
||||
+ {
|
||||
+ xpthread_create (NULL, target_thread_function, NULL);
|
||||
+
|
||||
+ /* Wait for the target thread to be set up and signal sending to
|
||||
+ start. */
|
||||
+ xpthread_barrier_wait (&barrier_1);
|
||||
+
|
||||
+ /* Wait for signal sending to complete. */
|
||||
+ xpthread_barrier_wait (&barrier_2);
|
||||
+
|
||||
+ xpthread_join (target_thread);
|
||||
+ }
|
||||
+
|
||||
+ exiting = true;
|
||||
+
|
||||
+ /* Signal the sending threads to exit. */
|
||||
+ xpthread_create (NULL, target_thread_function, NULL);
|
||||
+ xpthread_barrier_wait (&barrier_1);
|
||||
+
|
||||
+ for (int i = 0; i < array_length (threads); ++i)
|
||||
+ xpthread_join (threads[i]);
|
||||
+ xpthread_join (thr_timeout);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
117
SOURCES/glibc-upstream-2.34-15.patch
Normal file
117
SOURCES/glibc-upstream-2.34-15.patch
Normal file
@ -0,0 +1,117 @@
|
||||
commit 3fc51f35b4f32e1bb99d85c1578e930e725ff929
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Mon Sep 13 20:48:35 2021 +0530
|
||||
|
||||
iconvconfig: Fix behaviour with --prefix [BZ #28199]
|
||||
|
||||
The consolidation of configuration parsing broke behaviour with
|
||||
--prefix, where the prefix bled into the modules cache. Accept a
|
||||
prefix which, when non-NULL, is prepended to the path when looking for
|
||||
configuration files but only the original directory is added to the
|
||||
modules cache.
|
||||
|
||||
This has no effect on the codegen of gconv_conf since it passes NULL.
|
||||
|
||||
Reported-by: Patrick McCarty <patrick.mccarty@intel.com>
|
||||
Reported-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
|
||||
Reviewed-by: Andreas Schwab <schwab@linux-m68k.org>
|
||||
(cherry picked from commit 43cea6d5652b6b9e61ac6ecc69419c909b504f47)
|
||||
|
||||
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
|
||||
index 62bee28769deb979..cc391d8f936687f3 100644
|
||||
--- a/iconv/gconv_conf.c
|
||||
+++ b/iconv/gconv_conf.c
|
||||
@@ -478,7 +478,7 @@ __gconv_read_conf (void)
|
||||
__gconv_get_path ();
|
||||
|
||||
for (cnt = 0; __gconv_path_elem[cnt].name != NULL; ++cnt)
|
||||
- gconv_parseconfdir (__gconv_path_elem[cnt].name,
|
||||
+ gconv_parseconfdir (NULL, __gconv_path_elem[cnt].name,
|
||||
__gconv_path_elem[cnt].len);
|
||||
#endif
|
||||
|
||||
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
|
||||
index 2f062689ecc72749..a586268abc103abd 100644
|
||||
--- a/iconv/gconv_parseconfdir.h
|
||||
+++ b/iconv/gconv_parseconfdir.h
|
||||
@@ -39,7 +39,6 @@
|
||||
/* Name of the file containing the module information in the directories
|
||||
along the path. */
|
||||
static const char gconv_conf_filename[] = "gconv-modules";
|
||||
-static const char gconv_conf_dirname[] = "gconv-modules.d";
|
||||
|
||||
static void add_alias (char *);
|
||||
static void add_module (char *, const char *, size_t, int);
|
||||
@@ -110,19 +109,28 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len)
|
||||
return true;
|
||||
}
|
||||
|
||||
+/* Prefix DIR (with length DIR_LEN) with PREFIX if the latter is non-NULL and
|
||||
+ parse configuration in it. */
|
||||
+
|
||||
static __always_inline bool
|
||||
-gconv_parseconfdir (const char *dir, size_t dir_len)
|
||||
+gconv_parseconfdir (const char *prefix, const char *dir, size_t dir_len)
|
||||
{
|
||||
- /* No slash needs to be inserted between dir and gconv_conf_filename;
|
||||
- dir already ends in a slash. */
|
||||
- char *buf = malloc (dir_len + sizeof (gconv_conf_dirname));
|
||||
+ /* No slash needs to be inserted between dir and gconv_conf_filename; dir
|
||||
+ already ends in a slash. The additional 2 is to accommodate the ".d"
|
||||
+ when looking for configuration files in gconv-modules.d. */
|
||||
+ size_t buflen = dir_len + sizeof (gconv_conf_filename) + 2;
|
||||
+ char *buf = malloc (buflen + (prefix != NULL ? strlen (prefix) : 0));
|
||||
+ char *cp = buf;
|
||||
bool found = false;
|
||||
|
||||
if (buf == NULL)
|
||||
return false;
|
||||
|
||||
- char *cp = mempcpy (mempcpy (buf, dir, dir_len), gconv_conf_filename,
|
||||
- sizeof (gconv_conf_filename));
|
||||
+ if (prefix != NULL)
|
||||
+ cp = stpcpy (cp, prefix);
|
||||
+
|
||||
+ cp = mempcpy (mempcpy (cp, dir, dir_len), gconv_conf_filename,
|
||||
+ sizeof (gconv_conf_filename));
|
||||
|
||||
/* Read the gconv-modules configuration file first. */
|
||||
found = read_conf_file (buf, dir, dir_len);
|
||||
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
|
||||
index 783b2bbdbb684ac6..273a71f67315f670 100644
|
||||
--- a/iconv/iconvconfig.c
|
||||
+++ b/iconv/iconvconfig.c
|
||||
@@ -653,13 +653,21 @@ add_module (char *rp, const char *directory,
|
||||
static int
|
||||
handle_dir (const char *dir)
|
||||
{
|
||||
+ char *newp = NULL;
|
||||
size_t dirlen = strlen (dir);
|
||||
bool found = false;
|
||||
|
||||
- char *fulldir = xasprintf ("%s%s%s", dir[0] == '/' ? prefix : "",
|
||||
- dir, dir[dirlen - 1] != '/' ? "/" : "");
|
||||
+ /* End directory path with a '/' if it doesn't already. */
|
||||
+ if (dir[dirlen - 1] != '/')
|
||||
+ {
|
||||
+ newp = xmalloc (dirlen + 2);
|
||||
+ memcpy (newp, dir, dirlen);
|
||||
+ newp[dirlen++] = '/';
|
||||
+ newp[dirlen] = '\0';
|
||||
+ dir = newp;
|
||||
+ }
|
||||
|
||||
- found = gconv_parseconfdir (fulldir, strlen (fulldir));
|
||||
+ found = gconv_parseconfdir (dir[0] == '/' ? prefix : NULL, dir, dirlen);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -671,7 +679,7 @@ handle_dir (const char *dir)
|
||||
"configuration files with names ending in .conf.");
|
||||
}
|
||||
|
||||
- free (fulldir);
|
||||
+ free (newp);
|
||||
|
||||
return found ? 0 : 1;
|
||||
}
|
31
SOURCES/glibc-upstream-2.34-16.patch
Normal file
31
SOURCES/glibc-upstream-2.34-16.patch
Normal file
@ -0,0 +1,31 @@
|
||||
commit ae925404a10bf0ea63d6e8d41e3821f68b4d776c
|
||||
Author: Aurelien Jarno <aurelien@aurel32.net>
|
||||
Date: Fri Sep 3 00:28:14 2021 +0200
|
||||
|
||||
Fix failing nss/tst-nss-files-hosts-long with local resolver
|
||||
|
||||
When a local resolver like unbound is listening on the IPv4 loopback
|
||||
address 127.0.0.1, the nss/tst-nss-files-hosts-long test fails. This is
|
||||
due to:
|
||||
- the default resolver in the absence of resolv.conf being 127.0.0.1
|
||||
- the default DNS NSS database configuration in the absence of
|
||||
nsswitch.conf being 'hosts: dns [!UNAVAIL=return] file'
|
||||
|
||||
This causes the requests for 'test4' and 'test6' to first be sent to the
|
||||
local resolver, which responds with NXDOMAIN in the likely case those
|
||||
records do no exist. In turn that causes the access to /etc/hosts to be
|
||||
skipped, which is the purpose of that test.
|
||||
|
||||
Fix that by providing a simple nsswitch.conf file forcing access to
|
||||
/etc/hosts for that test. I have tested that the only changed result in
|
||||
the testsuite is that test.
|
||||
|
||||
(cherry picked from commit 2738480a4b0866723fb8c633f36bdd34a8767581)
|
||||
|
||||
diff --git a/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
|
||||
new file mode 100644
|
||||
index 0000000000000000..5b0c6a419937a013
|
||||
--- /dev/null
|
||||
+++ b/nss/tst-nss-files-hosts-long.root/etc/nsswitch.conf
|
||||
@@ -0,0 +1 @@
|
||||
+hosts: files
|
26
SOURCES/glibc-upstream-2.34-17.patch
Normal file
26
SOURCES/glibc-upstream-2.34-17.patch
Normal file
@ -0,0 +1,26 @@
|
||||
commit 007d699d0e0d0957eead78ad252ad592656284de
|
||||
Author: Joseph Myers <joseph@codesourcery.com>
|
||||
Date: Tue Sep 7 13:08:38 2021 +0000
|
||||
|
||||
Use Linux 5.14 in build-many-glibcs.py
|
||||
|
||||
This patch makes build-many-glibcs.py use Linux 5.14.
|
||||
|
||||
Tested with build-many-glibcs.py (host-libraries, compilers and glibcs
|
||||
builds).
|
||||
|
||||
(cherry picked from commit 4e04a47208e1712fcf202a6d9831f0900d575225)
|
||||
|
||||
diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
|
||||
index 5a77af90a6b49909..86537fa8005cfd3d 100755
|
||||
--- a/scripts/build-many-glibcs.py
|
||||
+++ b/scripts/build-many-glibcs.py
|
||||
@@ -782,7 +782,7 @@ class Context(object):
|
||||
'gcc': 'vcs-11',
|
||||
'glibc': 'vcs-mainline',
|
||||
'gmp': '6.2.1',
|
||||
- 'linux': '5.13',
|
||||
+ 'linux': '5.14',
|
||||
'mpc': '1.2.1',
|
||||
'mpfr': '4.1.0',
|
||||
'mig': 'vcs-mainline',
|
377
SOURCES/glibc-upstream-2.34-18.patch
Normal file
377
SOURCES/glibc-upstream-2.34-18.patch
Normal file
@ -0,0 +1,377 @@
|
||||
commit 005bafcf5b8a85d4c82831401f052747e160a7e8
|
||||
Author: Joseph Myers <joseph@codesourcery.com>
|
||||
Date: Wed Sep 8 12:42:06 2021 +0000
|
||||
|
||||
Update syscall lists for Linux 5.14
|
||||
|
||||
Linux 5.14 has two new syscalls, memfd_secret (on some architectures
|
||||
only) and quotactl_fd. Update syscall-names.list and regenerate the
|
||||
arch-syscall.h headers with build-many-glibcs.py update-syscalls.
|
||||
|
||||
Tested with build-many-glibcs.py.
|
||||
|
||||
(cherry picked from commit 89dc0372a9055e7ef86fe19be6201fa0b16b2f0e)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
|
||||
index e9eb707d0ac022ed..bedab1abbac7f6c1 100644
|
||||
--- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h
|
||||
@@ -126,6 +126,7 @@
|
||||
#define __NR_mbind 235
|
||||
#define __NR_membarrier 283
|
||||
#define __NR_memfd_create 279
|
||||
+#define __NR_memfd_secret 447
|
||||
#define __NR_migrate_pages 238
|
||||
#define __NR_mincore 232
|
||||
#define __NR_mkdirat 34
|
||||
@@ -187,6 +188,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
|
||||
index bd6b7d4003a252be..91354ed9e29b8d15 100644
|
||||
--- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h
|
||||
@@ -337,6 +337,7 @@
|
||||
#define __NR_pwritev2 521
|
||||
#define __NR_query_module 347
|
||||
#define __NR_quotactl 148
|
||||
+#define __NR_quotactl_fd 553
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 379
|
||||
#define __NR_readlink 58
|
||||
diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
|
||||
index 10650549c1dcd100..ff5c7eb36db89494 100644
|
||||
--- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h
|
||||
@@ -190,6 +190,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
|
||||
index 85c9b236ce7862b6..5772333ceef6ce59 100644
|
||||
--- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h
|
||||
@@ -244,6 +244,7 @@
|
||||
#define __NR_pwritev 362
|
||||
#define __NR_pwritev2 393
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 225
|
||||
#define __NR_readlink 85
|
||||
diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
|
||||
index 24b0d1f94e5f99da..4af6d6202f6df7ae 100644
|
||||
--- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h
|
||||
@@ -199,6 +199,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
|
||||
index feb70abc3e1eb486..b07fc8549de34157 100644
|
||||
--- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h
|
||||
@@ -231,6 +231,7 @@
|
||||
#define __NR_pwritev 316
|
||||
#define __NR_pwritev2 348
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 207
|
||||
#define __NR_readlink 85
|
||||
diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
|
||||
index 3b1894a79b6fcfaf..6e4264698b5ce480 100644
|
||||
--- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h
|
||||
@@ -183,6 +183,7 @@
|
||||
#define __NR_mbind 274
|
||||
#define __NR_membarrier 375
|
||||
#define __NR_memfd_create 356
|
||||
+#define __NR_memfd_secret 447
|
||||
#define __NR_migrate_pages 294
|
||||
#define __NR_mincore 218
|
||||
#define __NR_mkdir 39
|
||||
@@ -266,6 +267,7 @@
|
||||
#define __NR_pwritev2 379
|
||||
#define __NR_query_module 167
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 225
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
|
||||
index fb388a5fa4e9b28e..1ca706d7216a3902 100644
|
||||
--- a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h
|
||||
@@ -218,6 +218,7 @@
|
||||
#define __NR_pwritev 1320
|
||||
#define __NR_pwritev2 1349
|
||||
#define __NR_quotactl 1137
|
||||
+#define __NR_quotactl_fd 1467
|
||||
#define __NR_read 1026
|
||||
#define __NR_readahead 1216
|
||||
#define __NR_readlink 1092
|
||||
diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
|
||||
index 7bc8c4af92cf2bd3..2f10f71f90d225ff 100644
|
||||
--- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h
|
||||
@@ -254,6 +254,7 @@
|
||||
#define __NR_pwritev2 378
|
||||
#define __NR_query_module 167
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 240
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
|
||||
index cf560d3af47f19c5..0607a4dfa6adaa23 100644
|
||||
--- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h
|
||||
@@ -266,6 +266,7 @@
|
||||
#define __NR_pwritev2 394
|
||||
#define __NR_query_module 167
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 225
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
|
||||
index f346460f4880f10e..0055eec0b169ba96 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h
|
||||
@@ -251,6 +251,7 @@
|
||||
#define __NR_pwritev2 4362
|
||||
#define __NR_query_module 4187
|
||||
#define __NR_quotactl 4131
|
||||
+#define __NR_quotactl_fd 4443
|
||||
#define __NR_read 4003
|
||||
#define __NR_readahead 4223
|
||||
#define __NR_readdir 4089
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
|
||||
index 38ed84997a2fa3d1..8e8e9f91ccfebfab 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h
|
||||
@@ -232,6 +232,7 @@
|
||||
#define __NR_pwritev2 6326
|
||||
#define __NR_query_module 6171
|
||||
#define __NR_quotactl 6172
|
||||
+#define __NR_quotactl_fd 6443
|
||||
#define __NR_read 6000
|
||||
#define __NR_readahead 6179
|
||||
#define __NR_readlink 6087
|
||||
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
|
||||
index e6a10c842178168c..ebd1545f806564bb 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h
|
||||
@@ -219,6 +219,7 @@
|
||||
#define __NR_pwritev2 5322
|
||||
#define __NR_query_module 5171
|
||||
#define __NR_quotactl 5172
|
||||
+#define __NR_quotactl_fd 5443
|
||||
#define __NR_read 5000
|
||||
#define __NR_readahead 5179
|
||||
#define __NR_readlink 5087
|
||||
diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
|
||||
index 5314890289a1723f..2b530b1f88e4c52a 100644
|
||||
--- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h
|
||||
@@ -198,6 +198,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
|
||||
index b5b075853297cf2e..a32984a9c17315ee 100644
|
||||
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h
|
||||
@@ -260,6 +260,7 @@
|
||||
#define __NR_pwritev2 381
|
||||
#define __NR_query_module 166
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 191
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
|
||||
index c77435ca61aba109..b01e464fb906d632 100644
|
||||
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h
|
||||
@@ -243,6 +243,7 @@
|
||||
#define __NR_pwritev2 381
|
||||
#define __NR_query_module 166
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 191
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
|
||||
index 70854bb9e360b40a..24d0a2c455caa630 100644
|
||||
--- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h
|
||||
@@ -179,6 +179,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
|
||||
index 83b9f31abaee9d52..e526c89ae7b285cc 100644
|
||||
--- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h
|
||||
@@ -187,6 +187,7 @@
|
||||
#define __NR_pwritev 70
|
||||
#define __NR_pwritev2 287
|
||||
#define __NR_quotactl 60
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 63
|
||||
#define __NR_readahead 213
|
||||
#define __NR_readlinkat 78
|
||||
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
|
||||
index b224c4aad4c9b1b1..d4c7b101b64c010f 100644
|
||||
--- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h
|
||||
@@ -251,6 +251,7 @@
|
||||
#define __NR_pwritev2 377
|
||||
#define __NR_query_module 167
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 222
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
|
||||
index 59864af125b437e4..bd8c78d7059a0f31 100644
|
||||
--- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h
|
||||
@@ -221,6 +221,7 @@
|
||||
#define __NR_pwritev2 377
|
||||
#define __NR_query_module 167
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 222
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
|
||||
index 23612c9092b9c2ee..3b6ac3d084d74638 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h
|
||||
@@ -246,6 +246,7 @@
|
||||
#define __NR_pwritev 334
|
||||
#define __NR_pwritev2 382
|
||||
#define __NR_quotactl 131
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 225
|
||||
#define __NR_readdir 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
|
||||
index 380cddb2d8f9f443..35221a707e4d4a7c 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h
|
||||
@@ -252,6 +252,7 @@
|
||||
#define __NR_pwritev2 359
|
||||
#define __NR_query_module 184
|
||||
#define __NR_quotactl 165
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 205
|
||||
#define __NR_readdir 204
|
||||
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
|
||||
index 2175eeb6edcf7c34..5ba2b2050924df1c 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h
|
||||
@@ -231,6 +231,7 @@
|
||||
#define __NR_pwritev2 359
|
||||
#define __NR_query_module 184
|
||||
#define __NR_quotactl 165
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 3
|
||||
#define __NR_readahead 205
|
||||
#define __NR_readdir 204
|
||||
diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list
|
||||
index 89c5895b9b6845ff..fd98893b0e44a606 100644
|
||||
--- a/sysdeps/unix/sysv/linux/syscall-names.list
|
||||
+++ b/sysdeps/unix/sysv/linux/syscall-names.list
|
||||
@@ -21,8 +21,8 @@
|
||||
# This file can list all potential system calls. The names are only
|
||||
# used if the installed kernel headers also provide them.
|
||||
|
||||
-# The list of system calls is current as of Linux 5.13.
|
||||
-kernel 5.13
|
||||
+# The list of system calls is current as of Linux 5.14.
|
||||
+kernel 5.14
|
||||
|
||||
FAST_atomic_update
|
||||
FAST_cmpxchg
|
||||
@@ -247,6 +247,7 @@ madvise
|
||||
mbind
|
||||
membarrier
|
||||
memfd_create
|
||||
+memfd_secret
|
||||
memory_ordering
|
||||
migrate_pages
|
||||
mincore
|
||||
@@ -452,6 +453,7 @@ pwritev
|
||||
pwritev2
|
||||
query_module
|
||||
quotactl
|
||||
+quotactl_fd
|
||||
read
|
||||
readahead
|
||||
readdir
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
|
||||
index 8e028eb62be2041d..26d6ac68a651ec98 100644
|
||||
--- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h
|
||||
@@ -154,6 +154,7 @@
|
||||
#define __NR_mbind 237
|
||||
#define __NR_membarrier 324
|
||||
#define __NR_memfd_create 319
|
||||
+#define __NR_memfd_secret 447
|
||||
#define __NR_migrate_pages 256
|
||||
#define __NR_mincore 27
|
||||
#define __NR_mkdir 83
|
||||
@@ -224,6 +225,7 @@
|
||||
#define __NR_pwritev2 328
|
||||
#define __NR_query_module 178
|
||||
#define __NR_quotactl 179
|
||||
+#define __NR_quotactl_fd 443
|
||||
#define __NR_read 0
|
||||
#define __NR_readahead 187
|
||||
#define __NR_readlink 89
|
||||
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
|
||||
index 004feb53f1f38ced..36847783f6b91d5e 100644
|
||||
--- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
|
||||
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h
|
||||
@@ -148,6 +148,7 @@
|
||||
#define __NR_mbind 1073742061
|
||||
#define __NR_membarrier 1073742148
|
||||
#define __NR_memfd_create 1073742143
|
||||
+#define __NR_memfd_secret 1073742271
|
||||
#define __NR_migrate_pages 1073742080
|
||||
#define __NR_mincore 1073741851
|
||||
#define __NR_mkdir 1073741907
|
||||
@@ -216,6 +217,7 @@
|
||||
#define __NR_pwritev 1073742359
|
||||
#define __NR_pwritev2 1073742371
|
||||
#define __NR_quotactl 1073742003
|
||||
+#define __NR_quotactl_fd 1073742267
|
||||
#define __NR_read 1073741824
|
||||
#define __NR_readahead 1073742011
|
||||
#define __NR_readlink 1073741913
|
27
SOURCES/glibc-upstream-2.34-19.patch
Normal file
27
SOURCES/glibc-upstream-2.34-19.patch
Normal file
@ -0,0 +1,27 @@
|
||||
commit 114581bf53864aaee562ee237461fc394bc61963
|
||||
Author: Joseph Myers <joseph@codesourcery.com>
|
||||
Date: Tue Sep 14 13:51:58 2021 +0000
|
||||
|
||||
Update kernel version to 5.14 in tst-mman-consts.py
|
||||
|
||||
This patch updates the kernel version in the test tst-mman-consts.py
|
||||
to 5.14. (There are no new MAP_* constants covered by this test in
|
||||
5.14 that need any other header changes.)
|
||||
|
||||
Tested with build-many-glibcs.py.
|
||||
|
||||
(cherry picked from commit 4b39e3498324d1aea802fea8d4b8764f5ddb4fd1)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/tst-mman-consts.py b/sysdeps/unix/sysv/linux/tst-mman-consts.py
|
||||
index ee5b13ee1232fdf5..810433c238f31c25 100644
|
||||
--- a/sysdeps/unix/sysv/linux/tst-mman-consts.py
|
||||
+++ b/sysdeps/unix/sysv/linux/tst-mman-consts.py
|
||||
@@ -33,7 +33,7 @@ def main():
|
||||
help='C compiler (including options) to use')
|
||||
args = parser.parse_args()
|
||||
linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
|
||||
- linux_version_glibc = (5, 13)
|
||||
+ linux_version_glibc = (5, 14)
|
||||
sys.exit(glibcextract.compare_macro_consts(
|
||||
'#define _GNU_SOURCE 1\n'
|
||||
'#include <sys/mman.h>\n',
|
33
SOURCES/glibc-upstream-2.34-2.patch
Normal file
33
SOURCES/glibc-upstream-2.34-2.patch
Normal file
@ -0,0 +1,33 @@
|
||||
commit 3a48da47a91ccc6f5de260574809e7a44551b876
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Tue Aug 3 21:10:20 2021 +0530
|
||||
|
||||
gconv_parseconfdir: Fix memory leak
|
||||
|
||||
The allocated `conf` would leak if we have to skip over the file due
|
||||
to the underlying filesystem not supporting dt_type.
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 5f9b78fe35d08739b6da1e5b356786d41116c108)
|
||||
|
||||
diff --git a/iconv/gconv_parseconfdir.h b/iconv/gconv_parseconfdir.h
|
||||
index a4153e54c6d43797..2f062689ecc72749 100644
|
||||
--- a/iconv/gconv_parseconfdir.h
|
||||
+++ b/iconv/gconv_parseconfdir.h
|
||||
@@ -153,12 +153,11 @@ gconv_parseconfdir (const char *dir, size_t dir_len)
|
||||
struct stat64 st;
|
||||
if (asprintf (&conf, "%s/%s", buf, ent->d_name) < 0)
|
||||
continue;
|
||||
- if (ent->d_type == DT_UNKNOWN
|
||||
- && (lstat64 (conf, &st) == -1
|
||||
- || !S_ISREG (st.st_mode)))
|
||||
- continue;
|
||||
|
||||
- found |= read_conf_file (conf, dir, dir_len);
|
||||
+ if (ent->d_type != DT_UNKNOWN
|
||||
+ || (lstat64 (conf, &st) != -1 && S_ISREG (st.st_mode)))
|
||||
+ found |= read_conf_file (conf, dir, dir_len);
|
||||
+
|
||||
free (conf);
|
||||
}
|
||||
}
|
29
SOURCES/glibc-upstream-2.34-20.patch
Normal file
29
SOURCES/glibc-upstream-2.34-20.patch
Normal file
@ -0,0 +1,29 @@
|
||||
commit 4ed990e5b97a61f29f929bdeb36c5b2abb547a64
|
||||
Author: Joseph Myers <joseph@codesourcery.com>
|
||||
Date: Tue Sep 14 14:19:24 2021 +0000
|
||||
|
||||
Add MADV_POPULATE_READ and MADV_POPULATE_WRITE from Linux 5.14 to bits/mman-linux.h
|
||||
|
||||
Linux 5.14 adds constants MADV_POPULATE_READ and MADV_POPULATE_WRITE
|
||||
(with the same values on all architectures). Add these to glibc's
|
||||
bits/mman-linux.h.
|
||||
|
||||
Tested for x86_64.
|
||||
|
||||
(cherry picked from commit 3561106278cddd2f007bd27fd4c3e90caaf14b43)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/bits/mman-linux.h b/sysdeps/unix/sysv/linux/bits/mman-linux.h
|
||||
index 3b1ae418e073c122..31451c28d93f9f72 100644
|
||||
--- a/sysdeps/unix/sysv/linux/bits/mman-linux.h
|
||||
+++ b/sysdeps/unix/sysv/linux/bits/mman-linux.h
|
||||
@@ -89,6 +89,10 @@
|
||||
# define MADV_KEEPONFORK 19 /* Undo MADV_WIPEONFORK. */
|
||||
# define MADV_COLD 20 /* Deactivate these pages. */
|
||||
# define MADV_PAGEOUT 21 /* Reclaim these pages. */
|
||||
+# define MADV_POPULATE_READ 22 /* Populate (prefault) page tables
|
||||
+ readable. */
|
||||
+# define MADV_POPULATE_WRITE 23 /* Populate (prefault) page tables
|
||||
+ writable. */
|
||||
# define MADV_HWPOISON 100 /* Poison a page for testing. */
|
||||
#endif
|
||||
|
44
SOURCES/glibc-upstream-2.34-21.patch
Normal file
44
SOURCES/glibc-upstream-2.34-21.patch
Normal file
@ -0,0 +1,44 @@
|
||||
commit 433ec4f14a5753c7689c83c20c9972915c53c204
|
||||
Author: Aurelien Jarno <aurelien@aurel32.net>
|
||||
Date: Fri Sep 10 19:39:35 2021 +0200
|
||||
|
||||
posix: Fix attribute access mode on getcwd [BZ #27476]
|
||||
|
||||
There is a GNU extension that allows to call getcwd(NULL, >0). It is
|
||||
described in the documentation, but also directly in the unistd.h
|
||||
header, just above the declaration.
|
||||
|
||||
Therefore the attribute access mode added in commit 06febd8c6705
|
||||
is not correct. Drop it.
|
||||
|
||||
diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h
|
||||
index f0831386c7ddb574..622adeb2b28ed298 100644
|
||||
--- a/posix/bits/unistd.h
|
||||
+++ b/posix/bits/unistd.h
|
||||
@@ -199,10 +199,9 @@ __NTH (readlinkat (int __fd, const char *__restrict __path,
|
||||
#endif
|
||||
|
||||
extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
|
||||
- __THROW __wur __attr_access ((__write_only__, 1, 2));
|
||||
+ __THROW __wur;
|
||||
extern char *__REDIRECT_NTH (__getcwd_alias,
|
||||
- (char *__buf, size_t __size), getcwd)
|
||||
- __wur __attr_access ((__write_only__, 1, 2));
|
||||
+ (char *__buf, size_t __size), getcwd) __wur;
|
||||
extern char *__REDIRECT_NTH (__getcwd_chk_warn,
|
||||
(char *__buf, size_t __size, size_t __buflen),
|
||||
__getcwd_chk)
|
||||
diff --git a/posix/unistd.h b/posix/unistd.h
|
||||
index 3dca65732fdde52f..8224c5fbc956306f 100644
|
||||
--- a/posix/unistd.h
|
||||
+++ b/posix/unistd.h
|
||||
@@ -528,8 +528,7 @@ extern int fchdir (int __fd) __THROW __wur;
|
||||
an array is allocated with `malloc'; the array is SIZE
|
||||
bytes long, unless SIZE == 0, in which case it is as
|
||||
big as necessary. */
|
||||
-extern char *getcwd (char *__buf, size_t __size) __THROW __wur
|
||||
- __attr_access ((__write_only__, 1, 2));
|
||||
+extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Return a malloc'd string containing the current directory name.
|
137
SOURCES/glibc-upstream-2.34-22.patch
Normal file
137
SOURCES/glibc-upstream-2.34-22.patch
Normal file
@ -0,0 +1,137 @@
|
||||
commit 73c7f5a87971de2797f261e1a447f68dce09284b
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Mon Sep 20 14:56:08 2021 +0200
|
||||
|
||||
nptl: pthread_kill needs to return ESRCH for old programs (bug 19193)
|
||||
|
||||
The fix for bug 19193 breaks some old applications which appear
|
||||
to use pthread_kill to probe if a thread is still running, something
|
||||
that is not supported by POSIX.
|
||||
|
||||
(cherry picked from commit 95dba35bf05e4a5d69dfae5e9c9d4df3646a7f93)
|
||||
|
||||
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
|
||||
index fb7862eff787a94f..a44dc8f2d9baa925 100644
|
||||
--- a/nptl/pthread_kill.c
|
||||
+++ b/nptl/pthread_kill.c
|
||||
@@ -21,8 +21,11 @@
|
||||
#include <pthreadP.h>
|
||||
#include <shlib-compat.h>
|
||||
|
||||
-int
|
||||
-__pthread_kill_internal (pthread_t threadid, int signo)
|
||||
+/* Sends SIGNO to THREADID. If the thread is about to exit or has
|
||||
+ already exited on the kernel side, return NO_TID. Otherwise return
|
||||
+ 0 or an error code. */
|
||||
+static int
|
||||
+__pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
|
||||
{
|
||||
struct pthread *pd = (struct pthread *) threadid;
|
||||
if (pd == THREAD_SELF)
|
||||
@@ -52,11 +55,8 @@ __pthread_kill_internal (pthread_t threadid, int signo)
|
||||
signal is either not observable (the target thread has already
|
||||
blocked signals at this point), or it will fail, or it might be
|
||||
delivered to a new, unrelated thread that has reused the TID.
|
||||
- So do not actually send the signal. Do not report an error
|
||||
- because the threadid argument is still valid (the thread ID
|
||||
- lifetime has not ended), and ESRCH (for example) would be
|
||||
- misleading. */
|
||||
- ret = 0;
|
||||
+ So do not actually send the signal. */
|
||||
+ ret = no_tid;
|
||||
else
|
||||
{
|
||||
/* Using tgkill is a safety measure. pd->exit_lock ensures that
|
||||
@@ -71,6 +71,15 @@ __pthread_kill_internal (pthread_t threadid, int signo)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int
|
||||
+__pthread_kill_internal (pthread_t threadid, int signo)
|
||||
+{
|
||||
+ /* Do not report an error in the no-tid case because the threadid
|
||||
+ argument is still valid (the thread ID lifetime has not ended),
|
||||
+ and ESRCH (for example) would be misleading. */
|
||||
+ return __pthread_kill_implementation (threadid, signo, 0);
|
||||
+}
|
||||
+
|
||||
int
|
||||
__pthread_kill (pthread_t threadid, int signo)
|
||||
{
|
||||
@@ -81,6 +90,7 @@ __pthread_kill (pthread_t threadid, int signo)
|
||||
|
||||
return __pthread_kill_internal (threadid, signo);
|
||||
}
|
||||
+
|
||||
/* Some architectures (for instance arm) might pull raise through libgcc, so
|
||||
avoid the symbol version if it ends up being used on ld.so. */
|
||||
#if !IS_IN(rtld)
|
||||
@@ -88,6 +98,17 @@ libc_hidden_def (__pthread_kill)
|
||||
versioned_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_34);
|
||||
|
||||
# if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34)
|
||||
-compat_symbol (libc, __pthread_kill, pthread_kill, GLIBC_2_0);
|
||||
+/* Variant which returns ESRCH in the no-TID case, for backwards
|
||||
+ compatibility. */
|
||||
+int
|
||||
+attribute_compat_text_section
|
||||
+__pthread_kill_esrch (pthread_t threadid, int signo)
|
||||
+{
|
||||
+ if (__is_internal_signal (signo))
|
||||
+ return EINVAL;
|
||||
+
|
||||
+ return __pthread_kill_implementation (threadid, signo, ESRCH);
|
||||
+}
|
||||
+compat_symbol (libc, __pthread_kill_esrch, pthread_kill, GLIBC_2_0);
|
||||
# endif
|
||||
#endif
|
||||
diff --git a/sysdeps/pthread/tst-pthread_kill-exited.c b/sysdeps/pthread/tst-pthread_kill-exited.c
|
||||
index 7575fb6d58cae99c..a2fddad526666c8c 100644
|
||||
--- a/sysdeps/pthread/tst-pthread_kill-exited.c
|
||||
+++ b/sysdeps/pthread/tst-pthread_kill-exited.c
|
||||
@@ -16,11 +16,15 @@
|
||||
License along with the GNU C Library; if not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
-/* This test verifies that pthread_kill returns 0 (and not ESRCH) for
|
||||
- a thread that has exited on the kernel side. */
|
||||
+/* This test verifies that the default pthread_kill returns 0 (and not
|
||||
+ ESRCH) for a thread that has exited on the kernel side. */
|
||||
|
||||
+#include <errno.h>
|
||||
+#include <pthread.h>
|
||||
+#include <shlib-compat.h>
|
||||
#include <signal.h>
|
||||
#include <stddef.h>
|
||||
+#include <support/check.h>
|
||||
#include <support/support.h>
|
||||
#include <support/xthread.h>
|
||||
|
||||
@@ -30,6 +34,12 @@ noop_thread (void *closure)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
|
||||
+extern __typeof (pthread_kill) compat_pthread_kill;
|
||||
+compat_symbol_reference (libpthread, compat_pthread_kill, pthread_kill,
|
||||
+ GLIBC_2_0);
|
||||
+#endif
|
||||
+
|
||||
static int
|
||||
do_test (void)
|
||||
{
|
||||
@@ -37,7 +47,14 @@ do_test (void)
|
||||
|
||||
support_wait_for_thread_exit ();
|
||||
|
||||
+ /* NB: Always uses the default symbol due to separate compilation. */
|
||||
xpthread_kill (thr, SIGUSR1);
|
||||
+
|
||||
+#if TEST_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_34) && PTHREAD_IN_LIBC
|
||||
+ /* Old binaries need the non-conforming ESRCH error code. */
|
||||
+ TEST_COMPARE (compat_pthread_kill (thr, SIGUSR1), ESRCH);
|
||||
+#endif
|
||||
+
|
||||
xpthread_join (thr);
|
||||
|
||||
return 0;
|
32
SOURCES/glibc-upstream-2.34-23.patch
Normal file
32
SOURCES/glibc-upstream-2.34-23.patch
Normal file
@ -0,0 +1,32 @@
|
||||
commit 8b8a1d0b7375c547ae905917a03743ed6759c5bc
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Tue Sep 21 07:12:56 2021 +0200
|
||||
|
||||
nptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np (bug 28036)
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit f3e664563361dc17530113b3205998d1f19dc4d9)
|
||||
|
||||
diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h
|
||||
index f1b7f2bdc6062c3e..43146e91c9d9579b 100644
|
||||
--- a/sysdeps/nptl/pthread.h
|
||||
+++ b/sysdeps/nptl/pthread.h
|
||||
@@ -933,7 +933,7 @@ extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr,
|
||||
# ifdef __USE_GNU
|
||||
# ifdef __REDIRECT_NTH
|
||||
extern int __REDIRECT_NTH (pthread_mutexattr_getrobust_np,
|
||||
- (pthread_mutex_t *, int *),
|
||||
+ (pthread_mutexattr_t *, int *),
|
||||
pthread_mutexattr_getrobust) __nonnull ((1))
|
||||
__attribute_deprecated_msg__ ("\
|
||||
pthread_mutexattr_getrobust_np is deprecated, use pthread_mutexattr_getrobust");
|
||||
@@ -949,7 +949,7 @@ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
|
||||
# ifdef __USE_GNU
|
||||
# ifdef __REDIRECT_NTH
|
||||
extern int __REDIRECT_NTH (pthread_mutexattr_setrobust_np,
|
||||
- (pthread_mutex_t *, int),
|
||||
+ (pthread_mutexattr_t *, int),
|
||||
pthread_mutexattr_setrobust) __nonnull ((1))
|
||||
__attribute_deprecated_msg__ ("\
|
||||
pthread_mutexattr_setrobust_np is deprecated, use pthread_mutexattr_setrobust");
|
355
SOURCES/glibc-upstream-2.34-24.patch
Normal file
355
SOURCES/glibc-upstream-2.34-24.patch
Normal file
@ -0,0 +1,355 @@
|
||||
commit 5ad589d63bc2d9b1fc3d9f32144acaebb85e0803
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Aug 24 16:12:24 2021 -0300
|
||||
|
||||
support: Add support_open_dev_null_range
|
||||
|
||||
It returns a range of file descriptor referring to the '/dev/null'
|
||||
pathname. The function takes care of restarting the open range
|
||||
if a file descriptor is found within the specified range and
|
||||
also increases RLIMIT_NOFILE if required.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
|
||||
(cherry picked from commit e814f4b04ee413a7bb3dfa43e74c8fb4abf58359)
|
||||
|
||||
diff --git a/support/Makefile b/support/Makefile
|
||||
index ef2b1a980a407f8f..2a0731796fdb3f2d 100644
|
||||
--- a/support/Makefile
|
||||
+++ b/support/Makefile
|
||||
@@ -66,6 +66,7 @@ libsupport-routines = \
|
||||
support_path_support_time64 \
|
||||
support_process_state \
|
||||
support_ptrace \
|
||||
+ support-open-dev-null-range \
|
||||
support_openpty \
|
||||
support_paths \
|
||||
support_quote_blob \
|
||||
@@ -265,6 +266,7 @@ tests = \
|
||||
tst-support_capture_subprocess \
|
||||
tst-support_descriptors \
|
||||
tst-support_format_dns_packet \
|
||||
+ tst-support-open-dev-null-range \
|
||||
tst-support-process_state \
|
||||
tst-support_quote_blob \
|
||||
tst-support_quote_string \
|
||||
diff --git a/support/support-open-dev-null-range.c b/support/support-open-dev-null-range.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..80d9dba50402ce12
|
||||
--- /dev/null
|
||||
+++ b/support/support-open-dev-null-range.c
|
||||
@@ -0,0 +1,134 @@
|
||||
+/* Return a range of open file descriptors.
|
||||
+ Copyright (C) 2021 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 <errno.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <support/support.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <sys/resource.h>
|
||||
+
|
||||
+static void
|
||||
+increase_nofile (void)
|
||||
+{
|
||||
+ struct rlimit rl;
|
||||
+ if (getrlimit (RLIMIT_NOFILE, &rl) == -1)
|
||||
+ FAIL_EXIT1 ("getrlimit (RLIMIT_NOFILE): %m");
|
||||
+
|
||||
+ rl.rlim_cur += 128;
|
||||
+
|
||||
+ if (setrlimit (RLIMIT_NOFILE, &rl) == 1)
|
||||
+ FAIL_EXIT1 ("setrlimit (RLIMIT_NOFILE): %m");
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+open_dev_null (int flags, mode_t mode)
|
||||
+{
|
||||
+ int fd = open64 ("/dev/null", flags, mode);
|
||||
+ if (fd > 0)
|
||||
+ return fd;
|
||||
+
|
||||
+ if (fd < 0 && errno != EMFILE)
|
||||
+ FAIL_EXIT1 ("open64 (\"/dev/null\", 0x%x, 0%o): %m", flags, mode);
|
||||
+
|
||||
+ increase_nofile ();
|
||||
+
|
||||
+ return xopen ("/dev/null", flags, mode);
|
||||
+}
|
||||
+
|
||||
+struct range
|
||||
+{
|
||||
+ int lowfd;
|
||||
+ size_t len;
|
||||
+};
|
||||
+
|
||||
+struct range_list
|
||||
+{
|
||||
+ size_t total;
|
||||
+ size_t used;
|
||||
+ struct range *ranges;
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+range_init (struct range_list *r)
|
||||
+{
|
||||
+ r->total = 8;
|
||||
+ r->used = 0;
|
||||
+ r->ranges = xmalloc (r->total * sizeof (struct range));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+range_add (struct range_list *r, int lowfd, size_t len)
|
||||
+{
|
||||
+ if (r->used == r->total)
|
||||
+ {
|
||||
+ r->total *= 2;
|
||||
+ r->ranges = xrealloc (r->ranges, r->total * sizeof (struct range));
|
||||
+ }
|
||||
+ r->ranges[r->used].lowfd = lowfd;
|
||||
+ r->ranges[r->used].len = len;
|
||||
+ r->used++;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+range_close (struct range_list *r)
|
||||
+{
|
||||
+ for (size_t i = 0; i < r->used; i++)
|
||||
+ {
|
||||
+ int minfd = r->ranges[i].lowfd;
|
||||
+ int maxfd = r->ranges[i].lowfd + r->ranges[i].len;
|
||||
+ for (int fd = minfd; fd < maxfd; fd++)
|
||||
+ xclose (fd);
|
||||
+ }
|
||||
+ free (r->ranges);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+support_open_dev_null_range (int num, int flags, mode_t mode)
|
||||
+{
|
||||
+ /* We keep track of the ranges that hit an already opened descriptor, so
|
||||
+ we close them after we get a working range. */
|
||||
+ struct range_list rl;
|
||||
+ range_init (&rl);
|
||||
+
|
||||
+ int lowfd = open_dev_null (flags, mode);
|
||||
+ int prevfd = lowfd;
|
||||
+ while (true)
|
||||
+ {
|
||||
+ int i = 1;
|
||||
+ for (; i < num; i++)
|
||||
+ {
|
||||
+ int fd = open_dev_null (flags, mode);
|
||||
+ if (fd != lowfd + i)
|
||||
+ {
|
||||
+ range_add (&rl, lowfd, prevfd - lowfd + 1);
|
||||
+
|
||||
+ prevfd = lowfd = fd;
|
||||
+ break;
|
||||
+ }
|
||||
+ prevfd = fd;
|
||||
+ }
|
||||
+ if (i == num)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ range_close (&rl);
|
||||
+
|
||||
+ return lowfd;
|
||||
+}
|
||||
diff --git a/support/support.h b/support/support.h
|
||||
index a5978b939af2fb41..c219e0d9d1aef046 100644
|
||||
--- a/support/support.h
|
||||
+++ b/support/support.h
|
||||
@@ -197,6 +197,14 @@ struct support_stack support_stack_alloc (size_t size);
|
||||
/* Deallocate the STACK. */
|
||||
void support_stack_free (struct support_stack *stack);
|
||||
|
||||
+
|
||||
+/* Create a range of NUM opened '/dev/null' file descriptors using FLAGS and
|
||||
+ MODE. The function takes care of restarting the open range if a file
|
||||
+ descriptor is found within the specified range and also increases
|
||||
+ RLIMIT_NOFILE if required.
|
||||
+ The returned value is the lowest file descriptor number. */
|
||||
+int support_open_dev_null_range (int num, int flags, mode_t mode);
|
||||
+
|
||||
__END_DECLS
|
||||
|
||||
#endif /* SUPPORT_H */
|
||||
diff --git a/support/tst-support-open-dev-null-range.c b/support/tst-support-open-dev-null-range.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..8e29def1ce780629
|
||||
--- /dev/null
|
||||
+++ b/support/tst-support-open-dev-null-range.c
|
||||
@@ -0,0 +1,155 @@
|
||||
+/* Tests for support_open_dev_null_range.
|
||||
+ Copyright (C) 2021 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 <errno.h>
|
||||
+#include <dirent.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <limits.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/support.h>
|
||||
+#include <support/xunistd.h>
|
||||
+#include <sys/resource.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#ifndef PATH_MAX
|
||||
+# define PATH_MAX 1024
|
||||
+#endif
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+static void
|
||||
+check_path (int fd)
|
||||
+{
|
||||
+ char *proc_fd_path = xasprintf ("/proc/self/fd/%d", fd);
|
||||
+ char file_path[PATH_MAX];
|
||||
+ ssize_t file_path_length
|
||||
+ = readlink (proc_fd_path, file_path, sizeof (file_path));
|
||||
+ free (proc_fd_path);
|
||||
+ if (file_path_length < 0)
|
||||
+ FAIL_EXIT1 ("readlink (%s, %p, %zu)", proc_fd_path, file_path,
|
||||
+ sizeof (file_path));
|
||||
+ file_path[file_path_length] = '\0';
|
||||
+ TEST_COMPARE_STRING (file_path, "/dev/null");
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+number_of_opened_files (void)
|
||||
+{
|
||||
+ DIR *fds = opendir ("/proc/self/fd");
|
||||
+ if (fds == NULL)
|
||||
+ FAIL_EXIT1 ("opendir (\"/proc/self/fd\"): %m");
|
||||
+
|
||||
+ int r = 0;
|
||||
+ while (true)
|
||||
+ {
|
||||
+ errno = 0;
|
||||
+ struct dirent64 *e = readdir64 (fds);
|
||||
+ if (e == NULL)
|
||||
+ {
|
||||
+ if (errno != 0)
|
||||
+ FAIL_EXIT1 ("readdir: %m");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (e->d_name[0] == '.')
|
||||
+ continue;
|
||||
+
|
||||
+ char *endptr;
|
||||
+ long int fd = strtol (e->d_name, &endptr, 10);
|
||||
+ if (*endptr != '\0' || fd < 0 || fd > INT_MAX)
|
||||
+ FAIL_EXIT1 ("readdir: invalid file descriptor name: /proc/self/fd/%s",
|
||||
+ e->d_name);
|
||||
+
|
||||
+ /* Skip the descriptor which is used to enumerate the
|
||||
+ descriptors. */
|
||||
+ if (fd == dirfd (fds))
|
||||
+ continue;
|
||||
+
|
||||
+ r = r + 1;
|
||||
+ }
|
||||
+
|
||||
+ closedir (fds);
|
||||
+
|
||||
+ return r;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ const int nfds1 = 8;
|
||||
+ int lowfd = support_open_dev_null_range (nfds1, O_RDONLY, 0600);
|
||||
+ for (int i = 0; i < nfds1; i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (fcntl (lowfd + i, F_GETFL) > -1);
|
||||
+ check_path (lowfd + i);
|
||||
+ }
|
||||
+
|
||||
+ /* create some gaps. */
|
||||
+ xclose (lowfd + 1);
|
||||
+ xclose (lowfd + 5);
|
||||
+ xclose (lowfd + 6);
|
||||
+
|
||||
+ const int nfds2 = 16;
|
||||
+ int lowfd2 = support_open_dev_null_range (nfds2, O_RDONLY, 0600);
|
||||
+ for (int i = 0; i < nfds2; i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (fcntl (lowfd2 + i, F_GETFL) > -1);
|
||||
+ check_path (lowfd2 + i);
|
||||
+ }
|
||||
+
|
||||
+ /* Decrease the maximum number of files. */
|
||||
+ {
|
||||
+ struct rlimit rl;
|
||||
+ if (getrlimit (RLIMIT_NOFILE, &rl) == -1)
|
||||
+ FAIL_EXIT1 ("getrlimit (RLIMIT_NOFILE): %m");
|
||||
+
|
||||
+ rl.rlim_cur = number_of_opened_files ();
|
||||
+
|
||||
+ if (setrlimit (RLIMIT_NOFILE, &rl) == 1)
|
||||
+ FAIL_EXIT1 ("setrlimit (RLIMIT_NOFILE): %m");
|
||||
+ }
|
||||
+
|
||||
+ const int nfds3 = 16;
|
||||
+ int lowfd3 = support_open_dev_null_range (nfds3, O_RDONLY, 0600);
|
||||
+ for (int i = 0; i < nfds3; i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (fcntl (lowfd3 + i, F_GETFL) > -1);
|
||||
+ check_path (lowfd3 + i);
|
||||
+ }
|
||||
+
|
||||
+ /* create a lot of gaps to trigger the range extension. */
|
||||
+ xclose (lowfd3 + 1);
|
||||
+ xclose (lowfd3 + 3);
|
||||
+ xclose (lowfd3 + 5);
|
||||
+ xclose (lowfd3 + 7);
|
||||
+ xclose (lowfd3 + 9);
|
||||
+ xclose (lowfd3 + 11);
|
||||
+ xclose (lowfd3 + 13);
|
||||
+
|
||||
+ const int nfds4 = 16;
|
||||
+ int lowfd4 = support_open_dev_null_range (nfds4, O_RDONLY, 0600);
|
||||
+ for (int i = 0; i < nfds4; i++)
|
||||
+ {
|
||||
+ TEST_VERIFY (fcntl (lowfd4 + i, F_GETFL) > -1);
|
||||
+ check_path (lowfd4 + i);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
204
SOURCES/glibc-upstream-2.34-25.patch
Normal file
204
SOURCES/glibc-upstream-2.34-25.patch
Normal file
@ -0,0 +1,204 @@
|
||||
commit 772e33411bc730f832f415f93eb3e7c67e4d5488
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Tue Aug 24 16:15:50 2021 -0300
|
||||
|
||||
Use support_open_dev_null_range io/tst-closefrom, misc/tst-close_range, and posix/tst-spawn5 (BZ #28260)
|
||||
|
||||
It ensures a continuous range of file descriptor and avoid hitting
|
||||
the RLIMIT_NOFILE.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
|
||||
(cherry picked from commit 6b20880b22d1d0fce7e9f506baa6fe2d5c7fcfdc)
|
||||
|
||||
diff --git a/io/tst-closefrom.c b/io/tst-closefrom.c
|
||||
index d4c187073c7280e9..395ec0d894101a47 100644
|
||||
--- a/io/tst-closefrom.c
|
||||
+++ b/io/tst-closefrom.c
|
||||
@@ -24,31 +24,22 @@
|
||||
#include <support/check.h>
|
||||
#include <support/descriptors.h>
|
||||
#include <support/xunistd.h>
|
||||
+#include <support/support.h>
|
||||
|
||||
#include <array_length.h>
|
||||
|
||||
#define NFDS 100
|
||||
|
||||
-static int
|
||||
-open_multiple_temp_files (void)
|
||||
-{
|
||||
- /* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
|
||||
- for (int i = 1; i <= NFDS; i++)
|
||||
- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600), lowfd + i);
|
||||
- return lowfd;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
closefrom_test (void)
|
||||
{
|
||||
struct support_descriptors *descrs = support_descriptors_list ();
|
||||
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
- const int maximum_fd = lowfd + NFDS;
|
||||
+ const int maximum_fd = lowfd + NFDS - 1;
|
||||
const int half_fd = lowfd + NFDS / 2;
|
||||
- const int gap = maximum_fd / 4;
|
||||
+ const int gap = lowfd + NFDS / 4;
|
||||
|
||||
/* Close half of the descriptors and check result. */
|
||||
closefrom (half_fd);
|
||||
@@ -58,7 +49,7 @@ closefrom_test (void)
|
||||
TEST_COMPARE (fcntl (i, F_GETFL), -1);
|
||||
TEST_COMPARE (errno, EBADF);
|
||||
}
|
||||
- for (int i = 0; i < half_fd; i++)
|
||||
+ for (int i = lowfd; i < half_fd; i++)
|
||||
TEST_VERIFY (fcntl (i, F_GETFL) > -1);
|
||||
|
||||
/* Create some gaps, close up to a threshold, and check result. */
|
||||
@@ -74,7 +65,7 @@ closefrom_test (void)
|
||||
TEST_COMPARE (fcntl (i, F_GETFL), -1);
|
||||
TEST_COMPARE (errno, EBADF);
|
||||
}
|
||||
- for (int i = 0; i < gap; i++)
|
||||
+ for (int i = lowfd; i < gap; i++)
|
||||
TEST_VERIFY (fcntl (i, F_GETFL) > -1);
|
||||
|
||||
/* Close the remmaining but the last one. */
|
||||
diff --git a/posix/tst-spawn5.c b/posix/tst-spawn5.c
|
||||
index ac6673800464ce72..a95199af6b3b7c9a 100644
|
||||
--- a/posix/tst-spawn5.c
|
||||
+++ b/posix/tst-spawn5.c
|
||||
@@ -47,17 +47,6 @@ static int initial_argv_count;
|
||||
|
||||
#define NFDS 100
|
||||
|
||||
-static int
|
||||
-open_multiple_temp_files (void)
|
||||
-{
|
||||
- /* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
|
||||
- for (int i = 1; i <= NFDS; i++)
|
||||
- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600),
|
||||
- lowfd + i);
|
||||
- return lowfd;
|
||||
-}
|
||||
-
|
||||
static int
|
||||
parse_fd (const char *str)
|
||||
{
|
||||
@@ -185,7 +174,7 @@ spawn_closefrom_test (posix_spawn_file_actions_t *fa, int lowfd, int highfd,
|
||||
static void
|
||||
do_test_closefrom (void)
|
||||
{
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
const int half_fd = lowfd + NFDS / 2;
|
||||
|
||||
/* Close half of the descriptors and check result. */
|
||||
diff --git a/sysdeps/unix/sysv/linux/tst-close_range.c b/sysdeps/unix/sysv/linux/tst-close_range.c
|
||||
index dccb6189c53fcb90..f5069d1b8a067241 100644
|
||||
--- a/sysdeps/unix/sysv/linux/tst-close_range.c
|
||||
+++ b/sysdeps/unix/sysv/linux/tst-close_range.c
|
||||
@@ -36,23 +36,12 @@
|
||||
|
||||
#define NFDS 100
|
||||
|
||||
-static int
|
||||
-open_multiple_temp_files (void)
|
||||
-{
|
||||
- /* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = xopen ("/dev/null", O_RDONLY, 0600);
|
||||
- for (int i = 1; i <= NFDS; i++)
|
||||
- TEST_COMPARE (xopen ("/dev/null", O_RDONLY, 0600),
|
||||
- lowfd + i);
|
||||
- return lowfd;
|
||||
-}
|
||||
-
|
||||
static void
|
||||
close_range_test_max_upper_limit (void)
|
||||
{
|
||||
struct support_descriptors *descrs = support_descriptors_list ();
|
||||
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
{
|
||||
int r = close_range (lowfd, ~0U, 0);
|
||||
@@ -68,7 +57,7 @@ close_range_test_max_upper_limit (void)
|
||||
static void
|
||||
close_range_test_common (int lowfd, unsigned int flags)
|
||||
{
|
||||
- const int maximum_fd = lowfd + NFDS;
|
||||
+ const int maximum_fd = lowfd + NFDS - 1;
|
||||
const int half_fd = lowfd + NFDS / 2;
|
||||
const int gap_1 = maximum_fd - 8;
|
||||
|
||||
@@ -121,7 +110,7 @@ close_range_test (void)
|
||||
struct support_descriptors *descrs = support_descriptors_list ();
|
||||
|
||||
/* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
close_range_test_common (lowfd, 0);
|
||||
|
||||
@@ -146,7 +135,7 @@ close_range_test_subprocess (void)
|
||||
struct support_descriptors *descrs = support_descriptors_list ();
|
||||
|
||||
/* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
struct support_stack stack = support_stack_alloc (4096);
|
||||
|
||||
@@ -184,7 +173,7 @@ close_range_unshare_test (void)
|
||||
struct support_descriptors *descrs1 = support_descriptors_list ();
|
||||
|
||||
/* Check if the temporary file descriptor has no no gaps. */
|
||||
- int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
struct support_descriptors *descrs2 = support_descriptors_list ();
|
||||
|
||||
@@ -200,7 +189,7 @@ close_range_unshare_test (void)
|
||||
|
||||
support_stack_free (&stack);
|
||||
|
||||
- for (int i = 0; i < NFDS; i++)
|
||||
+ for (int i = lowfd; i < lowfd + NFDS; i++)
|
||||
TEST_VERIFY (fcntl (i, F_GETFL) > -1);
|
||||
|
||||
support_descriptors_check (descrs2);
|
||||
@@ -226,9 +215,9 @@ static void
|
||||
close_range_cloexec_test (void)
|
||||
{
|
||||
/* Check if the temporary file descriptor has no no gaps. */
|
||||
- const int lowfd = open_multiple_temp_files ();
|
||||
+ int lowfd = support_open_dev_null_range (NFDS, O_RDONLY, 0600);
|
||||
|
||||
- const int maximum_fd = lowfd + NFDS;
|
||||
+ const int maximum_fd = lowfd + NFDS - 1;
|
||||
const int half_fd = lowfd + NFDS / 2;
|
||||
const int gap_1 = maximum_fd - 8;
|
||||
|
||||
@@ -251,13 +240,13 @@ close_range_cloexec_test (void)
|
||||
/* Create some gaps, close up to a threshold, and check result. */
|
||||
static int gap_close[] = { 57, 78, 81, 82, 84, 90 };
|
||||
for (int i = 0; i < array_length (gap_close); i++)
|
||||
- xclose (gap_close[i]);
|
||||
+ xclose (lowfd + gap_close[i]);
|
||||
|
||||
TEST_COMPARE (close_range (half_fd + 1, gap_1, CLOSE_RANGE_CLOEXEC), 0);
|
||||
for (int i = half_fd + 1; i < gap_1; i++)
|
||||
{
|
||||
int flags = fcntl (i, F_GETFD);
|
||||
- if (is_in_array (gap_close, array_length (gap_close), i))
|
||||
+ if (is_in_array (gap_close, array_length (gap_close), i - lowfd))
|
||||
TEST_COMPARE (flags, -1);
|
||||
else
|
||||
{
|
129
SOURCES/glibc-upstream-2.34-26.patch
Normal file
129
SOURCES/glibc-upstream-2.34-26.patch
Normal file
@ -0,0 +1,129 @@
|
||||
commit 33adeaa3e2b9143c38884bc5aa65ded222ed274e
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Sep 23 09:55:54 2021 +0200
|
||||
|
||||
nptl: Avoid setxid deadlock with blocked signals in thread exit [BZ #28361]
|
||||
|
||||
As part of the fix for bug 12889, signals are blocked during
|
||||
thread exit, so that application code cannot run on the thread that
|
||||
is about to exit. This would cause problems if the application
|
||||
expected signals to be delivered after the signal handler revealed
|
||||
the thread to still exist, despite pthread_kill can no longer be used
|
||||
to send signals to it. However, glibc internally uses the SIGSETXID
|
||||
signal in a way that is incompatible with signal blocking, due to the
|
||||
way the setxid handshake delays thread exit until the setxid operation
|
||||
has completed. With a blocked SIGSETXID, the handshake can never
|
||||
complete, causing a deadlock.
|
||||
|
||||
As a band-aid, restore the previous handshake protocol by not blocking
|
||||
SIGSETXID during thread exit.
|
||||
|
||||
The new test sysdeps/pthread/tst-pthread-setuid-loop.c is based on
|
||||
a downstream test by Martin Osvald.
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 2849e2f53311b66853cb5159b64cba2bddbfb854)
|
||||
|
||||
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
|
||||
index 33b426fc682300dc..bc213f0bc4e948bd 100644
|
||||
--- a/nptl/pthread_create.c
|
||||
+++ b/nptl/pthread_create.c
|
||||
@@ -488,8 +488,16 @@ start_thread (void *arg)
|
||||
|
||||
/* This prevents sending a signal from this thread to itself during
|
||||
its final stages. This must come after the exit call above
|
||||
- because atexit handlers must not run with signals blocked. */
|
||||
- __libc_signal_block_all (NULL);
|
||||
+ because atexit handlers must not run with signals blocked.
|
||||
+
|
||||
+ Do not block SIGSETXID. The setxid handshake below expects the
|
||||
+ signal to be delivered. (SIGSETXID cannot run application code,
|
||||
+ nor does it use pthread_kill.) Reuse the pd->sigmask space for
|
||||
+ computing the signal mask, to save stack space. */
|
||||
+ __sigfillset (&pd->sigmask);
|
||||
+ __sigdelset (&pd->sigmask, SIGSETXID);
|
||||
+ INTERNAL_SYSCALL_CALL (rt_sigprocmask, SIG_BLOCK, &pd->sigmask, NULL,
|
||||
+ __NSIG_BYTES);
|
||||
|
||||
/* Tell __pthread_kill_internal that this thread is about to exit.
|
||||
If there is a __pthread_kill_internal in progress, this delays
|
||||
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||
index 48dba717a1cdc20a..d4bd2d4e3ee6a496 100644
|
||||
--- a/sysdeps/pthread/Makefile
|
||||
+++ b/sysdeps/pthread/Makefile
|
||||
@@ -118,6 +118,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||
tst-unload \
|
||||
tst-unwind-thread \
|
||||
tst-pt-vfork1 tst-pt-vfork2 tst-vfork1x tst-vfork2x \
|
||||
+ tst-pthread-setuid-loop \
|
||||
tst-pthread_cancel-exited \
|
||||
tst-pthread_cancel-select-loop \
|
||||
tst-pthread_kill-exited \
|
||||
diff --git a/sysdeps/pthread/tst-pthread-setuid-loop.c b/sysdeps/pthread/tst-pthread-setuid-loop.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..fda2a49b7f0ccf81
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread-setuid-loop.c
|
||||
@@ -0,0 +1,61 @@
|
||||
+/* Test that setuid, pthread_create, thread exit do not deadlock (bug 28361).
|
||||
+ Copyright (C) 2021 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 <support/check.h>
|
||||
+#include <support/xthread.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+/* How many threads to launch during each iteration. */
|
||||
+enum { threads = 4 };
|
||||
+
|
||||
+/* How many iterations to perform. This value seems to reproduce
|
||||
+ bug 28361 in a bout one in three runs. */
|
||||
+enum { iterations = 5000 };
|
||||
+
|
||||
+/* Cache of the real user ID used by setuid_thread. */
|
||||
+static uid_t uid;
|
||||
+
|
||||
+/* Start routine for the threads. */
|
||||
+static void *
|
||||
+setuid_thread (void *closure)
|
||||
+{
|
||||
+ TEST_COMPARE (setuid (uid), 0);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ /* The setxid machinery is still invoked even if the UID is
|
||||
+ unchanged. (The kernel might reset other credentials as part of
|
||||
+ the system call.) */
|
||||
+ uid = getuid ();
|
||||
+
|
||||
+ for (int i = 0; i < iterations; ++i)
|
||||
+ {
|
||||
+ pthread_t thread_ids[threads];
|
||||
+ for (int j = 0; j < threads; ++j)
|
||||
+ thread_ids[j] = xpthread_create (NULL, setuid_thread, NULL);
|
||||
+ for (int j = 0; j < threads; ++j)
|
||||
+ xpthread_join (thread_ids[j]);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
37
SOURCES/glibc-upstream-2.34-27.patch
Normal file
37
SOURCES/glibc-upstream-2.34-27.patch
Normal file
@ -0,0 +1,37 @@
|
||||
commit 4bf72519987ebc2be4a2058c670379040fae90ea
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Oct 1 18:16:41 2021 +0200
|
||||
|
||||
support: Add check for TID zero in support_wait_for_thread_exit
|
||||
|
||||
Some kernel versions (observed with kernel 5.14 and earlier) can list
|
||||
"0" entries in /proc/self/task. This happens when a thread exits
|
||||
while the task list is being constructed. Treat this entry as not
|
||||
present, like the proposed kernel patch does:
|
||||
|
||||
[PATCH] procfs: Do not list TID 0 in /proc/<pid>/task
|
||||
<https://lore.kernel.org/all/8735pn5dx7.fsf@oldenburg.str.redhat.com/>
|
||||
|
||||
Fixes commit 032d74eaf6179100048a5bf0ce942e97dc8b9a60 ("support: Add
|
||||
support_wait_for_thread_exit").
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit 176c88f5214d8107d330971cbbfbbba5186a111f)
|
||||
|
||||
diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
|
||||
index 658a81381006ea62..5e3be421a78a4c78 100644
|
||||
--- a/support/support_wait_for_thread_exit.c
|
||||
+++ b/support/support_wait_for_thread_exit.c
|
||||
@@ -43,7 +43,10 @@ support_wait_for_thread_exit (void)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0)
|
||||
+ /* In some kernels, "0" entries denote a thread that has just
|
||||
+ exited. */
|
||||
+ if (strcmp (e->d_name, ".") == 0 || strcmp (e->d_name, "..") == 0
|
||||
+ || strcmp (e->d_name, "0") == 0)
|
||||
continue;
|
||||
|
||||
int task_tid = atoi (e->d_name);
|
154
SOURCES/glibc-upstream-2.34-28.patch
Normal file
154
SOURCES/glibc-upstream-2.34-28.patch
Normal file
@ -0,0 +1,154 @@
|
||||
commit 40bade26d5bcbda3d21fb598c5063d9df62de966
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Oct 1 18:16:41 2021 +0200
|
||||
|
||||
nptl: pthread_kill must send signals to a specific thread [BZ #28407]
|
||||
|
||||
The choice between the kill vs tgkill system calls is not just about
|
||||
the TID reuse race, but also about whether the signal is sent to the
|
||||
whole process (and any thread in it) or to a specific thread.
|
||||
|
||||
This was caught by the openposix test suite:
|
||||
|
||||
LTP: openposix test suite - FAIL: SIGUSR1 is member of new thread pendingset.
|
||||
<https://gitlab.com/cki-project/kernel-tests/-/issues/764>
|
||||
|
||||
Fixes commit 526c3cf11ee9367344b6b15d669e4c3cb461a2be ("nptl: Fix race
|
||||
between pthread_kill and thread exit (bug 12889)").
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
Tested-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit eae81d70574e923ce3c59078b8df857ae192efa6)
|
||||
|
||||
diff --git a/nptl/pthread_kill.c b/nptl/pthread_kill.c
|
||||
index a44dc8f2d9baa925..35bf1f973eaeda90 100644
|
||||
--- a/nptl/pthread_kill.c
|
||||
+++ b/nptl/pthread_kill.c
|
||||
@@ -40,7 +40,7 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
|
||||
below. POSIX only guarantees delivery of a single signal,
|
||||
which may not be the right one.) */
|
||||
pid_t tid = INTERNAL_SYSCALL_CALL (gettid);
|
||||
- int ret = INTERNAL_SYSCALL_CALL (kill, tid, signo);
|
||||
+ int ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), tid, signo);
|
||||
return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ __pthread_kill_implementation (pthread_t threadid, int signo, int no_tid)
|
||||
ret = no_tid;
|
||||
else
|
||||
{
|
||||
- /* Using tgkill is a safety measure. pd->exit_lock ensures that
|
||||
- the target thread cannot exit. */
|
||||
ret = INTERNAL_SYSCALL_CALL (tgkill, __getpid (), pd->tid, signo);
|
||||
ret = INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
|
||||
}
|
||||
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
|
||||
index d4bd2d4e3ee6a496..0af9c59b425aefb1 100644
|
||||
--- a/sysdeps/pthread/Makefile
|
||||
+++ b/sysdeps/pthread/Makefile
|
||||
@@ -121,6 +121,7 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
|
||||
tst-pthread-setuid-loop \
|
||||
tst-pthread_cancel-exited \
|
||||
tst-pthread_cancel-select-loop \
|
||||
+ tst-pthread-raise-blocked-self \
|
||||
tst-pthread_kill-exited \
|
||||
tst-pthread_kill-exiting \
|
||||
# tests
|
||||
diff --git a/sysdeps/pthread/tst-pthread-raise-blocked-self.c b/sysdeps/pthread/tst-pthread-raise-blocked-self.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..128e1a6071c0b15f
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/pthread/tst-pthread-raise-blocked-self.c
|
||||
@@ -0,0 +1,92 @@
|
||||
+/* Test that raise sends signal to current thread even if blocked.
|
||||
+ Copyright (C) 2021 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 <signal.h>
|
||||
+#include <support/check.h>
|
||||
+#include <support/xsignal.h>
|
||||
+#include <support/xthread.h>
|
||||
+#include <pthread.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+/* Used to create a dummy thread ID distinct from all other thread
|
||||
+ IDs. */
|
||||
+static void *
|
||||
+noop (void *ignored)
|
||||
+{
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static volatile pthread_t signal_thread;
|
||||
+
|
||||
+static void
|
||||
+signal_handler (int signo)
|
||||
+{
|
||||
+ signal_thread = pthread_self ();
|
||||
+}
|
||||
+
|
||||
+/* Used to ensure that waiting_thread has launched and can accept
|
||||
+ signals. */
|
||||
+static pthread_barrier_t barrier;
|
||||
+
|
||||
+static void *
|
||||
+waiting_thread (void *ignored)
|
||||
+{
|
||||
+ xpthread_barrier_wait (&barrier);
|
||||
+ pause ();
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ xsignal (SIGUSR1, signal_handler);
|
||||
+ xpthread_barrier_init (&barrier, NULL, 2);
|
||||
+
|
||||
+ /* Distinct thread ID value to */
|
||||
+ pthread_t dummy = xpthread_create (NULL, noop, NULL);
|
||||
+ signal_thread = dummy;
|
||||
+
|
||||
+ pthread_t helper = xpthread_create (NULL, waiting_thread, NULL);
|
||||
+
|
||||
+ /* Make sure that the thread is running. */
|
||||
+ xpthread_barrier_wait (&barrier);
|
||||
+
|
||||
+ /* Block signals on this thread. */
|
||||
+ sigset_t set;
|
||||
+ sigfillset (&set);
|
||||
+ xpthread_sigmask (SIG_BLOCK, &set, NULL);
|
||||
+
|
||||
+ /* Send the signal to this thread. It must not be delivered. */
|
||||
+ raise (SIGUSR1);
|
||||
+ TEST_VERIFY (signal_thread == dummy);
|
||||
+
|
||||
+ /* Wait a bit to give a chance for signal delivery (increases
|
||||
+ chances of failure with bug 28407). */
|
||||
+ usleep (50 * 1000);
|
||||
+
|
||||
+ /* Unblocking should cause synchronous delivery of the signal. */
|
||||
+ xpthread_sigmask (SIG_UNBLOCK, &set, NULL);
|
||||
+ TEST_VERIFY (signal_thread == pthread_self ());
|
||||
+
|
||||
+ xpthread_cancel (helper);
|
||||
+ xpthread_join (helper);
|
||||
+ xpthread_join (dummy);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
101
SOURCES/glibc-upstream-2.34-29.patch
Normal file
101
SOURCES/glibc-upstream-2.34-29.patch
Normal file
@ -0,0 +1,101 @@
|
||||
commit e870aac8974cda746157a5a3c9f452ccd70da29b
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon Sep 6 12:22:54 2021 -0300
|
||||
|
||||
misc: Add __get_nprocs_sched
|
||||
|
||||
This is an internal function meant to return the number of avaliable
|
||||
processor where the process can scheduled, different than the
|
||||
__get_nprocs which returns a the system available online CPU.
|
||||
|
||||
The Linux implementation currently only calls __get_nprocs(), which
|
||||
in tuns calls sched_getaffinity.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 11a02b035b464ab6813676adfd19c4a59c36d907)
|
||||
|
||||
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
|
||||
index 7388356a19269335..c490561581733038 100644
|
||||
--- a/include/sys/sysinfo.h
|
||||
+++ b/include/sys/sysinfo.h
|
||||
@@ -9,10 +9,15 @@
|
||||
extern int __get_nprocs_conf (void);
|
||||
libc_hidden_proto (__get_nprocs_conf)
|
||||
|
||||
-/* Return number of available processors. */
|
||||
+/* Return number of available processors (not all of them will be
|
||||
+ available to the caller process). */
|
||||
extern int __get_nprocs (void);
|
||||
libc_hidden_proto (__get_nprocs)
|
||||
|
||||
+/* Return the number of available processors which the process can
|
||||
+ be scheduled. */
|
||||
+extern int __get_nprocs_sched (void) attribute_hidden;
|
||||
+
|
||||
/* 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 667484630ed0afa5..f1f0af86489d0063 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 ();
|
||||
+ int n = __get_nprocs_sched ();
|
||||
|
||||
if (n >= 1)
|
||||
narenas_limit = NARENAS_FROM_NCORES (n);
|
||||
diff --git a/misc/getsysstats.c b/misc/getsysstats.c
|
||||
index 0eedface6d2b0f75..57d93601e21265d7 100644
|
||||
--- a/misc/getsysstats.c
|
||||
+++ b/misc/getsysstats.c
|
||||
@@ -45,6 +45,12 @@ weak_alias (__get_nprocs, get_nprocs)
|
||||
link_warning (get_nprocs, "warning: get_nprocs will always return 1")
|
||||
|
||||
|
||||
+int
|
||||
+__get_nprocs_sched (void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
long int
|
||||
__get_phys_pages (void)
|
||||
{
|
||||
diff --git a/sysdeps/mach/getsysstats.c b/sysdeps/mach/getsysstats.c
|
||||
index 1267f39da26aee38..cc8023f979bf6f74 100644
|
||||
--- a/sysdeps/mach/getsysstats.c
|
||||
+++ b/sysdeps/mach/getsysstats.c
|
||||
@@ -62,6 +62,12 @@ __get_nprocs (void)
|
||||
libc_hidden_def (__get_nprocs)
|
||||
weak_alias (__get_nprocs, get_nprocs)
|
||||
|
||||
+int
|
||||
+__get_nprocs_sched (void)
|
||||
+{
|
||||
+ return __get_nprocs ();
|
||||
+}
|
||||
+
|
||||
/* Return the number of physical pages on the system. */
|
||||
long int
|
||||
__get_phys_pages (void)
|
||||
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
index 1391e360b8f8e86c..120ce1bb756b09cc 100644
|
||||
--- a/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
@@ -88,6 +88,12 @@ __get_nprocs (void)
|
||||
libc_hidden_def (__get_nprocs)
|
||||
weak_alias (__get_nprocs, get_nprocs)
|
||||
|
||||
+int
|
||||
+__get_nprocs_sched (void)
|
||||
+{
|
||||
+ return __get_nprocs ();
|
||||
+}
|
||||
+
|
||||
|
||||
/* On some architectures it is possible to distinguish between configured
|
||||
and active cpus. */
|
32
SOURCES/glibc-upstream-2.34-3.patch
Normal file
32
SOURCES/glibc-upstream-2.34-3.patch
Normal file
@ -0,0 +1,32 @@
|
||||
commit a5bd2e10e0c25b80286dc36068e22a4cb4893af0
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Tue Aug 3 21:11:03 2021 +0530
|
||||
|
||||
gaiconf_init: Avoid double-free in label and precedence lists
|
||||
|
||||
labellist and precedencelist could get freed a second time if there
|
||||
are allocation failures, so set them to NULL to avoid a double-free.
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 77a34079d8f3d63b61543bf3af93043f8674e4c4)
|
||||
|
||||
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
|
||||
index 838a68f0229b5aa8..43dfc6739e350a58 100644
|
||||
--- a/sysdeps/posix/getaddrinfo.c
|
||||
+++ b/sysdeps/posix/getaddrinfo.c
|
||||
@@ -2008,6 +2008,7 @@ gaiconf_init (void)
|
||||
l = l->next;
|
||||
}
|
||||
free_prefixlist (labellist);
|
||||
+ labellist = NULL;
|
||||
|
||||
/* Sort the entries so that the most specific ones are at
|
||||
the beginning. */
|
||||
@@ -2046,6 +2047,7 @@ gaiconf_init (void)
|
||||
l = l->next;
|
||||
}
|
||||
free_prefixlist (precedencelist);
|
||||
+ precedencelist = NULL;
|
||||
|
||||
/* Sort the entries so that the most specific ones are at
|
||||
the beginning. */
|
208
SOURCES/glibc-upstream-2.34-30.patch
Normal file
208
SOURCES/glibc-upstream-2.34-30.patch
Normal file
@ -0,0 +1,208 @@
|
||||
commit cda99af14e82b4bb6abaecd717ebe3b57c0aa534
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon Sep 6 12:28:24 2021 -0300
|
||||
|
||||
linux: Simplify get_nprocs
|
||||
|
||||
This patch simplifies the memory allocation code and uses the sched
|
||||
routines instead of reimplement it. This still uses a stack
|
||||
allocation buffer, so it can be used on malloc initialization code.
|
||||
|
||||
Linux currently supports at maximum of 4096 cpus for most architectures:
|
||||
|
||||
$ find -iname Kconfig | xargs git grep -A10 -w NR_CPUS | grep -w range
|
||||
arch/alpha/Kconfig- range 2 32
|
||||
arch/arc/Kconfig- range 2 4096
|
||||
arch/arm/Kconfig- range 2 16 if DEBUG_KMAP_LOCAL
|
||||
arch/arm/Kconfig- range 2 32 if !DEBUG_KMAP_LOCAL
|
||||
arch/arm64/Kconfig- range 2 4096
|
||||
arch/csky/Kconfig- range 2 32
|
||||
arch/hexagon/Kconfig- range 2 6 if SMP
|
||||
arch/ia64/Kconfig- range 2 4096
|
||||
arch/mips/Kconfig- range 2 256
|
||||
arch/openrisc/Kconfig- range 2 32
|
||||
arch/parisc/Kconfig- range 2 32
|
||||
arch/riscv/Kconfig- range 2 32
|
||||
arch/s390/Kconfig- range 2 512
|
||||
arch/sh/Kconfig- range 2 32
|
||||
arch/sparc/Kconfig- range 2 32 if SPARC32
|
||||
arch/sparc/Kconfig- range 2 4096 if SPARC64
|
||||
arch/um/Kconfig- range 1 1
|
||||
arch/x86/Kconfig-# [NR_CPUS_RANGE_BEGIN ... NR_CPUS_RANGE_END] range.
|
||||
arch/x86/Kconfig- range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
|
||||
arch/xtensa/Kconfig- range 2 32
|
||||
|
||||
With x86 supporting 8192:
|
||||
|
||||
arch/x86/Kconfig
|
||||
976 config NR_CPUS_RANGE_END
|
||||
977 int
|
||||
978 depends on X86_64
|
||||
979 default 8192 if SMP && CPUMASK_OFFSTACK
|
||||
980 default 512 if SMP && !CPUMASK_OFFSTACK
|
||||
981 default 1 if !SMP
|
||||
|
||||
So using a maximum of 32k cpu should cover all cases (and I would
|
||||
expect once we start to have many more CPUs that Linux would provide
|
||||
a more straightforward way to query for such information).
|
||||
|
||||
A test is added to check if sched_getaffinity can successfully return
|
||||
with large buffers.
|
||||
|
||||
Checked on x86_64-linux-gnu and i686-linux-gnu.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 33099d72e41cf8a129b362e9709eb2be9372d844)
|
||||
|
||||
diff --git a/posix/Makefile b/posix/Makefile
|
||||
index a5229777eeb0e067..61fcdf015b4ec83b 100644
|
||||
--- a/posix/Makefile
|
||||
+++ b/posix/Makefile
|
||||
@@ -107,7 +107,8 @@ tests := test-errno tstgetopt testfnm runtests runptests \
|
||||
tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
|
||||
tst-glob-tilde test-ssize-max tst-spawn4 bug-regex37 \
|
||||
bug-regex38 tst-regcomp-truncated tst-spawn-chdir \
|
||||
- tst-wordexp-nocmd tst-execveat tst-spawn5
|
||||
+ tst-wordexp-nocmd tst-execveat tst-spawn5 \
|
||||
+ tst-sched_getaffinity
|
||||
|
||||
# Test for the glob symbol version that was replaced in glibc 2.27.
|
||||
ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
|
||||
diff --git a/posix/tst-sched_getaffinity.c b/posix/tst-sched_getaffinity.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..db9d517a96fdd99e
|
||||
--- /dev/null
|
||||
+++ b/posix/tst-sched_getaffinity.c
|
||||
@@ -0,0 +1,48 @@
|
||||
+/* Tests for sched_getaffinity with large buffers.
|
||||
+ Copyright (C) 2021 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 <array_length.h>
|
||||
+#include <sched.h>
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+/* NB: this test may fail on system with more than 32k cpus. */
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ /* The values are larger than the default cpu_set_t. */
|
||||
+ const int bufsize[] = { 1<<11, 1<<12, 1<<13, 1<<14, 1<<15, 1<<16, 1<<17 };
|
||||
+ int cpucount[array_length (bufsize)];
|
||||
+
|
||||
+ for (int i = 0; i < array_length (bufsize); i++)
|
||||
+ {
|
||||
+ cpu_set_t *cpuset = CPU_ALLOC (bufsize[i]);
|
||||
+ TEST_VERIFY (cpuset != NULL);
|
||||
+ size_t size = CPU_ALLOC_SIZE (bufsize[i]);
|
||||
+ TEST_COMPARE (sched_getaffinity (0, size, cpuset), 0);
|
||||
+ cpucount[i] = CPU_COUNT_S (size, cpuset);
|
||||
+ CPU_FREE (cpuset);
|
||||
+ }
|
||||
+
|
||||
+ for (int i = 0; i < array_length (cpucount) - 1; i++)
|
||||
+ TEST_COMPARE (cpucount[i], cpucount[i + 1]);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
index 120ce1bb756b09cc..61d20e7bab8640f2 100644
|
||||
--- a/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
@@ -29,61 +29,29 @@
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
-/* Compute the population count of the entire array. */
|
||||
-static int
|
||||
-__get_nprocs_count (const unsigned long int *array, size_t length)
|
||||
-{
|
||||
- int count = 0;
|
||||
- for (size_t i = 0; i < length; ++i)
|
||||
- if (__builtin_add_overflow (count, __builtin_popcountl (array[i]),
|
||||
- &count))
|
||||
- return INT_MAX;
|
||||
- return count;
|
||||
-}
|
||||
-
|
||||
-/* __get_nprocs with a large buffer. */
|
||||
-static int
|
||||
-__get_nprocs_large (void)
|
||||
-{
|
||||
- /* This code cannot use scratch_buffer because it is used during
|
||||
- malloc initialization. */
|
||||
- size_t pagesize = GLRO (dl_pagesize);
|
||||
- unsigned long int *page = __mmap (0, pagesize, PROT_READ | PROT_WRITE,
|
||||
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
- if (page == MAP_FAILED)
|
||||
- return 2;
|
||||
- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, pagesize, page);
|
||||
- int count;
|
||||
- if (r > 0)
|
||||
- count = __get_nprocs_count (page, pagesize / sizeof (unsigned long int));
|
||||
- else if (r == -EINVAL)
|
||||
- /* One page is still not enough to store the bits. A more-or-less
|
||||
- arbitrary value. This assumes t hat such large systems never
|
||||
- happen in practice. */
|
||||
- count = GLRO (dl_pagesize) * CHAR_BIT;
|
||||
- else
|
||||
- count = 2;
|
||||
- __munmap (page, GLRO (dl_pagesize));
|
||||
- return count;
|
||||
-}
|
||||
-
|
||||
int
|
||||
__get_nprocs (void)
|
||||
{
|
||||
- /* Fast path for most systems. The kernel expects a buffer size
|
||||
- that is a multiple of 8. */
|
||||
- unsigned long int small_buffer[1024 / CHAR_BIT / sizeof (unsigned long int)];
|
||||
- int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0,
|
||||
- sizeof (small_buffer), small_buffer);
|
||||
+ enum
|
||||
+ {
|
||||
+ max_num_cpus = 32768,
|
||||
+ cpu_bits_size = CPU_ALLOC_SIZE (32768)
|
||||
+ };
|
||||
+
|
||||
+ /* This cannot use malloc because it is used on malloc initialization. */
|
||||
+ __cpu_mask cpu_bits[cpu_bits_size / sizeof (__cpu_mask)];
|
||||
+ int r = INTERNAL_SYSCALL_CALL (sched_getaffinity, 0, cpu_bits_size,
|
||||
+ cpu_bits);
|
||||
if (r > 0)
|
||||
- return __get_nprocs_count (small_buffer, r / sizeof (unsigned long int));
|
||||
+ return CPU_COUNT_S (cpu_bits_size, (cpu_set_t*) cpu_bits);
|
||||
else if (r == -EINVAL)
|
||||
- /* The kernel requests a larger buffer to store the data. */
|
||||
- return __get_nprocs_large ();
|
||||
- else
|
||||
- /* Some other error. 2 is conservative (not a uniprocessor
|
||||
- system, so atomics are needed). */
|
||||
- return 2;
|
||||
+ /* The input buffer is still not enough to store the number of cpus. This
|
||||
+ is an arbitrary values assuming such systems should be rare and there
|
||||
+ is no offline cpus. */
|
||||
+ return max_num_cpus;
|
||||
+ /* Some other error. 2 is conservative (not a uniprocessor system, so
|
||||
+ atomics are needed). */
|
||||
+ return 2;
|
||||
}
|
||||
libc_hidden_def (__get_nprocs)
|
||||
weak_alias (__get_nprocs, get_nprocs)
|
201
SOURCES/glibc-upstream-2.34-31.patch
Normal file
201
SOURCES/glibc-upstream-2.34-31.patch
Normal file
@ -0,0 +1,201 @@
|
||||
commit 822662cf2a4b170ade4c5342f035d68815a03276
|
||||
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||
Date: Mon Sep 6 14:19:51 2021 -0300
|
||||
|
||||
linux: Revert the use of sched_getaffinity on get_nproc (BZ #28310)
|
||||
|
||||
The use of sched_getaffinity on get_nproc and
|
||||
sysconf (_SC_NPROCESSORS_ONLN) done in 903bc7dcc2acafc40 (BZ #27645)
|
||||
breaks the top command in common hypervisor configurations and also
|
||||
other monitoring tools.
|
||||
|
||||
The main issue using sched_getaffinity changed the symbols semantic
|
||||
from system-wide scope of online CPUs to per-process one (which can
|
||||
be changed with kernel cpusets or book parameters in VM).
|
||||
|
||||
This patch reverts mostly of the 903bc7dcc2acafc40, with the
|
||||
exceptions:
|
||||
|
||||
* No more cached values and atomic updates, since they are inherent
|
||||
racy.
|
||||
|
||||
* No /proc/cpuinfo fallback, since /proc/stat is already used and
|
||||
it would require to revert more arch-specific code.
|
||||
|
||||
* The alloca is replace with a static buffer of 1024 bytes.
|
||||
|
||||
So the implementation first consult the sysfs, and fallbacks to procfs.
|
||||
|
||||
Checked on x86_64-linux-gnu.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit 342298278eabc75baabcaced110a11a02c3d3580)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
index 61d20e7bab8640f2..d70ed9586950615c 100644
|
||||
--- a/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
+++ b/sysdeps/unix/sysv/linux/getsysstats.c
|
||||
@@ -18,6 +18,8 @@
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <array_length.h>
|
||||
+#include <assert.h>
|
||||
+#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <ldsodefs.h>
|
||||
@@ -30,7 +32,7 @@
|
||||
#include <sysdep.h>
|
||||
|
||||
int
|
||||
-__get_nprocs (void)
|
||||
+__get_nprocs_sched (void)
|
||||
{
|
||||
enum
|
||||
{
|
||||
@@ -53,14 +55,141 @@ __get_nprocs (void)
|
||||
atomics are needed). */
|
||||
return 2;
|
||||
}
|
||||
-libc_hidden_def (__get_nprocs)
|
||||
-weak_alias (__get_nprocs, get_nprocs)
|
||||
+
|
||||
+static char *
|
||||
+next_line (int fd, char *const buffer, char **cp, char **re,
|
||||
+ char *const buffer_end)
|
||||
+{
|
||||
+ char *res = *cp;
|
||||
+ char *nl = memchr (*cp, '\n', *re - *cp);
|
||||
+ if (nl == NULL)
|
||||
+ {
|
||||
+ if (*cp != buffer)
|
||||
+ {
|
||||
+ if (*re == buffer_end)
|
||||
+ {
|
||||
+ memmove (buffer, *cp, *re - *cp);
|
||||
+ *re = buffer + (*re - *cp);
|
||||
+ *cp = buffer;
|
||||
+
|
||||
+ ssize_t n = __read_nocancel (fd, *re, buffer_end - *re);
|
||||
+ if (n < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ *re += n;
|
||||
+
|
||||
+ nl = memchr (*cp, '\n', *re - *cp);
|
||||
+ while (nl == NULL && *re == buffer_end)
|
||||
+ {
|
||||
+ /* Truncate too long lines. */
|
||||
+ *re = buffer + 3 * (buffer_end - buffer) / 4;
|
||||
+ n = __read_nocancel (fd, *re, buffer_end - *re);
|
||||
+ if (n < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ nl = memchr (*re, '\n', n);
|
||||
+ **re = '\n';
|
||||
+ *re += n;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ nl = memchr (*cp, '\n', *re - *cp);
|
||||
+
|
||||
+ res = *cp;
|
||||
+ }
|
||||
+
|
||||
+ if (nl == NULL)
|
||||
+ nl = *re - 1;
|
||||
+ }
|
||||
+
|
||||
+ *cp = nl + 1;
|
||||
+ assert (*cp <= *re);
|
||||
+
|
||||
+ return res == *re ? NULL : res;
|
||||
+}
|
||||
+
|
||||
|
||||
int
|
||||
-__get_nprocs_sched (void)
|
||||
+__get_nprocs (void)
|
||||
{
|
||||
- return __get_nprocs ();
|
||||
+ enum { buffer_size = 1024 };
|
||||
+ char buffer[buffer_size];
|
||||
+ char *buffer_end = buffer + buffer_size;
|
||||
+ char *cp = buffer_end;
|
||||
+ char *re = buffer_end;
|
||||
+
|
||||
+ const int flags = O_RDONLY | O_CLOEXEC;
|
||||
+ /* This file contains comma-separated ranges. */
|
||||
+ int fd = __open_nocancel ("/sys/devices/system/cpu/online", flags);
|
||||
+ char *l;
|
||||
+ int result = 0;
|
||||
+ if (fd != -1)
|
||||
+ {
|
||||
+ l = next_line (fd, buffer, &cp, &re, buffer_end);
|
||||
+ if (l != NULL)
|
||||
+ do
|
||||
+ {
|
||||
+ char *endp;
|
||||
+ unsigned long int n = strtoul (l, &endp, 10);
|
||||
+ if (l == endp)
|
||||
+ {
|
||||
+ result = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ unsigned long int m = n;
|
||||
+ if (*endp == '-')
|
||||
+ {
|
||||
+ l = endp + 1;
|
||||
+ m = strtoul (l, &endp, 10);
|
||||
+ if (l == endp)
|
||||
+ {
|
||||
+ result = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ result += m - n + 1;
|
||||
+
|
||||
+ l = endp;
|
||||
+ if (l < re && *l == ',')
|
||||
+ ++l;
|
||||
+ }
|
||||
+ while (l < re && *l != '\n');
|
||||
+
|
||||
+ __close_nocancel_nostatus (fd);
|
||||
+
|
||||
+ if (result > 0)
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ cp = buffer_end;
|
||||
+ re = buffer_end;
|
||||
+
|
||||
+ /* Default to an SMP system in case we cannot obtain an accurate
|
||||
+ number. */
|
||||
+ result = 2;
|
||||
+
|
||||
+ fd = __open_nocancel ("/proc/stat", flags);
|
||||
+ if (fd != -1)
|
||||
+ {
|
||||
+ result = 0;
|
||||
+
|
||||
+ while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
|
||||
+ /* The current format of /proc/stat has all the cpu* entries
|
||||
+ at the front. We assume here that stays this way. */
|
||||
+ if (strncmp (l, "cpu", 3) != 0)
|
||||
+ break;
|
||||
+ else if (isdigit (l[3]))
|
||||
+ ++result;
|
||||
+
|
||||
+ __close_nocancel_nostatus (fd);
|
||||
+ }
|
||||
+
|
||||
+ return result;
|
||||
}
|
||||
+libc_hidden_def (__get_nprocs)
|
||||
+weak_alias (__get_nprocs, get_nprocs)
|
||||
|
||||
|
||||
/* On some architectures it is possible to distinguish between configured
|
42
SOURCES/glibc-upstream-2.34-32.patch
Normal file
42
SOURCES/glibc-upstream-2.34-32.patch
Normal file
@ -0,0 +1,42 @@
|
||||
commit 80a009119ba2330768120476aaad63767b81d543
|
||||
Author: Jonathan Wakely <jwakely@redhat.com>
|
||||
Date: Wed May 19 16:48:19 2021 +0100
|
||||
|
||||
Suppress -Wcast-qual warnings in bsearch
|
||||
|
||||
The first cast to (void *) is redundant but should be (const void *)
|
||||
anyway, because that's the type of the lvalue being assigned to.
|
||||
|
||||
The second cast is necessary and intentionally not const-correct, so
|
||||
tell the compiler not to warn about it.
|
||||
|
||||
Reviewed-by: Florian Weimer <fweimer@redhat.com>
|
||||
(cherry picked from commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7)
|
||||
|
||||
diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h
|
||||
index 4132dc6af0077f31..d688ed2e15678e9c 100644
|
||||
--- a/bits/stdlib-bsearch.h
|
||||
+++ b/bits/stdlib-bsearch.h
|
||||
@@ -29,14 +29,21 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
|
||||
while (__l < __u)
|
||||
{
|
||||
__idx = (__l + __u) / 2;
|
||||
- __p = (void *) (((const char *) __base) + (__idx * __size));
|
||||
+ __p = (const void *) (((const char *) __base) + (__idx * __size));
|
||||
__comparison = (*__compar) (__key, __p);
|
||||
if (__comparison < 0)
|
||||
__u = __idx;
|
||||
else if (__comparison > 0)
|
||||
__l = __idx + 1;
|
||||
else
|
||||
+#if __GNUC_PREREQ(4, 6)
|
||||
+# pragma GCC diagnostic push
|
||||
+# pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
+#endif
|
||||
return (void *) __p;
|
||||
+#if __GNUC_PREREQ(4, 6)
|
||||
+# pragma GCC diagnostic pop
|
||||
+#endif
|
||||
}
|
||||
|
||||
return NULL;
|
37
SOURCES/glibc-upstream-2.34-33.patch
Normal file
37
SOURCES/glibc-upstream-2.34-33.patch
Normal file
@ -0,0 +1,37 @@
|
||||
commit a996d13b8a2e101bedbb1bdaa7ffcfea3b959bb2
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Thu Sep 30 18:44:06 2021 +0200
|
||||
|
||||
Add missing braces to bsearch inline implementation [BZ #28400]
|
||||
|
||||
GCC treats the pragma as a statement, so that the else branch only
|
||||
consists of the pragma, not the return statement.
|
||||
|
||||
Fixes commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7 ("Suppress
|
||||
-Wcast-qual warnings in bsearch").
|
||||
|
||||
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
|
||||
(cherry picked from commit 32b96d0dec0294465d2221a8f049703599d9d8e4)
|
||||
|
||||
diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h
|
||||
index d688ed2e15678e9c..e2fcea6e172af72c 100644
|
||||
--- a/bits/stdlib-bsearch.h
|
||||
+++ b/bits/stdlib-bsearch.h
|
||||
@@ -36,14 +36,16 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
|
||||
else if (__comparison > 0)
|
||||
__l = __idx + 1;
|
||||
else
|
||||
+ {
|
||||
#if __GNUC_PREREQ(4, 6)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wcast-qual"
|
||||
#endif
|
||||
- return (void *) __p;
|
||||
+ return (void *) __p;
|
||||
#if __GNUC_PREREQ(4, 6)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
+ }
|
||||
}
|
||||
|
||||
return NULL;
|
24
SOURCES/glibc-upstream-2.34-4.patch
Normal file
24
SOURCES/glibc-upstream-2.34-4.patch
Normal file
@ -0,0 +1,24 @@
|
||||
commit 7ff4da3dc26de351a5abe7c2905038cbe55c8041
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Tue Aug 3 21:10:53 2021 +0530
|
||||
|
||||
copy_and_spawn_sgid: Avoid double calls to close()
|
||||
|
||||
If close() on infd and outfd succeeded, reset the fd numbers so that
|
||||
we don't attempt to close them again.
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 45caed9d67a00af917d8b5b88d4b5eb1225b7aef)
|
||||
|
||||
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
|
||||
index 27bfd19c9374a183..0bacf6dbc23b0732 100644
|
||||
--- a/support/support_capture_subprocess.c
|
||||
+++ b/support/support_capture_subprocess.c
|
||||
@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
|
||||
support_subprogram because we only want the program exit status, not the
|
||||
contents. */
|
||||
ret = 0;
|
||||
+ infd = outfd = -1;
|
||||
|
||||
char * const args[] = {execname, child_id, NULL};
|
||||
|
22
SOURCES/glibc-upstream-2.34-5.patch
Normal file
22
SOURCES/glibc-upstream-2.34-5.patch
Normal file
@ -0,0 +1,22 @@
|
||||
commit 9995d0588f4f9adc68419224d2b3698e2ca4f77e
|
||||
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
Date: Tue Aug 3 21:10:29 2021 +0530
|
||||
|
||||
iconv_charmap: Close output file when done
|
||||
|
||||
Reviewed-by: Arjun Shankar <arjun@redhat.com>
|
||||
(cherry picked from commit 1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff)
|
||||
|
||||
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
|
||||
index e2d53fee3cbfbb7a..a8b6b56124909f6c 100644
|
||||
--- a/iconv/iconv_charmap.c
|
||||
+++ b/iconv/iconv_charmap.c
|
||||
@@ -234,6 +234,8 @@ charmap_conversion (const char *from_code, struct charmap_t *from_charmap,
|
||||
while (++remaining < argc);
|
||||
|
||||
/* All done. */
|
||||
+ if (output != stdout)
|
||||
+ fclose (output);
|
||||
free_table (cvtbl);
|
||||
return status;
|
||||
}
|
65
SOURCES/glibc-upstream-2.34-6.patch
Normal file
65
SOURCES/glibc-upstream-2.34-6.patch
Normal file
@ -0,0 +1,65 @@
|
||||
commit 31902ae639d6a50e768a85f1cd2a17e56b8463c2
|
||||
Author: Florian Weimer <fweimer@redhat.com>
|
||||
Date: Fri Aug 6 09:51:38 2021 +0200
|
||||
|
||||
Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182)
|
||||
|
||||
__REDIRECT and __THROW are not compatible with C++ due to the ordering of the
|
||||
__asm__ alias and the throw specifier. __REDIRECT_NTH has to be used
|
||||
instead.
|
||||
|
||||
Fixes commit 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias
|
||||
for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add
|
||||
time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158
|
||||
("Linux: Add time64 alias for prctl").
|
||||
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
(cherry picked from commit c87fcacc50505d550f1bb038382bcc7ea73a5926)
|
||||
|
||||
diff --git a/io/fcntl.h b/io/fcntl.h
|
||||
index 8917a73b420b503d..1c96f98f4d75ce65 100644
|
||||
--- a/io/fcntl.h
|
||||
+++ b/io/fcntl.h
|
||||
@@ -187,10 +187,10 @@ extern int fcntl64 (int __fd, int __cmd, ...);
|
||||
# endif
|
||||
#else /* __USE_TIME_BITS64 */
|
||||
# ifdef __REDIRECT
|
||||
-extern int __REDIRECT (fcntl, (int __fd, int __request, ...),
|
||||
- __fcntl_time64) __THROW;
|
||||
-extern int __REDIRECT (fcntl64, (int __fd, int __request, ...),
|
||||
- __fcntl_time64) __THROW;
|
||||
+extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
|
||||
+ __fcntl_time64);
|
||||
+extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
|
||||
+ __fcntl_time64);
|
||||
# else
|
||||
extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
|
||||
# define fcntl64 __fcntl_time64
|
||||
diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h
|
||||
index 6884d9925f06125f..9945c1e9181eb313 100644
|
||||
--- a/misc/sys/ioctl.h
|
||||
+++ b/misc/sys/ioctl.h
|
||||
@@ -42,8 +42,8 @@ __BEGIN_DECLS
|
||||
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
-extern int __REDIRECT (ioctl, (int __fd, unsigned long int __request, ...),
|
||||
- __ioctl_time64) __THROW;
|
||||
+extern int __REDIRECT_NTH (ioctl, (int __fd, unsigned long int __request, ...),
|
||||
+ __ioctl_time64);
|
||||
# else
|
||||
extern int __ioctl_time64 (int __fd, unsigned long int __request, ...) __THROW;
|
||||
# define ioctl __ioctl_time64
|
||||
diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h
|
||||
index db88938b3a542b0b..f0e0d2f27f9b9ee9 100644
|
||||
--- a/sysdeps/unix/sysv/linux/sys/prctl.h
|
||||
+++ b/sysdeps/unix/sysv/linux/sys/prctl.h
|
||||
@@ -42,7 +42,7 @@ __BEGIN_DECLS
|
||||
extern int prctl (int __option, ...) __THROW;
|
||||
#else
|
||||
# ifdef __REDIRECT
|
||||
-extern int __REDIRECT (prctl, (int __option, ...), __prctl_time64) __THROW;
|
||||
+extern int __REDIRECT_NTH (prctl, (int __option, ...), __prctl_time64);
|
||||
# else
|
||||
extern int __prctl_time64 (int __option,d ...) __THROW;
|
||||
# define ioctl __prctl_time64
|
35
SOURCES/glibc-upstream-2.34-7.patch
Normal file
35
SOURCES/glibc-upstream-2.34-7.patch
Normal file
@ -0,0 +1,35 @@
|
||||
commit 79474303223c5665bec75ffbdb2a86ee04a2514b
|
||||
Author: Nikita Popov <npv1310@gmail.com>
|
||||
Date: Mon Aug 9 20:17:34 2021 +0530
|
||||
|
||||
librt: fix NULL pointer dereference (bug 28213)
|
||||
|
||||
Helper thread frees copied attribute on NOTIFY_REMOVED message
|
||||
received from the OS kernel. Unfortunately, it fails to check whether
|
||||
copied attribute actually exists (data.attr != NULL). This worked
|
||||
earlier because free() checks passed pointer before actually
|
||||
attempting to release corresponding memory. But
|
||||
__pthread_attr_destroy assumes pointer is not NULL.
|
||||
|
||||
So passing NULL pointer to __pthread_attr_destroy will result in
|
||||
segmentation fault. This scenario is possible if
|
||||
notification->sigev_notify_attributes == NULL (which means default
|
||||
thread attributes should be used).
|
||||
|
||||
Signed-off-by: Nikita Popov <npv1310@gmail.com>
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit b805aebd42364fe696e417808a700fdb9800c9e8)
|
||||
|
||||
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
index 9799dcdaa479a1d5..eccae2e4c6cdfefa 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
@@ -131,7 +131,7 @@ helper_thread (void *arg)
|
||||
to wait until it is done with it. */
|
||||
(void) __pthread_barrier_wait (¬ify_barrier);
|
||||
}
|
||||
- else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED)
|
||||
+ else if (data.raw[NOTIFY_COOKIE_LEN - 1] == NOTIFY_REMOVED && data.attr != NULL)
|
||||
{
|
||||
/* The only state we keep is the copy of the thread attributes. */
|
||||
__pthread_attr_destroy (data.attr);
|
140
SOURCES/glibc-upstream-2.34-8.patch
Normal file
140
SOURCES/glibc-upstream-2.34-8.patch
Normal file
@ -0,0 +1,140 @@
|
||||
commit 7c987a5ccb31df80456d53a094e47f81310f549b
|
||||
Author: Nikita Popov <npv1310@gmail.com>
|
||||
Date: Thu Aug 12 16:09:50 2021 +0530
|
||||
|
||||
librt: add test (bug 28213)
|
||||
|
||||
This test implements following logic:
|
||||
1) Create POSIX message queue.
|
||||
Register a notification with mq_notify (using NULL attributes).
|
||||
Then immediately unregister the notification with mq_notify.
|
||||
Helper thread in a vulnerable version of glibc
|
||||
should cause NULL pointer dereference after these steps.
|
||||
2) Once again, register the same notification.
|
||||
Try to send a dummy message.
|
||||
Test is considered successfulif the dummy message
|
||||
is successfully received by the callback function.
|
||||
|
||||
Signed-off-by: Nikita Popov <npv1310@gmail.com>
|
||||
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||
(cherry picked from commit 4cc79c217744743077bf7a0ec5e0a4318f1e6641)
|
||||
|
||||
diff --git a/rt/Makefile b/rt/Makefile
|
||||
index 113cea03a5b75613..910e7759956d7ae9 100644
|
||||
--- a/rt/Makefile
|
||||
+++ b/rt/Makefile
|
||||
@@ -74,6 +74,7 @@ tests := tst-shm tst-timer tst-timer2 \
|
||||
tst-aio7 tst-aio8 tst-aio9 tst-aio10 \
|
||||
tst-mqueue1 tst-mqueue2 tst-mqueue3 tst-mqueue4 \
|
||||
tst-mqueue5 tst-mqueue6 tst-mqueue7 tst-mqueue8 tst-mqueue9 \
|
||||
+ tst-bz28213 \
|
||||
tst-timer3 tst-timer4 tst-timer5 \
|
||||
tst-cpuclock2 tst-cputimer1 tst-cputimer2 tst-cputimer3 \
|
||||
tst-shm-cancel \
|
||||
diff --git a/rt/tst-bz28213.c b/rt/tst-bz28213.c
|
||||
new file mode 100644
|
||||
index 0000000000000000..0c096b5a0ad4170a
|
||||
--- /dev/null
|
||||
+++ b/rt/tst-bz28213.c
|
||||
@@ -0,0 +1,101 @@
|
||||
+/* Bug 28213: test for NULL pointer dereference in mq_notify.
|
||||
+ Copyright (C) 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 <errno.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <mqueue.h>
|
||||
+#include <signal.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <support/check.h>
|
||||
+
|
||||
+static mqd_t m = -1;
|
||||
+static const char msg[] = "hello";
|
||||
+
|
||||
+static void
|
||||
+check_bz28213_cb (union sigval sv)
|
||||
+{
|
||||
+ char buf[sizeof (msg)];
|
||||
+
|
||||
+ (void) sv;
|
||||
+
|
||||
+ TEST_VERIFY_EXIT ((size_t) mq_receive (m, buf, sizeof (buf), NULL)
|
||||
+ == sizeof (buf));
|
||||
+ TEST_VERIFY_EXIT (memcmp (buf, msg, sizeof (buf)) == 0);
|
||||
+
|
||||
+ exit (0);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+check_bz28213 (void)
|
||||
+{
|
||||
+ struct sigevent sev;
|
||||
+
|
||||
+ memset (&sev, '\0', sizeof (sev));
|
||||
+ sev.sigev_notify = SIGEV_THREAD;
|
||||
+ sev.sigev_notify_function = check_bz28213_cb;
|
||||
+
|
||||
+ /* Step 1: Register & unregister notifier.
|
||||
+ Helper thread should receive NOTIFY_REMOVED notification.
|
||||
+ In a vulnerable version of glibc, NULL pointer dereference follows. */
|
||||
+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
|
||||
+ TEST_VERIFY_EXIT (mq_notify (m, NULL) == 0);
|
||||
+
|
||||
+ /* Step 2: Once again, register notification.
|
||||
+ Try to send one message.
|
||||
+ Test is considered successful, if the callback does exit (0). */
|
||||
+ TEST_VERIFY_EXIT (mq_notify (m, &sev) == 0);
|
||||
+ TEST_VERIFY_EXIT (mq_send (m, msg, sizeof (msg), 1) == 0);
|
||||
+
|
||||
+ /* Wait... */
|
||||
+ pause ();
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+do_test (void)
|
||||
+{
|
||||
+ static const char m_name[] = "/bz28213_queue";
|
||||
+ struct mq_attr m_attr;
|
||||
+
|
||||
+ memset (&m_attr, '\0', sizeof (m_attr));
|
||||
+ m_attr.mq_maxmsg = 1;
|
||||
+ m_attr.mq_msgsize = sizeof (msg);
|
||||
+
|
||||
+ m = mq_open (m_name,
|
||||
+ O_RDWR | O_CREAT | O_EXCL,
|
||||
+ 0600,
|
||||
+ &m_attr);
|
||||
+
|
||||
+ if (m < 0)
|
||||
+ {
|
||||
+ if (errno == ENOSYS)
|
||||
+ FAIL_UNSUPPORTED ("POSIX message queues are not implemented\n");
|
||||
+ FAIL_EXIT1 ("Failed to create POSIX message queue: %m\n");
|
||||
+ }
|
||||
+
|
||||
+ TEST_VERIFY_EXIT (mq_unlink (m_name) == 0);
|
||||
+
|
||||
+ check_bz28213 ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
24
SOURCES/glibc-upstream-2.34-9.patch
Normal file
24
SOURCES/glibc-upstream-2.34-9.patch
Normal file
@ -0,0 +1,24 @@
|
||||
commit 9acab0bba6a5a57323b1f94bf95b21618a9e5aa4
|
||||
Author: Arjun Shankar <arjun@redhat.com>
|
||||
Date: Fri Aug 20 16:24:05 2021 +0200
|
||||
|
||||
elf: Fix missing colon in LD_SHOW_AUXV output [BZ #28253]
|
||||
|
||||
This commit adds a missing colon in the AT_MINSIGSTKSZ entry in
|
||||
the _dl_show_auxv function.
|
||||
|
||||
(cherry picked from commit 82fbcd7118d760492e2ecc9fa291e358b9ba0361)
|
||||
|
||||
diff --git a/elf/dl-sysdep.c b/elf/dl-sysdep.c
|
||||
index d47bef1340ce6f35..2c684c2db2a1f59b 100644
|
||||
--- a/elf/dl-sysdep.c
|
||||
+++ b/elf/dl-sysdep.c
|
||||
@@ -317,7 +317,7 @@ _dl_show_auxv (void)
|
||||
[AT_SYSINFO_EHDR - 2] = { "SYSINFO_EHDR: 0x", hex },
|
||||
[AT_RANDOM - 2] = { "RANDOM: 0x", hex },
|
||||
[AT_HWCAP2 - 2] = { "HWCAP2: 0x", hex },
|
||||
- [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ ", dec },
|
||||
+ [AT_MINSIGSTKSZ - 2] = { "MINSIGSTKSZ: ", dec },
|
||||
[AT_L1I_CACHESIZE - 2] = { "L1I_CACHESIZE: ", dec },
|
||||
[AT_L1I_CACHEGEOMETRY - 2] = { "L1I_CACHEGEOMETRY: 0x", hex },
|
||||
[AT_L1D_CACHESIZE - 2] = { "L1D_CACHESIZE: ", dec },
|
3
SOURCES/glibc.attr
Normal file
3
SOURCES/glibc.attr
Normal file
@ -0,0 +1,3 @@
|
||||
%__glibc_requires %{_rpmconfigdir}/glibc.req
|
||||
%__glibc_magic ELF
|
||||
%__glibc_flags exeonly
|
42
SOURCES/glibc.req.in
Normal file
42
SOURCES/glibc.req.in
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Auto-generating dependencies for glibc development snapshots.
|
||||
#
|
||||
# A glibc development snapshot (say version 2.33.9000) may define
|
||||
# symbols in its under-development symbol version (GLIBC_2.34). RPM
|
||||
# automatically derives RPM dependencies such as
|
||||
# libc.so.6(GLIBC_2.34)(64bit) from that. While the GLIBC_2.34
|
||||
# version is under development, these dependencies may be inaccurate
|
||||
# and could be satisfied by glibc RPM package versions that lack the
|
||||
# symbols because they were created from an earlier development
|
||||
# snapshot that had some other GLIBC_2.34 symbols. Therefore, if the
|
||||
# latest, under-development ELF symbol version is detected, this
|
||||
# dependency generator adds an explicit RPM dependencies on the glibc
|
||||
# packaging version against which an RPM package is built.
|
||||
#
|
||||
# This script runs for the glibc build itself. In this case, it may
|
||||
# produce a >= dependency on the build-time glibc, but there will also
|
||||
# be an (potentially indirect) = dependency, which takes precedence.
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
searching=true
|
||||
# Pre-filter using eu-elfclassify, to skip kernel modules.
|
||||
eu-elfclassify --loadable --file --stdin --print | while read path; do
|
||||
# Assume that all dynamically linked objects depend on glibc in
|
||||
# some way.
|
||||
if $searching; then
|
||||
# Undefined symbols within latest, under-development
|
||||
# (changing) symbol versions trigger the versioned RPM
|
||||
# dependency. Do not use "egrep -q" to keep reading from the
|
||||
# pipe, avoiding a spurious EPIPE error in eu-readelf.
|
||||
if eu-readelf -s "$path" \
|
||||
| egrep '\sUNDEF\s.*@''@SYMVER@(\s|$)' >/dev/null
|
||||
then
|
||||
echo 'glibc >= @VERSION@-@RELEASE@'
|
||||
# Stop searching after the first match, but keep reading from
|
||||
# the pipe.
|
||||
searching=false
|
||||
fi
|
||||
fi
|
||||
done
|
1
SOURCES/nscd.conf
Normal file
1
SOURCES/nscd.conf
Normal file
@ -0,0 +1 @@
|
||||
d /run/nscd 0755 root root
|
40
SOURCES/parse-SUPPORTED.py
Normal file
40
SOURCES/parse-SUPPORTED.py
Normal file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# This script turns localedata/SUPPORTED (whose path is passed as the
|
||||
# first argument) into a normalized list of LANGUAGE "_" REGION pairs.
|
||||
# (If there is no REGION defined, only LANGUAGE is used.) The list
|
||||
# is written to standard output, with one element per line.
|
||||
|
||||
import sys
|
||||
|
||||
supported, = sys.argv[1:]
|
||||
|
||||
# Pairs seen so far. Used to suppress duplicates.
|
||||
seen = set()
|
||||
with open(supported) as inp:
|
||||
for line in inp:
|
||||
if line.startswith("#") or line == "SUPPORTED-LOCALES=\\\n":
|
||||
# Comment or prefix.
|
||||
continue
|
||||
if not line.endswith(" \\\n"):
|
||||
raise IOError("line without continuation: " + repr(line))
|
||||
try:
|
||||
slash = line.index("/")
|
||||
except ValueError:
|
||||
raise IOError("line without slash: " + repr(line))
|
||||
spec = line[:slash]
|
||||
for separator in ".@":
|
||||
try:
|
||||
# Strip charset, variant specifiers.
|
||||
spec = spec[:spec.index(separator)]
|
||||
except ValueError:
|
||||
pass
|
||||
seen.add(spec)
|
||||
|
||||
# The C locale does not correspond to a language.
|
||||
seen.remove("C")
|
||||
|
||||
# The glibc source file is not sorted.
|
||||
for spec in sorted(seen):
|
||||
print(spec)
|
||||
print() # The Lua generator produces a trailing newline.
|
117
SOURCES/wrap-find-debuginfo.sh
Normal file
117
SOURCES/wrap-find-debuginfo.sh
Normal file
@ -0,0 +1,117 @@
|
||||
#!/bin/bash
|
||||
# Wrapper script for find-debuginfo.sh
|
||||
#
|
||||
# Usage:
|
||||
# wrap-find-debuginfo.sh SYSROOT-PATH SCRIPT-PATH SCRIPT-ARGS...
|
||||
#
|
||||
# The wrapper saves the original version of ld.so found in SYSROOT-PATH,
|
||||
# invokes SCRIPT-PATH with SCRIPT-ARGS, and then restores the
|
||||
# LDSO-PATH file, followed by note merging and DWZ compression.
|
||||
# As a result, ld.so has (mostly) unchanged debuginfo even
|
||||
# after debuginfo extraction.
|
||||
#
|
||||
# For libc.so.6, a set of strategic symbols is preserved in .symtab
|
||||
# that are frequently used in valgrind suppressions and elsewhere.
|
||||
|
||||
set -ex
|
||||
|
||||
ldso_tmp="$(mktemp)"
|
||||
libc_tmp="$(mktemp)"
|
||||
|
||||
# Prefer a separately installed debugedit over the RPM-integrated one.
|
||||
if command -v debugedit >/dev/null ; then
|
||||
debugedit=debugedit
|
||||
else
|
||||
debugedit=/usr/lib/rpm/debugedit
|
||||
fi
|
||||
|
||||
cleanup () {
|
||||
rm -f "$ldso_tmp" "$libc_tmp"
|
||||
}
|
||||
trap cleanup 0
|
||||
|
||||
sysroot_path="$1"
|
||||
shift
|
||||
script_path="$1"
|
||||
shift
|
||||
|
||||
# See ldso_path setting in glibc.spec.
|
||||
ldso_path=
|
||||
for ldso_candidate in `find "$sysroot_path" -regextype posix-extended \
|
||||
-regex '.*/ld(-.*|64|)\.so\.[0-9]+$' -type f` ; do
|
||||
if test -z "$ldso_path" ; then
|
||||
ldso_path="$ldso_candidate"
|
||||
else
|
||||
echo "error: multiple ld.so candidates: $ldso_path, $ldso_candidate"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# libc.so.6 always uses this name, so it is simpler to locate.
|
||||
libc_path=
|
||||
for libc_candidate in `find "$sysroot_path" -name libc.so.6`; do
|
||||
if test -z "$libc_path" ; then
|
||||
libc_path="$libc_candidate"
|
||||
else
|
||||
echo "error: multiple libc.so.6 candidates: $libc_path, $libc_candidate"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
# Preserve the original files.
|
||||
cp "$ldso_path" "$ldso_tmp"
|
||||
cp "$libc_path" "$libc_tmp"
|
||||
|
||||
# Run the debuginfo extraction.
|
||||
"$script_path" "$@"
|
||||
|
||||
# Restore the original files.
|
||||
cp "$ldso_tmp" "$ldso_path"
|
||||
cp "$libc_tmp" "$libc_path"
|
||||
|
||||
# Reduce the size of notes. Primarily for annobin.
|
||||
objcopy --merge-notes "$ldso_path"
|
||||
objcopy --merge-notes "$libc_path"
|
||||
|
||||
# libc.so.6: Reduce to valuable symbols. Eliminate file symbols,
|
||||
# annobin symbols, and symbols used by the glibc build to implement
|
||||
# hidden aliases (__EI_*). We would also like to remove __GI_*
|
||||
# symbols, but even listing them explicitly (as in -K __GI_strlen)
|
||||
# still causes strip to remove them, so there is no filtering of
|
||||
# __GI_* here. (Debuginfo is gone after this, so no need to optimize
|
||||
# it.)
|
||||
strip -w \
|
||||
-K '*' \
|
||||
-K '!*.c' \
|
||||
-K '!*.os' \
|
||||
-K '!.annobin_*' \
|
||||
-K '!__EI_*' \
|
||||
-K '!__PRETTY_FUNCTION__*' \
|
||||
"$libc_path"
|
||||
|
||||
# ld.so: Rewrite the source file paths to match the extracted
|
||||
# locations. First compute the arguments for invoking debugedit.
|
||||
# See find-debuginfo.sh.
|
||||
debug_dest_name="/usr/src/debug"
|
||||
last_arg=
|
||||
while true ; do
|
||||
arg="$1"
|
||||
shift || break
|
||||
case "$arg" in
|
||||
(--unique-debug-src-base)
|
||||
debug_dest_name="/usr/src/debug/$1"
|
||||
shift
|
||||
;;
|
||||
(-*)
|
||||
;;
|
||||
(*)
|
||||
last_arg="$arg"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
debug_base_name=${last_arg:-$RPM_BUILD_ROOT}
|
||||
$debugedit -b "$debug_base_name" -d "$debug_dest_name" -n $ldso_path
|
||||
|
||||
# Apply single-file DWARF optimization.
|
||||
dwz $ldso_path
|
5280
SPECS/glibc.spec
Normal file
5280
SPECS/glibc.spec
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user