From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Manoj Gupta <manojgupta@chromium.org>,
linux-kernel@vger.kernel.org,
Josh Poimboeuf <jpoimboe@redhat.com>,
Alexander Potapenko <glider@google.com>
Subject: Re: [PATCH] debugfs: Check return value of debugfs_real_fops() for NULL
Date: Wed, 28 Mar 2018 21:22:42 +0200 [thread overview]
Message-ID: <20180328192242.GA1404@kroah.com> (raw)
In-Reply-To: <20180328185009.GB87376@google.com>
On Wed, Mar 28, 2018 at 11:50:09AM -0700, Matthias Kaehlcke wrote:
> El Wed, Mar 28, 2018 at 08:19:36PM +0200 Greg Kroah-Hartman ha dit:
>
> > On Wed, Mar 28, 2018 at 11:14:56AM -0700, Matthias Kaehlcke wrote:
> > > El Wed, Mar 28, 2018 at 08:05:56PM +0200 Greg Kroah-Hartman ha dit:
> > >
> > > >
> > > > A: Because it messes up the order in which people normally read text.
> > > > Q: Why is top-posting such a bad thing?
> > > > A: Top-posting.
> > > > Q: What is the most annoying thing in e-mail?
> > > >
> > > > A: No.
> > > > Q: Should I include quotations after my reply?
> > > >
> > > > http://daringfireball.net/2007/07/on_top
> > > >
> > > > 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.
> > > >
> > > > Then fix the tool, the C code is correct :)
> > > >
> > > > > Clang has simply omitted the statement where NULL is returned since
> > > > > the pointer was always dereferenced post inlining.
> > > >
> > > > Then tell clang not to do that, like we tell gcc not to do that as that
> > > > is a foolish thing for a compiler to do when building the kernel.
> > >
> > > Thanks all for your input, we'll try to get
> > > -fno-delete-null-pointer-checks or a similar flag to be added to
> > > clang.
> >
> > Wait, clang does not have that?
>
> Nope, clang doesn't currently have such a flag.
>
> > That's crazy, how has this not been hit yet when building the
> > kernel?
>
> IIRC this patch was needed to work around the lack of the flag:
>
> commit beaec533fc2701a28a4d667f67c9f59c6e4e0d13
> Author: Alexander Potapenko <glider@google.com>
> Date: Wed Jul 19 20:27:30 2017 +0200
>
> llist: clang: introduce member_address_is_nonnull()
>
> Currently llist_for_each_entry() and llist_for_each_entry_safe() iterate
> until &pos->member != NULL. But when building the kernel with Clang,
> the compiler assumes &pos->member cannot be NULL if the member's offset
> is greater than 0 (which would be equivalent to the object being
> non-contiguous in memory). Therefore the loop condition is always true,
> and the loops become infinite.
>
> To work around this, introduce the member_address_is_nonnull() macro,
> which casts object pointer to uintptr_t, thus letting the member pointer
> to be NULL.
>
> Signed-off-by: Alexander Potapenko <glider@google.com>
> Tested-by: Sodagudi Prasad <psodagud@codeaurora.org>
> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
>
>
> Other than that I am not aware of any known issues.
I think you have gotten lucky :)
greg k-h
prev parent reply other threads:[~2018-03-28 19:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 23:55 [PATCH] debugfs: Check return value of debugfs_real_fops() for NULL Matthias Kaehlcke
2018-03-28 6:16 ` Greg Kroah-Hartman
2018-03-28 14:47 ` Manoj Gupta
2018-03-28 15:30 ` Josh Poimboeuf
2018-03-28 15:34 ` Josh Poimboeuf
2018-03-28 18:05 ` Greg Kroah-Hartman
2018-03-28 18:14 ` Matthias Kaehlcke
2018-03-28 18:19 ` Greg Kroah-Hartman
2018-03-28 18:50 ` Matthias Kaehlcke
2018-03-28 19:22 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180328192242.GA1404@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=glider@google.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manojgupta@chromium.org \
--cc=mka@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox