From: Mark Rutland <mark.rutland@arm.com>
To: Kees Cook <keescook@chromium.org>
Cc: "kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [kernel-hardening] [PATCH] lib: harden strncpy_from_user
Date: Mon, 17 Oct 2016 14:04:12 +0100 [thread overview]
Message-ID: <20161017130412.GG29095@leverpostej> (raw)
In-Reply-To: <CAGXu5jKdu+8zf+NM6nFMwWgs=AVcAE5c0tiq+AvADqCAVL4BFg@mail.gmail.com>
On Fri, Aug 26, 2016 at 02:57:58PM -0400, Kees Cook wrote:
> On Fri, Aug 26, 2016 at 10:31 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > The strncpy_from_user() accessor is effectively a copy_from_user()
> > specialised to copy strings, terminating early at a NUL byte if
> > possible. In other respects it is identical, and can be used to copy an
> > arbitrarily large buffer from userspace into the kernel. Conceptually,
> > it exposes a similar attack surface.
> >
> > As with copy_from_user(), we check the destination range when the kernel
> > is built with KASAN, but unlike copy_from_user() we do not check the
> > destination buffer when using HARDENED_USERCOPY. As strncpy_from_user()
> > calls get_user() in a loop, we must call check_object_size() explicitly.
> >
> > This patch adds this instrumentation to strncpy_from_user(), per the
> > same rationale as with the regular copy_from_user(). In the absence of
> > hardened usercopy this will have no impact as the instrumentation
> > expands to an empty static inline function.
[...]
> Ah, yes, good catch! (And to repeat what you mentioned to me in
> passing in the hall: there appear to be other users of get_user() in a
> loop in other places in the kernel that will likely need some
> attention too.)
I was reminded of this as it just hit mainline; is it worth dropping a
TODO on the KSPP wiki? I suspect I won't have the time to delve much
further into this in the near term, and it might be a good intro task
for someone.
Thanks,
Mark.
next prev parent reply other threads:[~2016-10-17 13:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 14:31 [PATCH] lib: harden strncpy_from_user Mark Rutland
2016-08-26 18:57 ` [kernel-hardening] " Kees Cook
2016-10-17 13:04 ` Mark Rutland [this message]
2016-10-17 13:06 ` Loganaden Velvindron
2016-10-18 20:49 ` 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=20161017130412.GG29095@leverpostej \
--to=mark.rutland@arm.com \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--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