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]
Date: Mon, 15 Apr 2024 12:19:50 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Arnd Bergmann <arnd@...db.de>, Adrian Hunter <adrian.hunter@...el.com>,
 Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Peter Zijlstra <peterz@...radead.org>, Dave Hansen
 <dave.hansen@...ux.intel.com>, John Stultz <jstultz@...gle.com>, "H. Peter
 Anvin" <hpa@...or.com>, Alexander Gordeev <agordeev@...ux.ibm.com>,
 Vincenzo Frascino <vincenzo.frascino@....com>,
 "linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>, Naresh Kamboju
 <naresh.kamboju@...aro.org>, "x86@...nel.org" <x86@...nel.org>, "Aneesh
 Kumar K.V" <aneesh.kumar@...nel.org>, Ingo Molnar <mingo@...hat.com>,
 "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>, Christian Borntraeger
 <borntraeger@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>, Heiko
 Carstens <hca@...ux.ibm.com>, Nicholas Piggin <npiggin@...il.com>,
 Borislav Petkov <bp@...en8.de>, Andy Lutomirski <luto@...nel.org>, Bjorn
 Helgaas <bhelgaas@...gle.com>, Thomas Gleixner <tglx@...utronix.de>,
 Anna-Maria Gleixner <anna-maria@...utronix.de>, Stephen Boyd
 <sboyd@...nel.org>, Randy Dunlap <rdunlap@...radead.org>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Sven
 Schnelle <svens@...ux.ibm.com>, "linuxppc-dev@...ts.ozlabs.org"
 <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH] bug: Fix no-return-statement warning with !CONFIG_BUG

"Arnd Bergmann" <arnd@...db.de> writes:
> On Thu, Apr 11, 2024, at 11:27, Adrian Hunter wrote:
>> On 11/04/24 11:22, Christophe Leroy wrote:
>>> Le 11/04/2024 à 10:12, Christophe Leroy a écrit :
>>>>
>>>> Looking at the report, I think the correct fix should be to use 
>>>> BUILD_BUG() instead of BUG()
>>> 
>>> I confirm the error goes away with the following change to next-20240411 
>>> on powerpc tinyconfig with gcc 13.2
>>> 
>>> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
>>> index 4e18db1819f8..3d5ac0cdd721 100644
>>> --- a/kernel/time/timekeeping.c
>>> +++ b/kernel/time/timekeeping.c
>>> @@ -282,7 +282,7 @@ static inline void timekeeping_check_update(struct 
>>> timekeeper *tk, u64 offset)
>>>   }
>>>   static inline u64 timekeeping_debug_get_ns(const struct tk_read_base *tkr)
>>>   {
>>> -	BUG();
>>> +	BUILD_BUG();
>>>   }
>>>   #endif
>>> 
>>
>> That is fragile because it depends on defined(__OPTIMIZE__),
>> so it should still be:
>
> If there is a function that is defined but that must never be
> called, I think we are doing something wrong.

It's a pretty inevitable result of using IS_ENABLED(), which the docs
encourage people to use.

In this case it could easily be turned into a build error by just making
it an extern rather than a static inline.

But I think Christophe's solution is actually better, because it's more
explicit, ie. this function should not be called and if it is that's a
build time error.

cheers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ