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:   Wed, 28 Mar 2018 10:30:51 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Manoj Gupta <manojgupta@...omium.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Matthias Kaehlcke <mka@...omium.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] debugfs: Check return value of debugfs_real_fops() for
 NULL

On Wed, Mar 28, 2018 at 07:47:53AM -0700, Manoj Gupta wrote:
> Please note that there is nothing wrong in the generated code, just
> that it confuses objtool.
> Clang has simply omitted the statement where NULL is returned since
> the pointer was always dereferenced post inlining.

... but returning NULL would be far more sane than falling through to
the next function.

> Note that GCC will also remove the NULL pointers if it knows that the
> pointer is dereferenced.
> Here is an example.
> 
> void null_check(int *P) {
>   int deref = *P;
>   if (P == 0) // GCC won't check the condition.
>     return;
>   *P = 4;
> }
> 
> Compiling with gcc -O2 gives:
>         movl    $4, (%rdi)
>         ret

This is why we use -fno-delete-null-pointer-checks.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ