Szabolcs Nagy [Thu, 11 Mar 2021 14:49:45 +0000 (14:49 +0000)]
malloc: Rename chunk2rawmem
The previous patch ensured that all chunk to mem computations use
chunk2rawmem, so now we can rename it to chunk2mem, and in the few
cases where the tag of mem is relevant chunk2mem_tag can be used.
Replaced tag_at (chunk2rawmem (x)) with chunk2mem_tag (x).
Renamed chunk2rawmem to chunk2mem.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Tue, 9 Mar 2021 14:04:49 +0000 (14:04 +0000)]
malloc: Use chunk2rawmem throughout
The difference between chunk2mem and chunk2rawmem is that the latter
does not get the memory tag for the returned pointer. It turns out
chunk2rawmem almost always works:
The input of chunk2mem is a chunk pointer that is untagged so it can
access the chunk header. All memory that is not user allocated heap
memory is untagged, which in the current implementation means that it
has the 0 tag, but this patch does not rely on the tag value. The
patch relies on that chunk operations are either done on untagged
chunks or without doing memory access to the user owned part.
Internal interface contracts:
sysmalloc: Returns untagged memory.
_int_malloc: Returns untagged memory.
_int_free: Takes untagged memory.
_int_memalign: Returns untagged memory.
_int_realloc: Takes and returns tagged memory.
So only _int_realloc and functions outside this list need care.
Alignment checks do not need the right tag and tcache works with
untagged memory.
tag_at was kept in realloc after an mremap, which is not strictly
necessary, since the pointer is only used to retag the memory, but this
way the tag is guaranteed to be different from the old tag.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Fri, 12 Mar 2021 09:46:15 +0000 (09:46 +0000)]
malloc: Use different tag after mremap
The comment explained why different tag is used after mremap, but
for that correctly tagged pointer should be passed to tag_new_usable.
Use chunk2mem to get the tag.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Mon, 8 Mar 2021 12:59:05 +0000 (12:59 +0000)]
malloc: Use memsize instead of CHUNK_AVAILABLE_SIZE
This is a pure refactoring change that does not affect behaviour.
The CHUNK_AVAILABLE_SIZE name was unclear, the memsize name tries to
follow the existing convention of mem denoting the allocation that is
handed out to the user, while chunk is its internally used container.
The user owned memory for a given chunk starts at chunk2mem(p) and
the size is memsize(p). It is not valid to use on dumped heap chunks.
Moved the definition next to other chunk and mem related macros.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Tue, 9 Feb 2021 17:59:11 +0000 (17:59 +0000)]
aarch64: Optimize __libc_mtag_tag_zero_region
This is a target hook for memory tagging, the original was a naive
implementation. Uses the same algorithm as __libc_mtag_tag_region,
but with instructions that also zero the memory. This was not
benchmarked on real cpu, but expected to be faster than the naive
implementation.
Szabolcs Nagy [Tue, 9 Feb 2021 17:56:02 +0000 (17:56 +0000)]
aarch64: Optimize __libc_mtag_tag_region
This is a target hook for memory tagging, the original was a naive
implementation. The optimized version relies on "dc gva" to tag 64
bytes at a time for large allocations and optimizes small cases without
adding too many branches. This was not benchmarked on real cpu, but
expected to be faster than the naive implementation.
Szabolcs Nagy [Thu, 4 Feb 2021 17:05:28 +0000 (17:05 +0000)]
aarch64: inline __libc_mtag_new_tag
This is a common operation when heap tagging is enabled, so inline the
instructions instead of using an extern call.
Szabolcs Nagy [Thu, 4 Feb 2021 10:04:07 +0000 (10:04 +0000)]
aarch64: inline __libc_mtag_address_get_tag
This is a common operation when heap tagging is enabled, so inline the
instruction instead of using an extern call.
The .inst directive is used instead of the name of the instruction (or
acle intrinsics) because malloc.c is not compiled for armv8.5-a+memtag
architecture, runtime cpu support detection is used.
Prototypes are removed from the comments as they were not always
correct.
Szabolcs Nagy [Wed, 17 Feb 2021 10:15:18 +0000 (10:15 +0000)]
malloc: Use mtag_enabled instead of USE_MTAG
Use the runtime check where possible: it should not cause slow down in
the !USE_MTAG case since then mtag_enabled is constant false, but it
allows compiling the tagging logic so it's less likely to break or
diverge when developers only test the !USE_MTAG case.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Mon, 8 Feb 2021 12:39:01 +0000 (12:39 +0000)]
malloc: Use branches instead of mtag_granule_mask
The branches may be better optimized since mtag_enabled is widely used.
Granule size larger than a chunk header is not supported since then we
cannot have both the chunk header and user area granule aligned. To
fix that for targets with large granule, the chunk layout has to change.
So code that attempted to handle the granule mask generally was changed.
This simplified CHUNK_AVAILABLE_SIZE and the logic in malloc_usable_size.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Tue, 16 Feb 2021 17:02:44 +0000 (17:02 +0000)]
malloc: Change calloc when tagging is disabled
When glibc is built with memory tagging support (USE_MTAG) but it is not
enabled at runtime (mtag_enabled) then unconditional memset was used
even though that can be often avoided.
This is for performance when tagging is supported but not enabled.
The extra check should have no overhead: tag_new_zero_region already
had a runtime check which the compiler can now optimize away.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Fri, 29 Jan 2021 17:07:28 +0000 (17:07 +0000)]
malloc: Only support zeroing and not arbitrary memset with mtag
The memset api is suboptimal and does not provide much benefit. Memory
tagging only needs a zeroing memset (and only for memory that's sized
and aligned to multiples of the tag granule), so change the internal
api and the target hooks accordingly. This is to simplify the
implementation of the target hook.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Wed, 27 Jan 2021 15:45:43 +0000 (15:45 +0000)]
malloc: Use global flag instead of function pointer dispatch for mtag
A flag check can be faster than function pointers because of how
branch prediction and speculation works and it can also remove a layer
of indirection when there is a mismatch between the malloc internal
tag_* api and __libc_mtag_* target hooks.
Memory tagging wrapper functions are moved to malloc.c from arena.c and
the logic now checks mmap_enabled. The definition of tag_new_usable is
moved after chunk related definitions.
This refactoring also allows using mtag_enabled checks instead of
USE_MTAG ifdefs when memory tagging support only changes code logic
when memory tagging is enabled at runtime. Note: an "if (false)" code
block is optimized away even at -O0 by gcc.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Tue, 16 Feb 2021 14:12:25 +0000 (14:12 +0000)]
malloc: Refactor TAG_ macros to avoid indirection
This does not change behaviour, just removes one layer of indirection
in the internal memory tagging logic.
Use tag_ and mtag_ prefixes instead of __tag_ and __mtag_ since these
are all symbols with internal linkage, private to malloc.c, so there
is no user namespace pollution issue.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Wed, 17 Feb 2021 10:39:37 +0000 (10:39 +0000)]
malloc: Ensure the generic mtag hooks are not used
Use inline functions instead of macros, because macros can cause unused
variable warnings and type conversion issues. We assume these functions
may appear in the code but only in dead code paths (hidden by a runtime
check), so it's important that they can compile with correct types, but
if they are actually used that should be an error.
Currently the hooks are only used when USE_MTAG is true which only
happens on aarch64 and then the aarch64 specific code is used not this
generic header. However followup refactoring will allow the hooks to
be used with !USE_MTAG.
Note: the const qualifier in the comment was wrong: changing tags is a
write operation.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Thu, 4 Feb 2021 11:52:14 +0000 (11:52 +0000)]
malloc: Avoid taggig mmaped memory on free
Either the memory belongs to the dumped area, in which case we don't
want to tag (the dumped area has the same tag as malloc internal data
so tagging is unnecessary, but chunks there may not have the right
alignment for the tag granule), or the memory will be unmapped
immediately (and thus tagging is not useful).
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Thu, 4 Feb 2021 11:38:23 +0000 (11:38 +0000)]
malloc: Simplify __mtag_tag_new_usable
The chunk cannot be a dumped one here. The only non-obvious cases
are free and realloc which may be called on a dumped area chunk,
but in both cases it can be verified that tagging is already
avoided for dumped area chunks.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Thu, 28 Jan 2021 17:34:36 +0000 (17:34 +0000)]
malloc: Move MTAG_MMAP_FLAGS definition
This is only used internally in malloc.c, the extern declaration
was wrong, __mtag_mmap_flags has internal linkage.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Thu, 11 Mar 2021 14:09:56 +0000 (14:09 +0000)]
malloc: Fix a potential realloc issue with memory tagging
At an _int_free call site in realloc the wrong size was used for tag
clearing: the chunk header of the next chunk was also cleared which
in practice may work, but logically wrong.
The tag clearing is moved before the memcpy to save a tag computation,
this avoids a chunk2mem. Another chunk2mem is removed because newmem
does not have to be recomputed. Whitespaces got fixed too.
Reviewed-by: DJ Delorie <dj@redhat.com>
Szabolcs Nagy [Thu, 25 Feb 2021 14:49:58 +0000 (14:49 +0000)]
malloc: Fix a realloc crash with heap tagging [BZ 27468]
_int_free must be called with a chunk that has its tag reset. This was
missing in a rare case that could crash when heap tagging is enabled:
when in a multi-threaded process the current arena runs out of memory
during realloc, but another arena still has space to finish the realloc
then _int_free was called without clearing the user allocation tags.
Fixes bug 27468.
Reviewed-by: DJ Delorie <dj@redhat.com>
Stefan Liebler [Tue, 23 Mar 2021 16:29:26 +0000 (17:29 +0100)]
S390: Also check vector support in memmove ifunc-selector [BZ #27511]
The arch13 memmove variant is currently selected by the ifunc selector
if the Miscellaneous-Instruction-Extensions Facility 3 facility bit
is present, but the function is also using vector instructions.
If the vector support is not present, one is receiving an operation
exception.
Therefore this patch also checks for vector support in the ifunc
selector and in ifunc-impl-list.c.
Just to be sure, the configure check is now also testing an arch13
vector instruction and an arch13 Miscellaneous-Instruction-Extensions
Facility 3 instruction.
Stefan Liebler [Wed, 17 Mar 2021 13:03:52 +0000 (14:03 +0100)]
S390: Don't test nanoseconds in io/tst-stat.c
Both new tests io/tst-stat and io/tst-stat-lfs (_FILE_OFFSET_BITS=64)
are comparing the nanosecond fields with the statx result. Unfortunately
on s390(31bit) those fields are always zero if old KABI with non-LFS
support is used. With _FILE_OFFSET_BITS=64 stat is using statx internally.
As suggested by Adhemerval this patch disables the nanosecond check for
s390(31bit).
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 25 Mar 2021 10:05:37 +0000 (11:05 +0100)]
Support for multiple versions in versioned_symbol, compat_symbol
This essentially folds compat_symbol_unique functionality into
compat_symbol.
This change eliminates the need for intermediate aliases for defining
multiple symbol versions, for both compat_symbol and versioned_symbol.
Some binutils versions do not suport multiple versions per symbol on
some targets, so aliases are automatically introduced, similar to what
compat_symbol_unique did. To reduce symbol table sizes, a configure
check is added to avoid these aliases if they are not needed.
The new mechanism works with data symbols as well as function symbols,
due to the way an assembler-level redirect is used. It is not
compatible with weak symbols for old binutils versions, which is why
the definition of __malloc_initialize_hook had to be changed. This
is not a loss of functionality because weak symbols do not matter
to dynamic linking.
The placeholder symbol needs repeating in nptl/libpthread-compat.c
now that compat_symbol is used, but that seems more obvious than
introducing yet another macro.
A subtle difference was that compat_symbol_unique made the symbol
global automatically. compat_symbol does not do this, so static
had to be removed from the definition of
__libpthread_version_placeholder.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 25 Mar 2021 10:05:37 +0000 (11:05 +0100)]
locale: Use compat_symbol_reference in _nl_postload_ctype
These symbol usages are not definitions, so compat_symbol_reference is
more appropriate than compat_symbol. compat_symbol_reference is also
safe to emit multiple times (in case the inline assembly is
duplicated; this is possible because it is nested in a function).
compat_symbol does not necessarily have this property because it is
intended to provide a symbol definition.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Thu, 25 Mar 2021 10:05:37 +0000 (11:05 +0100)]
Change how the symbol_version_reference macro is defined
A subsequent change will require including <config.h> for defining
symbol_version_reference. <libc-symbol.h> should not include
<config.h> for _ISOMAC, so it cannot define symbol_version_reference
anymore, but symbol_version_reference is needed <shlib-compat.h> even
for _ISOMAC. Moving the definition of symbol_version_reference to a
separate file <libc-symver.h> makes it possible to use a single
definition for both cases.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Samuel Thibault [Wed, 24 Mar 2021 00:36:20 +0000 (01:36 +0100)]
stdlib: Fix BZ #26241 testcase on GNU/Hurd
GNU/Hurd's readlink system call is partly implemented in userspace, which
also allocates a buffer on the stack for the result, and thus needs one
more path.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Samuel Thibault [Wed, 24 Mar 2021 00:10:38 +0000 (01:10 +0100)]
elf: Fix not compiling ifunc tests that need gcc ifunc support
Samuel Thibault [Wed, 24 Mar 2021 00:18:17 +0000 (00:18 +0000)]
htl: Add missing fork.h
2b47727c68b6 ("posix: Consolidate register-atfork") introduced a fork.h
header to declare the atfork unregister hook, but was missing adding it
for htl.
This fixes tst-atfork2.
Samuel Thibault [Tue, 23 Mar 2021 22:38:54 +0000 (22:38 +0000)]
hurd: handle EINTR during critical sections
During critical sections, signal handling is deferred and thus RPCs return
EINTR, even if SA_RESTART is set. We thus have to restart the whole critical
section in that case.
This also adds HURD_CRITICAL_UNLOCK in the cases where one wants to
break the section in the middle.
Lukasz Majewski [Mon, 15 Mar 2021 11:14:22 +0000 (12:14 +0100)]
tst: Add test for sigtimedwait
This change adds new test to assess sigtimedwait's timeout related
functionality - the sigset_t is configured for SIGUSR1, which will
not be triggered, so sigtimedwait just waits for timeout.
To be more specific - two use cases are checked:
- if sigtimedwait times out immediately when passed struct timespec has
zero values of tv_nsec and tv_sec.
- if sigtimedwait times out after timeout specified in passed argument
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Sat, 13 Mar 2021 22:34:21 +0000 (23:34 +0100)]
tst: Provide test for select
This change adds new test to assess select()'s timeout related
functionality (the rdfs set provides valid fd - stderr - but during
normal program operation there is no data to be read, so one just
waits for timeout).
To be more specific - two use cases are checked:
- if select() times out immediately when passed struct timeval has
zero values of tv_usec and tv_sec.
- if select() times out after timeout specified in passed argument
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Tue, 9 Mar 2021 10:38:05 +0000 (11:38 +0100)]
tst: Add test for ntp_gettimex
This test is a wrapper on tst-ntp_gettime test.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Tue, 9 Mar 2021 10:33:34 +0000 (11:33 +0100)]
tst: Add test for ntp_gettime
This code provides test to check if time on target machine is properly
read via ntp_gettime syscall.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Lukasz Majewski [Tue, 23 Mar 2021 10:37:01 +0000 (11:37 +0100)]
fix: Always export ntp_gettimex function
After this patch applied the ntp_gettimex function is always declared
in the sys/timex.h header. Currently it is not when __REDIRECT_NTH is
defined (i.e. in ARM 32 bit port).
H.J. Lu [Fri, 19 Mar 2021 19:53:40 +0000 (12:53 -0700)]
nptl: Remove MULTI_PAGE_ALIASING [BZ #23554]
MULTI_PAGE_ALIASING was introduced to mitigate an aliasing issue on
Pentium 4. It is no longer needed for processors after Pentium 4.
H.J. Lu [Fri, 19 Mar 2021 17:39:32 +0000 (10:39 -0700)]
elf: Add EM_INTELGT for Intel Graphics Technology
Add EM_INTELGT (205) for Intel Graphics Technology which has been added
to gABI:
https://groups.google.com/g/generic-abi/c/ofBevXA48dM
Adhemerval Zanella [Thu, 18 Mar 2021 20:52:09 +0000 (17:52 -0300)]
support: Use syscall function instead of INLINE_SYSCALL_CALL
It fixes the build on ARM in thumb mode that requires an out of the
line helper (__libc_do_syscall) to issue the syscall.
Adhemerval Zanella [Mon, 15 Mar 2021 18:23:40 +0000 (15:23 -0300)]
signal: Add __libc_sigaction
The generic implementation basically handle the system agnostic logic
(filtering out the invalid signals) while the __libc_sigaction is
the function with implements the system and architecture bits.
Checked on x86_64-linux-gnu and i686-linux-gnu.
Adhemerval Zanella [Mon, 15 Mar 2021 14:02:21 +0000 (11:02 -0300)]
nptl: Move system to libc
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Sun, 14 Mar 2021 12:52:16 +0000 (09:52 -0300)]
nptl: Move fcntl from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Sun, 14 Mar 2021 12:28:25 +0000 (09:28 -0300)]
nptl: Remove sendmsg from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Sat, 13 Mar 2021 23:15:55 +0000 (20:15 -0300)]
nptl: Remove recvmsg from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Sat, 13 Mar 2021 23:11:50 +0000 (20:11 -0300)]
nptl: Remove sigwait from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Sat, 13 Mar 2021 23:04:18 +0000 (20:04 -0300)]
nptl: Remove tcdrain from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 23:57:52 +0000 (20:57 -0300)]
nptl: Remove pause from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 23:29:57 +0000 (20:29 -0300)]
nptl: Remove msync from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:47:45 +0000 (16:47 -0300)]
nptl: Remove fsync from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:45:29 +0000 (16:45 -0300)]
nptl: Remove sendto from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:42:05 +0000 (16:42 -0300)]
nptl: Remove recvfrom from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:33:38 +0000 (16:33 -0300)]
nptl: Remove recv from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:31:17 +0000 (16:31 -0300)]
nptl: Remove connect from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:29:32 +0000 (16:29 -0300)]
nptl: Remove accept from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:26:53 +0000 (16:26 -0300)]
nptl: Remove close from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:22:44 +0000 (16:22 -0300)]
nptl: Remove read from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Fri, 12 Mar 2021 19:13:26 +0000 (16:13 -0300)]
nptl: Remove write from libpthread
The libc version is identical and built with same flags.
Checked on x86_64-linux-gnu.
Raphael Moreira Zinsly [Thu, 3 Dec 2020 13:41:02 +0000 (10:41 -0300)]
benchtests: Add ilogb* tests
Add a benchtest to ilogb, ilogbf and ilogbf128 based on the logb* benchtests.
Raphael Moreira Zinsly [Thu, 25 Feb 2021 12:58:52 +0000 (09:58 -0300)]
powerpc: Add optimized llogb* for POWER9
The POWER9 builtins used to improve the ilogb* functions can be
used in the llogb* functions as well.
Raphael Moreira Zinsly [Tue, 23 Feb 2021 17:14:37 +0000 (14:14 -0300)]
powerpc: Add optimized ilogb* for POWER9
The instructions xsxexpdp and xsxexpqp introduced on POWER9 extract
the exponent from a double-precision and quad-precision floating-point
respectively, thus they can be used to improve ilogb, ilogbf and ilogbf128.
Florian Weimer [Tue, 16 Mar 2021 14:56:50 +0000 (15:56 +0100)]
glibcymbols.read_abilist: Add check for duplicate symbols
This detects some bogus abilist files.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 16 Mar 2021 14:56:50 +0000 (15:56 +0100)]
scripts/glibcsymbols.py: Extract from scripts/move-symbol-to-libc.py
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 16 Mar 2021 14:33:09 +0000 (15:33 +0100)]
Legacy unwinder: Remove definition of _Unwind_GetCFA
It is not actually used by the legacy unwinder linked into
libc.so, and it conflicts with the unwind-link functionality
in libpthread.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Siddhesh Poyarekar [Mon, 15 Mar 2021 11:53:30 +0000 (17:23 +0530)]
support: Pass environ to child process
Pass environ to posix_spawn so that the child process can inherit
environment of the test.
Matheus Castanho [Mon, 1 Mar 2021 20:07:27 +0000 (14:07 -0600)]
powerpc: Update libm-test-ulps
Generated with 'make regen-ulps' on POWER8.
Tested on powerpc, powerpc64, and powerpc64le
Siddhesh Poyarekar [Mon, 15 Mar 2021 14:55:00 +0000 (20:25 +0530)]
Build libc-start with stack protector for SHARED
This does not change the emitted code since __libc_start_main does not
return, but is important for formal flags compliance.
This also cleans up the cosmetic inconsistency in the stack protector
flags in csu, especially the incorrect value of STACK_PROTECTOR_LEVEL.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Siddhesh Poyarekar [Mon, 15 Mar 2021 14:54:45 +0000 (20:24 +0530)]
Build get-cpuid-feature-leaf.c without stack-protector [BZ #27555]
__x86_get_cpuid_feature_leaf is called during early startup, before
the stack check guard is initialized and is hence not safe to build
with stack-protector.
Additionally, IFUNC resolvers for static tst-ifunc-isa tests get
called too early for stack protector to be useful, so fix them to
disable stack protector for the resolver functions.
This fixes all failures seen with --enable-stack-protector=all
configuration.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
David Hughes [Mon, 15 Mar 2021 14:53:39 +0000 (20:23 +0530)]
Add inhibit_stack_protector to ifuncmain9 [BZ #25680]
Enabling --enable-stack-protector=all causes the following tests to fail:
FAIL: elf/ifuncmain9picstatic
FAIL: elf/ifuncmain9static
Nick Alcock (who committed the stack protector code) marked the IFUNC
resolvers with inhibit_stack_protector when he done the original work and
suggested doing so again @ BZ #25680. This patch adds
inhibit_stack_protector to ifuncmain9.
After patch is applied, --enable-stack-protector=all does not fail the
above tests.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Siddhesh Poyarekar [Mon, 15 Mar 2021 10:30:06 +0000 (16:00 +0530)]
support: Typo and formatting fixes
- Add a newline to the end of error messages in transfer().
- Fixed the name of support_subprocess_init().
Florian Weimer [Mon, 15 Mar 2021 09:33:43 +0000 (10:33 +0100)]
elf: ld.so --help calls _dl_init_paths without a main map [BZ #27577]
In this case, use the link map of the dynamic loader itself as
a replacement. This is more than just a hack: if we ever support
DT_RUNPATH/DT_RPATH for the dynamic loader, reporting it for
ld.so --help (without further command line arguments) would be the
right thing to do.
Fixes commit
332421312576bd7095e70589154af99b124dd2d1 ("elf: Always
set l in _dl_init_paths (bug 23462)").
H.J. Lu [Sat, 6 Mar 2021 18:19:32 +0000 (10:19 -0800)]
x86: Handle _SC_LEVEL1_ICACHE_LINESIZE [BZ #27444]
commit
2d651eb9265d1366d7b9e881bfddd46db9c1ecc4
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Fri Sep 18 07:55:14 2020 -0700
x86: Move x86 processor cache info to cpu_features
missed _SC_LEVEL1_ICACHE_LINESIZE.
1. Add level1_icache_linesize to struct cpu_features.
2. Initialize level1_icache_linesize by calling handle_intel,
handle_zhaoxin and handle_amd with _SC_LEVEL1_ICACHE_LINESIZE.
3. Return level1_icache_linesize for _SC_LEVEL1_ICACHE_LINESIZE.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Carlos O'Donell [Fri, 12 Mar 2021 15:44:47 +0000 (16:44 +0100)]
elf: Always set l in _dl_init_paths (bug 23462)
After
d1d5471579eb0426671bf94f2d71e61dfb204c30 ("Remove dead
DL_DST_REQ_STATIC code.") we always setup the link map l to make the
static and shared cases the same. The bug is that in elf/dl-load.c
(_dl_init_paths) we conditionally set l only in the #ifdef SHARED
case, but unconditionally use it later. The simple solution is to
remove the #ifdef SHARED conditional, because it's no longer needed,
and unconditionally setup l for both the static and shared cases. A
regression test is added to run a static binary with
LD_LIBRARY_PATH='$ORIGIN' which crashes before the fix and runs after
the fix.
Co-Authored-By: Florian Weimer <fweimer@redhat.com>
Stefan Liebler [Fri, 12 Mar 2021 13:31:49 +0000 (14:31 +0100)]
s390x: Regenerate ULPs.
Updates needed after recent commit:
db3f7bb5586392d9809fc6397c7184983aed6008
"math: Remove slow paths from asin and acos [BZ #15267]"
Compre to the required ulps update for x86_64.
Adhemerval Zanella [Wed, 20 Jan 2021 17:32:23 +0000 (14:32 -0300)]
support: Add xpthread_kill
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Tue, 19 Jan 2021 12:18:46 +0000 (09:18 -0300)]
nptl: Move fork into libc
This is part of the libpthread removal project:
<https://sourceware.org/ml/libc-alpha/2019-10/msg00080.html>
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 18 Jan 2021 18:32:02 +0000 (15:32 -0300)]
linux: Use __libc_single_threaded on fork
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Mon, 18 Jan 2021 18:10:02 +0000 (15:10 -0300)]
posix: Consolidate register-atfork
Both htl and nptl uses a different data structure to implement atfork
handlers. The nptl one was refactored by
27761a1042d to use a dynarray
which simplifies the code.
This patch moves the nptl one to be the generic implementation and
replace Hurd linked one. Different than previous NPTL, Hurd also uses
a global lock, so performance should be similar.
Checked on x86_64-linux-gnu, i686-linux-gnu, and with a build for
i686-gnu.
Adhemerval Zanella [Thu, 3 Dec 2020 14:28:58 +0000 (11:28 -0300)]
nptl: Move Linux pthread_kill to nptl
The nptl already expects a Linux syscall internally. Also
__is_internal_signal is used and the DEBUGGING_P check is removed.
Checked on x86_64-linux-gnu.
Adhemerval Zanella [Thu, 11 Mar 2021 12:30:33 +0000 (09:30 -0300)]
io: Return UNSUPPORTED if filesystem do not support 64 bit timestamps
Some Linux filesystems might not fully support 64 bit timestamps [1],
which make some Linux specific tests to fail when they check for the
functionality.
This patch adds a new libsupport function, support_path_support_time64,
that returns whether the target file supports or not 64 bit timestamps.
The support is checked by issuing a utimensat and verifying both the
last access and last modification time against a statx call.
The tests that might fail are also adjusted to check the file support
as well:
$ dd if=/dev/zero of=loopbackfile.img bs=100M count=1
1+0 records in
1+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0,0589568 s, 1,8 GB/s
$ sudo losetup -fP loopbackfile.img
$ mkfs.xfs loopbackfile.img
meta-data=loopbackfile.img isize=512 agcount=4, agsize=6400 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=25600, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=1368, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
$ mkdir loopfs
$ sudo mount -o loop /dev/loop0 loopfs/
$ sudo chown -R azanella:azanella loopfs
$ TMPDIR=loopfs/ ./testrun.sh misc/tst-utimes
error: ../sysdeps/unix/sysv/linux/tst-utimes.c:55: File loopfs//utimesfECsK1 does not support 64-bit timestamps
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1795576
DJ Delorie [Thu, 11 Mar 2021 17:50:02 +0000 (12:50 -0500)]
test-container: Always copy test-specific support files [BZ #27537]
There's a small chance that a fresh checkout will result in some of
the test-specific container files will have the same timestamp and
size, which breaks the rsync logic in test-container, resulting in
tests running with the wrong support files.
This patch changes the rsync logic to always copy the test-specific
files, which normally would always be copied anyway. The rsync logic
for the testroot itself is unchanged.
Wilco Dijkstra [Thu, 11 Mar 2021 15:36:14 +0000 (15:36 +0000)]
math: Remove mpa files (part 2) [BZ #15267]
Previous commit was missing deleted files in sysdeps/ieee754/dbl-64.
Finally remove all mpa related files, headers, declarations, probes, unused
tables and update makefiles.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Wilco Dijkstra [Wed, 10 Mar 2021 12:41:47 +0000 (12:41 +0000)]
math: Remove mpa files [BZ #15267]
Finally remove all mpa related files, headers, declarations, probes, unused
tables and update makefiles.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Wilco Dijkstra [Wed, 10 Mar 2021 12:41:20 +0000 (12:41 +0000)]
math: Remove slow paths from atan2 [BZ #15267]
Remove slow paths from atan2. Add ULP annotations.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Wilco Dijkstra [Wed, 10 Mar 2021 12:40:56 +0000 (12:40 +0000)]
math: Remove slow paths from atan [BZ #15267]
Remove slow paths from atan. Add ULP annotations.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Wilco Dijkstra [Wed, 10 Mar 2021 12:40:26 +0000 (12:40 +0000)]
math: Remove slow paths in tan [BZ #15267]
Remove slow paths in tan. Add ULP annotations. Merge 'number' into 'mynumber'.
Remove unused entries from tan constants.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Wilco Dijkstra [Wed, 10 Mar 2021 12:39:56 +0000 (12:39 +0000)]
math: Remove slow paths from asin and acos [BZ #15267]
This patch series removes all remaining slow paths and related code.
First asin/acos, tan, atan, atan2 implementations are updated, and the final
patch removes the unused mpa files, headers and probes. Passes buildmanyglibc.
Remove slow paths from asin/acos. Add ULP annotations based on previous slow
path checks (which are approximate). Update AArch64 and x86_64 libm-test-ulps.
Reviewed-By: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Adhemerval Zanella [Thu, 11 Mar 2021 11:21:06 +0000 (08:21 -0300)]
io: Return EBAFD for negative file descriptor on fstat (BZ #27559)
Now that fstat is implemented on top fstatat we need to handle negative
inputs. The implementation now rejects AT_FDCWD, which would otherwise
be accepted by the kernel.
Checked on x86_64-linux-gnu and on i686-linux-gnu.
Stefan Liebler [Thu, 11 Mar 2021 09:45:15 +0000 (10:45 +0100)]
Allow gdb version 10 in pretty printer tests.
With gdb 10, the pretty printer tests are UNSUPPORTED::
The gdb version string (gdb -v) is incorrectly formatted.
This is observable in:
nptl/test-cond-printers, nptl/test-condattr-printers,
nptl/test-mutex-printers, nptl/test-mutexattr-printers,
nptl/test-rwlock-printers, nptl/test-rwlockattr-printers
After updating the regexp and building with debug-info,
all those tests are passing.
Joseph Myers [Wed, 10 Mar 2021 14:26:57 +0000 (14:26 +0000)]
Update kernel version to 5.11 in tst-mman-consts.py.
This patch updates the kernel version in the test tst-mman-consts.py
to 5.11. (There are no new MAP_* constants covered by this test in
5.11 that need any other header changes.)
Tested with build-many-glibcs.py.
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
Linux: misc/tst-ofdlocks-compat can be a regular test
Now that compat_symbol_reference works in non-internal tests.
Also do not build and run the test at all on architectures which
do not have the pre-2.28 symbol version of fcntl.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
Linux: dirent/tst-readdir64-compat can be a regular test
compat_symbol_reference works in non-internal tests now. Also
avoid building the test for unsupported configurations at all.
I verified by building with build-many-glibcs.py that GLIBC_2.1.3
works as the predecessor of GLIBC_2.2. (Symbol versions in
the early days are complex.)
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
sunrpc: tst-svc_register can be a regular test
Now that compat_symbol_reference is not restricted to internal tests
anymore.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
resolv: tst-p_secstodate can be a regular test
Now that compat_symbol_reference works for non-internal tests, too.
Also do not build and run the tests on architectures which lack the
__p_secstodate compatibility symbol.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
posix: tst-spawn4-compat can be a regular test
compat_symbol_reference now works for non-internal tests, too.
Also stop building and running the tests on those architectures
that lack the test symbol versions.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
posix: tst-glob_lstat_compat no longer needs to be an internal test
compat_symbol_reference is now available for regular tests as well.
Also avoid building and running the tests in case the pre-2.27
symbol version of glob is not available. This avoids a spurious
UNSUPPORTED result.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
math: test-matherr and test-matherr-2 can be regular tests
compat_symbol_reference is now available without tests-internal.
Do not build the test at all on glibc versions that lack the symbols,
to avoid spurious UNSUPPORTED results.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
math: $(libm-tests-compat) can be regular tests
tests-internal is no longer needed because compat_symbol_reference
now works in regular tests.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
malloc: Turn tst-mallocstate into a non-internal test
compat_symbol_reference no longer needs tests-internal. Do not build
the test at all for newer targets, so that no spurious UNSUPPORTED
result is generated. Use compat_symbol_reference for
__malloc_initialize_hook as well, eliminating the need for -rdynamic.
Reviewed-by: DJ Delorie <dj@redhat.com>
Florian Weimer [Tue, 9 Mar 2021 20:07:24 +0000 (21:07 +0100)]
<shlib-compat.h>: Support compat_symbol_reference for _ISOMAC
This is helpful for testing compat symbols in cases where _ISOMAC
is activated implicitly due to -DMODULE_NAME=testsuite and cannot
be disabled easily.
DJ Delorie [Tue, 16 Feb 2021 02:34:23 +0000 (21:34 -0500)]
nss: fix nss_database_lookup2's alternate handling [BZ #27416]
__nss_database_lookup2's extra arguments were left unused in the
nsswitch reloading patch set; this broke compat (default config
ignored) and shadow files (secondary name ignored) which relies on
these fallbacks.
This patch adds in the previous behavior by correcting the
initialization of the database list to reflect the fallbacks. This
means that the nss_database_lookup2 interface no longer needs to be
passed the fallback info, so API and callers were adjusted.
Since all callers needed to be edited anyway, the calls were changed
from __nss_database_lookup2 to the faster __nss_database_get. This
was an intended optimization which was deferred during the initial
lookup changes to avoid touching so many files.
The test case verifies that compat targets work (passwd) and that the
default configuration works (group). Tested on x86-64.
DJ Delorie [Wed, 3 Mar 2021 19:52:57 +0000 (14:52 -0500)]
NEWS: Add entry for CVE-2021-27645
Lukasz Majewski [Sun, 7 Mar 2021 12:11:55 +0000 (13:11 +0100)]
tst: Add test for settimeofday
This code brings test to check if time on target machine is properly set.
To avoid any issues with altering the time:
- The time, which was set before the test was executed is restored.
- The time is altered only when cross-test-ssh.sh is executed with
--allow-time-setting flag
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>