[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKRvLqWkOF=3qoQ1ZdaKNLai_kai4Png5Ls3X1WAtdzJA@mail.gmail.com>
Date: Mon, 18 Nov 2013 11:27:36 -0800
From: Kees Cook <keescook@...omium.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"security@...nel.org" <security@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Vasily Kulikov <segoon@...nwall.com>,
Petr Matousek <pmatouse@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org,
Alex Kelly <alex.page.kelly@...il.com>,
Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH 2/3] kill MMF_DUMPABLE and MMF_DUMP_SECURELY
On Mon, Nov 18, 2013 at 11:16 AM, Oleg Nesterov <oleg@...hat.com> wrote:
> On 11/18, Kees Cook wrote:
>>
>> On Sat, Nov 16, 2013 at 11:01 AM, Oleg Nesterov <oleg@...hat.com> wrote:
>> > @@ -1629,24 +1628,13 @@ void set_dumpable(struct mm_struct *mm, int value)
>> >
>> > do {
>> > old = ACCESS_ONCE(mm->flags);
>> > - new = old & ~MMF_DUMPABLE_MASK;
>> > -
>> > - switch (value) {
>> > - case SUID_DUMP_ROOT:
>> > - new |= (1 << MMF_DUMP_SECURELY);
>> > - case SUID_DUMP_USER:
>> > - new |= (1<< MMF_DUMPABLE);
>> > - }
>> > -
>> > + new = (old & ~MMF_DUMPABLE_MASK) | value;
>>
>> Just to make this safe against insane callers, perhaps mask the value as well?
>
> Well yes, before this patch set_dumpable() silently ignored the wrong
> value, perhaps you are right but see below.
>
>> new = (old & ~MMF_DUMPABLE_MASK) | (value & MMF_DUMPABLE_MASK);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> this doesn't really help, with this patch "mm->flags & MMF_DUMPABLE_MASK"
> has a room for yet another SUID_DUMP == 4 we do not have yet.
>
> And I don't really like the "silently ignore" logic, so perhaps
>
> if (WARN_ON(value > SUID_DUMP_ROOT))
> return;
Ah, good point about == 4. Yeah, I like the WARN_ON. No reason not to
be defensive as long as this code is getting changed.
-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