Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: kernel-hardening@xxxxxxxxxxxxxxxxxx
- Subject: Re: [kernel-hardening] Re: [PATCH 9/9] mm: SLUB hardened usercopy support
- From: Valdis.Kletnieks@xxxxxx
- Date: Sat, 09 Jul 2016 02:17:17 -0400
- Cc: Kees Cook <keescook@xxxxxxxxxxxx>, Christoph Lameter <cl@xxxxxxxxx>, Jan Kara <jack@xxxxxxx>, Catalin Marinas <catalin.marinas@xxxxxxx>, Will Deacon <will.deacon@xxxxxxx>, Linux-MM <linux-mm@xxxxxxxxx>, sparclinux <sparclinux@xxxxxxxxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, Andrea Arcangeli <aarcange@xxxxxxxxxx>, linux-arch <linux-arch@xxxxxxxxxxxxxxx>, "x86\@kernel.org" <x86@xxxxxxxxxx>, Russell King <linux@xxxxxxxxxxxxxxx>, PaX Team <pageexec@xxxxxxxxxxx>, Borislav Petkov <bp@xxxxxxx>, Mathias Krause <minipli@xxxxxxxxxxxxxx>, Fenghua Yu <fenghua.yu@xxxxxxxxx>, Rik van Riel <riel@xxxxxxxxxx>, David Rientjes <rientjes@xxxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>, Dmitry Vyukov <dvyukov@xxxxxxxxxx>, Laura Abbott <labbott@xxxxxxxxxxxxxxxxx>, Brad Spengler <spender@xxxxxxxxxxxxxx>, Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>, LKML <linux-kernel@xxxxxxxxxxxxxxx>, Pekka Enberg <penberg@xxxxxxxxxx>, Case y Sc hauf ler <casey@xxxxxxxxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, "linuxppc-dev\@lists.ozlabs.org" <linuxppc-dev@xxxxxxxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxxxxx>, "linux-arm-kernel\@lists.infradead.org" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
- In-reply-to: <57809299.84b3370a.5390c.ffff9e58SMTPIN_ADDED_BROKEN@mx.google.com>
- List-id: <linux-ia64.vger.kernel.org>
- References: <577f7e55.4668420a.84f17.5cb9SMTPIN_ADDED_MISSING@mx.google.com> <alpine.DEB.2.20.1607080844370.3379@east.gentwo.org> <CAGXu5jKE=h32tHVLsDeaPN1GfC+BB3YbFvC+5TE5TK1oR-xU3A@mail.gmail.com> <alpine.DEB.2.20.1607081119170.6192@east.gentwo.org> <CAGXu5j+UdkQA+k39GNLe5CwBPVD5ZbRGTCQLqS8VF=kWx+PtsQ@mail.gmail.com> <CAGXu5jKxw3RxWNKLX4XVCwJ6x_zA=_RwiU9jLDm2+VRO79G7+w@mail.gmail.com> <57809299.84b3370a.5390c.ffff9e58SMTPIN_ADDED_BROKEN@mx.google.com>
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?
Attachment:
pgp3ndzEyxAI9.pgp
Description: PGP signature
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]