From: James Morse <james.morse@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-efi@vger.kernel.org, mark.rutland@arm.com,
kernel-hardening@lists.openwall.com, matt@codeblueprint.co.uk,
leif.lindholm@linaro.org, bp@alien8.de, rfranz@cavium.com,
mingo@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [kernel-hardening] Re: [PATCH 4/4] ef/libstub: arm/arm64: randomize the base of the UEFI rt services region
Date: Fri, 07 Apr 2017 16:47:04 +0100 [thread overview]
Message-ID: <58E7B478.6010305@arm.com> (raw)
In-Reply-To: <20170324132410.16628-5-ard.biesheuvel@linaro.org>
Hi Ard,
On 24/03/17 13:24, Ard Biesheuvel wrote:
> Update the allocation logic for the virtual mapping of the UEFI runtime
> services to start from a randomized base address if KASLR is in effect,
> and if the UEFI firmware exposes an implementation of EFI_RNG_PROTOCOL.
>
> This makes it more difficult to predict the location of exploitable
> data structures in the runtime UEFI firmware, which increases robustness
> against attacks. Note that these regions are only mapped during the
> time a runtime service call is in progress, and only on a single CPU
> at a time, bit give the lack of a downside, let's enable it nonetheless.
With next-20170407 on Seattle Overdrive, I get an SError[0] on boot:
The three patches I have on top of 4.11.0-rc5-next-20170407 are:
* Revert "efi/libstub/arm*: Set default address and size cells values for an
empty dtb"
* Revert "ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
At which point the machine start booting to a prompt again, (its noisier than
usual but looks like double-printing).
If I then cherry-pick:
* ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
It again fails, producing the trace below. This is all with next-20170407's
defconfig, 4K/48. UEFI identifies itself as:
> UEFI v2.40 (American Megatrends, 0x0005000B)
Thanks,
James
[0]
Shell> efi\morse\Image console=ttyAMA0,115200 root=PARTUUID=b2edf709-3b28-4cb3-8
809-203f262e2bcc rw earlycon=pl011,0xe1010000 crashkernel=1G stacktrace ignore_l
oglevel=1 acpi=on efi=debug resume=/dev/sda3
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.11.0-rc5-next-20170407-00003-gbe65d54f8671 (morse
@melchizedek) (gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11) ) #7
401 SMP PREEMPT Fri Apr 7 16:19:28 BST 2017
[ 0.000000] Boot CPU: AArch64 Processor [411fd072]
[ 0.000000] earlycon: pl11 at MMIO 0x00000000e1010000 (options '')
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Bad mode in Error handler detected on CPU0, code 0xbf000000 -- SError
[ 0.000000] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.11.0-rc5-next-20170407-
00003-gbe65d54f8671 #7401
[ 0.000000] Hardware name: AMD Seattle (Rev.B0) Development Board (Overdrive)
(DT)
[ 0.000000] task: ffff000008e02b80 task.stack: ffff000008df0000
[ 0.000000] PC is at setup_arch+0xf0/0x504
[ 0.000000] LR is at setup_arch+0xec/0x504
[ 0.000000] pc : [<ffff000008ce2844>] lr : [<ffff000008ce2840>] pstate: 000000c5
[ 0.000000] Call trace:
[ 0.000000] [<ffff000008ce2844>] setup_arch+0xf0/0x504
[ 0.000000] [<ffff000008ce0838>] start_kernel+0x70/0x398
[ 0.000000] [<ffff000008ce01e0>] __primary_switched+0x64/0x74
[ 0.000000] Code: 9111c000 940034d9 97fff7cd d50344ff (90fffce3)
[ 0.000000] ---[ end trace 0000000000000000 ]---
[ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
WARNING: multiple messages have this Message-ID (diff)
From: James Morse <james.morse-5wv7dgnIgG8@public.gmane.org>
To: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
kernel-hardening-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org,
matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org,
leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org,
rfranz-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org,
mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 4/4] ef/libstub: arm/arm64: randomize the base of the UEFI rt services region
Date: Fri, 07 Apr 2017 16:47:04 +0100 [thread overview]
Message-ID: <58E7B478.6010305@arm.com> (raw)
In-Reply-To: <20170324132410.16628-5-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Hi Ard,
On 24/03/17 13:24, Ard Biesheuvel wrote:
> Update the allocation logic for the virtual mapping of the UEFI runtime
> services to start from a randomized base address if KASLR is in effect,
> and if the UEFI firmware exposes an implementation of EFI_RNG_PROTOCOL.
>
> This makes it more difficult to predict the location of exploitable
> data structures in the runtime UEFI firmware, which increases robustness
> against attacks. Note that these regions are only mapped during the
> time a runtime service call is in progress, and only on a single CPU
> at a time, bit give the lack of a downside, let's enable it nonetheless.
With next-20170407 on Seattle Overdrive, I get an SError[0] on boot:
The three patches I have on top of 4.11.0-rc5-next-20170407 are:
* Revert "efi/libstub/arm*: Set default address and size cells values for an
empty dtb"
* Revert "ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
At which point the machine start booting to a prompt again, (its noisier than
usual but looks like double-printing).
If I then cherry-pick:
* ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
It again fails, producing the trace below. This is all with next-20170407's
defconfig, 4K/48. UEFI identifies itself as:
> UEFI v2.40 (American Megatrends, 0x0005000B)
Thanks,
James
[0]
Shell> efi\morse\Image console=ttyAMA0,115200 root=PARTUUID=b2edf709-3b28-4cb3-8
809-203f262e2bcc rw earlycon=pl011,0xe1010000 crashkernel=1G stacktrace ignore_l
oglevel=1 acpi=on efi=debug resume=/dev/sda3
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.11.0-rc5-next-20170407-00003-gbe65d54f8671 (morse
@melchizedek) (gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11) ) #7
401 SMP PREEMPT Fri Apr 7 16:19:28 BST 2017
[ 0.000000] Boot CPU: AArch64 Processor [411fd072]
[ 0.000000] earlycon: pl11 at MMIO 0x00000000e1010000 (options '')
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Bad mode in Error handler detected on CPU0, code 0xbf000000 -- SError
[ 0.000000] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.11.0-rc5-next-20170407-
00003-gbe65d54f8671 #7401
[ 0.000000] Hardware name: AMD Seattle (Rev.B0) Development Board (Overdrive)
(DT)
[ 0.000000] task: ffff000008e02b80 task.stack: ffff000008df0000
[ 0.000000] PC is at setup_arch+0xf0/0x504
[ 0.000000] LR is at setup_arch+0xec/0x504
[ 0.000000] pc : [<ffff000008ce2844>] lr : [<ffff000008ce2840>] pstate: 000000c5
[ 0.000000] Call trace:
[ 0.000000] [<ffff000008ce2844>] setup_arch+0xf0/0x504
[ 0.000000] [<ffff000008ce0838>] start_kernel+0x70/0x398
[ 0.000000] [<ffff000008ce01e0>] __primary_switched+0x64/0x74
[ 0.000000] Code: 9111c000 940034d9 97fff7cd d50344ff (90fffce3)
[ 0.000000] ---[ end trace 0000000000000000 ]---
[ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
WARNING: multiple messages have this Message-ID (diff)
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ef/libstub: arm/arm64: randomize the base of the UEFI rt services region
Date: Fri, 07 Apr 2017 16:47:04 +0100 [thread overview]
Message-ID: <58E7B478.6010305@arm.com> (raw)
In-Reply-To: <20170324132410.16628-5-ard.biesheuvel@linaro.org>
Hi Ard,
On 24/03/17 13:24, Ard Biesheuvel wrote:
> Update the allocation logic for the virtual mapping of the UEFI runtime
> services to start from a randomized base address if KASLR is in effect,
> and if the UEFI firmware exposes an implementation of EFI_RNG_PROTOCOL.
>
> This makes it more difficult to predict the location of exploitable
> data structures in the runtime UEFI firmware, which increases robustness
> against attacks. Note that these regions are only mapped during the
> time a runtime service call is in progress, and only on a single CPU
> at a time, bit give the lack of a downside, let's enable it nonetheless.
With next-20170407 on Seattle Overdrive, I get an SError[0] on boot:
The three patches I have on top of 4.11.0-rc5-next-20170407 are:
* Revert "efi/libstub/arm*: Set default address and size cells values for an
empty dtb"
* Revert "ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
At which point the machine start booting to a prompt again, (its noisier than
usual but looks like double-printing).
If I then cherry-pick:
* ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region"
It again fails, producing the trace below. This is all with next-20170407's
defconfig, 4K/48. UEFI identifies itself as:
> UEFI v2.40 (American Megatrends, 0x0005000B)
Thanks,
James
[0]
Shell> efi\morse\Image console=ttyAMA0,115200 root=PARTUUID=b2edf709-3b28-4cb3-8
809-203f262e2bcc rw earlycon=pl011,0xe1010000 crashkernel=1G stacktrace ignore_l
oglevel=1 acpi=on efi=debug resume=/dev/sda3
EFI stub: Booting Linux Kernel...
EFI stub: Using DTB from configuration table
EFI stub: Exiting boot services and installing virtual address map...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.11.0-rc5-next-20170407-00003-gbe65d54f8671 (morse
@melchizedek) (gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11) ) #7
401 SMP PREEMPT Fri Apr 7 16:19:28 BST 2017
[ 0.000000] Boot CPU: AArch64 Processor [411fd072]
[ 0.000000] earlycon: pl11 at MMIO 0x00000000e1010000 (options '')
[ 0.000000] bootconsole [pl11] enabled
[ 0.000000] debug: ignoring loglevel setting.
[ 0.000000] Bad mode in Error handler detected on CPU0, code 0xbf000000 -- SError
[ 0.000000] Internal error: Oops - bad mode: 0 [#1] PREEMPT SMP
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.11.0-rc5-next-20170407-
00003-gbe65d54f8671 #7401
[ 0.000000] Hardware name: AMD Seattle (Rev.B0) Development Board (Overdrive)
(DT)
[ 0.000000] task: ffff000008e02b80 task.stack: ffff000008df0000
[ 0.000000] PC is at setup_arch+0xf0/0x504
[ 0.000000] LR is at setup_arch+0xec/0x504
[ 0.000000] pc : [<ffff000008ce2844>] lr : [<ffff000008ce2840>] pstate: 000000c5
[ 0.000000] Call trace:
[ 0.000000] [<ffff000008ce2844>] setup_arch+0xf0/0x504
[ 0.000000] [<ffff000008ce0838>] start_kernel+0x70/0x398
[ 0.000000] [<ffff000008ce01e0>] __primary_switched+0x64/0x74
[ 0.000000] Code: 9111c000 940034d9 97fff7cd d50344ff (90fffce3)
[ 0.000000] ---[ end trace 0000000000000000 ]---
[ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
next prev parent reply other threads:[~2017-04-07 15:47 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-24 13:24 [kernel-hardening] [PATCH 0/4] efi: libstub enhancements for cmdline parsing and kaslr Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` [kernel-hardening] [PATCH 1/4] efi/libstub: fix harmless command line parsing bug Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` [kernel-hardening] [PATCH 2/4] efi/libstub: unify command line param parsing Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` [kernel-hardening] [PATCH 3/4] efi/libstub: arm/arm64: disable debug prints on 'quiet' cmdline arg Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 14:15 ` [kernel-hardening] " Mark Rutland
2017-03-24 14:15 ` Mark Rutland
2017-03-24 14:15 ` Mark Rutland
2017-03-24 13:24 ` [kernel-hardening] [PATCH 4/4] ef/libstub: arm/arm64: randomize the base of the UEFI rt services region Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-03-24 13:24 ` Ard Biesheuvel
2017-04-07 15:47 ` James Morse [this message]
2017-04-07 15:47 ` James Morse
2017-04-07 15:47 ` James Morse
2017-04-07 15:51 ` [kernel-hardening] " Ard Biesheuvel
2017-04-07 15:51 ` Ard Biesheuvel
2017-04-07 15:51 ` Ard Biesheuvel
2017-04-07 16:11 ` [kernel-hardening] " James Morse
2017-04-07 16:11 ` James Morse
2017-04-07 16:11 ` James Morse
2017-04-10 9:41 ` [kernel-hardening] " Mark Rutland
2017-04-10 9:41 ` Mark Rutland
2017-04-10 9:41 ` Mark Rutland
2017-04-10 9:44 ` [kernel-hardening] " Ard Biesheuvel
2017-04-10 9:44 ` Ard Biesheuvel
2017-04-10 9:44 ` Ard Biesheuvel
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=58E7B478.6010305@arm.com \
--to=james.morse@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@alien8.de \
--cc=kernel-hardening@lists.openwall.com \
--cc=leif.lindholm@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@kernel.org \
--cc=rfranz@cavium.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.