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: <20220830044627.t37gkqjdknu4wgz6@treble>
Date:   Mon, 29 Aug 2022 21:46:27 -0700
From:   Josh Poimboeuf <jpoimboe@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Segher Boessenkool <segher@...nel.crashing.org>,
        Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
        Michael Matz <matz@...e.de>, linux-toolchains@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] x86/sev: Mark snp_abort() noreturn

On Wed, Aug 24, 2022 at 10:45:12PM +0200, Peter Zijlstra wrote:
> On Wed, Aug 24, 2022 at 12:29:29PM -0500, Segher Boessenkool wrote:
> > Hi!
> > 
> > On Wed, Aug 24, 2022 at 05:24:20PM +0200, Borislav Petkov wrote:
> > > Mark both the function prototype and definition as noreturn in order to
> > > prevent the compiler from doing transformations which confuse objtool
> > > like so:
> > > 
> > >   vmlinux.o: warning: objtool: sme_enable+0x71: unreachable instruction
> > 
> > Would -Wmissing-noreturn have caught this?  It sounds like you need this
> > (and then fix all resulting warnings) to not upset objtool?
> > 
> > It is nice to have this anyway (if there aren't a zillion false
> > positives), but it seems objtool is very fragile.
> 
> Well, just like gcc has noreturn heuristics so has objtool, it just
> turns into pain when they don't agree with one another.
> 
> Ideally noreturn would be reflected in the object file so we don't have
> to guess at it. STT_FUNC_NORETURN would do I suppose, except then all
> the tools will need to be taught how to deal with that, which is also
> very painful.
> 
> Another options is something like .symtab.noreturn which is another
> symbol table explicitly listing the noreturn functions. Since it's an
> extra section tools that don't know about it can freely ignore it and
> carry on as usual.

We're planning to talk about this at the LPC toolchains microconference.

My proposal is similar to yours except I called it .annotate.noreturn.
It would be enabled with a --annotate=noreturn compiler option.  It
would report both explicit noreturns (with the "noreturn" function
attribute) and implicit noreturns (static functions which only call
other noreturn functions).

There would also be an --annotate=jump_table option which creates an
.annotate.jump_table to describe switch statement jump table flow.

Those are the two biggest challenges for objtool.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ