Skip to content

Commit c36d891

Browse files
committed
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
2 parents a4cc5ea + 6c3118c commit c36d891

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/signal.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4185,6 +4185,15 @@ do_sigaltstack (const stack_t *ss, stack_t *oss, unsigned long sp,
41854185
ss_mode != 0))
41864186
return -EINVAL;
41874187

4188+
/*
4189+
* Return before taking any locks if no actual
4190+
* sigaltstack changes were requested.
4191+
*/
4192+
if (t->sas_ss_sp == (unsigned long)ss_sp &&
4193+
t->sas_ss_size == ss_size &&
4194+
t->sas_ss_flags == ss_flags)
4195+
return 0;
4196+
41884197
sigaltstack_lock();
41894198
if (ss_mode == SS_DISABLE) {
41904199
ss_size = 0;

0 commit comments

Comments
 (0)