From: David Laight <David.Laight@ACULAB.COM>
To: 'Jann Horn' <jannh@google.com>
Cc: Kees Cook <keescook@chromium.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>,
"kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
Greg KH <gregkh@linuxfoundation.org>,
Linus Torvalds <torvalds@linuxfoundation.org>,
Seth Jenkins <sethjenkins@google.com>,
"Eric W . Biederman" <ebiederm@xmission.com>,
"Andy Lutomirski" <luto@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] exit: Put an upper limit on how often we can oops
Date: Wed, 9 Nov 2022 09:04:36 +0000 [thread overview]
Message-ID: <d88999d8e9ec486bb1a0f75911457985@AcuMS.aculab.com> (raw)
In-Reply-To: <CAG48ez3AGh-R+deQMbNPt6PCQazOz8a96skW+qP3_HmUaANmmQ@mail.gmail.com>
From: Jann Horn
> Sent: 08 November 2022 14:53
>
> On Tue, Nov 8, 2022 at 10:26 AM David Laight <David.Laight@aculab.com> wrote:
> > > Many Linux systems are configured to not panic on oops; but allowing an
> > > attacker to oops the system **really** often can make even bugs that look
> > > completely unexploitable exploitable (like NULL dereferences and such) if
> > > each crash elevates a refcount by one or a lock is taken in read mode, and
> > > this causes a counter to eventually overflow.
> > >
> > > The most interesting counters for this are 32 bits wide (like open-coded
> > > refcounts that don't use refcount_t). (The ldsem reader count on 32-bit
> > > platforms is just 16 bits, but probably nobody cares about 32-bit platforms
> > > that much nowadays.)
> > >
> > > So let's panic the system if the kernel is constantly oopsing.
> >
> > I think you are pretty much guaranteed to run out of memory
> > (or at least KVA) before any 32bit counter wraps.
>
> Not if you repeatedly take a reference and then oops without dropping
> the reference, and the oops path cleans up all the resources that were
> allocated for the crashing tasks. In that case, each oops increments
> the reference count by 1 without causing memory allocation.
I'd have thought that the kernel stack and process areas couldn't
be freed because they might contain 'live data'.
There is also the much smaller pid_t structure.
Of course I might be wrong...
But I'm sure /proc/pid/stack is valid for an oopsed process.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-11-09 9:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 20:13 Jann Horn
2022-11-07 20:56 ` Linus Torvalds
2022-11-07 21:14 ` Solar Designer
2022-11-07 21:48 ` Jann Horn
2022-11-08 17:24 ` Kees Cook
2022-11-08 19:38 ` Kees Cook
2022-11-09 16:19 ` Solar Designer
2022-11-08 9:26 ` David Laight
2022-11-08 14:53 ` Jann Horn
2022-11-09 9:04 ` David Laight [this message]
2022-11-09 9:33 ` Jann Horn
2022-11-09 15:59 ` Seth Jenkins
2022-11-08 17:22 ` 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=d88999d8e9ec486bb1a0f75911457985@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ebiederm@xmission.com \
--cc=gregkh@linuxfoundation.org \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=sethjenkins@google.com \
--cc=torvalds@linuxfoundation.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
Powered by JetHome