linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Patricia Alfonso <trishalfonso@google.com>
Cc: Jeff Dike <jdike@addtoit.com>,
	Richard Weinberger <richard@nod.at>,
	anton.ivanov@cambridgegreys.com,
	Andrey Ryabinin <aryabinin@virtuozzo.com>,
	David Gow <davidgow@google.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	linux-um@lists.infradead.org,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] UML: add support for KASAN under x86_64
Date: Thu, 16 Jan 2020 09:44:08 +0100	[thread overview]
Message-ID: <CACT4Y+bPzRbWw-dPQkLVENPKy_DBdjrbSce0f6XE3=W7RhfhBA@mail.gmail.com> (raw)
In-Reply-To: <20200115182816.33892-1-trishalfonso@google.com>

On Wed, Jan 15, 2020 at 7:28 PM Patricia Alfonso
<trishalfonso@google.com> wrote:
> +config KASAN_SHADOW_OFFSET
> +       hex
> +       depends on KASAN
> +       default 0x100000000000
> +       help
> +         This is the offset at which the ~2.25TB of shadow memory is
> +         initialized and used by KASAN for memory debugging. The default
> +         is 0x100000000000.

What are restrictions on this value?
In user-space we use 0x7fff8000 as a base (just below 2GB) and it's
extremely profitable wrt codegen since it fits into immediate of most
instructions.
We can load and add the base with a short instruction:
    2d8c: 48 81 c2 00 80 ff 7f    add    $0x7fff8000,%rdx
Or even add base, load shadow and check it with a single 7-byte instruction:
     1e4: 80 b8 00 80 ff 7f 00    cmpb   $0x0,0x7fff8000(%rax)

While with the large base, it takes 10 bytes just to load the const
into a register (current x86 KASAN codegen):
ffffffff81001571: 48 b8 00 00 00 00 00 fc ff df    movabs
$0xdffffc0000000000,%rax
Most instructions don't have 8-byte immediates, so then we separately
need to add/load/check.

  parent reply	other threads:[~2020-01-16  8:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15 18:28 [RFC PATCH] UML: add support for KASAN under x86_64 Patricia Alfonso
2020-01-15 18:48 ` Johannes Berg
2020-01-15 22:56   ` Patricia Alfonso
2020-01-16  7:57     ` Johannes Berg
2020-01-16  8:03       ` Johannes Berg
2020-01-16  9:18         ` Dmitry Vyukov
2020-01-16  9:20           ` Johannes Berg
2020-01-16  9:23             ` Dmitry Vyukov
2020-01-17  9:59               ` Dmitry Vyukov
2020-01-17 10:03                 ` Dmitry Vyukov
2020-01-17 10:05                   ` Dmitry Vyukov
2020-02-06 18:33                     ` Patricia Alfonso
2020-02-06 18:21         ` Patricia Alfonso
2020-02-06 19:14           ` Johannes Berg
2020-01-16  8:24     ` Dmitry Vyukov
2020-01-16  8:44 ` Dmitry Vyukov [this message]
2020-02-11 23:48   ` Patricia Alfonso
2020-02-12  6:23     ` Dmitry Vyukov
2020-01-16  8:50 ` Dmitry Vyukov
2020-01-16  8:52 ` Dmitry Vyukov
2020-02-12  0:19   ` Patricia Alfonso
2020-02-12  6:24     ` Dmitry Vyukov
2020-02-12 22:25       ` Patricia Alfonso
2020-02-13  5:39         ` Dmitry Vyukov
2020-02-13 22:55           ` Patricia Alfonso
2020-01-16  9:09 ` Dmitry Vyukov

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='CACT4Y+bPzRbWw-dPQkLVENPKy_DBdjrbSce0f6XE3=W7RhfhBA@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=jdike@addtoit.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=trishalfonso@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).