linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Micay <danielmicay@gmail.com>
To: Kostya Serebryany <kcc@google.com>, Kees Cook <keescook@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Michal Hocko <mhocko@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Rik van Riel <riel@redhat.com>, Reid Kleckner <rnk@google.com>,
	Peter Collingbourne <pcc@google.com>,
	eugenis@google.com
Subject: Re: binfmt_elf: use ELF_ET_DYN_BASE only for PIE breaks asan
Date: Mon, 07 Aug 2017 14:38:12 -0400	[thread overview]
Message-ID: <1502131092.1803.8.camel@gmail.com> (raw)
In-Reply-To: <CAN=P9pj_jbTgGoiECmu-b=s+NOL6uTkPbXDueXLhs8C6PVbLHg@mail.gmail.com>

> ASan already has the dynamic shadow as an option, and it's default
> mode
> on 64-bit windows, where the kernel is actively hostile to asan. 
> On Linux, we could enable it by
>   clang -fsanitize=address -O dummy.cc -mllvm -asan-force-dynamic-
> shadow=1
> (not heavily tested though). 
> 
> The problem is that this comes at a cost that we are very reluctant to
> pay. 
> Dynamic shadow means one extra load and one extra register stolen per
> function, 
> which increases the CPU usage and code size.

Can libraries compiled with dynamic be mixed with an executable or other
shared objects without it?

It could be the default with -fPIC / -fPIE without changing the default
for position dependent executables. Code isn't really PIC if it can't be
mapped within a large range. The performance hit would be paid by people
using dynamic libraries + PIE by default, but not non-PIE executables
and static libraries (unless they get compiled with -fPIC to allow
linking in a dynamic library, which is uncommon).

I'm sure a fix can be found either in the kernel or the sanitizers for
this specific PIE base move, but the problem isn't limited to this.

There are currently other issues. Try:

sysctl vm.mmap_rnd_bits=32
sysctl vm.mmap_rnd_compat_bits=16

IIRC that breaks some sanitizers at least for 32-bit executables.

Similar issues happen with certain arm64 address space configs since it
offers a bunch of choices (3 vs. 4 level page tables, different page
sizes).

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2017-08-07 18:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07 17:24 binfmt_elf: use ELF_ET_DYN_BASE only for PIE breaks asan Dmitry Vyukov
2017-08-07 17:33 ` Kostya Serebryany
2017-08-07 17:33 ` Kees Cook
2017-08-07 18:26   ` Kostya Serebryany
2017-08-07 18:36     ` Evgenii Stepanov
2017-08-07 18:40       ` Kees Cook
2017-08-07 18:51         ` Evgenii Stepanov
2017-08-07 18:57           ` Kees Cook
2017-08-07 19:03             ` Kostya Serebryany
2017-08-07 19:06               ` Kees Cook
2017-08-07 19:10                 ` Kostya Serebryany
2017-08-07 19:24               ` Kees Cook
2017-08-07 19:32                 ` Kostya Serebryany
2017-08-07 19:12             ` Evgenii Stepanov
2017-08-07 18:38     ` Daniel Micay [this message]
2017-08-07 18:45       ` Daniel Micay
2017-08-07 18:39     ` Kees Cook
2017-08-07 18:48       ` Daniel Micay
2017-08-07 18:52         ` Kees Cook
2017-08-07 18:56           ` Kostya Serebryany
2017-08-07 18:59             ` Kees Cook
2017-08-07 19:01               ` Daniel Micay
2017-08-07 19:05               ` Kostya Serebryany
2017-08-07 19:12                 ` Kees Cook
2017-08-07 19:16                   ` Kostya Serebryany
2017-08-07 19:21                     ` Kees Cook
2017-08-07 19:26                       ` Kostya Serebryany
2017-08-07 19:34                         ` Kees Cook
2017-08-07 19:40                           ` Kostya Serebryany
2017-08-07 19:42                             ` Daniel Micay
2017-08-07 19:46                             ` Kees Cook
2017-08-07 18:21 ` Daniel Micay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502131092.1803.8.camel@gmail.com \
    --to=danielmicay@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=eugenis@google.com \
    --cc=kcc@google.com \
    --cc=keescook@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=pcc@google.com \
    --cc=riel@redhat.com \
    --cc=rnk@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).