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
| ||
|
Date: Fri, 2 Oct 2015 08:09:04 +0200 From: Ingo Molnar <mingo@...nel.org> To: Dave Hansen <dave@...1.net> Cc: Kees Cook <keescook@...gle.com>, "x86@...nel.org" <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>, Linux-MM <linux-mm@...ck.org>, Linus Torvalds <torvalds@...ux-foundation.org>, Andrew Morton <akpm@...ux-foundation.org>, Peter Zijlstra <a.p.zijlstra@...llo.nl>, Andy Lutomirski <luto@...nel.org>, Borislav Petkov <bp@...en8.de> Subject: Re: [PATCH 26/26] x86, pkeys: Documentation * Dave Hansen <dave@...1.net> wrote: > On 10/01/2015 01:39 PM, Kees Cook wrote: > > On Thu, Oct 1, 2015 at 4:17 AM, Ingo Molnar <mingo@...nel.org> wrote: > >> So could we try to add an (opt-in) kernel option that enables this transparently > >> and automatically for all PROT_EXEC && !PROT_WRITE mappings, without any > >> user-space changes and syscalls necessary? > > > > I would like this very much. :) > > Here it is in a quite fugly form (well, it's not opt-in). Init crashes > if I boot with this, though. > > I'll see if I can turn it in to a bit more of an opt-in and see what's > actually going wrong. So the reality of modern Linux distros is that, according to some limited strace-ing around, pure PROT_EXEC usage does not seem to exist: 99% of executable mappings are mapped via PROT_EXEC|PROT_READ. So the most usable kernel testing approach would be to enable these types of pkeys for a child task via some mechanism and inherit it to all children (including inheriting it over non-suid exec) - but not to any other task. You could hijack a new personality bit just for debug purposes - see the (totally untested) patch below. Depending on user-space's assumptions it might not end up being anything usable we can apply, but it would be a great testing tool if it worked to a certain degree. I.e. allow the system to boot in without pkeys set for any task, then set the personality of a shell process to PER_LINUX_PKEYS and see which binaries (if any!) will start up without segfaulting. This way you don't have to debug SystemD, which is extremely fragile and passive-aggressive towards kernels that don't behave in precisely the fashion under which SystemD is being developed. Thanks, Ingo ========> Absolutely-Not-Signed-off-by: Ingo Molnar <mingo@...nel.org> include/uapi/linux/personality.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/personality.h b/include/uapi/linux/personality.h index aa169c4339d2..bead47213419 100644 --- a/include/uapi/linux/personality.h +++ b/include/uapi/linux/personality.h @@ -8,6 +8,7 @@ * These occupy the top three bytes. */ enum { + PROT_READ_EXEC_HACK = 0x0010000, /* PROT_READ|PROT_EXEC == PROT_EXEC hack */ UNAME26 = 0x0020000, ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */ FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors @@ -41,6 +42,7 @@ enum { enum { PER_LINUX = 0x0000, PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT, + PER_LINUX_PKEYS = 0x0000 | PROT_READ_EXEC_HACK, PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS, PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO, PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists