lists.openwall.net   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  linux-cve-announce  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]
Message-ID: <CAGXu5jJ0fyjku1OpuGZvfJWKfj9qfQyaUMxzkjWdCpYc9m8-hA@mail.gmail.com>
Date:	Tue, 20 Nov 2012 13:41:55 -0800
From:	Kees Cook <keescook@...omium.org>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:	linux-kernel@...r.kernel.org, ellyjones@...omium.org,
	Kay Sievers <kay@...y.org>,
	Roland Eggner <edvx1@...temanalysen.net>
Subject: Re: [PATCH v2] devtmpfs: mount with noexec and nosuid

On Tue, Nov 20, 2012 at 12:54 PM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> 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@...omium.org
>> Cc: Kay Sievers <kay@...y.org>
>> Cc: Roland Eggner <edvx1@...temanalysen.net>
>> Signed-off-by: Kees Cook <keescook@...omium.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 :)

Excellent idea.

-Kees

-- 
Kees Cook
Chrome OS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ