Age | Commit message (Collapse) | Author | Files | Lines |
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
loongarch64-linux-gnu-lp64d.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
or1k-linux-gnu-soft.
|
|
It adds the arch-specific cancellation syscall bridge and
adjust the cancellable syscall bridge to accept 7 arguments (as
required by mips o32).
To avoid add a requirement on all architectures to support
{INLINE,INTERNAL)_SYSCALL with 7 argument, mips support is added
through a flag, HAVE_CANCELABLE_SYSCALL_WITH_7_ARGS, which changes
the signature and prototype of the requires macros and functions
(SYSCALL_CANCEL, __syscall_cancel and __syscall_cancel_arch).
Checked on mips-linux-gnu, mips64-linux-gnu, and mips64-n32-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
csky-linux-gnuabiv2.
|
|
By adding the required syscall_cancel.S.
Checked on alpha-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked on m68k-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked on hppa-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
microblaze-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
nios2-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
sh4-linux-gnu.
|
|
The syscall bridge uses the old brk 0x10000 instruction because by
using the vDSO gate the resulting PC value for an interrupted syscall
points to an address outside the expected markers in
__syscall_cancel_arch. This is similar to i686 issue.
Also the __syscall_cancel_arch issues the 'break 0x100000' on its own
bundle, and __syscall_cancel_arch_end points to end of the previous one.
It requires an arch-specific ucontext_check_pc_boundary to check for the
ri value (embedded in the sc_ip by the kernel) to check if the syscall
had any side-effects.
Checked on ia64-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked against a build and make check run-built-tests=no for
arc-linux-gnu, arc-linux-gnuhf, and arceb-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Reviewed-by: Andrew Waterman <aswaterman@gmail.com>
|
|
By adding the required syscall_cancel.S.
Checked on s390-linux-gnu and s390x-linux-gnu.
Co-authored-by: Stefan Liebler <stli@linux.ibm.com>
|
|
By adding the required syscall_cancel.S.
Checked on sparc64-linux-gnu and sparcv9-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked on powerpc64le-linux-gnu, powerpc64-linux-gnu and
powerpc-linux-gnu.
|
|
By adding the required syscall_cancel.S.
Checked on arm-linux-gnueabihf.
|
|
By adding the required syscall_cancel.S.
Checked on aarch64-linux-gnu.
|
|
The syscall bridge uses the old int80 instruction because by using
the optimized vDSO symbol the resulting PC value for an interrupted
syscall points to an adress outside the expected markers in
__syscall_cancel_arch. It has been discussed in LKML [1] on how
kernel could help userland to accomplish it, but afaik discussion
has stalled.
Also, sysenter should not be used directly by libc since its calling
convention is set by the kernel depending of the underlying x86 chip
(check kernel commit 30bfa7b3488bfb1bb75c9f50a5fcac1832970c60).
Checked on i686-linux-gnu.
[1] https://lkml.org/lkml/2016/3/8/1105
|
|
By adding a x86_64-x32 __SSC macro.
Checked on x86_64-linux-gnu-x32.
|
|
By adding the required syscall_cancel.S.
Checked on x86_64-linux-gnu.
|
|
The current racy approach is to enable asynchronous cancellation
before making the syscall and restore the previous cancellation
type once the syscall returns, and check if cancellation has happen
during the cancellation entrypoint.
As described in BZ#12683, this approach shows 2 problems:
1. Cancellation can act after the syscall has returned from the
kernel, but before userspace saves the return value. It might
result in a resource leak if the syscall allocated a resource or a
side effect (partial read/write), and there is no way to program
handle it with cancellation handlers.
2. If a signal is handled while the thread is blocked at a cancellable
syscall, the entire signal handler runs with asynchronous
cancellation enabled. This can lead to issues if the signal
handler call functions which are async-signal-safe but not
async-cancel-safe.
For the cancellation to work correctly, there are 5 points at which the
cancellation signal could arrive:
1. Before the final "testcancel" and before the syscall is made.
2. Between the "testcancel" and the syscall.
3. While the syscall is blocked and no side effects have yet taken
place.
4. While the syscall is blocked but with some side effects already
having taken place (e.g. a partial read or write).
5. After the syscall has returned.
And libc wants to act on cancellation in cases 1, 2, and 3 but not
in cases 4 or 5. For the 4 and 5 cases, the cancellation will eventually
happen in the next cancellable entrypoint without any further external
event.
The proposed solution for each case is:
1. Do a conditional branch based on whether the thread has received
a cancellation request;
2. It can be caught by the signal handler determining that the saved
program counter (from the ucontext_t) is in some address range
beginning just before the "testcancel" and ending with the
syscall instruction.
3. In this case, except for certain syscalls that ALWAYS fail with
EINTR even for non-interrupting signals, the kernel will reset
the program counter to point at the syscall instruction during
signal handling, so that the syscall is restarted when the signal
handler returns. So, from the signal handler's standpoint, this
looks the same as case 2, and thus it's taken care of.
4. For syscalls with side-effects, the kernel cannot restart the
syscall; when it's interrupted by a signal, the kernel must cause
the syscall to return with whatever partial result is obtained
(e.g. partial read or write).
5. The saved program counter points just after the syscall
instruction, so the signal handler won't act on cancellation.
This is similar to 4. since the program counter is past the syscall
instruction.
So The proposed fixes are:
1. Remove the enable_asynccancel/disable_asynccancel function usage in
cancellable syscall definition and instead make them call a common
symbol that will check if cancellation is enabled (__syscall_cancel
at nptl/cancellation.c), call the arch-specific cancellable
entry-point (__syscall_cancel_arch), and cancel the thread when
required.
2. Provide an arch-specific generic system call wrapper function
that contains global markers. These markers will be used in
SIGCANCEL signal handler to check if the interruption has been
called in a valid syscall and if the syscalls has side-effects.
A reference implementation sysdeps/unix/sysv/linux/syscall_cancel.c
is provided. However, the markers may not be set on correct
expected places depending on how INTERNAL_SYSCALL_NCS is
implemented by the architecture. It is expected that all
architectures add an arch-specific implementation.
3. Rewrite SIGCANCEL asynchronous handler to check for both canceling
type and if current IP from signal handler falls between the global
markers and act accordingly.
4. Adjust libc code to replace LIBC_CANCEL_ASYNC/LIBC_CANCEL_RESET to
appropriated cancelable syscalls.
5. Adjust 'lowlevellock-futex.h' arch-specific implementations to
provide cancelable futex calls.
This patch adds the proposed changes to NPTL common code and the
following patches add the requires arch-specific bits. The build for
ia64-linux-gnu, mips-*, and x86_64-* are broken without the
arch-specific patches.
|
|
FreeBSD makes these functions available by default, so we should
not treat them as GNU-specific and restrict them to _GNU_SOURCE.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
FreeBSD makes them available by default, too, so there does not seem
to be a reason to restrict these functions to _GNU_SOURCE.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
|
Add PREFETCHI support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add AMX-COMPLEX support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add AVX-NE-CONVERT support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add AVX-VNNI-INT8 support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add MSRLIST support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add AVX-IFMA support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add AMX-FP16 support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add WRMSRNS support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add Architectural Performance Monitoring Extended Leaf (EAX = 23H)
support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add CMPCCXADD support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add Linear Address Space Separation (LASS) support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add RAO-INT support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add architectural LBR support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add RTM_FORCE_ABORT support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add SGX-KEYS support to <sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add Bus lock debug exceptions (BUS_LOCK_DETECT) support to
<sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Add 57-bit linear addresses and five-level paging (LA57) support to
<sys/platform/x86.h>.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Move LAM after LAHF64_SAHF64 to sort x86 features.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Rename x86_cpu_INDEX_7_ECX_1 to x86_cpu_INDEX_7_ECX_15 for the unused bit
15 in ECX from CPUID with EAX == 0x7 and ECX == 0.
Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
|
|
Signed-off-by: John David Anglin <dave.anglin@bell.net>
|
|
Handle both 32 and 64-bit ABIs.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
|
|
Both _IO_file_jumps_alias and _IO_wfile_jumps_alias are defined as
alias.
|
|
Both __rpc_freemem and __rpc_thread_destroy are only used if the
the compat symbols are required.
|
|
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <20230318095826.1125734-4-gfleury@disroot.org>
|
|
sysdeps/mach/hurd/htl/pt-pthread_self.c: New file.
htl/Makefile: .. Add it to libc routine.
sysdeps/mach/hurd/htl/pt-sysdep.c(__pthread_self): Remove it.
sysdeps/mach/hurd/htl/pt-sysdep.h(__pthread_self): Add hidden propertie.
htl/Versions(__pthread_self) Version it as private symbol.
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <20230318095826.1125734-3-gfleury@disroot.org>
|
|
htl/pt-nthreads.c: new file.
htl/Makefile: Add it to routine.
htl/Versions: version it as private libc symbol.
htl/pt-create.c: remove his definition here.
htl/pt-internal.h: add propertie to it declaration.
Signed-off-by: Guy-Fleury Iteriteka <gfleury@disroot.org>
Message-Id: <20230318095826.1125734-2-gfleury@disroot.org>
|