Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734897

Re: [PATCH 1/3] kcov: remove #ifdef CONFIG_RANDOMIZE_BASE

From Dmitry Vyukov <dvyukov@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] kcov: remove #ifdef CONFIG_RANDOMIZE_BASE
Date 2017-09-19 15:10 +0200
Message-ID <urqrM-5To-7@gated-at.bofh.it> (permalink)
References <urqi5-5B6-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 19, 2017 at 2:46 PM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
> There is no need to surround kaslr_offset() with CONFIG_RANDOMIZE_BASE ifdef.
> kaslr_offset() will just return 0 if CONFIG_RANDOMIZE_BASE isn't set.
>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>


As you said this is a very hot function, but this changes code from:

  2e:   48 8b 75 08             mov    0x8(%rbp),%rsi

to:

  2b:   48 c7 c2 00 00 00 81    mov    $0xffffffff81000000,%rdx
  32:   48 81 ea 00 00 00 00    sub    $0x0,%rdx
  3c:   48 03 55 08             add    0x8(%rbp),%rdx

This also changes semantics, as returned PCs won't match nm/objdump output.


> ---
>  kernel/kcov.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 3f693a0f6f3e..2f0e7a7c7afc 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -69,9 +69,7 @@ void notrace __sanitizer_cov_trace_pc(void)
>                 unsigned long pos;
>                 unsigned long ip = _RET_IP_;
>
> -#ifdef CONFIG_RANDOMIZE_BASE
>                 ip -= kaslr_offset();
> -#endif
>
>                 /*
>                  * There is some code that runs in interrupts but for which
> --
> 2.13.5
>

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 1/3] kcov: remove #ifdef CONFIG_RANDOMIZE_BASE Dmitry Vyukov <dvyukov@google.com> - 2017-09-19 15:10 +0200

csiph-web