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]
Date:   Tue, 9 Jan 2018 19:13:34 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Eric Biggers <ebiggers3@...il.com>
Cc:     "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Joe Lawrence <joe.lawrence@...hat.com>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        Willy Tarreau <w@....eu>,
        Mikulas Patocka <mpatocka@...hat.com>,
        "Luis R . Rodriguez" <mcgrof@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Eric Biggers <ebiggers@...gle.com>
Subject: Re: [PATCH 6/7] pipe: simplify round_pipe_size()

On Tue, Jan 9, 2018 at 6:52 PM, Eric Biggers <ebiggers3@...il.com> wrote:
> On Tue, Jan 09, 2018 at 02:27:10PM -0800, Kees Cook wrote:
>>
>> > @@ -1054,9 +1048,6 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)
>> >                 return -EINVAL;
>> >         nr_pages = size >> PAGE_SHIFT;
>> >
>> > -       if (!nr_pages)
>> > -               return -EINVAL;
>> > -
>>
>> I would just leave this hunk anyway: it's defensive for any future
>> changes. Maybe add a comment describing why it's currently redundant?
>>
>
> I don't know; I find it really confusing to have two slightly different checks
> for the same thing, as it implies that they actually need to be there for a
> reason.  How about just checking nr_pages?
>
>         size = round_pipe_size(arg);
>         nr_pages = size >> PAGE_SHIFT;
>
>         if (nr_pages == 0)
>                 return -EINVAL;

Oh yeah! I like that.

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ