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: <20220628135623.GA25163@embeddedor>
Date:   Tue, 28 Jun 2022 15:56:23 +0200
From:   "Gustavo A. R. Silva" <gustavoars@...nel.org>
To:     Jason Gunthorpe <jgg@...pe.ca>
Cc:     Daniel Borkmann <daniel@...earbox.net>,
        Kees Cook <keescook@...omium.org>,
        linux-kernel@...r.kernel.org, x86@...nel.org, dm-devel@...hat.com,
        linux-m68k@...ts.linux-m68k.org, linux-mips@...r.kernel.org,
        linux-s390@...r.kernel.org, kvm@...r.kernel.org,
        intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        netdev@...r.kernel.org, bpf@...r.kernel.org,
        linux-btrfs@...r.kernel.org, linux-can@...r.kernel.org,
        linux-fsdevel@...r.kernel.org,
        linux1394-devel@...ts.sourceforge.net, io-uring@...r.kernel.org,
        lvs-devel@...r.kernel.org, linux-mtd@...ts.infradead.org,
        kasan-dev@...glegroups.com, linux-mmc@...r.kernel.org,
        nvdimm@...ts.linux.dev, netfilter-devel@...r.kernel.org,
        coreteam@...filter.org, linux-perf-users@...r.kernel.org,
        linux-raid@...r.kernel.org, linux-sctp@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-scsi@...r.kernel.org,
        target-devel@...r.kernel.org, linux-usb@...r.kernel.org,
        virtualization@...ts.linux-foundation.org,
        v9fs-developer@...ts.sourceforge.net, linux-rdma@...r.kernel.org,
        alsa-devel@...a-project.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with
 flexible-array members

On Tue, Jun 28, 2022 at 10:36:51AM -0300, Jason Gunthorpe wrote:
> On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote:
> 
> > > > Though maybe we could just switch off -Wgnu-variable-sized-type-not-at-end  during configuration ?
> 
> > We need to think in a different strategy.
> 
> I think we will need to switch off the warning in userspace - this is
> doable for rdma-core.
> 
> On the other hand, if the goal is to enable the array size check
> compiler warning I would suggest focusing only on those structs that
> actually hit that warning in the kernel. IIRC infiniband doesn't
> trigger it because it just pointer casts the flex array to some other
> struct.

Yep; this is actually why I reverted those changes in rdma (before
sending out the patch) when 0-day reported the same problems you pointed
out[1].

Also, that's the strategy I'm following right now with the one-element
array into flex-array member transformations. I'm addressing those cases
in which the trailing array is actually being iterated over, first.

I just added the patch to my -next tree, so it can be build-tested by
other people, and let's see what else is reported this week. :)

--
Gustavo

[1] https://lore.kernel.org/lkml/620ca2a5.NkAEIDEfiYoxE9%2Fu%25lkp@intel.com/

> 
> It isn't actually an array it is a placeholder for a trailing
> structure, so it is never indexed.
> 
> This is also why we hit the warning because the convient way for
> userspace to compose the message is to squash the header and trailer
> structs together in a super struct on the stack, then invoke the
> ioctl.
> 
> Jason 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ