From: Mark Rutland <mark.rutland@arm.com>
To: Kees Cook <keescook@chromium.org>
Cc: Laura Abbott <labbott@redhat.com>,
Alexander Popov <alex.popov@linux.com>,
"kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>,
PaX Team <pageexec@freemail.hu>,
Brad Spengler <spender@grsecurity.net>,
Tycho Andersen <tycho@docker.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [kernel-hardening] Re: [PATCH RFC v2 1/1] gcc-plugins: Add stackleak feature erasing the kernel stack at the end of syscalls
Date: Wed, 21 Jun 2017 10:24:56 +0100 [thread overview]
Message-ID: <20170621092456.GA11903@leverpostej> (raw)
In-Reply-To: <CAGXu5j+Vpp60YSoPZUEGA-nFBLVUZSi-+itM7U9auSaWc0cBog@mail.gmail.com>
On Tue, Jun 20, 2017 at 12:11:56PM -0700, Kees Cook wrote:
> On Tue, Jun 20, 2017 at 4:20 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Jun 13, 2017 at 02:51:59PM -0700, Laura Abbott wrote:
> >> On 06/09/2017 10:28 AM, Kees Cook wrote:
> >> > It seems like it shouldn't be too hard to add on-user-return erasure
> >> > code to other architectures too.
> >>
> >> I played around getting this to compile for arm64 with a dummy
> >> stack clearing function. arm64 is doing something special with the
> >> efistub so it fails to link with
> >>
> >> drivers/firmware/efi/libstub/arm-stub.c:45:(.init.text+0x54): relocation
> >> truncated to fit: R_AARCH64_CALL26 against undefined symbol `__efistub_track_stack'
> >>
> >> The relocation to the .init.text section and appending __efistub happens after
> >> compilation so the checks in the plugin itself don't work. I haven't come up
> >> with a solution to not have the plugin run on the stub yet.
> >
> > Can we do something like what we do for KCOV, and (only) place the
> > plugin-invoking flags to into CFLAGS_STACKLEAK, which we can filter out
> > in scripts/Makefile.lib?
>
> That seems fine to me, though plugins have tended to provide a
> DISABLE_foo_bar_PLUGIN export (like used in ppc for turning off the
> latent entropy plugin):
>
> scripts/Makefile.gcc-plugins: DISABLE_LATENT_ENTROPY_PLUGIN +=
> -fplugin-arg-latent_entropy_plugin-disable
>
> arch/powerpc/kernel/Makefile:CFLAGS_cputable.o +=
> $(DISABLE_LATENT_ENTROPY_PLUGIN)
> arch/powerpc/kernel/Makefile:CFLAGS_prom_init.o +=
> $(DISABLE_LATENT_ENTROPY_PLUGIN)
> ...
Interesting. I hadn't encountered that style before.
I'd seen the per-makefile config disables:
drivers/firmware/efi/libstub/Makefile:GCOV_PROFILE := n
drivers/firmware/efi/libstub/Makefile:KASAN_SANITIZE := n
drivers/firmware/efi/libstub/Makefile:UBSAN_SANITIZE := n
drivers/firmware/efi/libstub/Makefile:KCOV_INSTRUMENT := n
... and per-object config disables:
arch/arm64/mm/Makefile:KASAN_SANITIZE_physaddr.o += n
arch/arm64/mm/Makefile:KASAN_SANITIZE_kasan_init.o := n
... which AFAICT are both handled by the standard scripts/Makefile.lib idiom:
ifeq ($(CONFIG_KASAN),y)
_c_flags += $(if $(patsubst n%,, \
$(KASAN_SANITIZE_$(basetarget).o)$(KASAN_SANITIZE)y), \
$(CFLAGS_KASAN))
endif
... it seems a shame for plugins to follow a different pattern.
Thanks,
Mark.
next prev parent reply other threads:[~2017-06-21 9:24 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-09 14:30 [kernel-hardening] [PATCH RFC v2 1/1] gcc-plugins: Add stackleak feature erasing the kernel stack at the end of syscalls Alexander Popov
2017-06-09 17:28 ` [kernel-hardening] " Kees Cook
2017-06-09 23:00 ` Alexander Popov
2017-06-20 19:20 ` Kees Cook
2017-06-13 21:51 ` Laura Abbott
2017-06-20 11:20 ` Mark Rutland
2017-06-20 14:13 ` Ard Biesheuvel
2017-06-20 19:11 ` Kees Cook
2017-06-21 9:24 ` Mark Rutland [this message]
2017-06-21 15:54 ` Laura Abbott
2017-07-10 22:04 ` [kernel-hardening] [RFC][PATCH 0/2] draft of stack clearing for arm64 Laura Abbott
2017-07-10 22:04 ` [kernel-hardening] [RFC][PATCH 1/2] stackleak: Update " Laura Abbott
2017-07-10 22:04 ` [kernel-hardening] [RFC][PATCH 2/2] arm64: Clear the stack Laura Abbott
2017-07-11 19:51 ` [kernel-hardening] " Mark Rutland
2017-07-11 20:04 ` Mark Rutland
2017-07-12 6:01 ` Alexander Popov
2017-07-14 20:51 ` Laura Abbott
2017-07-21 16:56 ` Alexander Popov
2017-07-22 0:23 ` Laura Abbott
2017-07-24 8:19 ` Alexander Popov
2017-07-25 3:34 ` Kees Cook
2017-08-18 8:07 ` Alexander Popov
2017-07-11 22:56 ` [kernel-hardening] Re: [RFC][PATCH 0/2] draft of stack clearing for arm64 Alexander Popov
2017-06-23 22:48 ` [kernel-hardening] Re: [PATCH RFC v2 1/1] gcc-plugins: Add stackleak feature erasing the kernel stack at the end of syscalls Tycho Andersen
2017-06-29 21:33 ` Kees Cook
2017-06-29 22:13 ` Tycho Andersen
2017-06-20 9:06 ` [kernel-hardening] " Hector Martin "marcan"
2017-06-20 19:07 ` Kees Cook
2017-06-20 20:22 ` Hector Martin "marcan"
2017-06-20 19:14 ` [kernel-hardening] " Kees Cook
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=20170621092456.GA11903@leverpostej \
--to=mark.rutland@arm.com \
--cc=alex.popov@linux.com \
--cc=ard.biesheuvel@linaro.org \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=labbott@redhat.com \
--cc=pageexec@freemail.hu \
--cc=spender@grsecurity.net \
--cc=tycho@docker.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.