lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 7 Sep 2016 10:17:01 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Andi Kleen <andi@...stfloor.org>, Jiri Olsa <jolsa@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        lkml <linux-kernel@...r.kernel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Subject: Re: [PATCH] fs/proc/kcore.c: Omit kernel text area for hardened
 usercopy feature

On Tue, Sep 6, 2016 at 12:48 PM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Tue, Sep 6, 2016 at 12:41 PM, Andi Kleen <andi@...stfloor.org> wrote:
>>
>> I suspect it's more than just /proc/kcore, there could be also
>> legitimate cases to read kernel text from /dev/mem or /dev/kmem
>
> Yes, that's probably true. Although I suspect that we should just say
> that user-copy hardening is incompatible with /dev/kmem and
> !STRICT_DEVMEM.
>
> At least Fedora seems to have
>
>   CONFIG_DEVMEM=y
>   # CONFIG_DEVKMEM is not set
>   CONFIG_STRICT_DEVMEM=y
>
> which should mean that you already should not be able to access normal
> RAM using /dev/[k]mem - ie it's purely for legacy X server kind of
> situations.
>
> So we could just make  HARDENED_USERCOPY force those settings. It's
> not like you should ever have anything else in any situation where you
> care about security *anyway*, so...

!DEVKMEM is easy to represent, but STRICT_DEVMEM=y gets a little ugly,
since the logic desired is actually "STRICT_DEVMEM=y if STRICT_DEVMEM
available" and STRICT_DEVMEM looks like this:

config STRICT_DEVMEM
        bool "Filter access to /dev/mem"
        depends on MMU
        depends on ARCH_HAS_DEVMEM_IS_ALLOWED

But I don't want to limit hardened usercopy to MMU only, so...

depends on !DEVKMEM
depends on STRICT_DEVMEM=y || !ARCH_HAS_DEVMEM_IS_ALLOWED || !MMU

This looks a bit ugly to me, but I'm happy to add it if people think
it's worth it.

-Kees

-- 
Kees Cook
Nexus Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ