Skip to content

arm64: module: improve module VA range selection

Mark Rutland linux-arm-kernel 1 version Applied

Status from this message: Applied to arm64 (for-next/module-alloc), thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest6 patches 2 repliesApplied

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/6arm64: module: remove old !KASAN_VMALLOC logicarch/arm64/kernel/kaslr.c arch/arm64/kernel/module.c+3 -300 replies
2/6arm64: kasan: remove !KASAN_VMALLOC remnantsarch/arm64/mm/kasan_init.c+4 -130 replies
3/6arm64: kaslr: split kaslr/module initializationarch/arm64/include/asm/memory.h arch/arm64/kernel/kaslr.c arch/arm64/kernel/setup.c+35 -200 replies
4/6arm64: module: move module randomization to module.carch/arm64/include/asm/module.h arch/arm64/kernel/kaslr.c arch/arm64/kernel/module.c+50 -640 replies
5/6arm64: module: mandate MODULE_PLTSarch/arm64/Kconfig arch/arm64/include/asm/module.h arch/arm64/include/asm/module.lds.h +3 more+19 -490 replies
6/6arm64: module: rework module VA range selectionDocumentation/arm64/memory.rst arch/arm64/include/asm/memory.h arch/arm64/kernel/module.c+99 -500 replies

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchAlexander PotapenkoArd BiesheuvelShanker Donthineni
SeriesT-b
1/6R-b
2/6R-b R-b
3/6R-b
4/6R-b
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/6] arm64: module: improve module VA range selection

This series (based on v6.4-rc3) aims to make arm64's module allocation code more robust. To that end:

* Redundant code for KASAN && !KASAN_VMALLOC is removed, as this combination is no longer possible.

* Module PLT support is mandated, always allowing for the use of a 2G module region. Practically speaking, this is already the case for almost all users as module PLT support is mandated by both KASLR (which most distros including Android, enable this), and by the workaround for ARM erratum 843419 (required by Cortex-A53).

* The module VA region selection is moved to module.c, making it self-contained and easier to follow.

* The default module VA region is expanded to 2G. This ensures that there is sufficient space for the full region using PLTs even when KASLR is disabled or no seed provided.

* The module VA range init code is updated to log when the kernel is too large to support the use of a 128M or 2G module region, to enable debugging of these cases. Contemporary kernels built with debug options can be bigger than 128M, and a kernel bigger than 2G is unlikely but theoretically possible. Adding this logging should help to debug or filter away reports for such cases.

This should allow for loading of very large modules, as Shanker reported was an issue:

https://lore.kernel.org/linux-arm-kernel/[email protected]/
https://lore.kernel.org/linux-arm-kernel/[email protected]/

... and as Ard had an alternative series for:

https://lore.kernel.org/linux-arm-kernel/[email protected]/

Since v1 [1]:
* Log the number of pages in range
* Remove unused kasan_mod_shadow_end
* Only randomize when kaslr_enabled()
* Simplify control-flow

Since v2 [2]:
* Apply Ard's Reviewed-by tags
* Fix typos
* Rebave to v6.4-rc3 (trivial)

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
[2] https://lore.kernel.org/linux-arm-kernel/[email protected]/

Thanks,
Mark.

Mark Rutland (6):
arm64: module: remove old !KASAN_VMALLOC logic
arm64: kasan: remove !KASAN_VMALLOC remnants
arm64: kaslr: split kaslr/module initialization
arm64: module: move module randomization to module.c
arm64: module: mandate MODULE_PLTS
arm64: module: rework module VA range selection

 Documentation/arm64/memory.rst      |   8 +-
 arch/arm64/Kconfig                  |  28 +----
 arch/arm64/include/asm/memory.h     |  16 +--
 arch/arm64/include/asm/module.h     |   8 --
 arch/arm64/include/asm/module.lds.h |   2 -
 arch/arm64/kernel/Makefile          |   3 +-
 arch/arm64/kernel/ftrace.c          |   8 +-
 arch/arm64/kernel/kaslr.c           |  83 +++------------
 arch/arm64/kernel/module.c          | 159 +++++++++++++++++++++-------
 arch/arm64/kernel/setup.c           |   2 +
 arch/arm64/mm/kasan_init.c          |  17 +--
 11 files changed, 159 insertions(+), 175 deletions(-)
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel