Patch "exec: Don't open code get_close_on_exec" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    exec: Don't open code get_close_on_exec

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     exec-don-t-open-code-get_close_on_exec.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 5f3a40a1192a3c8eaaf6a6f62ca5aeeaec147fe3
Author: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
Date:   Wed Dec 9 15:42:57 2020 -0600

    exec: Don't open code get_close_on_exec
    
    [ Upstream commit 878f12dbb8f514799d126544d59be4d2675caac3 ]
    
    Al Viro pointed out that using the phrase "close_on_exec(fd,
    rcu_dereference_raw(current->files->fdt))" instead of wrapping it in
    rcu_read_lock(), rcu_read_unlock() is a very questionable
    optimization[1].
    
    Once wrapped with rcu_read_lock()/rcu_read_unlock() that phrase
    becomes equivalent the helper function get_close_on_exec so
    simplify the code and make it more robust by simply using
    get_close_on_exec.
    
    [1] https://lkml.kernel.org/r/20201207222214.GA4115853@xxxxxxxxxxxxxxxxxx
    Suggested-by: Al Viro <viro@xxxxxxxxxxxxxxxx>
    Link: https://lkml.kernel.org/r/87k0tqr6zi.fsf_-_@xxxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/exec.c b/fs/exec.c
index ebe9011955b9b..fb8813cc532d0 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1821,8 +1821,7 @@ static int bprm_execve(struct linux_binprm *bprm,
 	 * inaccessible after exec. Relies on having exclusive access to
 	 * current->files (due to unshare_files above).
 	 */
-	if (bprm->fdpath &&
-	    close_on_exec(fd, rcu_dereference_raw(current->files->fdt)))
+	if (bprm->fdpath && get_close_on_exec(fd))
 		bprm->interp_flags |= BINPRM_FLAGS_PATH_INACCESSIBLE;
 
 	/* Set the unchanging part of bprm->cred */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux