From: "Arnd Bergmann" <arnd@arndb.de>
To: "Doug Anderson" <dianders@chromium.org>,
"Kees Cook" <keescook@chromium.org>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lkdtm/bugs: In lkdtm_HUNG_TASK() use BUG(), not BUG_ON(1)
Date: Fri, 26 Jan 2024 17:08:11 +0100 [thread overview]
Message-ID: <e70be9ff-5bf8-45ab-bd31-66d4a75acce5@app.fastmail.com> (raw)
In-Reply-To: <20240126072852.1.Ib065e528a8620474a72f15baa2feead1f3d89865@changeid>
On Fri, Jan 26, 2024, at 16:28, Douglas Anderson wrote:
> In commit edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid
> tail call optimization") we marked lkdtm_HUNG_TASK() as
> __noreturn. The compiler gets unhappy if it thinks a __noreturn
> function might return, so there's a BUG_ON(1) at the end. Any human
> can see that the function won't return and the compiler can figure
> that out too. Except when it can't.
>
> The MIPS architecture defines HAVE_ARCH_BUG_ON and defines its own
> version of BUG_ON(). The MIPS version of BUG_ON() is not a macro but
> is instead an inline function. Apparently this prevents the compiler
> from realizing that the condition to BUG_ON() is constant and that the
> function will never return.
>
> Let's change the BUG_ON(1) to just BUG(), which it should have been to
> begin with. The only reason I used BUG_ON(1) to begin with was because
> I was used to using WARN_ON(1) when writing test code and WARN() and
> BUG() are oddly inconsistent in this manner. :-/
>
> Fixes: edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid
> tail call optimization")
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
Acked-by: Arnd Bergmann <arnd@arndb.de>
> schedule();
> - BUG_ON(1);
> + BUG();
> }
Yes, this is a common problem that I've fixed in other
places before.
Arnd
next prev parent reply other threads:[~2024-01-26 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 15:28 Douglas Anderson
2024-01-26 15:58 ` Doug Anderson
2024-01-26 16:08 ` Arnd Bergmann [this message]
2024-01-26 18:30 ` Kees Cook
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=e70be9ff-5bf8-45ab-bd31-66d4a75acce5@app.fastmail.com \
--to=arnd@arndb.de \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®