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  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 1 May 2020 13:47:24 +0200
From:   Christian Heimes <>
To:     Jann Horn <>, Florian Weimer <>
Cc:     Mickaël Salaün <>,
        kernel list <>,
        Aleksa Sarai <>,
        Alexei Starovoitov <>,
        Al Viro <>,
        Andy Lutomirski <>,
        Daniel Borkmann <>,
        Deven Bowers <>,
        Eric Chiang <>,
        James Morris <>, Jan Kara <>,
        Jonathan Corbet <>,
        Kees Cook <>,
        Matthew Garrett <>,
        Matthew Wilcox <>,
        Michael Kerrisk <>,
        Mickaël Salaün <>,
        Mimi Zohar <>,
        Philippe Trébuchet 
        Scott Shell <>,
        Sean Christopherson <>,
        Shuah Khan <>,
        Steve Dower <>,
        Steve Grubb <>,
        Thibaut Sautereau <>,
        Vincent Strubel <>,
        Kernel Hardening <>,
        Linux API <>,
        linux-security-module <>,
        linux-fsdevel <>
Subject: Re: [PATCH v3 0/5] Add support for RESOLVE_MAYEXEC

On 29/04/2020 00.01, Jann Horn wrote:
> On Tue, Apr 28, 2020 at 11:21 PM Florian Weimer <> wrote:
>> * Jann Horn:
>>> Just as a comment: You'd probably also have to use RESOLVE_MAYEXEC in
>>> the dynamic linker.
>> Absolutely.  In typical configurations, the kernel does not enforce
>> that executable mappings must be backed by files which are executable.
>> It's most obvious with using an explicit loader invocation to run
>> executables on noexec mounts.  RESOLVE_MAYEXEC is much more useful
>> than trying to reimplement the kernel permission checks (or what some
>> believe they should be) in userspace.
> Oh, good point.
> That actually seems like something Mickaël could add to his series? If
> someone turns on that knob for "When an interpreter wants to execute
> something, enforce that we have execute access to it", they probably
> also don't want it to be possible to just map files as executable? So
> perhaps when that flag is on, the kernel should either refuse to map
> anything as executable if it wasn't opened with RESOLVE_MAYEXEC or
> (less strict) if RESOLVE_MAYEXEC wasn't used, print a warning, then
> check whether the file is executable and bail out if not?
> A configuration where interpreters verify that scripts are executable,
> but other things can just mmap executable pages, seems kinda
> inconsistent...


I worked with Steve Downer on Python PEP 578 [1] that added audit hooks
and PyFile_OpenCode() to CPython. A PyFile_OpenCode() implementation
with RESOLVE_MAYEXEC will hep to secure loading of Python code. But
Python also includes a wrapper of libffi. ctypes or cffi can load native
code from either shared libraries with dlopen() or execute native code
from mmap() regions. For example SnakeEater [2] is a clever attack that
abused memfd_create syscall and proc filesystem to execute code.

A consistent security policy must also ensure that mmap() PROT_EXEC
enforces the same restrictions as RESOLVE_MAYEXEC. The restriction
doesn't have be part of this patch, though.



Powered by blists - more mailing lists