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]
Message-ID: <Y5rASDcHCzsiF+Iw@mail.google.com>
Date:   Thu, 15 Dec 2022 19:35:52 +1300
From:   Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Kees Cook <keescook@...omium.org>, Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
        Jiri Slaby <jirislaby@...nel.org>,
        Haowen Bai <baihaowen@...zu.com>, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] [next] pcmcia: synclink_cs: replace 1-element array with
 flex-array member

On Thu, Dec 15, 2022 at 05:29:15PM +1300, Paulo Miguel Almeida wrote:
> On Thu, Dec 15, 2022 at 12:06:46AM +0200, Andy Shevchenko wrote:
> > On Wed, Dec 14, 2022 at 11:49 PM Kees Cook <keescook@...omium.org> wrote:
> > > On Wed, Dec 14, 2022 at 10:39:52PM +0200, Andy Shevchenko wrote:
> > > > Yes, and Try to make it work with __packed. As I said, the problem is
> > > > that the code is relying on something which is architecture dependent
> > > > strictly speaking. And hence I disagree with Kees that v2 is okay to
> > > > go.
> > >
> > > I meant that v2 is functionally identical to the existing code.
> > 
> > Ah, sorry for misunderstanding.
> > 
> 
> I agree with using __packed attribute to remove the extra padding (and
> for the reasons you mentioned before). That would reduce the sizeof(RXBUF)
> from 8 to 5 (which is good) but that is still 1 byte "too much".
> 
> Piggying back on a suggestion Kees gave before:
> 
> -       info->rx_buf_size = sizeof(RXBUF) + info->max_frame_size;
> +       info->rx_buf_size = sizeof(RXBUF) - 1 + info->max_frame_size;
> 
> That way RXBUF->data will point to the first byte of the frame_size 
> (MGSLPC_INFO->max_frame_size) which is what is actually needed.
> 

I chose my words poorly here... sorry my brain is a bit fried today.

Let me rephrase that last sentence. After that change (or similar
change), RXBUF->data will point to the first byte of the buffer
allocated during the initialisation process. (which is
limited/controlled by the size of MGSLPC_INFO->max_frame_size)...
so no 'extra byte/padding' will be there.

- Paulo A.

> > > > The full change should be something like
> > > >
> > > > check_add(sizeof(), max_frame_size)
> > > > kcalloc(8, size)
> > >
> > > Right -- this would fix the existing mistakes in size calculation (and
> > > is certainly better).
> > 
> > Glad to hear that we are on the same page.
> > 
> 
> That makes sense to me.
> 
> thanks!
> 
> - Paulo A.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ