From: "PaX Team" <pageexec@freemail.hu>
To: linux-kernel@vger.kernel.org,
kernel-hardening@lists.openwall.com, Jann Horn <jannh@google.com>
Cc: Kees Cook <keescook@google.com>,
jann@thejh.net, Jann Horn <jannh@google.com>
Subject: Re: [RFC] kref: pin objects with dangerously high reference count
Date: Sun, 26 Jun 2016 02:03:01 +0200 [thread overview]
Message-ID: <576F1BB5.24129.6C9A3386@pageexec.freemail.hu> (raw)
In-Reply-To: <1466817192-9586-2-git-send-email-jannh@google.com>
On 25 Jun 2016 at 3:13, Jann Horn wrote:
> Since 2009 or so, PaX had reference count overflow mitigation code. My main
> reasons for reinventing the wheel are:
>
> - PaX adds arch-specific code, both in the atomic_t operations and in
> exception handlers. I'd like to keep the code as
> architecture-independent as possible, especially without adding
> complexity to assembler code, to make it more maintainable and
> auditable.
complexity is a few simple lines of asm insns in what is already asm, hardly
a big deal ;). in exchange you'd lose on code density, performance and race
windows.
> - The refcounting hardening from PaX does not handle the "simple reference
> count overflow" case when just the refcounting hardening code is used as
> a standalone patch.
i don't think that this is quite true as stated as handling this case depends
on the exact sequencing of events. there're 3 cases in practice:
1. local use
inc_refcount -> use referenced object -> dec_refcount
in this case inc_refcount would detect and prevent the overflow, regardless
of how many outstanding non-local or local references there are.
2. non-local use, safe sequence
inc_refcount -> object reference escapes to non-local memory
same as above, this case is not exploitable because the reference wouldn't
escape to non-local memory on overflow.
3. non-local use, unsafe sequence
object reference escapes to non-local memory -> inc_refcount
this case may already be a logic bug (the object could be freed between these
two actions if there's no other synchronization mechanism protecting them) and
a reference would escape even though the refcount itself wouldn't actually be
incremented. further decrements could then trigger the overdecrement case and
be exploitable as a use-after-free bug.
the REFCOUNT feature in PaX wasn't designed to handle this case because it's
too rare to be worth the additional code and performance impact it'd require
to saturate the refcount in this case as well.
cheers,
PaX Team
next prev parent reply other threads:[~2016-06-26 0:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-25 1:13 [RFC] reference count hardening via kref: another attempt Jann Horn
2016-06-25 1:13 ` [RFC] kref: pin objects with dangerously high reference count Jann Horn
2016-06-26 0:03 ` PaX Team [this message]
2016-06-26 4:07 ` Jann Horn
2016-06-25 1:59 ` [RFC] reference count hardening via kref: another attempt Kees Cook
2016-06-25 14:24 ` [kernel-hardening] " Greg KH
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=576F1BB5.24129.6C9A3386@pageexec.freemail.hu \
--to=pageexec@freemail.hu \
--cc=jann@thejh.net \
--cc=jannh@google.com \
--cc=keescook@google.com \
--cc=kernel-hardening@lists.openwall.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®