[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZdJWuMifIiNnrLbZ@duo.ucw.cz>
Date: Sun, 18 Feb 2024 20:12:56 +0100
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Kees Cook <keescook@...omium.org>,
Kentaro Takeda <takedakn@...data.co.jp>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Eric Biederman <ebiederm@...ssion.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org, mingo@...hat.com,
peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, surenb@...gle.com,
michael.christie@...cle.com, mst@...hat.com, mjguzik@...il.com,
npiggin@...il.com, zhangpeng.00@...edance.com, hca@...ux.ibm.com
Subject: Re: [PATCH AUTOSEL 5.10 7/8] exec: Distinguish in_execve from in_exec
Hi!
> From: Kees Cook <keescook@...omium.org>
>
> [ Upstream commit 90383cc07895183c75a0db2460301c2ffd912359 ]
>
> Just to help distinguish the fs->in_exec flag from the current->in_execve
> flag, add comments in check_unsafe_exec() and copy_fs() for more
> context. Also note that in_execve is only used by TOMOYO now.
These are just a whitespace changes, we should not need them.
Best regards,
Pavel
> +++ b/fs/exec.c
> @@ -1565,6 +1565,7 @@ static void check_unsafe_exec(struct linux_binprm *bprm)
> }
> rcu_read_unlock();
>
> + /* "users" and "in_exec" locked for copy_fs() */
> if (p->fs->users > n_fs)
> bprm->unsafe |= LSM_UNSAFE_SHARE;
> else
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index aa015416c569..65cfe85de8d5 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -806,7 +806,7 @@ struct task_struct {
> */
> unsigned sched_remote_wakeup:1;
>
> - /* Bit to tell LSMs we're in execve(): */
> + /* Bit to tell TOMOYO we're in execve(): */
> unsigned in_execve:1;
> unsigned in_iowait:1;
> #ifndef TIF_RESTORE_SIGMASK
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 633b0af1d1a7..906dbaf25058 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1452,6 +1452,7 @@ static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
> if (clone_flags & CLONE_FS) {
> /* tsk->fs is already what we want */
> spin_lock(&fs->lock);
> + /* "users" and "in_exec" locked for check_unsafe_exec() */
> if (fs->in_exec) {
> spin_unlock(&fs->lock);
> return -EAGAIN;
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists