* [GIT PULL 0/1] EFI fix for v5.0
@ 2019-02-02 9:50 Ard Biesheuvel
2019-02-02 9:50 ` [PATCH 1/1] efi/arm64: add a terminator for ptdump marker Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2019-02-02 9:50 UTC (permalink / raw)
To: linux-efi, Ingo Molnar, Thomas Gleixner
Cc: Ard Biesheuvel, linux-kernel, Qian Cai
The following changes since commit 1c7fc5cbc33980acd13d668f1c8f0313d6ae9fd8:
Linux 5.0-rc2 (2019-01-14 10:41:12 +1200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git tags/efi-urgent
for you to fetch changes up to 10faccaef2b72b28961b1917719cf6a39c63f0cb:
efi/arm64: add a terminator for ptdump marker (2019-02-02 10:44:40 +0100)
----------------------------------------------------------------
A single EFI fix for v5.0:
- Fix an out of bounds memory access in the EFI page table dumping routine.
----------------------------------------------------------------
Qian Cai (1):
efi/arm64: add a terminator for ptdump marker
drivers/firmware/efi/arm-runtime.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 1/1] efi/arm64: add a terminator for ptdump marker 2019-02-02 9:50 [GIT PULL 0/1] EFI fix for v5.0 Ard Biesheuvel @ 2019-02-02 9:50 ` Ard Biesheuvel 2019-02-02 10:30 ` [tip:efi/urgent] efi/arm64: Fix debugfs crash by adding " tip-bot for Qian Cai 0 siblings, 1 reply; 3+ messages in thread From: Ard Biesheuvel @ 2019-02-02 9:50 UTC (permalink / raw) To: linux-efi, Ingo Molnar, Thomas Gleixner Cc: Ard Biesheuvel, linux-kernel, Qian Cai From: Qian Cai <cai@lca.pw> Reading efi_page_tables debugfs triggers an out-of-bounds access here, arch/arm64/mm/dump.c: 282 if (addr >= st->marker[1].start_address) { called from, arch/arm64/mm/dump.c: 331 note_page(st, addr, 2, pud_val(pud)); because st->marker++ is is called after "UEFI runtime end" which is the last element in addr_marker[]. Therefore, add a terminator like the one for kernel_page_tables, so it can be skipped to print out non-existent markers. # cat /sys/kernel/debug/efi_page_tables ---[ UEFI runtime start ]--- 0x0000000020000000-0x0000000020010000 64K PTE RW NX SHD AF ... 0x0000000020200000-0x0000000021340000 17664K PTE RW NX SHD AF ... ... 0x0000000021920000-0x0000000021950000 192K PTE RW x SHD AF ... 0x0000000021950000-0x00000000219a0000 320K PTE RW NX SHD AF ... ---[ UEFI runtime end ]--- ---[ (null) ]--- ---[ (null) ]--- [12126.163970] BUG: KASAN: global-out-of-bounds in note_page+0x1f0/0xac0 [12126.170404] Read of size 8 at addr ffff2000123f2ac0 by task read_all/42464 [12126.199520] Call trace: [12126.201972] dump_backtrace+0x0/0x298 [12126.205627] show_stack+0x24/0x30 [12126.208944] dump_stack+0xb0/0xdc [12126.212258] print_address_description+0x64/0x2b0 [12126.216954] kasan_report+0x150/0x1a4 [12126.220610] __asan_report_load8_noabort+0x30/0x3c [12126.225392] note_page+0x1f0/0xac0 [12126.228786] walk_pgd+0xb4/0x244 [12126.232005] ptdump_walk_pgd+0xec/0x140 [12126.235833] ptdump_show+0x40/0x50 [12126.239237] seq_read+0x3f8/0xad0 [12126.242548] full_proxy_read+0x9c/0xc0 [12126.246290] __vfs_read+0xfc/0x4c8 [12126.249684] vfs_read+0xec/0x208 [12126.252904] ksys_read+0xd0/0x15c [12126.256210] __arm64_sys_read+0x84/0x94 [12126.260048] el0_svc_handler+0x258/0x304 [12126.263963] el0_svc+0x8/0xc [12126.266834] [12126.268317] The buggy address belongs to the variable: [12126.273458] __compound_literal.0+0x20/0x800 [12126.277718] [12126.279201] Memory state around the buggy address: [12126.283987] ffff2000123f2980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [12126.291200] ffff2000123f2a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa [12126.298412] >ffff2000123f2a80: fa fa fa fa 00 00 00 00 fa fa fa fa 00 00 00 00 [12126.305624] ^ [12126.310927] ffff2000123f2b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [12126.318140] ffff2000123f2b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 Fixes: 9d80448ac92b ("efi/arm64: Add debugfs node to dump UEFI runtime page tables") Signed-off-by: Qian Cai <cai@lca.pw> [ardb: fix up whitespace] Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- drivers/firmware/efi/arm-runtime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 23ea1ed409d1..352bd2473162 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -37,8 +37,9 @@ extern u64 efi_system_table; static struct ptdump_info efi_ptdump_info = { .mm = &efi_mm, .markers = (struct addr_marker[]){ - { 0, "UEFI runtime start" }, - { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" } + { 0, "UEFI runtime start" }, + { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }, + { -1, NULL } }, .base_addr = 0, }; -- 2.17.1 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:efi/urgent] efi/arm64: Fix debugfs crash by adding a terminator for ptdump marker 2019-02-02 9:50 ` [PATCH 1/1] efi/arm64: add a terminator for ptdump marker Ard Biesheuvel @ 2019-02-02 10:30 ` tip-bot for Qian Cai 0 siblings, 0 replies; 3+ messages in thread From: tip-bot for Qian Cai @ 2019-02-02 10:30 UTC (permalink / raw) To: linux-tip-commits Cc: mingo, torvalds, peterz, tglx, cai, ard.biesheuvel, hpa, linux-kernel Commit-ID: 74c953ca5f6b4d5f1daa1ef34f4317e15c1a2987 Gitweb: https://git.kernel.org/tip/74c953ca5f6b4d5f1daa1ef34f4317e15c1a2987 Author: Qian Cai <cai@lca.pw> AuthorDate: Sat, 2 Feb 2019 10:50:17 +0100 Committer: Ingo Molnar <mingo@kernel.org> CommitDate: Sat, 2 Feb 2019 11:27:29 +0100 efi/arm64: Fix debugfs crash by adding a terminator for ptdump marker When reading 'efi_page_tables' debugfs triggers an out-of-bounds access here: arch/arm64/mm/dump.c: 282 if (addr >= st->marker[1].start_address) { called from: arch/arm64/mm/dump.c: 331 note_page(st, addr, 2, pud_val(pud)); because st->marker++ is is called after "UEFI runtime end" which is the last element in addr_marker[]. Therefore, add a terminator like the one for kernel_page_tables, so it can be skipped to print out non-existent markers. Here's the KASAN bug report: # cat /sys/kernel/debug/efi_page_tables ---[ UEFI runtime start ]--- 0x0000000020000000-0x0000000020010000 64K PTE RW NX SHD AF ... 0x0000000020200000-0x0000000021340000 17664K PTE RW NX SHD AF ... ... 0x0000000021920000-0x0000000021950000 192K PTE RW x SHD AF ... 0x0000000021950000-0x00000000219a0000 320K PTE RW NX SHD AF ... ---[ UEFI runtime end ]--- ---[ (null) ]--- ---[ (null) ]--- BUG: KASAN: global-out-of-bounds in note_page+0x1f0/0xac0 Read of size 8 at addr ffff2000123f2ac0 by task read_all/42464 Call trace: dump_backtrace+0x0/0x298 show_stack+0x24/0x30 dump_stack+0xb0/0xdc print_address_description+0x64/0x2b0 kasan_report+0x150/0x1a4 __asan_report_load8_noabort+0x30/0x3c note_page+0x1f0/0xac0 walk_pgd+0xb4/0x244 ptdump_walk_pgd+0xec/0x140 ptdump_show+0x40/0x50 seq_read+0x3f8/0xad0 full_proxy_read+0x9c/0xc0 __vfs_read+0xfc/0x4c8 vfs_read+0xec/0x208 ksys_read+0xd0/0x15c __arm64_sys_read+0x84/0x94 el0_svc_handler+0x258/0x304 el0_svc+0x8/0xc The buggy address belongs to the variable: __compound_literal.0+0x20/0x800 Memory state around the buggy address: ffff2000123f2980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff2000123f2a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa >ffff2000123f2a80: fa fa fa fa 00 00 00 00 fa fa fa fa 00 00 00 00 ^ ffff2000123f2b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff2000123f2b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 [ ardb: fix up whitespace ] [ mingo: fix up some moar ] Signed-off-by: Qian Cai <cai@lca.pw> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Fixes: 9d80448ac92b ("efi/arm64: Add debugfs node to dump UEFI runtime page tables") Link: http://lkml.kernel.org/r/20190202095017.13799-2-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org> --- drivers/firmware/efi/arm-runtime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 23ea1ed409d1..352bd2473162 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -37,8 +37,9 @@ extern u64 efi_system_table; static struct ptdump_info efi_ptdump_info = { .mm = &efi_mm, .markers = (struct addr_marker[]){ - { 0, "UEFI runtime start" }, - { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" } + { 0, "UEFI runtime start" }, + { DEFAULT_MAP_WINDOW_64, "UEFI runtime end" }, + { -1, NULL } }, .base_addr = 0, }; ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-02-02 10:31 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-02-02 9:50 [GIT PULL 0/1] EFI fix for v5.0 Ard Biesheuvel 2019-02-02 9:50 ` [PATCH 1/1] efi/arm64: add a terminator for ptdump marker Ard Biesheuvel 2019-02-02 10:30 ` [tip:efi/urgent] efi/arm64: Fix debugfs crash by adding " tip-bot for Qian Cai
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