Comment 0 for bug 1797139

Revision history for this message
Paolo Pisati (p-pisati) wrote :

Impact:

Upon boot on a recent bionic or cosmic kernel:

...
[ 0.049776] WARNING: CPU: 0 PID: 1 at arch/arm64/kernel/setup.c:271 reserve_memblock_reserved_regions+0xe0/0x148
[ 0.049783] Modules linked in:
[ 0.049797] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.18.0-8-snapdragon #9
[ 0.049803] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 0.049813] pstate: 80400005 (Nzcv daif +PAN -UAO)
[ 0.049821] pc : reserve_memblock_reserved_regions+0xe0/0x148
[ 0.049829] lr : reserve_memblock_reserved_regions+0xd8/0x148
[ 0.049836] sp : ffff000008033d40
[ 0.049841] x29: ffff000008033d40 x28: 0000000000000000
[ 0.049852] x27: ffff000009410584 x26: ffff000009577018
[ 0.049863] x25: 0000000000000000 x24: 0000000000488020
[ 0.049874] x23: 00000000bfffffff x22: ffff0000090e8928
[ 0.049885] x21: ffff000008ffb578 x20: ffff000009a48708
[ 0.049896] x19: ffff80003a409280 x18: 0000000000000000
[ 0.049906] x17: 0000000000000000 x16: 0000000000000000
[ 0.049917] x15: ffffffffffffffff x14: ffff000009a48708
[ 0.049927] x13: 0000000000000000 x12: 0000000000000028
[ 0.049938] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f
[ 0.049949] x9 : 0000000000000000 x8 : ffff80003a409300
[ 0.049959] x7 : 0000000000000000 x6 : 000000000000003f
[ 0.049969] x5 : 0000000000000040 x4 : ffff80003d9ffc70
[ 0.049980] x3 : 00000000bd9fffff x2 : ffff000009c241b0
[ 0.049990] x1 : 0000000000000000 x0 : 0000000000000000
[ 0.050001] Call trace:
[ 0.050010] reserve_memblock_reserved_regions+0xe0/0x148
[ 0.050021] do_one_initcall+0x54/0x1e0
[ 0.050031] kernel_init_freeable+0x254/0x2f8
[ 0.050043] kernel_init+0x18/0x110
[ 0.050052] ret_from_fork+0x10/0x18
[ 0.050063] ---[ end trace dc768b294fafe4aa ]---
...

commit 50d7ba36b916 upstream ("arm64: export memblock_reserve()d regions via
/proc/iomem") backported in commit 62289841 in bionic/master, wrongly assumed that memblock_reserve() would not be used to reserve regions that aren't memory. It turns out, this is exactly what early_init_dt_reserve_memory_arch() will do if it finds a reservation
that was also carved out of the memory node.

Fix:

Apply the attached patch and recompile

The fix wad discussed here: https://www.spinics.net/lists/arm-kernel/msg675580.html

How to test:

Boot the patched kernel and check for the above WARNING in dmesg

Regression potential:

The patch didn't make it upstream yet, but the fix is very small and was tested on the lkml.

Proposing for Bionic and Cosmic.