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]
Date:   Wed, 19 Feb 2020 22:36:57 -0300
From:   Paul Cercueil <paul@...pouillou.net>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
Cc:     Linus Walleij <linus.walleij@...aro.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>
Subject: Re: [PATCH] pinctrl: ingenic: Make unreachable path more robust

Hi Josh,

Le lun., févr. 17, 2020 at 09:18, Josh Poimboeuf <jpoimboe@...hat.com> 
a écrit :
> On Fri, Feb 14, 2020 at 11:37:04PM -0300, Paul Cercueil wrote:
>>  > >  I don't like the idea that you change this driver's code just 
>> to
>>  > > work around
>>  > >  a bug in objtool, and I don't like the idea of working around a
>>  > > future bug
>>  > >  that shouldn't be introduced in the first place.
>>  >
>>  > It's not an objtool bug.  It's a byproduct of the fact that GCC's
>>  > undefined behavior is inscrutable, and there's no way to 
>> determine that
>>  > it actually *wants* to jump to a random function.
>>  >
>>  > And anyway, regardless of objtool, the patch is meant to make the 
>> code
>>  > more robust.
>>  >
>>  > Do you not agree that BUG (defined behavior) is more robust than
>>  > unreachable (undefined behavior)?
>> 
>>  It's a dead code path. That would be an undefined behaviour, if it 
>> was
>>  taken, but it's not.
> 
> Given your confidence that humans don't introduce bugs, would you
> recommend that we
> 
>   s/BUG()/unreachable()/
> 
> tree-wide?

Of course not.

> Another option would be to remove the unreachable() statement, which
> would actually improve the generated code by making it more compact 
> (16
> bytes of i-cache savings), on top of removing the "fallthrough to next
> function" nastiness.

I'd prefer that, yes.

-Paul

> diff --git a/drivers/pinctrl/pinctrl-ingenic.c 
> b/drivers/pinctrl/pinctrl-ingenic.c
> index 96f04d121ebd..13c7d3351ed5 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -2158,7 +2158,8 @@ static int ingenic_pinconf_set(struct 
> pinctrl_dev *pctldev, unsigned int pin,
>  			break;
> 
>  		default:
> -			unreachable();
> +			/* unreachable */
> +			break;
>  		}
>  	}
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ