From: Ingo Molnar <mingo@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@suse.de>,
Baoquan He <bhe@redhat.com>, Yinghai Lu <yinghai@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "x86@kernel.org" <x86@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
"H.J. Lu" <hjl.tools@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/boot: Refuse to build with data relocations
Date: Mon, 16 May 2016 12:30:51 +0200 [thread overview]
Message-ID: <20160516103051.GA11330@gmail.com> (raw)
In-Reply-To: <8bc4f1fd-c6f8-4643-becf-4f84be378807@zytor.com>
* H. Peter Anvin <hpa@zytor.com> wrote:
> On 05/12/16 15:54, Kees Cook wrote:
> >>
> >> It would be far better to warn on the *type* of relocations rather than in which section they feel.
> >
> > I'm open to specific changes. What's the best way to detect what you want here?
> >
>
> Use readelf -r and look for inappropriate relocation types (which are
> basically the same ones that we should have to muck with for the main
> kernel in relocs.c.)
I suspect initially we are good if we don't allow any relocations in
arch/x86/boot/compressed/vmlinux:
fomalhaut:~/linux/linux> readelf -r arch/x86/boot/compressed/vmlinux | grep -q 'There are no relocations in this file' ; echo $?
0
versus a regular object file with lots of relocations:
fomalhaut:~/linux/linux> readelf -r arch/x86/built-in.o | grep -q 'There are no relocations in this file' ; echo $?
1
I.e. the relevant portion of Kees's patch would do something like:
quiet_cmd_check_data_rel = DATAREL $@
define cmd_check_data_rel
for obj in $(filter %.o,$^); do \
readelf -r $$obj | grep -qF 'There are no relocations in this file' && exit 0 || { \
echo "error: $$obj has data relocations!" >&2; \
exit 1; \
} \
done
endef
(totally untested)
Agreed?
Thanks,
Ingo
next prev parent reply other threads:[~2016-05-16 10:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 20:31 Kees Cook
2016-05-12 22:29 ` H. Peter Anvin
2016-05-12 22:54 ` Kees Cook
2016-05-13 20:45 ` H. Peter Anvin
2016-05-16 10:30 ` Ingo Molnar [this message]
2016-05-17 8:13 ` Kees Cook
2016-05-17 9:31 ` H. Peter Anvin
2016-05-17 13:53 ` Kees Cook
2016-05-17 16:56 ` H. Peter Anvin
2016-05-17 19:28 ` Kees Cook
2016-05-17 19:33 ` H. Peter Anvin
2016-05-18 8:29 ` Ingo Molnar
2016-05-18 14:11 ` Kees Cook
2016-05-20 6:41 ` Ingo Molnar
2016-05-20 16:37 ` Kees Cook
2016-05-16 15:57 ` Josh Poimboeuf
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=20160516103051.GA11330@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aryabinin@virtuozzo.com \
--cc=bhe@redhat.com \
--cc=bp@suse.de \
--cc=dvyukov@google.com \
--cc=hjl.tools@gmail.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yinghai@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
Powered by JetHome