diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-19 11:46:54 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-12-19 11:46:54 -0800 |
commit | c36d891d787d03b36e18aa4ef254eebe6060b39a (patch) | |
tree | 220e26c8017c129bd6c9ac26a6fb657bd77a3fbf /kernel | |
parent | a4cc5ea443e7f0649b322a47abc7ce612c5c0581 (diff) | |
parent | 6c3118c32129b4197999a8928ba776bcabd0f5c4 (diff) |
Merge tag 'core_urgent_for_v5.16_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull signal handlign fix from Borislav Petkov:
- Prevent lock contention on the new sigaltstack lock on the
common-case path, when no changes have been made to the alternative
signal stack.
* tag 'core_urgent_for_v5.16_rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
signal: Skip the altstack update when not needed
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/signal.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index a629b11bf3e0..dfcee3888b00 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -4185,6 +4185,15 @@ do_sigaltstack (const stack_t *ss, stack_t *oss, unsigned long sp, ss_mode != 0)) return -EINVAL; + /* + * Return before taking any locks if no actual + * sigaltstack changes were requested. + */ + if (t->sas_ss_sp == (unsigned long)ss_sp && + t->sas_ss_size == ss_size && + t->sas_ss_flags == ss_flags) + return 0; + sigaltstack_lock(); if (ss_mode == SS_DISABLE) { ss_size = 0; |