diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2023-08-02 10:49:47 -0700 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2023-08-03 10:13:51 +0200 |
commit | eb532bc1b7a635932fe5cef472d0442620a173a2 (patch) | |
tree | d7ce4e30c8f8202e48389c4fe26f6497018638a3 /libc/sysdeps/linux/common/geteuid.c | |
parent | 7ecdaaad7835dc22c255839dac3b92093defb54f (diff) |
linuxthreads/signal: improve sigaction behavior
Setting signal handler in the kernel and then updating sighandler[sig]
results in a crash if a signal which handler is being changed from
SIG_DFL to a non-default was pending. Improve the race a little and
update the sighandler[sig] before the sigaction syscall. It doesn't
eliminate the race entirely, but fixes this particular failing case.
E.g. this fixes the 100% reproducible segfault in the busybox hush shell
built with FEATURE_EDITING_WINCH on ssh client's terminal window resize,
but in that case there's one more even bigger issue: busybox calls
sigaction with both old and new signal pointers pointing to the same
structure instance, as a result act->sa_handler after the sigaction
syscall is not what the user requested, but the previous handler.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'libc/sysdeps/linux/common/geteuid.c')
0 files changed, 0 insertions, 0 deletions