[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGnkfhx+igF579dez6qwAxrtT-JrGSSEn-QmK+92447qBqXPpg@mail.gmail.com>
Date: Wed, 3 Apr 2019 17:24:26 +0200
From: Matteo Croce <mcroce@...hat.com>
To: Christian Brauner <christian@...uner.io>
Cc: linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Kees Cook <keescook@...omium.org>,
Matthew Wilcox <willy@...radead.org>,
Zev Weiss <zev@...ilderbeest.net>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] kernel/sysctl.c: fix out of bounds access in fs.file-max
On Wed, Apr 3, 2019 at 4:02 PM Christian Brauner <christian@...uner.io> wrote:
>
> On Thu, Mar 28, 2019 at 02:03:06PM +0100, Matteo Croce wrote:
> > fs.file-max sysctl uses proc_doulongvec_minmax() as proc handler, which
> > accesses *extra1 and *extra2 as unsigned long, but commit 32a5ad9c2285
> > ("sysctl: handle overflow for file-max") assigns &zero, which is an int,
> > to extra1, generating the following KASAN report.
> > Fix this by changing 'zero' to long, which does not need to be duplicated
> > like 'one' and 'one_ul' for two data types.
>
> Yeah, maybe but it still feels cleaner and more obvious to just add:
>
> static long long_zero;
>
> given that most callers actually seem to want an (unsigned) int.
>
> I don't have a strong opinion though so if others feel that it's just a
> waste of space consider it acked.
>
Well, given that the value is zero, in this expectional case we could
avoid duplicating the symbol and save 4 bytes.
What the maintainers think?
Cheers,
--
Matteo Croce
per aspera ad upstream
Powered by blists - more mailing lists