Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1443933

Re: [PATCH v2 02/11] mm: Hardened usercopy

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 02/11] mm: Hardened usercopy
Date 2016-07-15 06:30 +0200
Message-ID <rV2Vb-2fz-1@gated-at.bofh.it> (permalink)
References <rUAmd-nH-3@gated-at.bofh.it> <rUAmj-nH-27@gated-at.bofh.it> <rUYeS-7FM-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Jul 14, 2016 at 4:20 PM, Balbir Singh <bsingharora@gmail.com> wrote:
> On Wed, Jul 13, 2016 at 02:55:55PM -0700, Kees Cook wrote:
>> [...]
>> +++ b/mm/usercopy.c
>> @@ -0,0 +1,219 @@
>> [...]
>> +/*
>> + * Checks if a given pointer and length is contained by the current
>> + * stack frame (if possible).
>> + *
>> + *   0: not at all on the stack
>> + *   1: fully within a valid stack frame
>> + *   2: fully on the stack (when can't do frame-checking)
>> + *   -1: error condition (invalid stack position or bad stack frame)
>
> Can we use enums? Makes it easier to read/debug

Sure, I will update this.

>> [...]
>> +static void report_usercopy(const void *ptr, unsigned long len,
>> +                         bool to_user, const char *type)
>> +{
>> +     pr_emerg("kernel memory %s attempt detected %s %p (%s) (%lu bytes)\n",
>> +             to_user ? "exposure" : "overwrite",
>> +             to_user ? "from" : "to", ptr, type ? : "unknown", len);
>> +     dump_stack();
>> +     do_group_exit(SIGKILL);
>
> SIGKILL -- SIGBUS?

I'd like to keep SIGKILL since it indicates a process fiddling with a
kernel bug. The real problem here is that there doesn't seem to be an
arch-independent way to Oops the kernel and kill a process ("die()" is
closest, but it's defined on a per-arch basis with varying arguments).
This could be a BUG, but I'd rather not panic the entire kernel.

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-14 00:00 +0200
  Re: [PATCH v2 02/11] mm: Hardened usercopy Balbir Singh <bsingharora@gmail.com> - 2016-07-15 01:30 +0200
    Re: [PATCH v2 02/11] mm: Hardened usercopy Rik van Riel <riel@redhat.com> - 2016-07-15 03:10 +0200
      Re: [PATCH v2 02/11] mm: Hardened usercopy Balbir Singh <bsingharora@gmail.com> - 2016-07-15 03:50 +0200
        Re: [PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 06:10 +0200
          Re: [PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 07:00 +0200
            Re: [PATCH v2 02/11] mm: Hardened usercopy Balbir Singh <bsingharora@gmail.com> - 2016-07-15 15:00 +0200
    Re: [PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 06:30 +0200
      Re: [kernel-hardening] Re: [PATCH v2 02/11] mm: Hardened usercopy Daniel Micay <danielmicay@gmail.com> - 2016-07-15 21:10 +0200
        Re: [kernel-hardening] Re: [PATCH v2 02/11] mm: Hardened usercopy Daniel Micay <danielmicay@gmail.com> - 2016-07-15 21:20 +0200
          Re: [kernel-hardening] Re: [PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 21:30 +0200
        Re: [kernel-hardening] Re: [PATCH v2 02/11] mm: Hardened usercopy Kees Cook <keescook@chromium.org> - 2016-07-15 21:20 +0200

csiph-web