From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, ellyjones@chromium.org,
Kay Sievers <kay@vrfy.org>,
Roland Eggner <edvx1@systemanalysen.net>
Subject: Re: [PATCH v2] devtmpfs: mount with noexec and nosuid
Date: Tue, 20 Nov 2012 12:54:59 -0800 [thread overview]
Message-ID: <20121120205459.GA12859@kroah.com> (raw)
In-Reply-To: <20121120204238.GA19554@www.outflux.net>
On Tue, Nov 20, 2012 at 12:42:38PM -0800, Kees Cook wrote:
> Since devtmpfs is writable, make the default noexec,nosuid as well. This
> protects from the case of a privileged process having an arbitrary file
> write flaw and an argumentless arbitrary execution (i.e. it would lack
> the ability to run "mount -o remount,exec,suid /dev").
>
> Cc: ellyjones@chromium.org
> Cc: Kay Sievers <kay@vrfy.org>
> Cc: Roland Eggner <edvx1@systemanalysen.net>
> Signed-off-by: Kees Cook <keescook@chromium.org>
>
> ---
> v2:
> - use CONFIG_DEVTMPFS_SAFE to wrap the logic.
That's better, thanks.
One tiny bikeshead request though:
> --- a/drivers/base/devtmpfs.c
> +++ b/drivers/base/devtmpfs.c
> @@ -340,6 +340,10 @@ static int handle_remove(const char *nodename, struct device *dev)
> int devtmpfs_mount(const char *mntdir)
> {
> int err;
> + int mflags = MS_SILENT;
> +#ifdef CONFIG_DEVTMPFS_SAFE
> + mflags |= MS_NOEXEC | MS_NOSUID;
> +#endif
You duplicate this in two places, which makes the c code harder to read.
How about, at the top of the file, you do:
#ifdef CONFIG_DEVTMPFS_SAFE
#define DEVTMPFS_MFLAGS MS_SILENT | MS_NOEXEC | MS_NOSUID
#else
#define DEVTMPFS_MFLAGS MS_SILENT
#endif
And then just use DEVTMPFS_MFLAGS in both places?
That should make the patch smaller, which is always nice :)
thanks,
greg k-h
next prev parent reply other threads:[~2012-11-20 20:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 20:42 [PATCH v2] devtmpfs: mount with noexec and nosuid Kees Cook
2012-11-20 20:54 ` Greg Kroah-Hartman [this message]
2012-11-20 21:41 ` Kees Cook
2012-11-20 21:13 ` Alan Cox
2012-11-20 21:49 ` Kees Cook
2012-11-20 23:53 ` Alan Cox
2012-11-20 23:53 ` Kees Cook
2012-11-21 0:24 ` Alan Cox
2012-11-21 0:41 ` Kees Cook
2012-11-21 1:00 ` Alan Cox
2012-11-21 0:13 ` Kay Sievers
2012-11-21 0:18 ` Kees Cook
2012-11-21 0:32 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121120205459.GA12859@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=edvx1@systemanalysen.net \
--cc=ellyjones@chromium.org \
--cc=kay@vrfy.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.