[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKus0xd_6U6r_ebBmLdz8KR==i+wdt-7iMnwOX8c-S2ww@mail.gmail.com>
Date: Fri, 7 Jul 2017 19:46:07 -0700
From: Kees Cook <keescook@...omium.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andy Lutomirski <luto@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Michal Hocko <mhocko@...nel.org>,
Ben Hutchings <ben@...adent.org.uk>,
Hugh Dickins <hughd@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Rik van Riel <riel@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] exec: Limit arg stack to at most _STK_LIM / 4 * 3
On Fri, Jul 7, 2017 at 3:24 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Fri, Jul 7, 2017 at 11:57 AM, Kees Cook <keescook@...omium.org> wrote:
>> To avoid pathological stack usage or the need to special-case setuid
>> execs, just limit all arg stack usage to at most _STK_LIM / 4 * 3 (6MB).
>
> Ok, this I think I should just apply, but would prefer to avoid
> multi-line complex conditionals around things like this.
>
> So how about the attached slightly edited version instead?
>
> I didn't test it (and I'm not really committing it until I get an ack
> or two), but it seemed all ObviouslyCorrect(tm). FamousLastWords(tm).
>
> Comments?
That works for me, thanks. Testing showed the same sane results:
$ ulimit -s 32768
$ ./args
Detected max args size near: 6291023 bytes
$ ulimit -s 24576
$ ./args
Detected max args size near: 6291022 bytes
$ ulimit -s 20480
$ ./args
Detected max args size near: 5242448 bytes
$ ulimit -s 16384
$ ./args
Detected max args size near: 4193871 bytes
$ ulimit -s 8192
$ ./args
Detected max args size near: 2096719 bytes
$ ulimit -s 4096
$ ./args
Detected max args size near: 1048143 bytes
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists