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: <202206281104.7CC3935@keescook>
Date:   Tue, 28 Jun 2022 11:05:53 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:     "Gustavo A. R. Silva" <gustavoars@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        the arch/x86 maintainers <x86@...nel.org>,
        dm-devel@...hat.com, linux-m68k <linux-m68k@...ts.linux-m68k.org>,
        "open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
        linux-s390 <linux-s390@...r.kernel.org>,
        KVM list <kvm@...r.kernel.org>,
        Intel Graphics Development <intel-gfx@...ts.freedesktop.org>,
        DRI Development <dri-devel@...ts.freedesktop.org>,
        netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        linux-btrfs <linux-btrfs@...r.kernel.org>,
        linux-can@...r.kernel.org,
        Linux FS Devel <linux-fsdevel@...r.kernel.org>,
        linux1394-devel@...ts.sourceforge.net, io-uring@...r.kernel.org,
        lvs-devel@...r.kernel.org,
        MTD Maling List <linux-mtd@...ts.infradead.org>,
        kasan-dev <kasan-dev@...glegroups.com>,
        Linux MMC List <linux-mmc@...r.kernel.org>,
        nvdimm@...ts.linux.dev,
        NetFilter <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 <linux-arm-kernel@...ts.infradead.org>,
        scsi <linux-scsi@...r.kernel.org>,
        target-devel <target-devel@...r.kernel.org>,
        USB list <linux-usb@...r.kernel.org>,
        virtualization@...ts.linux-foundation.org,
        V9FS Developers <v9fs-developer@...ts.sourceforge.net>,
        linux-rdma <linux-rdma@...r.kernel.org>,
        ALSA Development Mailing List <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 09:27:21AM +0200, Geert Uytterhoeven wrote:
> Hi Gustavo,
> 
> Thanks for your patch!
> 
> On Mon, Jun 27, 2022 at 8:04 PM Gustavo A. R. Silva
> <gustavoars@...nel.org> wrote:
> > There is a regular need in the kernel to provide a way to declare
> > having a dynamically sized set of trailing elements in a structure.
> > Kernel code should always use “flexible array members”[1] for these
> > cases. The older style of one-element or zero-length arrays should
> > no longer be used[2].
> 
> These rules apply to the kernel, but uapi is not considered part of the
> kernel, so different rules apply.  Uapi header files should work with
> whatever compiler that can be used for compiling userspace.

Right, userspace isn't bound by these rules, but the kernel ends up
consuming these structures, so we need to fix them. The [0] -> []
changes (when they are not erroneously being used within other
structures) is valid for all compilers. Flexible arrays are C99; it's
been 23 years. :)

But, yes, where we DO break stuff we need to workaround it, etc.

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ