linux-stable/Documentation/arm64
Mark Rutland 3e35d303ab arm64: module: rework module VA range selection
Currently, the modules region is 128M in size, which is a problem for
some large modules. Shanker reports [1] that the NVIDIA GPU driver alone
can consume 110M of module space in some configurations. We'd like to
make the modules region a full 2G such that we can always make use of a
2G range.

It's possible to build kernel images which are larger than 128M in some
configurations, such as when many debug options are selected and many
drivers are built in. In these configurations, we can't legitimately
select a base for a 128M module region, though we currently select a
value for which allocation will fail. It would be nicer to have a
diagnostic message in this case.

Similarly, in theory it's possible to build a kernel image which is
larger than 2G and which cannot support modules. While this isn't likely
to be the case for any realistic kernel deplyed in the field, it would
be nice if we could print a diagnostic in this case.

This patch reworks the module VA range selection to use a 2G range, and
improves handling of cases where we cannot select legitimate module
regions. We now attempt to select a 128M region and a 2G region:

* The 128M region is selected such that modules can use direct branches
  (with JUMP26/CALL26 relocations) to branch to kernel code and other
  modules, and so that modules can reference data and text (using PREL32
  relocations) anywhere in the kernel image and other modules.

  This region covers the entire kernel image (rather than just the text)
  to ensure that all PREL32 relocations are in range even when the
  kernel data section is absurdly large. Where we cannot allocate from
  this region, we'll fall back to the full 2G region.

* The 2G region is selected such that modules can use direct branches
  with PLTs to branch to kernel code and other modules, and so that
  modules can use reference data and text (with PREL32 relocations) in
  the kernel image and other modules.

  This region covers the entire kernel image, and the 128M region (if
  one is selected).

The two module regions are randomized independently while ensuring the
constraints described above.

[1] https://lore.kernel.org/linux-arm-kernel/159ceeab-09af-3174-5058-445bc8dcf85b@nvidia.com/

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Cc: Shanker Donthineni <sdonthineni@nvidia.com>
Cc: Will Deacon <will@kernel.org>
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>
Link: https://lore.kernel.org/r/20230530110328.2213762-7-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2023-06-06 17:39:06 +01:00
..
acpi_object_usage.rst ACPI: Enable FPDT on arm64 2022-11-14 18:02:59 +00:00
amu.rst Documentation: Chinese translation of Documentation/arm64/amu.rst 2020-09-28 15:24:24 -06:00
arm-acpi.rst arm64: Replace HTTP links with HTTPS ones 2020-07-23 14:04:37 -06:00
asymmetric-32bit.rst Documentation: arm64: describe asymmetric 32-bit support 2021-08-20 12:33:07 +02:00
booting.rst Merge branches 'for-next/sysreg', 'for-next/sme', 'for-next/kselftest', 'for-next/misc', 'for-next/sme2', 'for-next/tpidr2', 'for-next/scs', 'for-next/compat-hwcap', 'for-next/ftrace', 'for-next/efi-boot-mmu-on', 'for-next/ptrauth' and 'for-next/pseudo-nmi', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2023-02-10 18:51:49 +00:00
cpu-feature-registers.rst arm64: cpufeature: Fix the visibility of compat hwcaps 2022-11-03 18:04:56 +00:00
elf_hwcaps.rst Merge branches 'for-next/sysreg', 'for-next/sme', 'for-next/kselftest', 'for-next/misc', 'for-next/sme2', 'for-next/tpidr2', 'for-next/scs', 'for-next/compat-hwcap', 'for-next/ftrace', 'for-next/efi-boot-mmu-on', 'for-next/ptrauth' and 'for-next/pseudo-nmi', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2023-02-10 18:51:49 +00:00
features.rst docs: archis: add a per-architecture features list 2020-12-03 15:10:15 -07:00
hugetlbpage.rst Documentation: Chinese translation of Documentation/arm64/hugetlbpage.rst 2020-10-21 15:15:17 -06:00
index.rst arm64/sme: Provide ABI documentation for SME 2022-04-22 18:50:39 +01:00
kasan-offsets.sh arm64: mm: extend linear region for 52-bit VA configurations 2020-11-09 17:15:37 +00:00
legacy_instructions.rst docs: arm64: convert docs to ReST and rename to .rst 2019-06-14 14:20:27 -06:00
memory-tagging-extension.rst elf: Fix the arm64 MTE ELF segment name and value 2022-04-28 11:37:06 +01:00
memory.rst arm64: module: rework module VA range selection 2023-06-06 17:39:06 +01:00
perf.rst Documentation: arm64: Document PMU counters access from userspace 2021-12-14 11:41:19 +00:00
pointer-authentication.rst arm64: update PAC description for kernel 2021-12-02 10:13:35 +00:00
silicon-errata.rst irqchip/gic-v3: Add Rockchip 3588001 erratum workaround 2023-04-18 17:31:17 +01:00
sme.rst Merge branches 'for-next/sysreg', 'for-next/sme', 'for-next/kselftest', 'for-next/misc', 'for-next/sme2', 'for-next/tpidr2', 'for-next/scs', 'for-next/compat-hwcap', 'for-next/ftrace', 'for-next/efi-boot-mmu-on', 'for-next/ptrauth' and 'for-next/pseudo-nmi', remote-tracking branch 'arm64/for-next/perf' into for-next/core 2023-02-10 18:51:49 +00:00
sve.rst Documentation: arm64: correct spelling 2023-01-31 15:54:54 +00:00
tagged-address-abi.rst docs/arm64: delete a space from tagged-address-abi 2021-12-14 19:01:37 +00:00
tagged-pointers.rst arm64: expose FAR_EL1 tag bits in siginfo 2020-11-23 18:17:39 +00:00