lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202212161232.D752E46@keescook>
Date:   Fri, 16 Dec 2022 12:32:53 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Jann Horn <jannh@...gle.com>,
        Seth Jenkins <sethjenkins@...gle.com>,
        Jonathan Corbet <corbet@....net>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Baolin Wang <baolin.wang@...ux.alibaba.com>,
        "Jason A. Donenfeld" <Jason@...c4.com>,
        Eric Biggers <ebiggers@...gle.com>,
        Huang Ying <ying.huang@...el.com>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Arnd Bergmann <arnd@...db.de>, linux-doc@...r.kernel.org,
        "Guilherme G. Piccoli" <gpiccoli@...lia.com>,
        Joel Savitz <jsavitz@...hat.com>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        Rob Herring <robh@...nel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [PATCH] exit: Allow oops_limit to be disabled

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ