Skip to content

Commit 5bf2fed

Browse files
bernd-edlingerkees
authored andcommitted
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. Signed-off-by: Bernd Edlinger <[email protected]> Cc: [email protected] Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/AM8PR10MB470871DEBD1DED081F9CC391E4389@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM
1 parent 9abf231 commit 5bf2fed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/exec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,11 +1197,11 @@ static int unshare_sighand(struct task_struct *me)
11971197
return -ENOMEM;
11981198

11991199
refcount_set(&newsighand->count, 1);
1200-
memcpy(newsighand->action, oldsighand->action,
1201-
sizeof(newsighand->action));
12021200

12031201
write_lock_irq(&tasklist_lock);
12041202
spin_lock(&oldsighand->siglock);
1203+
memcpy(newsighand->action, oldsighand->action,
1204+
sizeof(newsighand->action));
12051205
rcu_assign_pointer(me->sighand, newsighand);
12061206
spin_unlock(&oldsighand->siglock);
12071207
write_unlock_irq(&tasklist_lock);

0 commit comments

Comments
 (0)