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: <20200919033704.GA3014163@rani.riverdale.lan>
Date:   Fri, 18 Sep 2020 23:37:04 -0400
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Arvind Sankar <nivedita@...m.mit.edu>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Dennis Zhou <dennis@...nel.org>, Tejun Heo <tj@...nel.org>,
        Christoph Lameter <cl@...ux.com>,
        Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Kees Cook <keescook@...omium.org>
Subject: Re: [GIT PULL] percpu fix for v5.9-rc6

On Sat, Sep 19, 2020 at 03:45:56AM +0100, Matthew Wilcox wrote:
> On Fri, Sep 18, 2020 at 06:39:57PM -0400, Arvind Sankar wrote:
> > On Fri, Sep 18, 2020 at 02:18:20PM -0700, Linus Torvalds wrote:
> > > On Fri, Sep 18, 2020 at 2:00 PM Arvind Sankar <nivedita@...m.mit.edu> wrote:
> > > >
> > > > You could just assert that offsetof(typeof(s),flex) == sizeof(s), no?
> > > 
> > > No, because the whole point is that I want that "sizeof(s)" to *WARN*.
> > 
> > Ouch, offsetof() and sizeof() will give different results in the
> > presence of alignment padding.
> > 
> > https://godbolt.org/z/rqnxTK
> 
> We really should be using offsetof() then.  It's harmless because we're
> currently overallocating, not underallocating.  The test case I did was:
> 

I wonder if there are cases where we know the total size, and are
working out the number of elements in the flexible array by doing
size - sizeof(s).

Would a macro to do the inverse of struct_size(), i.e. get the count
knowing the total size be useful?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ