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: <cd1331511723e283c7238078bc12c71a739d4dda.camel@intel.com>
Date:   Thu, 14 Sep 2023 09:18:44 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "peterz@...radead.org" <peterz@...radead.org>
CC:     "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "oe-kbuild-all@...ts.linux.dev" <oe-kbuild-all@...ts.linux.dev>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        lkp <lkp@...el.com>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>
Subject: Re: [tip:x86/tdx 8/12] vmlinux.o: warning: objtool:
 __tdx_hypercall+0x128: __tdx_hypercall_failed() is missing a __noreturn
 annotation

On Thu, 2023-09-14 at 10:59 +0200, Peter Zijlstra wrote:
> On Thu, Sep 14, 2023 at 07:54:10AM +0000, Huang, Kai wrote:
> 
> > > The point of noreturn is that the caller should know to stop generating
> > > code. For that the declaration needs the attribute, because call sites
> > > typically do not have access to the function definition in C.
> > 
> > Ah that makes perfect sense.  Thanks!
> > 
> > Then I assume we don't need to annotate __noreturn in the function body, but
> > only in the declaration?  Because the compiler must already have seen the
> > declaration when it generates the code for the function body.
> 
> I think so, I'm sure it'll tell you if it disagrees :-)
> 
> > Btw, I happened to notice that the objtool documentation suggests that we should
> > also add the the function to tools/objtool/noreturns.h:
> > 
> > 3. file.o: warning: objtool: foo+0x48c: bar() is missing a __noreturn annotation
> > 
> >    The call from foo() to bar() doesn't return, but bar() is missing the
> >    __noreturn annotation.  NOTE: In addition to annotating the function
> >    with __noreturn, please also add it to tools/objtool/noreturns.h.
> > 
> > Is it a behaviour that we still need to follow?
> 
> Yes. objtool has some heuristics to detect noreturn, but is is very
> difficult. Sadly noreturn is not something that is reflected in the ELF
> object file so we have to guess.
> 
> For now manually adding it to the objtool list is required, we're trying
> to get to the point where it is generated/validated by the compiler,
> perhaps with a plugin, but we're not there yet.

Thanks Peter!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ