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
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Mar 2017 09:57:34 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH] lkdtm: turn off kcov for lkdtm_rodata_do_nothing:

On Tue, Mar 28, 2017 at 3:00 AM, Dmitry Vyukov <dvyukov@...gle.com> wrote:
> On Tue, Mar 28, 2017 at 11:57 AM, Arnd Bergmann <arnd@...db.de> wrote:
>> I ran into a link error on ARM64 for lkdtm_rodata_do_nothing:
>>
>> drivers/misc/built-in.o: In function `lkdtm_rodata_do_nothing':
>> :(.rodata+0x68c8): relocation truncated to fit: R_AARCH64_CALL26 against symbol `__sanitizer_cov_trace_pc' defined in .text section in kernel/built-in.o
>>
>> I did not analyze this further, but my theory is that we would need a trampoline
>> to call __sanitizer_cov_trace_pc(), but the linker (correctly) only adds trampolines
>> for callers in executable sections.

Yup, this function should be inherently uncallable (which is what
lkdtm is testing), so it makes sense to turn off kcov for it.

>>
>> Disabling KCOV for this one file avoids the build failure with no
>> other practical downsides I can think of.
>>
>> The problem can only happen on kernels that contain both kcov and
>> lkdtm, so if we want to backport this, it should be in the earliest
>> version that has both (v4.8).
>>
>> Cc: Dmitry Vyukov <dvyukov@...gle.com>
>> Cc: Kees Cook <keescook@...omium.org>
>> Fixes: 5c9a8750a640 ("kernel: add kcov code coverage")
>> Fixes: 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")
>> Signed-off-by: Arnd Bergmann <arnd@...db.de>
>> ---
>>  drivers/misc/Makefile | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
>> index 4925ea8e1952..7a321047bfbe 100644
>> --- a/drivers/misc/Makefile
>> +++ b/drivers/misc/Makefile
>> @@ -63,6 +63,8 @@ lkdtm-$(CONFIG_LKDTM)         += lkdtm_perms.o
>>  lkdtm-$(CONFIG_LKDTM)          += lkdtm_rodata_objcopy.o
>>  lkdtm-$(CONFIG_LKDTM)          += lkdtm_usercopy.o
>>
>> +KCOV_INSTRUMENT_lkdtm_rodata.o := n
>> +
>>  OBJCOPYFLAGS :=
>>  OBJCOPYFLAGS_lkdtm_rodata_objcopy.o := \
>>                         --set-section-flags .text=alloc,readonly \
>> --
>> 2.9.0
>
>
> Acked-by: Dmitry Vyukov <dvyukov@...gle.com>

Acked-by: Kees Cook <keescook@...omium.org>

Greg, can you please add this to the drivers/misc tree when you get a chance?

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ