Flavio Cruz [Mon, 22 May 2023 05:16:50 +0000 (01:16 -0400)]
Fix build for hurd/thread-self.c for i386.
We need to include hurd.h for libc_hidden_proto (__hurd_thread_self),
introduced in
b44c1e12524b ("hurd: Fix using interposable
hurd_thread_self")
This the error log:
In file included from <command-line>:
./../include/libc-symbols.h:472:33: error: '__EI___hurd_thread_self' aliased to undefined symbol '__GI___hurd_thread_self'
472 | extern thread __typeof (name) __EI_##name \
| ^~~~~
./../include/libc-symbols.h:468:3: note: in expansion of macro '__hidden_ver2'
468 | __hidden_ver2 (, local, internal, name)
| ^~~~~~~~~~~~~
./../include/libc-symbols.h:476:41: note: in expansion of macro '__hidden_ver1'
476 | # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
| ^~~~~~~~~~~~~
./../include/libc-symbols.h:557:32: note: in expansion of macro 'hidden_def'
557 | # define libc_hidden_def(name) hidden_def (name)
| ^~~~~~~~~~
thread-self.c:27:1: note: in expansion of macro 'libc_hidden_def'
27 | libc_hidden_def (__hurd_thread_self)
| ^~~~~~~~~~~~~~~
Message-Id: <ZGr6wj2UOxg3F0qH@jupiter.tail36e24.ts.net>
Sergey Bugaev [Sat, 20 May 2023 11:55:31 +0000 (14:55 +0300)]
io: Fix a typo
Fixes
85f7554cd97e7f03d8dc66278653045ef63a2221
"Add test case for O_TMPFILE handling in open, openat"
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230520115531.3911877-3-bugaevc@gmail.com>
Sergey Bugaev [Sat, 20 May 2023 11:55:30 +0000 (14:55 +0300)]
htl: Use __hurd_fail () instead of assigning errno
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230520115531.3911877-2-bugaevc@gmail.com>
Sergey Bugaev [Sat, 20 May 2023 11:55:29 +0000 (14:55 +0300)]
hurd: Use __hurd_fail () instead of assigning errno
The __hurd_fail () inline function is the dedicated, idiomatic way of
reporting errors in the Hurd part of glibc. Not only is it more concise
than '{ errno = err; return -1; }', it is since commit
6639cc10029e24e06b34e169712b21c31b8cf213
"hurd: Mark error functions as __COLD" marked with the cold attribute,
telling the compiler that this codepath is unlikely to be executed.
In one case, use __hurd_dfail () over the plain __hurd_fail ().
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230520115531.3911877-1-bugaevc@gmail.com>
Mahesh Bodapati [Fri, 12 May 2023 10:22:59 +0000 (05:22 -0500)]
powerpc:GCC(<10) doesn't allow -mlong-double-64 after -mabi=ieeelongdouble
Removed -mabi=ieeelongdouble on failing tests. It resolves the error.
error: ‘-mabi=ieeelongdouble’ requires ‘-mlong-double-128’
Sergey Bugaev [Fri, 19 May 2023 14:47:24 +0000 (17:47 +0300)]
hurd: Fix using interposable hurd_thread_self
Create a private hidden __hurd_thread_self alias, and use that one.
Fixes
2f8ecb58a59eb82c43214d000842d99644a662d1
"hurd: Fix x86_64 _hurd_tls_fork" and
c7fcce38c83a2bb665ef5dc4981bf20c7e586123
"hurd: Make sure to not use tcb->self"
Reported-by: Joseph Myers <joseph@codesourcery.com>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Samuel Thibault [Fri, 19 May 2023 18:44:01 +0000 (20:44 +0200)]
hurd 64bit: Re-introduce gai_suspend symbol
4d3f846b88d3 ("hurd: Fix __TIMESIZE on x86_64") incidentaly dropped it
because it fixed hurd 64bit into setting __TIMESIZE to 64, and that case
was not having gai_suspend defined yet.
Sergey Bugaev [Fri, 19 May 2023 17:15:16 +0000 (20:15 +0300)]
hurd: Fix __TIMESIZE on x86_64
We had sizeof (time_t) == 8, but __TIMESIZE == 32.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230519171516.3698754-1-bugaevc@gmail.com>
Carlos O'Donell [Thu, 18 May 2023 20:20:29 +0000 (16:20 -0400)]
posix: Reformat Makefile.
Fix LOCALE list formatting.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Samuel Thibault [Thu, 18 May 2023 23:45:06 +0000 (01:45 +0200)]
hurd: Fix expected c++ types
90604f670c10 ("hurd 64bit: Add data for check-c++-types") actually added
the 32bit version. This fixes it into a 64bit version.
Carlos O'Donell [Thu, 18 May 2023 17:13:32 +0000 (13:13 -0400)]
catgets: Reformat Makefile.
Reflow all long lines adding comment terminators.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 18 May 2023 17:06:02 +0000 (13:06 -0400)]
benchtests: Reformat Makefile.
Reflow all long lines adding comment terminators.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No regressions running microbenchmarks.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 18 May 2023 16:56:45 +0000 (12:56 -0400)]
assert: Reformat Makefile.
Reflow all long lines adding comment terminators.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Wed, 17 May 2023 12:27:59 +0000 (08:27 -0400)]
nptl: Reformat Makefile.
Reflow all long lines adding comment terminators.
Rename files that cause inconsistent ordering.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Wed, 17 May 2023 13:34:53 +0000 (09:34 -0400)]
wcsmbs: Reformat Makefile.
Reflow Makefile.
Sort using updated scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Wed, 17 May 2023 13:34:24 +0000 (09:34 -0400)]
misc: Reformat Makefile.
Reflow Makefile.
Sort using updated scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Wed, 17 May 2023 13:33:05 +0000 (09:33 -0400)]
stdio-common: Adjust tests in Makefile
Sort tests against updated scripts/sort-makefile-lines.py.
No changes in generated code.
No regressions on x86_64 and i686.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Wed, 17 May 2023 13:27:17 +0000 (09:27 -0400)]
elf: Adjust tests in Makefile.
Sort tests against updated scripts/sort-makefile-lines.py.
No changes in generated code.
No regressions on x86_64 and i686.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Wed, 17 May 2023 13:16:41 +0000 (09:16 -0400)]
scripts: sort-makefile-lines.py
We must return < 0, 0, or > 0 as the result of the comparison function
for cmp_to_key() to work correctly across all comparisons.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Siddhesh Poyarekar [Wed, 17 May 2023 23:44:46 +0000 (19:44 -0400)]
Add a SECURITY.md
Move content from the Security Process[1] and Security Exceptions[2]
wiki documents into the repository so that it is in a standard place for
analysis tools to look for the glibc security policy.
This is a more or less verbatim port of the wiki document with some
restructuring for a more coherent layout since the two pages are now
merged. There should be no change in messaging in this commit.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Joseph Myers [Thu, 18 May 2023 14:55:27 +0000 (14:55 +0000)]
Add HWCAP2_SME* from Linux 6.3 to AArch64 bits/hwcap.h
Linux 6.3 adds six HWCAP2_SME* constants for AArch64; add them to the
corresponding bits/hwcap.h in glibc.
Tested with build-many-glibcs.py for aarch64-linux-gnu.
Sergey Bugaev [Wed, 17 May 2023 19:14:35 +0000 (22:14 +0300)]
hurd: Also make it possible to call strlen very early
strlen, which is another ifunc-selected function, is invoked during
early static executable startup if the argv arrives from the exec
server. Make it not crash.
Checked on x86_64-gnu: statically linked executables launched after the
exec server is up now start up successfully.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-10-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:34 +0000 (22:14 +0300)]
hurd: Fix setting up pthreads
On x86_64, we have to pass function arguments in registers, not on the
stack. We also have to align the stack pointer in a specific way. Since
sharing the logic with i386 does not bring much benefit, split the file
back into i386- and x86_64-specific versions, and fix the x86_64 version
to set up the thread properly.
Bonus: i386 keeps doing the extra RPC inside __thread_set_pcsptp to
fetch the state of the thread before setting it; but x86_64 no lnoger
does that.
Checked on x86_64-gnu and i686-gnu.
Fixes
be6d002ca277ffc90058d382396150cb0e785b9c
"hurd: Set up the basic tree for x86_64-gnu"
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-9-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:33 +0000 (22:14 +0300)]
hurd: Fix x86_64 _hurd_tls_fork
It is illegal to call thread_get_state () on mach_thread_self (), so
this codepath cannot be used as-is to fork the calling thread's TLS.
Fortunately we can use THREAD_SELF (aka %fs:0x0) to find out the value
of our fs_base without calling into the kernel.
Fixes:
f6cf701efc61c9ad910372bda14b9a235db310a8
"hurd: Implement TLS for x86_64"
Checked on x86_64-gnu: fork () now works!
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-8-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:32 +0000 (22:14 +0300)]
hurd: Make sure to not use tcb->self
Unlike sigstate->thread, tcb->self did not hold a Mach port reference on
the thread port it names. This means that the port can be deallocated,
and the name reused for something else, without anyone noticing. Using
tcb->self will then lead to port use-after-free.
Fortunately nothing was accessing tcb->self, other than it being
intially set to then-valid thread port name upon TCB initialization. To
assert that this keeps being the case without altering TCB layout,
rename self -> self_do_not_use, and stop initializing it.
Also, do not (re-)allocate a whole separate and unused stack for the
main thread, and just exit __pthread_setup early in this case.
Found upon attempting to use tcb->self and getting unexpected crashes.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-7-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:31 +0000 (22:14 +0300)]
hurd: Use __mach_setup_thread_call ()
...instead of mach_setup_thread (), which is unsuitable for setting up
function calls.
Checked on x86_64-gnu: the signal thread no longer crashes upon trying
to process a message.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-6-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:30 +0000 (22:14 +0300)]
mach: Add __mach_setup_thread_call ()
This is just like mach_setup_thread (), but it's suitable for making the
thread call a function correctly, as opposed to explicitly setting the
thread's stack and instruction pointers to the given values. Internally,
it uses MACHINE_THREAD_STATE_SETUP_CALL.
Unlike mach_setup_thread (), which is exported via mach.h for the
benefit of the Hurd exec server, __mach_setup_thread_call () is private
to glibc for the time being.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-5-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:29 +0000 (22:14 +0300)]
hurd: Use MACHINE_THREAD_STATE_SETUP_CALL
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-4-bugaevc@gmail.com>
Sergey Bugaev [Wed, 17 May 2023 19:14:28 +0000 (22:14 +0300)]
mach: Define MACHINE_THREAD_STATE_SETUP_CALL
The existing two macros, MACHINE_THREAD_STATE_SET_PC and
MACHINE_THREAD_STATE_SET_SP, can be used to set program counter and the
stack pointer registers in a machine-specific thread state structure.
Useful as it is, this may not be enough to set up the thread to make a
function call, because the machine-specific ABI may impose additional
requirements. In particular, x86_64 ABI requires that upon function
entry, the stack pointer is 8 less than 16-byte aligned (sp & 15 == 8).
To deal with this, introduce a new macro,
MACHINE_THREAD_STATE_SETUP_CALL (), which sets both stack and
instruction pointers, and also applies any machine-specific requirements
to make a valid function call. The default implementation simply
forwards to MACHINE_THREAD_STATE_SET_PC and MACHINE_THREAD_STATE_SET_SP,
but on x86_64 we additionally align the stack pointer.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230517191436.73636-3-bugaevc@gmail.com>
Flavio Cruz [Wed, 17 May 2023 02:59:24 +0000 (22:59 -0400)]
Use TASK_THREAD_TIMES_INFO_COUNT when calling task_info with TASK_THREAD_TIMES_INFO
This hasn't caused any problems yet but we are passing a pointer to struct
task_thread_times_info which can cause problems if we populate over the
existing size of the struct.
Message-Id: <ZGRDDNcOM2hA3CuT@jupiter.tail36e24.ts.net>
Carlos O'Donell [Tue, 16 May 2023 15:59:25 +0000 (11:59 -0400)]
argp: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Florian Weimer [Tue, 16 May 2023 21:26:40 +0000 (23:26 +0200)]
stdlib: Avoid undefined behavior in stdlib/tst-labs
The last loop could attempt to overflow beyond INT_MAX on 32-bit
architectures.
Also switch to GNU style.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Florian Weimer [Tue, 16 May 2023 20:54:25 +0000 (22:54 +0200)]
stdlib: Use long long int in stdlib/tst-llabs
And adjust for GNU style.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Joseph Myers [Tue, 16 May 2023 23:15:13 +0000 (23:15 +0000)]
Update kernel version to 6.3 in header constant tests
This patch updates the kernel version in the tests tst-mman-consts.py,
tst-mount-consts.py and tst-pidfd-consts.py to 6.3. (There are no new
constants covered by these tests in 6.3 that need any other header
changes.)
Tested with build-many-glibcs.py.
DJ Delorie [Tue, 16 May 2023 02:50:35 +0000 (22:50 -0400)]
i386: Use pthread_barrier for synchronization on tst-bz21269
So I was able to reproduce the hangs in the original source, and debug
it, and fix it. In doing so, I realized that we can't use anything
complex to trigger the thread because that "anything" might also cause
the expected segfault and force everything out of sync again.
Here's what I ended up with, and it doesn't seem to hang where the
original one hung quite often (in a tight while..end loop). The key
changes are:
1. Calls to futex are error checked, with retries, to ensure that the
futexes are actually doing what they're supposed to be doing. In the
original code, nearly every futex call returned an error.
2. The main loop has checks for whether the thread ran or not, and
"unlocks" the thread if it didn't (this is how the original source
hangs).
Note: the usleep() is not for timing purposes, but just to give the
kernel an excuse to run the other thread at that time. The test will
not hang without it, but is more likely to test the right bugfix
if the usleep() is present.
Joe Simmons-Talbott [Tue, 4 Apr 2023 13:57:47 +0000 (09:57 -0400)]
stdlib: Add testcases for llabs(). (BZ #30263)
Test minimum and maximum long long values, zero, 32bit crossover points, and
part of the range of long long values. Use '-fno-builtin' to ensure we are
testing the implementation.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Joe Simmons-Talbott [Tue, 4 Apr 2023 13:57:46 +0000 (09:57 -0400)]
stdlib: Add testcases for labs(). (BZ #30263)
Test minimum and maximum long values, zero, and part of the range
of long values. Use '-fno-builtin' to ensure we are testing the
implementation.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Joe Simmons-Talbott [Tue, 4 Apr 2023 13:57:45 +0000 (09:57 -0400)]
stdlib: Add testcases for abs(). (BZ #30263)
Test minimum and maximum int values, zero, and part of the range
of int values. Use '-fno-builtin' to ensure we are testing the
implementation.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Sergey Bugaev [Mon, 15 May 2023 08:33:23 +0000 (11:33 +0300)]
hurd: Fix computing user stack pointer
Fixes
b574ae0a2876ee94e4fe617f878407bf818c2df0
"hurd: Implement sigreturn for x86_64"
Checked on x86_64-gnu.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230515083323.1358039-5-bugaevc@gmail.com>
Sergey Bugaev [Mon, 15 May 2023 08:33:22 +0000 (11:33 +0300)]
hurd: Fix sc_i386_thread_state layout
The real i386_thread_state Mach structure has an alignment of 8 on
x86_64. However, in struct sigcontext, the compiler was packing sc_gs
(which is the first member of sc_i386_thread_state) into the same 8-byte
slot as sc_error; this resulted in the rest of sc_i386_thread_state
members having wrong offsets relative to each other, and the overall
sc_i386_thread_state layout mismatching that of i386_thread_state.
Fix this by explicitly adding the required padding members, and
statically asserting that this results in the desired alignment.
The same goes for sc_i386_float_state.
Checked on x86_64-gnu.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230515083323.1358039-4-bugaevc@gmail.com>
Sergey Bugaev [Mon, 15 May 2023 08:33:21 +0000 (11:33 +0300)]
hurd: Align signal stack pointer after allocating stackframe
sizeof (*stackframe) appears to be divisible by 16, but we should not
rely on that. So make sure to leave enough space for the stackframe
first, and then align the final pointer at 16 bytes.
Checked on x86_64-gnu.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230515083323.1358039-3-bugaevc@gmail.com>
Sergey Bugaev [Mon, 15 May 2023 08:33:20 +0000 (11:33 +0300)]
hurd: Fix aligning signal stack pointer
Fixes
60f9bf974694d50daf58d46347b06a5975ac5ddd
"hurd: Port trampoline.c to x86_64"
Checked on x86_64-gnu.
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230515083323.1358039-2-bugaevc@gmail.com>
Carlos O'Donell [Fri, 12 May 2023 00:45:35 +0000 (20:45 -0400)]
wcsmbs: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 19:01:18 +0000 (15:01 -0400)]
linux: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 18:35:55 +0000 (14:35 -0400)]
stdlib: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 18:00:41 +0000 (14:00 -0400)]
stdio-common: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 17:14:51 +0000 (13:14 -0400)]
socket: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 11:04:11 +0000 (07:04 -0400)]
misc: Reformat Makefile.
Reflow Makefile.
Sort using scripts/sort-makefile-lines.py.
Code generation is changed as routines are linked in sorted order
as expected.
No regressions on x86_64 and i686.
Carlos O'Donell [Thu, 11 May 2023 10:46:27 +0000 (06:46 -0400)]
debug: Reformat Makefile.
Fix list terminator whitspace.
Sort using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Carlos O'Donell [Wed, 10 May 2023 17:40:17 +0000 (13:40 -0400)]
elf: Reformat Makefile.
Fix list terminator whitspace.
Sort using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Xi Ruoyao [Fri, 21 Apr 2023 06:21:33 +0000 (14:21 +0800)]
libio: Add __nonnull for FILE * arguments of fclose and freopen
Calling fclose or freopen with a null FILE * is undefined behavior, and
doing so in practice will cause a SIGSEGV. So it seems suitable for
__nonnull.
This will help the compiler to warn for some buggy code, like
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Arjun Shankar [Thu, 11 May 2023 12:54:11 +0000 (14:54 +0200)]
nss: Reconcile conditional declaration and use of `is_nscd'
This change harmonizes the declaration and use of `is_nscd' and fixes a
build failure with the "--enable-static-nss --enable-nscd"
configuration options due to `is_nscd' being used undeclared.
The purpose of `is_nscd' is to avoid (nss <-> nscd) recursion in
dynamically linked libc (SHARED) that is nscd-aware (USE_NSCD), and so
its declaration and use should be guarded by the definition of those
macros.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Joseph Myers [Mon, 15 May 2023 22:26:56 +0000 (22:26 +0000)]
Update syscall lists for Linux 6.3
Linux 6.3 has no new syscalls. Update the version number in
syscall-names.list to reflect that it is still current for 6.3.
Tested with build-many-glibcs.py.
Samuel Thibault [Wed, 10 May 2023 23:51:10 +0000 (01:51 +0200)]
hurd: rule out some mach headers when generating errno.h
While mach/kern_return.h happens to pull mach/machine/kern_return.h,
mach/machine/boolean.h, and mach/machine/vm_types.h (and realpath-ing them
exposes the machine-specific machine symlink content), those headers do not
actually define anything machine-specific for the content of errno.h.
So we can just rule out these machine-specific from the dependency
comment.
Flavio Cruz [Wed, 10 May 2023 05:20:34 +0000 (01:20 -0400)]
Stop checking if MiG supports retcode.
We already did the same change for Hurd
(https://git.savannah.gnu.org/cgit/hurd/hurd.git/commit/?id=
ef5924402864ef049f40a39e73967628583bc1a4)
Due to MiG requiring the subsystem to be defined early in order to know the
size of a port, this was causing a division by zero error during ./configure.
We could have just move subsystem to the top of the snippet, however it is
simpler to just remove the check given that we have no plans to use some other
MiG anyway.
HAVE_MIG_RETCODE is removed completely since this will be a no-op either
way (compiling against old Hurd headers will work the same, new Hurd
headers will result in the same stubs since retcode is a no-op).
Message-Id: <ZFspor91aoMwbh9T@jupiter.tail36e24.ts.net>
Sachin Monga [Wed, 10 May 2023 17:59:21 +0000 (13:59 -0400)]
Added Redirects to longdouble error functions [BZ #29033]
This patch redirects the error functions to the appropriate
longdouble variants which enables the compiler to optimize
for the abi ieeelongdouble.
Signed-off-by: Sachin Monga <smonga@linux.ibm.com>
Carlos O'Donell [Tue, 18 Apr 2023 15:02:09 +0000 (11:02 -0400)]
nptl: Reformat Makefile.
Reflow all long lines adding comment terminators.
Sort all reflowed text using scripts/sort-makefile-lines.py.
No code generation changes observed in binary artifacts.
No regressions on x86_64 and i686.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Carlos O'Donell [Tue, 18 Apr 2023 15:02:55 +0000 (11:02 -0400)]
scripts: Add sort-makefile-lines.py to sort Makefile variables.
The scripts/sort-makefile-lines.py script sorts Makefile variables
according to project expected order.
The script can be used like this:
$ scripts/sort-makefile-lines.py < elf/Makefile > elf/Makefile.tmp
$ mv elf/Makefile.tmp elf/Makefile
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Andreas Schwab [Thu, 23 Mar 2023 15:46:20 +0000 (16:46 +0100)]
dlopen: skip debugger notification for DSO loaded from sprof (bug 30258)
Avoid inconsistent state in the debugger interface.
DJ Delorie [Tue, 21 Mar 2023 04:46:43 +0000 (00:46 -0400)]
aligned_alloc: conform to C17
This patch adds the strict checking for power-of-two alignments
in aligned_alloc(), and updates the manual accordingly.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
наб [Thu, 4 May 2023 20:25:57 +0000 (22:25 +0200)]
testsuite: stdlib/isomac.c: fix REQUIREMENTS
All of the mentioned variables are gone. gcc is just the default and
argv[1] can be used instead. /usr/include isn't hard-coded and you can
pass argv[2] with -I... to adjust.
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Florian Weimer [Mon, 8 May 2023 11:14:22 +0000 (13:14 +0200)]
manual: Remove unsupported line breaks in waiting-with-clock section
The argument to @deftypefun must be on a single line.
Also add the missing @safety for sem_clockwait.
Reported-by: Nilgün Belma Bugüner <nillguine@gmail.com>
Flavio Cruz [Sun, 7 May 2023 17:13:23 +0000 (13:13 -0400)]
Enable new device_open_new RPC in libmachuser.
Message-Id: <ZFfcM3DP+x7VHpWA@jupiter.tail36e24.ts.net>
Florian Weimer [Sun, 7 May 2023 12:16:03 +0000 (14:16 +0200)]
Revert "riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC."
This reverts commit
117e8b341c5c0ace8d65feeef136fececb3fdc9c.
Reason for revert: Causes elf/tst-glibcelf and elf/tst-relro-*
to fail on all architectures.
Flavio Cruz [Sat, 6 May 2023 20:55:10 +0000 (16:55 -0400)]
Update hurd/hurdselect.c to be more portable.
Summary of changes:
- Use BAD_TYPECHECK to perform type checking in a cleaner way.
BAD_TYPECHECK is moved into sysdeps/mach/rpc.h to avoid duplication.
- Remove assertions for mach_msg_type_t since those won't work for
x86_64.
- Update message structs to use mach_msg_type_t directly.
- Use designated initializers.
Message-Id: <ZFa+roan3ioo0ONM@jupiter.tail36e24.ts.net>
Samuel Thibault [Sat, 6 May 2023 19:00:56 +0000 (21:00 +0200)]
hurd: Fix ld.so name
This was set to ld-x86-64.so.1 in gcc.
Samuel Thibault [Sat, 6 May 2023 16:59:32 +0000 (18:59 +0200)]
hurd: Add ioperm symbol on x86_64
Joe Simmons-Talbott [Wed, 3 May 2023 16:40:05 +0000 (12:40 -0400)]
time: Remove alloca() from getdate
Reduce the usage of alloca() to the bare minimum to avoid the potential
for stack overflow. Use __strndup to simplify the code.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Szabolcs Nagy [Fri, 5 May 2023 08:01:58 +0000 (09:01 +0100)]
aarch64: More configure checks for libmvec
Check assembler and linker support too, not just SVE ACLE in the
compiler, since variant PCS requires at least binutils 2.32.1.
Szabolcs Nagy [Thu, 4 May 2023 09:14:43 +0000 (10:14 +0100)]
aarch64: SVE ACLE configure test cleanups
Use more idiomatic configure test for better autoconf cache and logs.
Sam James [Fri, 5 May 2023 09:12:07 +0000 (10:12 +0100)]
hppa: Fix 'concurrency' typo in comment
Signed-off-by: Sam James <sam@gentoo.org>
Flavio Cruz [Thu, 4 May 2023 04:08:12 +0000 (00:08 -0400)]
Update hurd/intr-msg.c to be more portable
Summary of the changes:
- Introduce BAD_TYPECHECK from MiG to make it simpler to do type
checking.
- Replace int type with mach_msg_type_t. This assumes that
mach_msg_type_t is always the same size as int which is not true for
x86_64.
- Calculate the size and align using PTR_ALIGN_UP, which is a bit
cleaner and similar to what we do elsewhere.
- Define mach_msg_type_t to check using designated initializers.
Message-Id: <ZFMvrIkvoCSxqB/C@jupiter.tail36e24.ts.net>
Flavio Cruz [Thu, 4 May 2023 04:06:46 +0000 (00:06 -0400)]
Update sysdeps/mach/hurd/ioctl.c to make it more portable
Summary of the changes:
- Update msg_align to use ALIGN_UP like we have done in previous
patches. Use it below whenever necessary to avoid repeating the same
alignment logic.
- Define BAD_TYPECHECK to make it easier to do type checking in a few
places below.
- Update io2mach_type to use designated initializers.
- Make RetCodeType use mach_msg_type_t. mach_msg_type_t is 8 byte for
x86_64, so this make it portable.
- Also call msg_align for _IOT_COUNT2/_IOT_TYPE2 since it is more
correct.
Message-Id: <ZFMvVsuFKwIy2dUS@jupiter.tail36e24.ts.net>
Szabolcs Nagy [Thu, 4 May 2023 08:48:03 +0000 (09:48 +0100)]
aarch64: fix SVE ACLE check for bootstrap glibc builds
arm_sve.h depends on stdint.h but that relies on libc headers unless
compiled in freestanding mode. Without this change a bootstrap glibc
build (that uses a compiler without installed libc headers) failed with
checking for availability of SVE ACLE... In file included from [...]/arm_sve.h:28,
from conftest.c:1:
[...]/stdint.h:9:16: fatal error: stdint.h: No such file or directory
9 | # include_next <stdint.h>
| ^~~~~~~~~~
compilation terminated.
configure: error: mathvec is enabled but compiler does not have SVE ACLE. [...]
Joe Ramsay [Wed, 12 Apr 2023 13:37:49 +0000 (14:37 +0100)]
Enable libmvec support for AArch64
This patch enables libmvec on AArch64. The proposed change is mainly
implementing build infrastructure to add the new routines to ABI,
tests and benchmarks. I have demonstrated how this all fits together
by adding implementations for vector cos, in both single and double
precision, targeting both Advanced SIMD and SVE.
The implementations of the routines themselves are just loops over the
scalar routine from libm for now, as we are more concerned with
getting the plumbing right at this point. We plan to contribute vector
routines from the Arm Optimized Routines repo that are compliant with
requirements described in the libmvec wiki.
Building libmvec requires minimum GCC 10 for SVE ACLE. To avoid raising
the minimum GCC by such a big jump, we allow users to disable libmvec
if their compiler is too old.
Note that at this point users have to manually call the vector math
functions. This seems to be acceptable to some downstream users.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Samuel Thibault [Tue, 2 May 2023 19:40:31 +0000 (21:40 +0200)]
hurd: Enable x86_64 build script
This now passes crossbuilds.
Samuel Thibault [Tue, 2 May 2023 19:29:26 +0000 (21:29 +0200)]
hurd 64bit: Make dev_t word type
dev_t are 64bit on Linux ports, so better increase their size on 64bit
Hurd. It happens that this helps with BZ 23084 there: st_dev has type fsid_t
(quad) and is specified by POSIX to have type dev_t. Making dev_t 64bit
makes these match.
Samuel Thibault [Tue, 2 May 2023 19:26:09 +0000 (21:26 +0200)]
malloc: Really fix tst-memalign-3 link against threads
All the tst malloc variants need the thread linking flags.
Samuel Thibault [Tue, 2 May 2023 19:07:31 +0000 (21:07 +0200)]
malloc: Fix tst-memalign-3 link against threads
Joseph Myers [Tue, 2 May 2023 13:57:58 +0000 (13:57 +0000)]
Use GCC 13 branch, Linux 6.3 in build-many-glibcs.py
This patch updates build-many-glibcs.py to use Linux 6.3 and GCC 13
branch by default.
Tested with build-many-glibcs.py (host-libraries, compilers and glibc
builds).
Sergey Bugaev [Sat, 29 Apr 2023 13:12:23 +0000 (16:12 +0300)]
Mark various cold functions as __COLD
GCC docs explicitly list perror () as a good candidate for using
__attribute__ ((cold)). So apply __COLD to perror () and similar
functions.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230429131223.2507236-3-bugaevc@gmail.com>
наб [Sun, 23 Apr 2023 00:55:05 +0000 (02:55 +0200)]
Fix regex type usage
include/regex.h had not been updated during the int -> Idx transition,
and the prototypes don't matched the definitions in regexec.c.
In regcomp.c, most interfaces were updated for Idx, except for two ones
guarded by #if _LIBC.
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Samuel Thibault [Mon, 1 May 2023 12:51:22 +0000 (14:51 +0200)]
hurd 64bit: Fix struct msqid_ds and shmid_ds fields
The standards want msg_lspid/msg_lrpid/shm_cpid/shm_lpid to be pid_t, see BZ
23083 and 23085.
We can leave them __rpc_pid_t on i386 for ABI compatibility, but avoid
hitting the issue on 64bit.
Samuel Thibault [Mon, 1 May 2023 12:40:12 +0000 (14:40 +0200)]
hurd 64bit: Fix ipc_perm fields types
The standards want uid/cuid to be uid_t, gid/cgid to be gid_t and mode to be
mode_t, see BZ 23082.
We can leave them short ints on i386 for ABI compatibility, but avoid
hitting the issue on 64bit.
bits/ipc.h ends up being exactly the same in sysdeps/gnu/ and
sysdeps/unix/sysv/linux/, so remove the latter.
Samuel Thibault [Mon, 1 May 2023 12:35:32 +0000 (14:35 +0200)]
hurd 64bit: Fix flock fields types
The standards want l_type and l_whence to be short ints, see BZ 23081.
We can leave them ints on i386 for ABI compatibility, but avoid hitting the
issue on 64bit.
Samuel Thibault [Mon, 1 May 2023 12:27:48 +0000 (14:27 +0200)]
hurd 64bit: Add data for check-c++-types
Samuel Thibault [Mon, 1 May 2023 12:22:31 +0000 (14:22 +0200)]
hurd 64bit: Fix pthread_t/thread_t type to long
So that they can be trivially cast to pointer type, like with nptl.
Samuel Thibault [Mon, 1 May 2023 12:48:06 +0000 (14:48 +0200)]
socket: Fix tst-cmsghdr-skeleton.c use of cmsg_len
cmsg_len is supposed to be socklen_t according to standards, but it was made
size_t on Linux, see BZ 16919. For ports that have it socklen_t, SIZE_MAX is
too large. We can however explicitly cast it to the type of cmsg_len so it
will fit according to that type.
Samuel Thibault [Mon, 1 May 2023 11:38:57 +0000 (13:38 +0200)]
hurd 64bit: Add missing data file for check-localplt test
Samuel Thibault [Mon, 1 May 2023 11:35:54 +0000 (13:35 +0200)]
hurd 64bit: Add missing libanl
The move of libanl to libc was in glibc 2.34 for nptl only.
Samuel Thibault [Mon, 1 May 2023 11:01:46 +0000 (13:01 +0200)]
hurd: Also XFAIL missing SA_NOCLDWAIT on 64bit
Samuel Thibault [Mon, 1 May 2023 11:00:50 +0000 (13:00 +0200)]
hurd: Fix tst-writev test
There is no compile-time IOV_MAX constraint on GNU/Hurd
Samuel Thibault [Mon, 1 May 2023 10:59:12 +0000 (12:59 +0200)]
nptl: move tst-x86-64-tls-1 to nptl-only tests
It is essentially nptl-only.
Sergey Bugaev [Sat, 29 Apr 2023 20:18:20 +0000 (23:18 +0300)]
hurd: Add expected abilist files for x86_64
These were created by creating stub files, running 'make update-abi',
and reviewing the results.
Also, set baseline ABI to GLIBC_2.38, the (upcoming) first glibc
release to first have x86_64-gnu support.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Sergey Bugaev [Sat, 29 Apr 2023 20:18:19 +0000 (23:18 +0300)]
hurd: Replace reply port with a dead name on failed interruption
If we're trying to interrupt an interruptible RPC, but the server fails
to respond to our __interrupt_operation () call, we instead destroy the
reply port we were expecting the reply to the RPC on.
Instead of deallocating the name completely, replace it with a dead
name, so the name won't get reused for some other right, and deallocate
it in _hurd_intr_rpc_mach_msg once we return from the signal handler.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230429201822.2605207-4-bugaevc@gmail.com>
Flavio Cruz [Mon, 1 May 2023 00:09:49 +0000 (20:09 -0400)]
Define __mig_strlen to support dynamically sized strings in hurd RPCs
We make lib{mach,hurd}user.so only call __mig_strlen which can be
relocated before libc.so is relocated, similar to what is done with
__mig_memcpy.
Message-Id: <ZE8DTRDpY2hpPZlJ@jupiter.tail36e24.ts.net>
Samuel Thibault [Mon, 1 May 2023 00:20:59 +0000 (02:20 +0200)]
mach: Disable 32bit compatibility mode
32bit compatibility is the default for now with 64bit gnumach, until 64bit
userland is ready. Here we however want native 64bit userland anyway.
Sergey Bugaev [Sat, 29 Apr 2023 20:18:21 +0000 (23:18 +0300)]
hurd: Make it possible to call memcpy very early
Normally, in static builds, the first code that runs is _start, in e.g.
sysdeps/x86_64/start.S, which quickly calls __libc_start_main, passing
it the argv etc. Among the first things __libc_start_main does is
initializing the tunables (based on env), then CPU features, and then
calls _dl_relocate_static_pie (). Specifically, this runs ifunc
resolvers to pick, based on the CPU features discovered earlier, the
most suitable implementation of "string" functions such as memcpy.
Before that point, calling memcpy (or other ifunc-resolved functions)
will not work.
In the Hurd port, things are more complex. In order to get argv/env for
our process, glibc normally needs to do an RPC to the exec server,
unless our args/env are already located on the stack (which is what
happens to bootstrap processes spawned by GNU Mach). Fetching our
argv/env from the exec server has to be done before the call to
__libc_start_main, since we need to know what our argv/env are to pass
them to __libc_start_main.
On the other hand, the implementation of the RPC (and other initial
setup needed on the Hurd before __libc_start_main can be run) is not
very trivial. In particular, it may (and on x86_64, will) use memcpy.
But as described above, calling memcpy before __libc_start_main can not
work, since the GOT entry for it is not yet initialized at that point.
Work around this by pre-filling the GOT entry with the baseline version
of memcpy, __memcpy_sse2_unaligned. This makes it possible for early
calls to memcpy to just work. The initial value of the GOT entry is
unused on x86_64, and changing it won't interfere with the relocation
being performed later: once _dl_relocate_static_pie () is called, the
baseline version will get replaced with the most suitable one, and that
is what subsequent calls of memcpy are going to call.
Checked on x86_64-gnu.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230429201822.2605207-6-bugaevc@gmail.com>
Sergey Bugaev [Sat, 29 Apr 2023 20:18:18 +0000 (23:18 +0300)]
hurd: Implement longjmp for x86_64
Checked on x86_64-gnu.
[samuel.thibault@ens-lyon.org: Restored same comments as on i386]
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230429201822.2605207-3-bugaevc@gmail.com>
Sergey Bugaev [Sat, 29 Apr 2023 20:18:17 +0000 (23:18 +0300)]
hurd: Implement sigreturn for x86_64
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230429201822.2605207-2-bugaevc@gmail.com>