From: Mark Rutland <mark.rutland@arm.com>
To: Dmitry Vyukov <dvyukov@google.com>, Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <keescook@chromium.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lkdtm: turn off kcov for lkdtm_rodata_do_nothing:
Date: Tue, 28 Mar 2017 11:22:03 +0100 [thread overview]
Message-ID: <20170328102203.GB24221@leverpostej> (raw)
In-Reply-To: <CACT4Y+acdDcAkYn+vjGAp49ExXDwT5UuM_uPcz0G4QOyAhTOOw@mail.gmail.com>
Hi,
On Tue, Mar 28, 2017 at 12:00:15PM +0200, Dmitry Vyukov wrote:
> On Tue, Mar 28, 2017 at 11:57 AM, Arnd Bergmann <arnd@arndb.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.
For reference, is this a "large" config, e.g. allyesconfig?
I'm aware that at least as recently as GCC 6 there were issues with
veneer generation for calls across sections (which I personally saw with
calls from .init.text to .text) when the kernel was sufficiently large.
FWIW, I have no problem building a v4.11-rc3 kernel with both KCOV and
LKDTM using the Linaro 15.08 aarch64-linux-gnu GCC 5 toolchain. Which
toolchain are you using?
No strong feelings on this patch, but it may be indicative of a larger
problem, and we probably don't want to play whack-a-mole to fix
relocation truncation more generally.
Thanks,
Mark.
> > 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@google.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Fixes: 5c9a8750a640 ("kernel: add kcov code coverage")
> > Fixes: 9a49a528dcf3 ("lkdtm: add function for testing .rodata section")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.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@google.com>
next prev parent reply other threads:[~2017-03-28 10:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 9:57 Arnd Bergmann
2017-03-28 10:00 ` Dmitry Vyukov
2017-03-28 10:22 ` Mark Rutland [this message]
2017-03-28 12:35 ` Arnd Bergmann
2017-03-28 16:57 ` Kees Cook
2017-03-28 17:12 ` Greg Kroah-Hartman
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=20170328102203.GB24221@leverpostej \
--to=mark.rutland@arm.com \
--cc=arnd@arndb.de \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®