From: Greg KH <gregkh@linuxfoundation.org>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
Guangwu Zhang <guazhang@redhat.com>,
Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
linux-integrity@vger.kernel.org,
James Bottomley <James.Bottomley@hansenpartnership.com>
Subject: Re: [PATCH] hwrng: core - Add WARN_ON for buggy read return values
Date: Mon, 23 Sep 2024 16:48:27 +0200 [thread overview]
Message-ID: <2024092340-renovate-cornflake-4b5e@gregkh> (raw)
In-Reply-To: <D4DQJ34I5FSD.1K618VWEKI7IW@kernel.org>
On Mon, Sep 23, 2024 at 05:31:47PM +0300, Jarkko Sakkinen wrote:
> On Mon Sep 23, 2024 at 12:26 PM EEST, Herbert Xu wrote:
> > > +
> > > > + err = rng->read(rng, buffer, size, wait);
> > > > + if (WARN_ON_ONCE(err > 0 && err > size))
> > >
> > > Are you sure you want to use WARN_ON_ONCE here instead of
> > > pr_warn_once()? I.e. is it worth of taking down the whole
> > > kernel?
> >
> > Absolutely. If this triggers it's a serious kernel bug and we
> > should gather as much information as possible. pr_warn_once is
> > not the same thing as WARN_ON_ONCE in terms of what it prints.
>
> Personally I allow the use of WARN only as the last resort.
>
> If you need stack printout you can always use dump_stack().
>
> >
> > If people want to turn WARNs into BUGs, then they've only got
> > themselves to blame when the kernel goes down. On the other
> > hand perhaps they *do* want this to panic and we should hand
> > it to them.
>
> Actually when you turn on "panic_on_warn" the user expectation is and
> should be that the sites where WARN is used have been hand picked with
> consideration so that panic happens for a reason.
>
> This has also been denoted repeatedly by Greg:
>
> https://lore.kernel.org/linux-cve-announce/2024061828-CVE-2024-36975-6719@gregkh/
>
> I should check this somewhere but actually these days a wrongly chosen
> WARN() might lead to CVE entry. That fix was by me but I never created
> the CVE.
>
> Greg, did we have something under Documentation/ that would fully
> address the use of WARN?
Please see:
https://www.kernel.org/doc/html/latest/process/deprecated.html#bug-and-bug-on
which describes that. We should make it more explicit that any WARN()
or WARN_ON() calls that can be hit by user interactions somehow, will
end up getting a CVE id when we fix it up to not do so.
thanks,
greg k-h
next prev parent reply other threads:[~2024-09-23 14:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 6:05 [PATCH] hwrng: core - Add WARN_ON for buggy read return values Herbert Xu
2024-09-23 7:52 ` Jarkko Sakkinen
2024-09-23 8:07 ` Jarkko Sakkinen
2024-09-23 8:09 ` Jarkko Sakkinen
2024-09-23 9:26 ` Herbert Xu
2024-09-23 14:31 ` Jarkko Sakkinen
2024-09-23 14:36 ` Jarkko Sakkinen
2024-09-23 14:48 ` Greg KH [this message]
2024-09-23 20:46 ` Jarkko Sakkinen
2024-09-23 22:32 ` Herbert Xu
2024-09-24 16:05 ` Jarkko Sakkinen
2024-09-24 17:43 ` Jarkko Sakkinen
2024-09-27 0:42 ` Herbert Xu
2024-10-07 23:28 ` Jarkko Sakkinen
2025-04-07 5:19 ` Herbert Xu
2025-04-07 6:26 ` [PATCH] tpm: Mask TPM RC in tpm2_start_auth_session() Jarkko Sakkinen
2025-04-07 7:17 ` [PATCH v2] " Jarkko Sakkinen
2025-04-07 7:20 ` [PATCH v3] " Jarkko Sakkinen
2025-04-07 8:04 ` Stefano Garzarella
2025-04-07 11:30 ` Jarkko Sakkinen
2025-04-07 13:20 ` Stefano Garzarella
2025-04-07 12:28 ` [PATCH v4] " Jarkko Sakkinen
2025-04-07 12:32 ` Jarkko Sakkinen
2025-04-07 13:51 ` Stefano Garzarella
2025-04-07 18:13 ` Jarkko Sakkinen
2025-04-08 16:03 ` Jarkko Sakkinen
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=2024092340-renovate-cornflake-4b5e@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=guazhang@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=peterhuewe@gmx.de \
/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;
as well as URLs for NNTP newsgroup(s).