Skip to contentSkip to conversation

FAILED: patch "[PATCH] exec: Copy oldsighand->action under spin-lock" failed to apply to 4.19-stable tree

PATCH [email protected] 1 participant 1 message Oct 31, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Possible dependencies:

5bf2fedca8f5 ("exec: Copy oldsighand->action under spin-lock") 021691559245 ("exec: Factor unshare_sighand out of de_thread and call it separately") d036bda7d0e7 ("sched/core: Convert sighand_struct.count to refcount_t")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 5bf2fedca8f59379025b0d52f917b9ddb9bfe17e Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <[email protected]>
Date: Mon, 7 Jun 2021 15:54:27 +0200
Subject: [PATCH] exec: Copy oldsighand->action under spin-lock

unshare_sighand should only access oldsighand->action while holding oldsighand->siglock, to make sure that newsighand->action is in a consistent state.

fs/exec.c +2 -2
index 349a5da91efe..32dc8cf5fceb 100644
@@ -1197,11 +1197,11 @@ static int unshare_sighand(struct task_struct *me)
 			return -ENOMEM;
 
 		refcount_set(&newsighand->count, 1);
-		memcpy(newsighand->action, oldsighand->action,
-		       sizeof(newsighand->action));
 
 		write_lock_irq(&tasklist_lock);
 		spin_lock(&oldsighand->siglock);
+		memcpy(newsighand->action, oldsighand->action,
+		       sizeof(newsighand->action));
 		rcu_assign_pointer(me->sighand, newsighand);
 		spin_unlock(&oldsighand->siglock);
 		write_unlock_irq(&tasklist_lock);