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: <ca1f50d6-1005-8e3d-8d5c-98c82a704338@redhat.com>
Date:   Tue, 20 Oct 2020 06:55:52 -0700
From:   Tom Rix <trix@...hat.com>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, linux-edac@...r.kernel.org,
        linux-acpi@...r.kernel.org, linux-pm@...r.kernel.org,
        xen-devel@...ts.xenproject.org, linux-block@...r.kernel.org,
        openipmi-developer@...ts.sourceforge.net,
        "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
        <linux-crypto@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-power@...rohmeurope.com, linux-gpio@...r.kernel.org,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        nouveau@...ts.freedesktop.org,
        virtualization@...ts.linux-foundation.org,
        spice-devel@...ts.freedesktop.org, linux-iio@...r.kernel.org,
        linux-amlogic@...ts.infradead.org,
        industrypack-devel@...ts.sourceforge.net,
        linux-media@...r.kernel.org, MPT-FusionLinux.pdl@...adcom.com,
        linux-scsi@...r.kernel.org, linux-mtd@...ts.infradead.org,
        linux-can@...r.kernel.org,
        Network Development <netdev@...r.kernel.org>,
        intel-wired-lan@...ts.osuosl.org, ath10k@...ts.infradead.org,
        linux-wireless <linux-wireless@...r.kernel.org>,
        linux-stm32@...md-mailman.stormreply.com, linux-nfc@...ts.01.org,
        linux-nvdimm <linux-nvdimm@...ts.01.org>,
        linux-pci@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
        platform-driver-x86@...r.kernel.org, patches@...nsource.cirrus.com,
        storagedev@...rochip.com, devel@...verdev.osuosl.org,
        linux-serial@...r.kernel.org, linux-usb@...r.kernel.org,
        usb-storage@...ts.one-eyed-alien.net,
        linux-watchdog@...r.kernel.org, ocfs2-devel@....oracle.com,
        bpf <bpf@...r.kernel.org>, linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org, keyrings@...r.kernel.org,
        alsa-devel@...a-project.org,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        George Burgess <gbiv@...gle.com>, Joe Perches <joe@...ches.com>
Subject: Re: [RFC] treewide: cleanup unreachable breaks


On 10/19/20 12:42 PM, Nick Desaulniers wrote:
> On Sat, Oct 17, 2020 at 10:43 PM Greg KH <gregkh@...uxfoundation.org> wrote:
>> On Sat, Oct 17, 2020 at 09:09:28AM -0700, trix@...hat.com wrote:
>>> From: Tom Rix <trix@...hat.com>
>>>
>>> This is a upcoming change to clean up a new warning treewide.
>>> I am wondering if the change could be one mega patch (see below) or
>>> normal patch per file about 100 patches or somewhere half way by collecting
>>> early acks.
>> Please break it up into one-patch-per-subsystem, like normal, and get it
>> merged that way.
>>
>> Sending us a patch, without even a diffstat to review, isn't going to
>> get you very far...
> Tom,
> If you're able to automate this cleanup, I suggest checking in a
> script that can be run on a directory.  Then for each subsystem you
> can say in your commit "I ran scripts/fix_whatever.py on this subdir."
>  Then others can help you drive the tree wide cleanup.  Then we can
> enable -Wunreachable-code-break either by default, or W=2 right now
> might be a good idea.

I should have waited for Joe Perches's fixer addition to checkpatch :)

The easy fixes I did only cover about 1/2 of the problems.

Remaining are mostly nested switches, which from a complexity standpoint is bad.

>
> Ah, George (gbiv@, cc'ed), did an analysis recently of
> `-Wunreachable-code-loop-increment`, `-Wunreachable-code-break`, and
> `-Wunreachable-code-return` for Android userspace.  From the review:
> ```
> Spoilers: of these, it seems useful to turn on
> -Wunreachable-code-loop-increment and -Wunreachable-code-return by
> default for Android

In my simple add-a-cflag bot, i see there are about 250

issues for -Wunreachable-code-return.

I'll see about doing this one next.

> ...
> While these conventions about always having break arguably became
> obsolete when we enabled -Wfallthrough, my sample turned up zero
> potential bugs caught by this warning, and we'd need to put a lot of
> effort into getting a clean tree. So this warning doesn't seem to be
> worth it.
> ```
> Looks like there's an order of magnitude of `-Wunreachable-code-break`
> than the other two.
>
> We probably should add all 3 to W=2 builds (wrapped in cc-option).
> I've filed https://github.com/ClangBuiltLinux/linux/issues/1180 to
> follow up on.

Yes, i think think these should be added.

Tom

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ