diff --git a/fs/exec.c b/fs/exec.c index 7432820a50b7fd4ddd2f06539441e19dd3fbcc35..ba1c3898abae6942c317862c23ce8462c8853782 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1380,7 +1380,7 @@ void setup_new_exec(struct linux_binprm * bprm) /* An exec changes our domain. We are no longer part of the thread group */ - current->self_exec_id++; + WRITE_ONCE(current->self_exec_id, current->self_exec_id + 1); flush_signal_handlers(current, 0); } EXPORT_SYMBOL(setup_new_exec); diff --git a/include/linux/sched.h b/include/linux/sched.h index 1407cc0396c9898a419dacd6447f9e6ed1fadec5..4f52a1bf2db12a8515d80fd40e57d18e753ac430 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1012,8 +1012,8 @@ struct task_struct { struct seccomp seccomp; /* Thread group tracking: */ - u32 parent_exec_id; - u32 self_exec_id; + u64 parent_exec_id; + u64 self_exec_id; /* Protection against (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed, mempolicy: */ spinlock_t alloc_lock; diff --git a/kernel/signal.c b/kernel/signal.c index 9af6829ac69a7379a855eae36543343ff5911a28..d94916f539662736ee92ff788fe93871cb687fba 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1932,7 +1932,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig) * This is only possible if parent == real_parent. * Check if it has changed security domain. */ - if (tsk->parent_exec_id != tsk->parent->self_exec_id) + if (tsk->parent_exec_id != READ_ONCE(tsk->parent->self_exec_id)) sig = SIGCHLD; }