Messages in this thread | | | From | Dmitry Vyukov <> | Date | Wed, 12 Feb 2020 07:23:16 +0100 | Subject | Re: [RFC PATCH] UML: add support for KASAN under x86_64 |
| |
On Wed, Feb 12, 2020 at 12:48 AM Patricia Alfonso <trishalfonso@google.com> wrote: > > On Thu, Jan 16, 2020 at 12:44 AM Dmitry Vyukov <dvyukov@google.com> wrote: > > > > 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? > The only restriction is that there is enough space there to map all of > the KASAN shadow memory without conflicting with anything else. > > > 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) > > > I just tested with 0x7fff8000 as the KASAN_SHADOW_OFFSET and it worked > so I can make that the default if it will be more efficient.
I think it's the right thing to do if it works.
| |