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] [day] [month] [year] [list]
Message-ID: <5249CE5B.7040505@gmail.com>
Date:	Mon, 30 Sep 2013 12:17:47 -0700
From:	David Daney <ddaney.cavm@...il.com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
CC:	"Pinski, Andrew" <Andrew.Pinski@...iumnetworks.com>,
	Ralf Baechle <ralf@...ux-mips.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Arnd Bergmann <arnd@...db.de>,
	David Howells <dhowells@...hat.com>,
	Markos Chandras <Markos.Chandras@...tec.com>,
	"linux-mips@...ux-mips.org" <linux-mips@...ux-mips.org>,
	John Crispin <blogic@...nwrt.org>
Subject: Re: Issue with BUG() in asm-gemeric/bug.h if CONFIG_BUG=n

On 09/30/2013 12:03 PM, Geert Uytterhoeven wrote:
> On Mon, Sep 30, 2013 at 7:45 PM, David Daney <ddaney.cavm@...il.com> wrote:
>>> What about using __builtin_unreachable when we can but turn off warnings
>>> and use do{}while(0) when __builtin_unreachable does not exist?  This seems
>>> the both worlds.  Newer compilers produce better code with unreachable
>>> anyways.
>>>
>>
>> Simply not true.
>>
>> do{}while(0) is a NOP it is no more useful than an ';' statement.  It
>> doesn't serve as a magic uninitialized variable hiding mechanism.
>
> You missed the "turn off warnings" part of the "and".

You are correct, I did miss it.

The real problem here is that the kernel is written to expect that BUG() 
never returns.  Any implementation that has BUG() return, is almost 
certainly *not* what we want.

But wieh people select CONFIG_BUG=n they expect the smallest possible code.

These two criteria are mutually exclusive, so something should change.

It is not just the uninitialized variable warning, there can be others 
as well (control reaching the end of a non-void function comes to mind). 
  So I don't think turning off the warnings is a good solution.

That leaves:

1) Remove CONFIG_BUG and make it unconditionally enabled.

2) Make CONFIG_BUG=n imply "static inline void BUG(void){do{}while(1);}" 
which might be bigger than with CONFIG_BUG=y

David Daney


>
> Gr{oetje,eeting}s,
>
>                          Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                  -- Linus Torvalds
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ