search for: signal_descriptor

Displaying 6 results from an estimated 6 matches for "signal_descriptor".

Did you mean: signal_descriptors
2019 Feb 02
2
[PATCH 1/2] ia64: Fix invalid memory access in vfork
Commit 8418552 ("[klibc] ia64: Fix shared build") missed this use of the GP register, although the code appears to have been dubious anyway, assuming the address of errno was the first thing pointed to by GP. --- usr/klibc/arch/ia64/vfork.S | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/usr/klibc/arch/ia64/vfork.S b/usr/klibc/arch/ia64/vfork.S index
2019 Feb 02
0
[PATCH 2/2] ia64: Fix sigaction struct layout and function implementation
...ut the kernel always expects a descriptor. Thus we create a fake + descriptor for each possible signal, update it, and pass that to the kernel + instead (the descriptor must remain valid after returning from sigaction + until it is replaced). */ +struct { + uintptr_t entry; + uintptr_t gp; +} signal_descriptors[_NSIG]; +#endif + int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { int rv; -#if _KLIBC_NEEDS_SA_RESTORER +#if _KLIBC_NEEDS_SA_RESTORER || defined(__ia64__) struct sigaction sa; +#endif +#ifdef __ia64__ + uintptr_t old_entry; +#endif +#if _KLIBC_NEEDS_SA_RESTO...
2020 Aug 29
0
[klibc:master] ia64: Fix sigaction function implementation
...kernel always expects a descriptor. Thus we create a fake + descriptor for each possible signal, update it, and pass that to the kernel + instead (the descriptor must remain valid after returning from sigaction + until it is replaced). */ +static struct { + uintptr_t entry; + uintptr_t gp; +} signal_descriptors[_NSIG]; + +__extern int ____rt_sigaction(int, const struct sigaction *, struct sigaction *, + size_t); + +int __rt_sigaction(int sig, struct sigaction *act, + struct sigaction *oact, size_t size) +{ + uintptr_t old_entry; + int rv; + + if (sig < 0 || sig >= _NSIG) { + errno = EI...
2020 Aug 28
0
[klibc:ia64-signal-fix] ia64: Fix sigaction struct layout and function implementation
...kernel always expects a descriptor. Thus we create a fake + descriptor for each possible signal, update it, and pass that to the kernel + instead (the descriptor must remain valid after returning from sigaction + until it is replaced). */ +static struct { + uintptr_t entry; + uintptr_t gp; +} signal_descriptors[_NSIG]; + +__extern int ____rt_sigaction(int, const struct sigaction *, struct sigaction *, + size_t); + +int __rt_sigaction(int sig, const struct sigaction *act, + struct sigaction *oact, size_t size) +{ + uintptr_t old_entry; + int rv; + + if (sig < 0 || sig >= _NSIG) { + errn...
2020 Aug 28
0
[klibc:ia64-signal-fix] ia64: sigaction: Make signal updates atomic
...t sigaction *act, return -1; } + /* Mask the signal to avoid races on access to its descriptor */ + sigemptyset(&signal_mask); + sigaddset(&signal_mask, sig); + rv = sigprocmask(SIG_BLOCK, &signal_mask, &old_signal_mask); + if (rv) + return -1; + if (oact) { old_entry = signal_descriptors[sig].entry; } @@ -41,6 +49,12 @@ int __rt_sigaction(int sig, const struct sigaction *act, rv = ____rt_sigaction(sig, act, oact, size); + if (rv) + signal_descriptors[sig].entry = old_entry; + + /* Restore signal mask */ + (void)sigprocmask(SIG_SETMASK, &old_signal_mask, NULL); + if...
2020 Aug 29
0
[klibc:master] ia64: sigaction: Make signal updates atomic
...t sigaction *act, return -1; } + /* Mask the signal to avoid races on access to its descriptor */ + sigemptyset(&signal_mask); + sigaddset(&signal_mask, sig); + rv = sigprocmask(SIG_BLOCK, &signal_mask, &old_signal_mask); + if (rv) + return -1; + if (oact) { old_entry = signal_descriptors[sig].entry; } @@ -41,6 +49,12 @@ int __rt_sigaction(int sig, struct sigaction *act, rv = ____rt_sigaction(sig, act, oact, size); + if (rv) + signal_descriptors[sig].entry = old_entry; + + /* Restore signal mask */ + (void)sigprocmask(SIG_SETMASK, &old_signal_mask, NULL); + if (oact...