[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202404150919.042E6FF@keescook>
Date: Mon, 15 Apr 2024 09:26:40 -0700
From: Kees Cook <keescook@...omium.org>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: Christoph Hellwig <hch@...radead.org>, Alex Elder <elder@...aro.org>,
corbet@....net, workflows@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Documentation: coding-style: don't encourage WARN*()
On Mon, Apr 15, 2024 at 10:35:21AM +0200, Greg KH wrote:
> On Mon, Apr 15, 2024 at 01:07:41AM -0700, Christoph Hellwig wrote:
> > No, this advice is wronger than wrong. If you set panic_on_warn you
> > get to keep the pieces.
> >
>
> But don't add new WARN() calls please, just properly clean up and handle
> the error. And any WARN() that userspace can trigger ends up triggering
> syzbot reports which also is a major pain, even if you don't have
> panic_on_warn enabled.
Here's what was more recently written on WARN:
https://docs.kernel.org/process/deprecated.html#bug-and-bug-on
Specifically:
- never use BUG*()
- WARN*() should only be used for "expected to be unreachable" situations
This, then, maps correctly to panic_on_warn: System owners may have set
the panic_on_warn sysctl, to make sure their systems do not continue
running in the face of "unreachable" conditions.
As in, userspace should _never_ be able to reach a WARN(). If it can,
either the logic leading to it needs to be fixed, or the WARN() needs to
be changed to a pr_warn().
--
Kees Cook
Powered by blists - more mailing lists