lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Oct 2022 11:05:06 +0200
From:   Christian Brauner <>
To:     Kees Cook <>
Cc:     Eric Biederman <>,
        Jorge Merlino <>,
        Alexander Viro <>,
        Thomas Gleixner <>,
        Andy Lutomirski <>,
        Sebastian Andrzej Siewior <>,
        Andrew Morton <>,,,
        John Johansen <>,
        Paul Moore <>,
        James Morris <>,
        "Serge E. Hallyn" <>,
        Stephen Smalley <>,
        Eric Paris <>,
        Richard Haines <>,
        Casey Schaufler <>,
        Xin Long <>,
        "David S. Miller" <>,
        Todd Kjos <>,
        Ondrej Mosnacek <>,
        Prashanth Prahlad <>,
        Micah Morton <>,
        Fenghua Yu <>,
        Andrei Vagin <>,,,,,
Subject: Re: [PATCH 1/2] fs/exec: Explicitly unshare fs_struct on exec

On Thu, Oct 06, 2022 at 01:27:34AM -0700, Kees Cook wrote:
> The check_unsafe_exec() counting of n_fs would not add up under a heavily
> threaded process trying to perform a suid exec, causing the suid portion
> to fail. This counting error appears to be unneeded, but to catch any
> possible conditions, explicitly unshare fs_struct on exec, if it ends up

Isn't this a potential uapi break? Afaict, before this change a call to
clone{3}(CLONE_FS) followed by an exec in the child would have the
parent and child share fs information. So if the child e.g., changes the
working directory post exec it would also affect the parent. But after
this change here this would no longer be true. So a child changing a
workding directoro would not affect the parent anymore. IOW, an exec is
accompanied by an unshare(CLONE_FS). Might still be worth trying ofc but
it seems like a non-trivial uapi change but there might be few users
that do clone{3}(CLONE_FS) followed by an exec.

> +/*
> + * Unshare the filesystem structure if it is being shared
> + */
> +int unshare_fs(void)
> +{
> +	struct fs_struct *new_fs = NULL;
> +	int error;
> +
> +	error = unshare_fs_alloc(CLONE_FS, &new_fs);
> +	if (error || !new_fs)
> +		return error;

You should just check for error here, not new_fs.

Powered by blists - more mailing lists