From: Kees Cook <keescook@chromium.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jann Horn <jannh@google.com>,
Seth Jenkins <sethjenkins@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Eric Biggers <ebiggers@google.com>,
Huang Ying <ying.huang@intel.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-doc@vger.kernel.org,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Joel Savitz <jsavitz@redhat.com>,
Laurent Dufour <ldufour@linux.ibm.com>,
Rob Herring <robh@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] exit: Allow oops_limit to be disabled
Date: Fri, 16 Dec 2022 12:32:53 -0800 [thread overview]
Message-ID: <202212161232.D752E46@keescook> (raw)
In-Reply-To: <Y5x7GXeluFmZ8E0E@hirez.programming.kicks-ass.net>
On Fri, Dec 16, 2022 at 03:05:13PM +0100, Peter Zijlstra wrote:
> On Fri, Dec 02, 2022 at 01:06:21PM -0800, Kees Cook wrote:
>
> > --- a/kernel/exit.c
> > +++ b/kernel/exit.c
> > @@ -954,7 +954,7 @@ void __noreturn make_task_dead(int signr)
> > * To make sure this can't happen, place an upper bound on how often the
> > * kernel may oops without panic().
> > */
> > - if (atomic_inc_return(&oops_count) >= READ_ONCE(oops_limit))
> > + if (atomic_inc_return(&oops_count) >= READ_ONCE(oops_limit) && oops_limit)
> > panic("Oopsed too often (kernel.oops_limit is %d)", oops_limit);
> >
>
> That's dodgy, please write as:
>
> limit = READ_ONCE(oops_limit);
> if (atomic_inc_return(&oops_count) >= limit && limit)
>
> So we don't explicitly add a reload that negates the whole READ_ONCE().
Yup, that's more correct. Sent:
https://lore.kernel.org/lkml/20221216203024.never.640-kees@kernel.org
--
Kees Cook
prev parent reply other threads:[~2022-12-16 20:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 21:06 [PATCH] exit: Allow oops_limit to be disabled Kees Cook
2022-12-16 14:05 ` Peter Zijlstra
2022-12-16 20:32 ` Kees Cook [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=202212161232.D752E46@keescook \
--to=keescook@chromium.org \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=baolin.wang@linux.alibaba.com \
--cc=corbet@lwn.net \
--cc=ebiederm@xmission.com \
--cc=ebiggers@google.com \
--cc=gpiccoli@igalia.com \
--cc=jannh@google.com \
--cc=jsavitz@redhat.com \
--cc=ldufour@linux.ibm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=robh@kernel.org \
--cc=sethjenkins@google.com \
--cc=viro@zeniv.linux.org.uk \
--cc=ying.huang@intel.com \
/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).