Adhemerval Zanella [Tue, 18 Oct 2022 13:44:19 +0000 (10:44 -0300)]
Linux: Move wordsize-32 Version to default
And remove redundant entries on other architectures Version. The
version for fallocate64 was supposed to be 2.10, but it was then
added to 32-bit platforms in 2.11 because it mistakenly wasn't
exported for them in 2.10 (see the commit message for
1f3615a1c97a030bca59f728f998947f852679b9).
The linux/generic did not exist before 2.15, i.e. when the tile
ports were added (and microblaze did not exist before 2.18), which
explains those differences but also illustrates that "2.11 for 32-bit,
2.10 for 64-bit" should be sufficient since versions older than the
minimum for the architecture are automatically adjusted.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Samuel Thibault [Mon, 20 Feb 2023 12:44:06 +0000 (13:44 +0100)]
__glob64_time64: Fix typo for stub_warning call (BZ #30146)
The exported symbol is actually __glob64_time64, not glob64_time64.
Joan Bruguera [Sat, 18 Feb 2023 21:52:15 +0000 (21:52 +0000)]
elf: Restore ldconfig libc6 implicit soname logic [BZ #30125]
While cleaning up old libc version support, the deprecated libc4 code was
accidentally kept in `implicit_soname`, instead of the libc6 code.
This causes additional symlinks to be created by `ldconfig` for libraries
without a soname, e.g. a library `libsomething.123.456.789` without a soname
will create a `libsomething.123` -> `libsomething.123.456.789` symlink.
As the libc6 version of the `implicit_soname` code is a trivial `xstrdup`,
just inline it and remove `implicit_soname` altogether.
Some further simplification looks possible (e.g. the call to `create_links`
looks like a no-op if `soname == NULL`, other than the verbose printfs), but
logic is kept as-is for now.
Fixes: BZ #30125
Fixes:
8ee878592c4a ("Assume only FLAG_ELF_LIBC6 suport")
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Vitaly Buka [Sat, 18 Feb 2023 20:53:41 +0000 (12:53 -0800)]
stdlib: Undo post review change to
16adc58e73f3 [BZ #27749]
Post review removal of "goto restart" from
https://sourceware.org/pipermail/libc-alpha/2021-April/125470.html
introduced a bug when some atexit handers skipped.
Signed-off-by: Vitaly Buka <vitalybuka@google.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Flavio Cruz [Wed, 15 Feb 2023 06:16:38 +0000 (01:16 -0500)]
Define PC, SP and SYSRETURN for hurd x86_64
Moved thread_state.h to x86 directory since we only need to customize
those 3 definitions.
Message-Id: <Y+x4xrsDMkAomncO@jupiter.tail36e24.ts.net>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:14 +0000 (23:37 +0300)]
mach: Use PAGE_SIZE
The PAGE_SIZE from the Mach headers statically defines the machine's
page size. There's no need to query it dynamically; furthermore, the
implementation of the vm_statistics () RPC unconditionally fills in
pagesize = PAGE_SIZE;
Not doing the extra RPC shaves off 2 RPCs from the start-up of every
process!
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-7-bugaevc@gmail.com>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:13 +0000 (23:37 +0300)]
hurd: Simplify init-first.c a bit
And make it a bit more 64-bit ready. This is in preparation to moving this
file into x86/
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-6-bugaevc@gmail.com>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:12 +0000 (23:37 +0300)]
hurd: Make timer_t pointer-sized
This ensures that a timer_t value can be cast to struct timer_node *
and back.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-5-bugaevc@gmail.com>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:11 +0000 (23:37 +0300)]
hurd: Fix xattr function return type
They all return int, not size_t.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-4-bugaevc@gmail.com>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:10 +0000 (23:37 +0300)]
hurd: Use proper integer types
Fix a few more cases of build errors caused by mismatched types. This is a
continuation of
f4315054b46d5e58b44a709a51943fb73f846afb.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-3-bugaevc@gmail.com>
Sergey Bugaev [Sat, 18 Feb 2023 20:37:09 +0000 (23:37 +0300)]
hurd: Move thread state manipulation into _hurd_tls_new ()
This is going to be done differently on x86_64.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230218203717.373211-2-bugaevc@gmail.com>
Samuel Thibault [Sun, 19 Feb 2023 22:22:41 +0000 (23:22 +0100)]
glob64_time64: Fix typo for stub_warning call (BZ #30146)
We were erroneously reporting a stub warning for glob64 instead of
glob64_time64.
Qihao Chencao [Tue, 28 Jun 2022 08:57:55 +0000 (16:57 +0800)]
Use uintptr_t instead of performing pointer subtraction with a null pointer
Signed-off-by: Qihao Chencao <twose@qq.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Pavel Kozlov [Tue, 17 Jan 2023 12:12:23 +0000 (16:12 +0400)]
ARC:fpu: add extra capability check before use of sqrt and fma builtins
Add extra check for compiler definitions to ensure that compiler provides
sqrt and fma hw fpu instructions else use software implementation.
As divide/sqrt and FMA hw support from CPU side is optional,
the compiler can be configured by options to generate hw FPU instructions,
but without use of FDDIV, FDSQRT, FSDIV, FSSQRT, FDMADD and FSMADD
instructions. In this case __builtin_sqrt and __builtin_sqrtf provided by
compiler can't be used inside the glibc code, as these builtins are used
in implementations of sqrt() and sqrtf() functions but at the same time
these builtins unfold to sqrt() and sqrtf(). So it is possible to receive
code like that:
0001c4b4 <__ieee754_sqrtf>:
1c4b4: 0001 0000 b 0 ;1c4b4 <__ieee754_sqrtf>
The same is also true for __builtin_fma and __builtin_fmaf.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Pavel Kozlov [Wed, 21 Dec 2022 16:19:46 +0000 (20:19 +0400)]
ARC: align child stack in clone
The ARCv2 ABI requires 4 byte stack pointer alignment. Don't allow to
use unaligned child stack in clone. As the stack grows down,
align it down.
This was pointed by misc/tst-misalign-clone-internal and
misc/tst-misalign-clone tests. Stack alignmet fixes these tests
fails.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Fri, 10 Feb 2023 19:48:15 +0000 (16:48 -0300)]
string: Remove string_private.h
Now that _STRING_ARCH_unaligned is not used anymore.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Fri, 10 Feb 2023 19:37:36 +0000 (16:37 -0300)]
iconv: Remove _STRING_ARCH_unaligned usage
Use put/get macros __builtin_bswap32 instead. It allows to remove
the unaligned routines, the compiler will generate unaligned access
if the ABI allows it.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Fri, 10 Feb 2023 17:09:10 +0000 (14:09 -0300)]
iconv: Remove _STRING_ARCH_unaligned usage for get/set macros
And use a packed structure instead. The compiler generates optimized
unaligned code if the architecture supports it.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Fri, 10 Feb 2023 14:24:15 +0000 (11:24 -0300)]
resolv: Remove _STRING_ARCH_unaligned usage
GCC with default implementation already generates optimized code.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Fri, 10 Feb 2023 13:54:47 +0000 (10:54 -0300)]
nscd: Remove _STRING_ARCH_unaligned usage
It only adds a small overhead for unaligned inputs (which should not
be common) and unify the code.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Thu, 9 Feb 2023 13:36:57 +0000 (10:36 -0300)]
stdlib: Simplify getenv
And remove _STRING_ARCH_unaligned usage.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Adhemerval Zanella [Thu, 9 Feb 2023 13:26:43 +0000 (10:26 -0300)]
crypto: Remove _STRING_ARCH_unaligned usage
Assume unaligned inputs on all cases. The code is built and used only
in compat mode.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Joseph Myers [Fri, 17 Feb 2023 17:23:50 +0000 (17:23 +0000)]
Fix ifunc-impl-list.c build for s390
Builds for s390 recently started failing with:
../sysdeps/s390/multiarch/ifunc-impl-list.c: In function '__libc_ifunc_impl_list':
../sysdeps/s390/multiarch/ifunc-impl-list.c:83:21: error: unused variable 'dl_hwcap' [-Werror=unused-variable]
83 | unsigned long int dl_hwcap = features->hwcap;
| ^~~~~~~~
https://sourceware.org/pipermail/libc-testresults/2023q1/010855.html
Add __attribute__ ((unused)) as already done for another variable
there.
Tested with build-many-glibcs.py (compilers and glibcs) for
s390x-linux-gnu and s390-linux-gnu.
Note: s390x-linux-gnu-O3 started failing with a different error
earlier; that problem may still need to be fixed after this fix is in.
https://sourceware.org/pipermail/libc-testresults/2023q1/010829.html
Flavio Cruz [Fri, 17 Feb 2023 06:16:09 +0000 (01:16 -0500)]
[hurd] Fix i686 build breakage caused by
4fedebc91108
Message-Id: <Y+8bqZzYTl7WaUm7@jupiter.tail36e24.ts.net>
Joseph Myers [Thu, 16 Feb 2023 23:02:40 +0000 (23:02 +0000)]
C2x strtol binary constant handling
C2x adds binary integer constants starting with 0b or 0B, and supports
those constants in strtol-family functions when the base passed is 0
or 2. Implement that strtol support for glibc.
As discussed at
<https://sourceware.org/pipermail/libc-alpha/2020-December/120414.html>,
this is incompatible with previous C standard versions, in that such
an input string starting with 0b or 0B was previously required to be
parsed as 0 (with the rest of the string unprocessed). Thus, as
proposed there, this patch adds 20 new __isoc23_* functions with
appropriate header redirection support. This patch does *not* do
anything about scanf %i (which will need 12 new functions per long
double variant, so 12, 24 or 36 depending on the glibc configuration),
instead leaving that for a future patch. The function names would
remain as __isoc23_* even if C2x ends up published in 2024 rather than
2023.
Making this change leads to the question of what should happen to
internal uses of these functions in glibc and its tests. The header
redirection (which applies for _GNU_SOURCE or any other feature test
macros enabling C2x features) has the effect of redirecting internal
uses but without those uses then ending up at a hidden alias (see the
comment in include/stdio.h about interaction with libc_hidden_proto).
It seems desirable for the default for internal uses to be the same
versions used by normal code using _GNU_SOURCE, so rather than doing
anything to disable that redirection, similar macro definitions to
those in include/stdio.h are added to the include/ headers for the new
functions.
Given that the default for uses in glibc is for the redirections to
apply, the next question is whether the C2x semantics are correct for
all those uses. Uses with the base fixed to 10, 16 or any other value
other than 0 or 2 can be ignored. I think this leaves the following
internal uses to consider (an important consideration for review of
this patch will be both whether this list is complete and whether my
conclusions on all entries in it are correct):
benchtests/bench-malloc-simple.c
benchtests/bench-string.h
elf/sotruss-lib.c
math/libm-test-support.c
nptl/perf.c
nscd/nscd_conf.c
nss/nss_files/files-parse.c
posix/tst-fnmatch.c
posix/wordexp.c
resolv/inet_addr.c
rt/tst-mqueue7.c
soft-fp/testit.c
stdlib/fmtmsg.c
support/support_test_main.c
support/test-container.c
sysdeps/pthread/tst-mutex10.c
I think all of these places are OK with the new semantics, except for
resolv/inet_addr.c, where the POSIX semantics of inet_addr do not
allow for binary constants; thus, I changed that file (to use
__strtoul_internal, whose semantics are unchanged) and added a test
for this case. In the case of posix/wordexp.c I think accepting
binary constants is OK since POSIX explicitly allows additional forms
of shell arithmetic expressions, and in stdlib/fmtmsg.c SEV_LEVEL is
not in POSIX so again I think accepting binary constants is OK.
Functions such as __strtol_internal, which are only exported for
compatibility with old binaries from when those were used in inline
functions in headers, have unchanged semantics; the __*_l_internal
versions (purely internal to libc and not exported) have a new
argument to specify whether to accept binary constants.
As well as for the standard functions, the header redirection also
applies to the *_l versions (GNU extensions), and to legacy functions
such as strtoq, to avoid confusing inconsistency (the *q functions
redirect to __isoc23_*ll rather than needing their own __isoc23_*
entry points). For the functions that are only declared with
_GNU_SOURCE, this means the old versions are no longer available for
normal user programs at all. An internal __GLIBC_USE_C2X_STRTOL macro
is used to control the redirections in the headers, and cases in glibc
that wish to avoid the redirections - the function implementations
themselves and the tests of the old versions of the GNU functions -
then undefine and redefine that macro to allow the old versions to be
accessed. (There would of course be greater complexity should we wish
to make any of the old versions into compat symbols / avoid them being
defined at all for new glibc ABIs.)
strtol_l.c has some similarity to strtol.c in gnulib, but has already
diverged some way (and isn't listed at all at
https://sourceware.org/glibc/wiki/SharedSourceFiles unlike strtoll.c
and strtoul.c); I haven't made any attempts at gnulib compatibility in
the changes to that file.
I note incidentally that inttypes.h and wchar.h are missing the
__nonnull present on declarations of this family of functions in
stdlib.h; I didn't make any changes in that regard for the new
declarations added.
Samuel Thibault [Wed, 15 Feb 2023 14:13:19 +0000 (15:13 +0100)]
[hurd] Add MTU_DISCOVER values
Samuel Thibault [Tue, 14 Feb 2023 19:32:15 +0000 (19:32 +0000)]
hurd: Fix unwinding over INTR_MSG_TRAP in shared too
This follows
63550530d98d ("hurd: Fix unwinding over INTR_MSG_TRAP"),
for the shared library case.
Sergey Bugaev [Tue, 14 Feb 2023 17:37:21 +0000 (20:37 +0300)]
mach: undef ENTRY2
This macro from Mach headers conflicts with how
sysdeps/x86_64/multiarch/strcmp-sse2.S expects it to be defined.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230214173722.428140-3-bugaevc@gmail.com>
Sergey Bugaev [Tue, 14 Feb 2023 17:37:20 +0000 (20:37 +0300)]
hurd: i386 TLS tweaks
* Micro-optimize TLS access using GCC's native support for gs-based
addressing when available;
* Just use THREAD_GETMEM and THREAD_SETMEM instead of more inline
assembly;
* Sync tcbhead_t layout with NPTL, in particular update/fix __private_ss
offset;
* Statically assert that the two offsets that are a part of ABI are what
we expect them to be.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230214173722.428140-2-bugaevc@gmail.com>
Adhemerval Zanella [Tue, 6 Dec 2022 16:28:40 +0000 (13:28 -0300)]
stdio: Do not ignore posix_spawn error on popen (BZ #29016)
To correctly return error in case of default shell is not present.
Checked on x86_64-linux-gnu.
Paul Zimmermann [Tue, 14 Feb 2023 10:24:59 +0000 (11:24 +0100)]
update auto-libm-test-out-hypot
This change was forgotten in commit cf7ffdd.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Paul Zimmermann [Sun, 12 Feb 2023 07:01:18 +0000 (08:01 +0100)]
added pair of inputs for hypotf in binary32
This pair yields an error of 1 ulp in binary32, whereas the current
maximal known error for hypotf on x86_64 is zero:
Checking hypot with glibc-2.37
hypot 0 -1 -0x1.003222p-20,-0x1.6a2d58p-32 [0.501] 0.500001 0.
500000001392678
libm gives 0x1.003224p-20
mpfr gives 0x1.003222p-20
See https://sourceware.org/pipermail/libc-alpha/2023-February/145432.html
and https://sourceware.org/pipermail/libc-alpha/2023-February/145442.html
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Mahesh Bodapati [Mon, 13 Feb 2023 17:23:19 +0000 (11:23 -0600)]
Naming the parameter of dummy_sa_handler
ISO C does not support omitting parameter names in function definitions
before C2X,the compiler is giving an error with older versions of gcc and
this commit will resolve the test failure "error: parameter name omitted"
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Sergey Bugaev [Sun, 12 Feb 2023 16:08:57 +0000 (19:08 +0300)]
hurd: Fix tcflag_t and speed_t types on 64-bit
These are supposed to stay 32-bit even on 64-bit systems. This matches
BSD and Linux, as well as how these types are already defined in
tioctl.defs
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Samuel Thibault [Sun, 12 Feb 2023 16:28:32 +0000 (17:28 +0100)]
htl: Remove ./sysdeps/htl/bits/types/struct___pthread_mutex.h
This follows
a99155555c21 ("htl: Remove unused files")
Sergey Bugaev [Sun, 12 Feb 2023 11:10:42 +0000 (14:10 +0300)]
hurd, htl: Add some x86_64-specific code
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-12-bugaevc@gmail.com>
Samuel Thibault [Sun, 12 Feb 2023 15:34:28 +0000 (16:34 +0100)]
Fix typos in comments
Samuel Thibault [Sun, 12 Feb 2023 15:32:52 +0000 (16:32 +0100)]
htl: Generalize i386 pt-machdep.h to x86
Sergey Bugaev [Sun, 12 Feb 2023 11:10:41 +0000 (14:10 +0300)]
hurd: Set up the basic tree for x86_64-gnu
And move pt-setup.c to the generic x86 tree.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-11-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:40 +0000 (14:10 +0300)]
mach: Look for mach_i386.defs on x86_64 too
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-10-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:36 +0000 (14:10 +0300)]
htl: Fix semaphore reference
'sem' is the opaque 'sem_t', 'isem' is the actual 'struct new_sem'.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-6-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:35 +0000 (14:10 +0300)]
hurd: Fix xattr error value
This does not seem like it is supposed to return negative error codes.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-5-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:34 +0000 (14:10 +0300)]
mach, hurd: Cast through uintptr_t
When casting between a pointer and an integer of a different size, GCC
emits a warning (which is escalated to a build failure by -Werror).
Indeed, if what you start with is a pointer, which you then cast to a
shorter integer and then back again, you're going to cut off some bits
of the pointer.
But if you start with an integer (such as mach_port_t), then cast it to
a longer pointer (void *), and then back to a shorter integer, you are
fine. To keep GCC happy, cast through an intermediary uintptr_t, which
is always the same size as a pointer.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-4-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:33 +0000 (14:10 +0300)]
hurd: Use mach_msg_type_number_t where appropriate
It has been decided that on x86_64, mach_msg_type_number_t stays 32-bit.
Therefore, it's not possible to use mach_msg_type_number_t
interchangeably with size_t, in particular this breaks when a pointer to
a variable is passed to a MIG routine.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-3-bugaevc@gmail.com>
Sergey Bugaev [Sun, 12 Feb 2023 11:10:32 +0000 (14:10 +0300)]
hurd: Refactor readlinkat()
Make the code flow more linear using early returns where possible. This
makes it so much easier to reason about what runs on error / successful
code paths.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230212111044.610942-2-bugaevc@gmail.com>
Paul Pluzhnikov [Fri, 10 Feb 2023 16:14:30 +0000 (16:14 +0000)]
Use __builtin_FILE instead of __FILE__ in assert in C++.
Likewise use __builtin_LINE instead of __LINE__.
When building C++, inline functions are required to have the exact same
sequence of tokens in every translation unit. But __FILE__ token, when
used in a header file, does not necessarily expand to the exact same
string literal, and that may cause compilation failure when C++ modules
are being used. (It would also cause unpredictable output on assertion
failure at runtime, but this rarely matters in practice.)
For example, given the following sources:
// a.h
#include <assert.h>
inline void fn () { assert (0); }
// a.cc
#include "a.h"
// b.cc
#include "foo/../a.h"
preprocessing a.cc will yield a call to __assert_fail("0", "a.h", ...)
but b.cc will yield __assert_fail("0", "foo/../a.h", ...)
Samuel Thibault [Thu, 9 Feb 2023 18:58:43 +0000 (19:58 +0100)]
hurd: Fix unwinding over INTR_MSG_TRAP
We used to use .cfi_adjust_cfa_offset around %esp manipulation
asm instructions to fix unwinding, but when building glibc with
-fno-omit-frame-pointer this is bogus since in that case %ebp is the CFA and
does not move.
Instead, let's force -fno-omit-frame-pointer when building intr-msg.c so
that %ebp can always be used and no .cfi_adjust_cfa_offset is needed.
Adhemerval Zanella Netto [Fri, 3 Feb 2023 17:12:33 +0000 (14:12 -0300)]
powerpc64: Add the clone3 wrapper
It follows the internal signature:
extern int clone3 (struct clone_args *__cl_args, size_t __size,
int (*__func) (void *__arg), void *__arg);
The powerpc64 ABI requires an initial stackframe so the child can
store/restore the TOC. It is create prior calling clone3 by
adjusting the stack size (since kernel will compute the stack as
stack plus size).
Checked on powerpc64-linux-gnu (power8, kernel 6.0) and
powerpc64le-linux-gnu (power9, kernel 4.18).
Reviewed-by: Paul E. Murphy <murphyp@linux.ibm.com>
Adhemerval Zanella [Mon, 6 Feb 2023 18:07:44 +0000 (15:07 -0300)]
string: Disable stack protector in early static initialization
For powerpc, strncmp is used on _dl_string_platform issued by
__tcb_parse_hwcap_and_convert_at_platform.
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Adhemerval Zanella [Mon, 6 Feb 2023 18:05:56 +0000 (15:05 -0300)]
string: Add libc_hidden_proto for memrchr
Although static linker can optimize it to local call, it follows the
internal scheme to provide hidden proto and definitions.
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Adhemerval Zanella [Mon, 6 Feb 2023 16:15:22 +0000 (13:15 -0300)]
string: Add libc_hidden_proto for strchrnul
Although static linker can optimize it to local call, it follows the
internal scheme to provide hidden proto and definitions.
Reviewed-by: Carlos Eduardo Seo <carlos.seo@linaro.org>
Florian Weimer [Wed, 8 Feb 2023 17:11:04 +0000 (18:11 +0100)]
elf: Smoke-test ldconfig -p against system /etc/ld.so.cache
The test is sufficient to detect the ldconfig bug fixed in
commit
9fe6f6363886aae6b2b210cae3ed1f5921299083 ("elf: Fix 64 time_t
support for installed statically binaries").
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Carlos O'Donell [Mon, 6 Feb 2023 15:36:32 +0000 (10:36 -0500)]
NEWS: Document CVE-2023-25139.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Andreas Schwab [Thu, 26 Jan 2023 13:25:05 +0000 (14:25 +0100)]
Use 64-bit time_t interfaces in strftime and strptime (bug 30053)
Both functions use time_t only internally, so the ABI is not affected.
quxm [Wed, 25 Jan 2023 09:47:33 +0000 (17:47 +0800)]
C-SKY: Strip hard float abi from hard float feature.
The hard float abi and hard float are different,
Hard float abi: Use float register to pass float type arguments.
Hard float: Enable the hard float ISA feature.
So the with_fp_cond cannot represent these two features. When
-mfloat-abi=softfp, the float abi is soft and hard float is enabled.
So add 'with_hard_float_abi' in preconfigure and define 'CSKY_HARD_FLOAT_ABI'
if float abi is hard, and use 'CSKY_HARD_FLOAT_ABI' to determine
dynamic linker because it is what determines compatibility.
And with_fp_cond is still needed to tell glibc whether to enable
hard floating feature.
In addition, use AC_TRY_COMMAND to test gcc to ensure compatibility
between different versions of gcc. The original way has a problem
that __CSKY_HARD_FLOAT_FPU_SF__ means the target only has single
hard float-points ISA, so it's not defined in CPUs like ck810f.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Stefan Liebler [Thu, 2 Feb 2023 13:57:50 +0000 (14:57 +0100)]
S390: Influence hwcaps/stfle via GLIBC_TUNABLES.
This patch enables the option to influence hwcaps and stfle bits used
by the s390 specific ifunc-resolvers. The currently x86-specific
tunable glibc.cpu.hwcaps is also used on s390x to achieve the task. In
addition the user can also set a CPU arch-level like z13 instead of
single HWCAP and STFLE features.
Note that the tunable only handles the features which are really used
in the IFUNC-resolvers. All others are ignored as the values are only
used inside glibc. Thus we can influence:
- HWCAP_S390_VXRS (z13)
- HWCAP_S390_VXRS_EXT (z14)
- HWCAP_S390_VXRS_EXT2 (z15)
- STFLE_MIE3 (z15)
The influenced hwcap/stfle-bits are stored in the s390-specific
cpu_features struct which also contains reserved fields for future
usage.
The ifunc-resolvers and users of stfle bits are adjusted to use the
information from cpu_features struct.
On 31bit, the ELF_MACHINE_IRELATIVE macro is now also defined.
Otherwise the new ifunc-resolvers segfaults as they depend on
the not yet processed_rtld_global_ro@GLIBC_PRIVATE relocation.
Adhemerval Zanella [Thu, 2 Feb 2023 16:57:20 +0000 (13:57 -0300)]
string: Hook up the default implementation on test-strrchr
And remove SIMPLE_STRRCHR, which is not used anywhere.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:14:58 +0000 (10:14 -0300)]
string: Hook up the default implementation on test-memrchr
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:14:03 +0000 (10:14 -0300)]
string: Hook up the default implementation on test-memchr
And remove SIMPLE_MEMCHR, which is not used anywhere.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 31 Jan 2023 19:29:58 +0000 (16:29 -0300)]
string: Hook up the default implementation on test-strcpy
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 31 Jan 2023 19:29:53 +0000 (16:29 -0300)]
string: Hook up the default implementation on test-stpcpy
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Fri, 20 Jan 2023 20:50:41 +0000 (17:50 -0300)]
string: Hook up the default implementation on test-strncmp
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:13:35 +0000 (10:13 -0300)]
string: Hook up the default implementation on test-strcmp
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:12:40 +0000 (10:12 -0300)]
string: Hook up the default implementation on test-strchr
Also remove the simple_STRCHR, which can be easily replaced.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:11:36 +0000 (10:11 -0300)]
string: Hook up the default implementation on test-strnlen
Also remove the SIMPLE_STRNLEN, which is not used anywhere.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 17 Jan 2023 13:10:21 +0000 (10:10 -0300)]
string: Hook up the default implementation on test-strlen
Also remove the simple_STRLEN and builtin_strlen, which are not used
anywhere.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Wed, 1 Feb 2023 15:44:17 +0000 (12:44 -0300)]
riscv: Add string-fza.h and string-fzi.h
It uses the bitmanip extension to optimize index_fist and index_last
with clz/ctz (using generic implementation that routes to compiler
builtin) and orc.b to check null bytes.
Checked the string test on riscv64 user mode.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 10 Jan 2023 21:01:06 +0000 (18:01 -0300)]
sh: Add string-fzb.h
Use the SH cmp/str on has_{zero,eq,zero_eq}.
Checked on sh4-linux-gnu.
Richard Henderson [Tue, 10 Jan 2023 21:01:05 +0000 (18:01 -0300)]
powerpc: Add string-fza.h
While ppc has the more important string functions in assembly,
there are still a few generic routines used.
Use the Power 6 CMPB insn for testing of zeros.
Checked on powerpc64le-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Richard Henderson [Tue, 10 Jan 2023 21:01:04 +0000 (18:01 -0300)]
arm: Add string-fza.h
While arm has the more important string functions in assembly,
there are still a few generic routines used.
Use the UQSUB8 insn for testing of zeros.
Checked on armv7-linux-gnueabihf
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Richard Henderson [Tue, 10 Jan 2023 21:01:03 +0000 (18:01 -0300)]
alpha: Add string-fza, string-fzb.h, string-fzi.h, and string-shift.h
While alpha has the more important string functions in assembly,
there are still a few for find the generic routines are used.
Use the CMPBGE insn, via the builtin, for testing of zeros. Use a
simplified expansion of __builtin_ctz when the insn isn't available.
Checked on alpha-linux-gnu.
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Richard Henderson [Tue, 10 Jan 2023 21:01:02 +0000 (18:01 -0300)]
hppa: Add string-fza.h, string-fzc.h, and string-fzi.h
Use UXOR,SBZ to test for a zero byte within a word. While we can
get semi-decent code out of asm-goto, we would do slightly better
with a compiler builtin.
For index_zero et al, sequential testing of bytes is less expensive than
any tricks that involve a count-leading-zeros insn that we don't have.
Checked on hppa-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Richard Henderson [Tue, 10 Jan 2023 21:01:01 +0000 (18:01 -0300)]
hppa: Add memcopy.h
GCC's combine pass cannot merge (x >> c | y << (32 - c)) into a
double-word shift unless (1) the subtract is in the same basic block
and (2) the result of the subtract is used exactly once. Neither
condition is true for any use of MERGE.
By forcing the use of a double-word shift, we not only reduce
contention on SAR, but also allow the setting of SAR to be hoisted
outside of a loop.
Checked on hppa-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Adhemerval Zanella [Thu, 2 Feb 2023 16:44:13 +0000 (13:44 -0300)]
string: Improve generic strrchr with memrchr and strlen
Now that both strlen and memrchr have word vectorized implementation,
it should be faster to implement strrchr based on memrchr over the
string length instead of calling strchr on a loop.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powerpc64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Adhemerval Zanella [Tue, 10 Jan 2023 21:01:00 +0000 (18:01 -0300)]
string: Improve generic memrchr
New algorithm read the lastaligned address and mask off the unwanted
bytes. The loop now read word-aligned address and check using the
has_eq macro.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powerpc64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:55 +0000 (18:00 -0300)]
string: Improve generic strnlen with memchr
It also cleanups the multiple inclusion by leaving the ifunc
implementation to undef the weak_alias and libc_hidden_def.
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:59 +0000 (18:00 -0300)]
string: Improve generic memchr
New algorithm read the first aligned address and mask off the
unwanted bytes (this strategy is similar to arch-specific
implementations used on powerpc, sparc, and sh).
The loop now read word-aligned address and check using the has_eq
macro.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powerpc64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 31 Jan 2023 19:28:42 +0000 (16:28 -0300)]
string: Improve generic strcpy
Now that stpcpy is vectorized based on op_t, it should be better to
call it instead of strlen plus memcpy.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 31 Jan 2023 18:46:08 +0000 (15:46 -0300)]
string: Improve generic stpcpy
It follows the strategy:
- Align the destination on word boundary using byte operations.
- If source is also word aligned, read a word per time, check for
null (using has_zero from string-fzb.h), and write the remaining
bytes.
- If source is not word aligned, loop by aligning the source, and
merging the result of two reads. Similar to aligned case,
check for null with has_zero, and write the remaining bytes if
null is found.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Fri, 20 Jan 2023 19:18:33 +0000 (16:18 -0300)]
string: Improve generic strncmp
It follows the strategy:
- Align the first input to word boundary using byte operations.
- If second input is also word aligned, read a word per time, check
for null (using has_zero), and check final words using byte
operation.
- If second input is not word aligned, loop by aligning the source,
and merge the result of two reads. Similar to aligned case, check
for null with has_zero, and check final words using byte operation.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:58 +0000 (18:00 -0300)]
string: Improve generic strcmp
It follows the strategy:
- Align the first input to word boundary using byte operations.
- If second input is also word aligned, read a word per time, check for
null (using has_zero), and check final words using byte operation.
- If second input is not word aligned, loop by aligning the source, and
merging the result of two reads. Similar to aligned case, check for
null with has_zero, and check final words using byte operation.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:56 +0000 (18:00 -0300)]
string: Improve generic strchr
New algorithm now calls strchrnul.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powerpc64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:57 +0000 (18:00 -0300)]
string: Improve generic strchrnul
New algorithm read the first aligned address and mask off the unwanted
bytes (this strategy is similar to arch-specific implementations used
on powerpc, sparc, and sh).
The loop now read word-aligned address and check using the has_zero_eq
function.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc64-linux-gnu,
and powerpc-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:54 +0000 (18:00 -0300)]
string: Improve generic strlen
New algorithm read the first aligned address and mask off the
unwanted bytes (this strategy is similar to arch-specific
implementations used on powerpc, sparc, and sh).
The loop now read word-aligned address and check using the has_zero
macro.
Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu,
and powercp64-linux-gnu by removing the arch-specific assembly
implementation and disabling multi-arch (it covers both LE and BE
for 64 and 32 bits).
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:53 +0000 (18:00 -0300)]
Add string vectorized find and detection functions
This patch adds generic string find and detection meant to be used in
generic vectorized string implementation. The idea is to decompose the
basic string operation so each architecture can reimplement if it
provides any specialized hardware instruction.
The 'string-misc.h' provides miscellaneous functions:
- extractbyte: extracts the byte from an specific index.
- repeat_bytes: setup an word by replicate the argument on each byte.
The 'string-fza.h' provides zero byte detection functions:
- find_zero_low, find_zero_all, find_eq_low, find_eq_all,
find_zero_eq_low, find_zero_eq_all, and find_zero_ne_all
The 'string-fzb.h' provides boolean zero byte detection functions:
- has_zero: determine if any byte within a word is zero.
- has_eq: determine byte equality between two words.
- has_zero_eq: determine if any byte within a word is zero along with
byte equality between two words.
The 'string-fzi.h' provides positions for string-fza.h results:
- index_first: return index of first zero byte within a word.
- index_last: return index of first byte different between two words.
The 'string-fzc.h' provides a combined version of fza and fzi:
- index_first_zero_eq: return index of first zero byte within a word or
first byte different between two words.
- index_first_zero_ne: return index of first zero byte within a word or
first byte equal between two words.
- index_last_zero: return index of last zero byte within a word.
- index_last_eq: return index of last byte different between two words.
The 'string-shift.h' provides a way to mask off parts of a work based on
some alignmnet (to handle unaligned arguments):
- shift_find, shift_find_last.
Co-authored-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
Richard Henderson [Tue, 10 Jan 2023 21:00:51 +0000 (18:00 -0300)]
Parameterize OP_T_THRES from memcopy.h
It moves OP_T_THRES out of memcopy.h to its own header and adjust
each architecture that redefines it.
Checked with a build and check with run-built-tests=no for all major
Linux ABIs.
Co-authored-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Adhemerval Zanella [Tue, 10 Jan 2023 21:00:50 +0000 (18:00 -0300)]
Parameterize op_t from memcopy.h
It moves the op_t definition out to an specific header, adds
the attribute 'may-alias', and cleanup its duplicated definitions.
Checked with a build and check with run-built-tests=no for all major
Linux ABIs.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Wilco Dijkstra [Fri, 3 Feb 2023 12:01:33 +0000 (12:01 +0000)]
Replace rawmemchr (s, '\0') with strchr
Almost all uses of rawmemchr find the end of a string. Since most targets use
a generic implementation, replacing it with strchr is better since that is
optimized by compilers into strlen (s) + s. Also fix the generic rawmemchr
implementation to use a cast to unsigned char in the if statement.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Wilco Dijkstra [Wed, 1 Feb 2023 18:45:19 +0000 (18:45 +0000)]
AArch64: Improve SVE memcpy and memmove
Improve SVE memcpy by copying 2 vectors if the size is small enough.
This improves performance of random memcpy by ~9% on Neoverse V1, and
33-64 byte copies are ~16% faster.
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Carlos O'Donell [Thu, 19 Jan 2023 11:50:20 +0000 (12:50 +0100)]
Account for grouping in printf width (bug 30068)
This is a partial fix for mishandling of grouping when formatting
integers. It properly computes the width in the presence of grouping
characters when the width is larger than the number of significant
digits. The precision related issue is documented in bug 23432.
Co-authored-by: Andreas Schwab <schwab@suse.de>
Flavio Cruz [Sun, 5 Feb 2023 08:23:25 +0000 (03:23 -0500)]
Move RETURN_TO to x86/sysdep.h and implement x86_64 version.
Message-Id: <Y99nfeBrTubZL9oi@jupiter.tail36e24.ts.net>
Andreas Schwab [Fri, 3 Feb 2023 15:10:49 +0000 (16:10 +0100)]
Remove pthread-pi-defines.sym
It became unused with the removal of the assembler implementation of the
pthread functions.
Sam James [Fri, 3 Feb 2023 04:00:31 +0000 (23:00 -0500)]
stdlib: tests: don't double-define _FORTIFY_SOURCE
If using -D_FORITFY_SOURCE=3 (in my case, I've patched GCC to add
=3 instead of =2 (we've done =2 for years in Gentoo)), building
glibc tests will fail on testmb like:
```
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make[2]: *** [../o-iterator.mk:9: /var/tmp/portage/sys-libs/glibc-2.36/work/build-x86-x86_64-pc-linux-gnu-nptl/stdlib/testmb.o] Error 1
make[2]: *** Waiting for unfinished jobs....
```
It's just because we're always setting -D_FORTIFY_SOURCE=2
rather than unsetting it first. If F_S is already 2, it's harmless,
but if it's another value (say, 1, or 3), the compiler will bawk.
(I'm not aware of a reason this couldn't be tested with =3,
but the toolchain support is limited for that (too new), and we want
to run the tests everywhere possible.)
Signed-off-by: Sam James <sam@gentoo.org>
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
caiyinyu [Tue, 31 Jan 2023 12:40:10 +0000 (20:40 +0800)]
LoongArch: Add new relocation types.
Flavio Cruz [Thu, 2 Feb 2023 07:42:18 +0000 (02:42 -0500)]
Remove sysdeps/mach/i386/machine-sp.h
This file is not used today since we end up using
sysdeps/i386/htl/machine-sp.h. Getting the stack pointer does not need
to be hurd specific and can go into sysdeps/<arch>.
Message-Id: <Y9tpWs2WOgE/Duiq@jupiter.tail36e24.ts.net>
Siddhesh Poyarekar [Thu, 2 Feb 2023 12:49:02 +0000 (07:49 -0500)]
cdefs: Limit definition of fortification macros
Define the __glibc_fortify and other macros only when __FORTIFY_LEVEL >
0. This has the effect of not defining these macros on older C90
compilers that do not have support for variable length argument lists.
Also trim off the trailing backslashes from the definition of
__glibc_fortify and __glibc_fortify_n macros.
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Samuel Thibault [Wed, 1 Feb 2023 23:27:26 +0000 (00:27 +0100)]
hurd: Move some i386 bits to x86
As they will actually be usable on x86_64 too.
Flavio Cruz [Mon, 30 Jan 2023 06:52:53 +0000 (01:52 -0500)]
Remove support setting custom demuxers during signal handling.
We seem to call only into the exception and message server routines.
Message-Id: <Y9dpRZs3QYk2oZm+@jupiter.tail36e24.ts.net>
Sergey Bugaev [Mon, 30 Jan 2023 12:52:16 +0000 (15:52 +0300)]
hurd: Implement SHM_ANON
This adds a special SHM_ANON value that can be passed into shm_open ()
in place of a name. When called in this way, shm_open () will create a
new anonymous shared memory file. The file will be created in the same
way that other shared memory files are created (i.e., under /dev/shm/),
except that it is not given a name and therefore cannot be reached from
the file system, nor by other calls to shm_open (). This is accomplished
by utilizing O_TMPFILE.
This is intended to be compatible with FreeBSD's API of the same name.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230130125216.6254-4-bugaevc@gmail.com>
Sergey Bugaev [Mon, 30 Jan 2023 12:52:15 +0000 (15:52 +0300)]
hurd: Implement O_TMPFILE
This is a flag that causes open () to create a new, unnamed file in the
same filesystem as the given directory. The file descriptor can be
simply used in the creating process as a temporary file, or shared with
children processes via fork (), or sent over a Unix socket. The file can
be left anonymous, in which case it will be deleted from the backing
file system once all copies of the file descriptor are closed, or given
a permanent name with a linkat () call, such as the following:
int fd = open ("/tmp", O_TMPFILE | O_RDWR, 0700);
/* Do something with the file... */
linkat (fd, "", AT_FDCWD, "/tmp/filename", AT_EMPTY_PATH);
In between creating the file and linking it to the file system, it is
possible to set the file content, mode, ownership, author, and other
attributes, so that the file visibly appears in the file system (perhaps
replacing another file) atomically, with all of its attributes already
set up.
The Hurd support for O_TMPFILE directly exposes the dir_mkfile RPC to
user programs. Previously, dir_mkfile was used by glibc internally, in
particular for implementing tmpfile (), but not exposed to user programs
through a Unix-level API.
O_TMPFILE was initially introduced by Linux. This implementation is
intended to be compatible with the Linux implementation, except that the
O_EXCL flag is not given the special meaning when used together with
O_TMPFILE, unlike on Linux.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <
20230130125216.6254-3-bugaevc@gmail.com>