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] [day] [month] [year] [list]
Date:   Tue, 4 Jun 2019 10:01:58 -0700
From:   Ke Wu <mikewu@...gle.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Colin Ian King <colin.king@...onical.com>,
        James Morris <jamorris@...ux.microsoft.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        linux-security-module@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: security/loadpin: Allow to exclude specific file types

I sent out a new patch according to your last suggestion. Please take
a look. Thanks!


On Fri, May 31, 2019 at 1:33 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Fri, May 31, 2019 at 11:03:17AM -0700, Ke Wu wrote:
> > I think Coverity is correct. Note that it's the size of
> > kernel_read_file_str (rather than exclude_read_files) doesn't equal to
> > ignore_read_file_id.
> >
> > This is because READING_MAX_ID is also an element in
> > kernel_read_file_str, which makes the size of kernel_read_file_str to
> > be READING_MAX_ID+1. I will send a new patch to fix the issue. Thanks
> > for the  analysis!
>
> Ah! Yes, I see now. I was looking at the wrong things. It should be
> possible to just do:
>
> > > >> 209                for (j = 0; j < ARRAY_SIZE(kernel_read_file_str); j++) {
>
> for (j = 0; j < ARRAY_SIZE(ignore_read_file_id); j++)
>
> and add a
>
> BUILD_BUG_ON(ARRAY_SIZE(kernel_read_file_str) < ARRAY_SIZE(ignore_read_file_id))
>
> for future robustness checking.
>
> Thanks for looking at this more closely!
>
> -Kees
>
> > > >> 210                        if (strcmp(cur, kernel_read_file_str[j]) == 0) {
> > > >> 211                                pr_info("excluding: %s\n",
> > > >> 212                                        kernel_read_file_str[j]);
> > > >>
> > > >> CID 81977 (#1 of 1): Out-of-bounds write
> > > >> overrun-local: Overrunning array ignore_read_file_id of 8 4-byte
> > > >> elements at element index 8 (byte offset 35) using index j (which
> > > >> evaluates to 8).
> > > >>
> > > >> 213                                ignore_read_file_id[j] = 1;
> > > >>
> > > >> According to Coverity ignore_read_file_id is an array of 8 integers.
> > > >> However, ARRAY_SIZE(kernel_read_file_str) is 9, so we have an out of
> > > >> bounds write on ignore_read_file[j] when j is 8.
> > > >
> > > > What am I missing? This doesn't fail the build:
> > > >
> > > > +       BUILD_BUG_ON(ARRAY_SIZE(exclude_read_files) !=
> > > > +                    ARRAY_SIZE(ignore_read_file_id));
> > > >
> > > > They have the same number of elements.
> > > >
> > >
> > > Yep, that's very true. I'll discuss this with Coverity as this seems
> > > like a weird false positive.
> > >
> > > Apologies for the noise.
> > >
> > > Colin
> >
> >
> >
> > --
> > Ke Wu | Software Engineer | mikewu@...gle.com | Google Inc.
>
> --
> Kees Cook



-- 
Ke Wu | Software Engineer | mikewu@...gle.com | Google Inc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ