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


Groups > linux.kernel > #1439899

Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support

From Valdis.Kletnieks@vt.edu
Newsgroups linux.kernel
Subject Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support
Date 2016-07-09 08:20 +0200
Message-ID <rSTMl-7yt-5@gated-at.bofh.it> (permalink)
References (2 earlier) <rSGvM-71i-29@gated-at.bofh.it> <rSGP9-79Y-61@gated-at.bofh.it> <rSI4x-7VV-7@gated-at.bofh.it> <rSKSJ-1jd-1@gated-at.bofh.it> <rSTMl-7yt-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sat, 09 Jul 2016 15:58:20 +1000, Michael Ellerman said:

> I then get two hits, which may or may not be valid:
>
> [    2.309556] usercopy: kernel memory overwrite attempt detected to d000000003510028 (kernfs_node_cache) (64 bytes)
> [    2.309995] CPU: 7 PID: 2241 Comm: wait-for-root Not tainted 4.7.0-rc3-00099-g97872fc89d41 #64
> [    2.310480] Call Trace:
> [    2.310556] [c0000001f4773bf0] [c0000000009bdbe8] dump_stack+0xb0/0xf0 (unreliable)
> [    2.311016] [c0000001f4773c30] [c00000000029cf44] __check_object_size+0x74/0x320
> [    2.311472] [c0000001f4773cb0] [c00000000005d4d0] copy_from_user+0x60/0xd4
> [    2.311873] [c0000001f4773cf0] [c0000000008b38f4] __get_filter+0x74/0x160
> [    2.312230] [c0000001f4773d30] [c0000000008b408c] sk_attach_filter+0x2c/0xc0
> [    2.312596] [c0000001f4773d60] [c000000000871c34] sock_setsockopt+0x954/0xc00
> [    2.313021] [c0000001f4773dd0] [c00000000086ac44] SyS_setsockopt+0x134/0x150
> [    2.313380] [c0000001f4773e30] [c000000000009260] system_call+0x38/0x108

Yeah, 'ping' dies with a similar traceback going to rawv6_setsockopt(),
and 'trinity' dies a horrid death during initialization because it creates
some sctp sockets to fool around with.  The problem in all these cases is that
setsockopt uses copy_from_user() to pull in the option value, and the allocation
isn't tagged with USERCOPY to whitelist it.

Unfortunately, I haven't been able to track down where in net/ the memory is
allocated, nor is there any good hint in the grsecurity patch that I can find
where they do the tagging.

And the fact that so far, I'm only had ping and trinity killed in setsockopt()
hints that *most* setsockopt() calls must be going through a code path that
does allocate suitable memory, and these two have different paths.  I can't
believe they're the only two binaries that call setsockopt().....

Just saw your second mail, now I'm wondering why *my* laptop doesn't die a
horrid death when systemd starts up.  Mine is
systemd-230-3.gitea68351.fc25.x86_64 - maybe there's something
release-dependent going on?

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


Thread

Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy  support Christoph Lameter <cl@linux.com> - 2016-07-08 15:50 +0200
  Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support Kees Cook <keescook@chromium.org> - 2016-07-08 18:10 +0200
    Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy  support Christoph Lameter <cl@linux.com> - 2016-07-08 18:30 +0200
      Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support Kees Cook <keescook@chromium.org> - 2016-07-08 19:50 +0200
        Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support Kees Cook <keescook@chromium.org> - 2016-07-08 22:50 +0200
          Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support Valdis.Kletnieks@vt.edu - 2016-07-09 08:20 +0200
            Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support Kees Cook <keescook@chromium.org> - 2016-07-09 19:10 +0200
          Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy  support Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-07-11 08:10 +0200

csiph-web