Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
f474473
mm: introduce new 'lock_mm_and_find_vma()' page fault helper
torvalds Jul 5, 2023
7924413
mm: make the page fault mmap locking killable
torvalds Jul 5, 2023
7e26ec1
arm64/mm: Convert to using lock_mm_and_find_vma()
torvalds Jul 5, 2023
5fbb213
powerpc/mm: Convert to using lock_mm_and_find_vma()
mpe Jul 5, 2023
3fe51b9
mips/mm: Convert to using lock_mm_and_find_vma()
bwhacks Jul 5, 2023
8218035
riscv/mm: Convert to using lock_mm_and_find_vma()
bwhacks Jul 5, 2023
321e50a
arm/mm: Convert to using lock_mm_and_find_vma()
bwhacks Jul 5, 2023
c62c554
mm/fault: convert remaining simple cases to lock_mm_and_find_vma()
torvalds Jul 5, 2023
f0dc8c1
powerpc/mm: convert coprocessor fault to lock_mm_and_find_vma()
torvalds Jul 5, 2023
543c62e
mm: make find_extend_vma() fail if write lock not held
howlett Jul 5, 2023
9dc4f0c
execve: expand new process stack manually ahead of time
torvalds Jul 5, 2023
c31ab58
mm: always expand the stack with the mmap write lock held
torvalds Jul 5, 2023
8e19887
UBUNTU: [CONFIG]: Set CONFIG_LOCK_MM_AND_FIND_VMA
Jul 5, 2023
82b71b5
ipvlan:Fix out-of-bounds caused by unclear skb->cb
Jul 3, 2023
b4b1353
netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE
ummakynes Jul 3, 2023
a6d885c
io_uring/poll: serialize poll linked timer start with poll removal
axboe Jul 4, 2023
b3e4c1f
netfilter: nf_tables: do not ignore genmask when looking up chain by id
Jul 6, 2023
3684c40
netfilter: nf_tables: prevent OOB access in nft_byteorder_eval
Jul 6, 2023
74e9631
Revert "UBUNTU: SAUCE: overlayfs: handle idmapped mounts in ovl_do_(s…
Jul 6, 2023
82ccf6e
Revert "UBUNTU: SAUCE: overlayfs: Skip permission checking for truste…
Jul 6, 2023
a3adfc5
UBUNTU: SAUCE: overlayfs: default to userxattr when mounted from non …
Jul 6, 2023
95e258e
UBUNTU: Start new release
Jul 10, 2023
91e7a05
UBUNTU: link-to-tracker: update tracking bug
Jul 10, 2023
112efaa
UBUNTU: Ubuntu-6.2.0-26.26
Jul 10, 2023
f6e8b32
UBUNTU: [Packaging] initialize linux-hwe-6.2
May 10, 2023
4eeceb2
UBUNTU: [Packaging] update variants
May 10, 2023
73cab9e
UBUNTU: [Packaging] update update.conf
May 10, 2023
329bb97
UBUNTU: [Packaging] import and update copy-files and local-mangle
May 10, 2023
df4c0d4
UBUNTU: [Config] import annotations from master
May 10, 2023
0e7a9aa
UBUNTU: Start new release
May 10, 2023
ba571a3
UBUNTU: link-to-tracker: update tracking bug
May 10, 2023
b8352c4
UBUNTU: Ubuntu-hwe-6.2-6.2.0-21.21~22.04.2
May 10, 2023
d2636ea
UBUNTU: [Packaging] update variants
May 11, 2023
76c6664
UBUNTU: [Packaging] update Ubuntu.md
May 11, 2023
96b7110
Revert "UBUNTU: SAUCE: modpost: support arbitrary symbol length in mo…
May 24, 2023
b97ca58
UBUNTU: Start new release
May 30, 2023
d3f8bee
UBUNTU: link-to-tracker: update tracking bug
May 30, 2023
a30ee6e
UBUNTU: Ubuntu-hwe-6.2-6.2.0-23.23~22.04.1
May 30, 2023
1fcdf5d
UBUNTU: [Packaging] Update local-mangle to override gcc version
LukeNow Jun 27, 2023
6cf737e
UBUNTU: [Packaging] resync update-dkms-versions helper
LukeNow Jun 27, 2023
b8f4215
UBUNTU: [Packaging] update local-mangle to not include rust
LukeNow Jun 27, 2023
477a89f
UBUNTU: [Config] Update annotations after change to gcc-11
LukeNow Jun 27, 2023
57cf380
UBUNTU: Start new release
LukeNow Jun 27, 2023
d6a8bbb
UBUNTU: [Packaging] Replace miscellaneous changelog entries
LukeNow Jun 27, 2023
487b989
UBUNTU: link-to-tracker: update tracking bug
LukeNow Jun 27, 2023
25735ca
UBUNTU: Ubuntu-hwe-6.2-6.2.0-25.25~22.04.1
LukeNow Jun 27, 2023
75402c2
UBUNTU: [Config] Do not override RUST_IS_AVAILABLE
smb49 Jun 28, 2023
60182ca
UBUNTU: Ubuntu-hwe-6.2-6.2.0-25.25~22.04.2
smb49 Jun 28, 2023
00d2a86
UBUNTU: [Packaging] Convert getabis to hwe-6.2
smb49 Jul 13, 2023
f03f6aa
UBUNTU: Start new release
smb49 Jul 13, 2023
34da7e8
UBUNTU: link-to-tracker: update tracking bug
smb49 Jul 13, 2023
cd019c3
UBUNTU: Ubuntu-hwe-6.2-6.2.0-26.26~22.04.1
smb49 Jul 13, 2023
67e4867
UBUNTU: [Packaging] Initialize linux-nvidia-6.2
ianmay81 Apr 6, 2023
ff98aa0
UBUNTU: [Packaging] update variants
ianmay81 May 3, 2023
433818d
UBUNTU: [Packaging] update Ubuntu.md
ianmay81 May 3, 2023
d5d720c
UBUNTU: [Packaging] update update.conf
ianmay81 May 3, 2023
b9d2765
UBUNTU: Start new release
ianmay81 May 3, 2023
ae12e4a
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1002.2~22.04.1
ianmay81 May 3, 2023
a936df7
UBUNTU: [Packaging] fix Vcs-Git url
ianmay81 May 4, 2023
6d989f0
UBUNTU: [Packaging] update helper script
ianmay81 May 31, 2023
294368d
UBUNTU: Start new release
ianmay81 May 31, 2023
e1f7add
UBUNTU: link-to-tracker: update tracking bug
ianmay81 May 31, 2023
a41100a
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1003.3~22.04.1
ianmay81 May 31, 2023
f923fc7
drm/ast: Fix ARM compatibility
jammyaspeed Apr 21, 2023
7ea328c
i2c: tegra: Fix PEC support for SMBUS block read
Apr 27, 2023
e176b58
irqchip/gicv3: Workaround for NVIDIA erratum T241-FABRIC-4
shankerd04 Mar 19, 2023
e155c7b
spi: Add TPM HW flow flag
kkyarlagadda Apr 21, 2023
027b4de
spi: tegra210-quad: Enable TPM wait polling
kkyarlagadda Apr 21, 2023
bc3dfc7
spi: tegra210-quad: set half duplex flag
kkyarlagadda Feb 23, 2023
1aae722
genirq: Use hlist for managing resend handlers
shankerd04 May 19, 2023
1dd4d11
genirq: Encapsulate sparse bitmap handling
shankerd04 May 19, 2023
453cd03
genirq: Use a maple tree for interrupt descriptor management
shankerd04 May 19, 2023
80fa5cb
tpm_tis-spi: Add hardware wait polling
kkyarlagadda Apr 21, 2023
c082383
arm64: kaslr: don't pretend KASLR is enabled if offset < MIN_KIMG_ALIGN
ardbiesheuvel Feb 23, 2023
a8330fe
arm64: module: remove old !KASAN_VMALLOC logic
mrutland-arm May 30, 2023
bb78959
arm64: kasan: remove !KASAN_VMALLOC remnants
mrutland-arm May 30, 2023
de82ede
arm64: kaslr: split kaslr/module initialization
mrutland-arm May 30, 2023
e58db01
arm64: module: move module randomization to module.c
mrutland-arm May 30, 2023
c063645
arm64: module: mandate MODULE_PLTS
mrutland-arm May 30, 2023
4123441
arm64: module: rework module VA range selection
mrutland-arm May 30, 2023
467efa3
UBUNTU: [Packaging] resync getabis
nvidia-bfigg Jun 28, 2023
88be468
UBUNTU: [Packaging] update helper scripts
nvidia-bfigg Jun 28, 2023
395a474
UBUNTU: [Packaging] resync getabis
nvidia-bfigg Jun 29, 2023
71efe9c
UBUNTU: [Packaging] update helper scripts
nvidia-bfigg Jun 29, 2023
d077331
UBUNTU: Start new release
nvidia-bfigg Jun 29, 2023
93c937a
UBUNTU: link-to-tracker: update tracking bug
nvidia-bfigg Jun 29, 2023
efff6c8
UBUNTU: CONFIG: CONFIG_ARM64_MODULE_PLTS added, CC VERSION changed
nvidia-bfigg Jun 30, 2023
023fdda
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1004.4~22.04.1
nvidia-bfigg Jun 30, 2023
0d8ecb1
mm, slab/slub: Ensure kmem_cache_alloc_bulk() is available early
KAGA-KOKO Feb 7, 2023
24a8437
UBUNTU: [Packaging] nvidia-6.2: remove tools-common package
ianmay81 Jul 26, 2023
5b21623
UBUNTU: [Packaging] update variants
ianmay81 Jul 26, 2023
45b2f16
UBUNTU: Start new release
ianmay81 Jul 26, 2023
0dbd431
UBUNTU: link-to-tracker: update tracking bug
ianmay81 Jul 26, 2023
e47e4bb
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1006.6~22.04.2
ianmay81 Jul 26, 2023
8805fa9
NVIDIA: SAUCE: Add NVMe Patches to enable GDS
sourabgupta3 Jul 27, 2023
4a56f18
UBUNTU: [Packaging] resync update-dkms-versions helper
ianmay81 Aug 5, 2023
9e4cf2a
UBUNTU: [Packaging] update variants
ianmay81 Aug 5, 2023
cc4e2f1
UBUNTU: [Packaging] resync getabis
ianmay81 Aug 5, 2023
39ce4b7
UBUNTU: [Packaging] update update.conf
ianmay81 Aug 5, 2023
8e4d794
UBUNTU: Start new release
ianmay81 Aug 5, 2023
d9c90a9
UBUNTU: [Config] nvidia-6.2: update annotations
ianmay81 Aug 5, 2023
4a1033c
NVIDIA: [Config] Overriding CONFIG_PREEMPT_NONE, CONFIG_CPU_FREQ_DEFA…
ianmay81 Aug 5, 2023
0be9aa4
NVIDIA: SAUCE: NFS: Patch NFS driver to support GDS with 6.2 Kernel
sourabgupta3 Jul 19, 2023
41fd5df
UBUNTU: link-to-tracker: update tracking bug
ianmay81 Aug 5, 2023
bc90b12
UBUNTU: debian/dkms-versions -- update from kernel-versions (main/d20…
ianmay81 Aug 5, 2023
3caa68b
UBUNTU: debian/dkms-versions -- add nvidia-fs and mstflint
ianmay81 Aug 5, 2023
fe1cc4b
UBUNTU: [Packaging] add nvidia build depends for nvidia-fs-dkms
ianmay81 Aug 5, 2023
af6a500
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1007.7
ianmay81 Aug 6, 2023
7fbcab8
UBUNTU: Start new release
ianmay81 Aug 7, 2023
358bc2e
UBUNTU: [Packaging] nvidia-6.2: remove nvidia-fs module
ianmay81 Aug 7, 2023
2e959e1
UBUNTU: link-to-tracker: update tracking bug
ianmay81 Aug 7, 2023
f1bcf84
UBUNTU: Ubuntu-nvidia-6.2-6.2.0-1008.8
ianmay81 Aug 7, 2023
bb01e78
NVIDIA: [Config] CONFIG_NR_CPUS=512 for Grace
nvidia-bfigg Aug 9, 2023
bf650bd
NVIDIA: [Config] CONFIG_MTD_SPI_NOR=y for Grace
nvidia-bfigg Aug 9, 2023
5773b77
NVIDIA: SAUCE: iommu/arm-smmu-v3: Allow default substream bypass with…
nicolinc Jun 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Documentation/arm64/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ AArch64 Linux memory layout with 4KB pages + 4 levels (48-bit)::
0000000000000000 0000ffffffffffff 256TB user
ffff000000000000 ffff7fffffffffff 128TB kernel logical memory map
[ffff600000000000 ffff7fffffffffff] 32TB [kasan shadow region]
ffff800000000000 ffff800007ffffff 128MB modules
ffff800008000000 fffffbffefffffff 124TB vmalloc
ffff800000000000 ffff80007fffffff 2GB modules
ffff800080000000 fffffbffefffffff 124TB vmalloc
fffffbfff0000000 fffffbfffdffffff 224MB fixed mappings (top down)
fffffbfffe000000 fffffbfffe7fffff 8MB [guard region]
fffffbfffe800000 fffffbffff7fffff 16MB PCI I/O space
Expand All @@ -50,8 +50,8 @@ AArch64 Linux memory layout with 64KB pages + 3 levels (52-bit with HW support):
0000000000000000 000fffffffffffff 4PB user
fff0000000000000 ffff7fffffffffff ~4PB kernel logical memory map
[fffd800000000000 ffff7fffffffffff] 512TB [kasan shadow region]
ffff800000000000 ffff800007ffffff 128MB modules
ffff800008000000 fffffbffefffffff 124TB vmalloc
ffff800000000000 ffff80007fffffff 2GB modules
ffff800080000000 fffffbffefffffff 124TB vmalloc
fffffbfff0000000 fffffbfffdffffff 224MB fixed mappings (top down)
fffffbfffe000000 fffffbfffe7fffff 8MB [guard region]
fffffbfffe800000 fffffbffff7fffff 16MB PCI I/O space
Expand Down
2 changes: 2 additions & 0 deletions Documentation/arm64/silicon-errata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| NVIDIA | Carmel Core | N/A | NVIDIA_CARMEL_CNP_ERRATUM |
+----------------+-----------------+-----------------+-----------------------------+
| NVIDIA | T241 GICv3/4.x | T241-FABRIC-4 | N/A |
+----------------+-----------------+-----------------+-----------------------------+
+----------------+-----------------+-----------------+-----------------------------+
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
+----------------+-----------------+-----------------+-----------------------------+
Expand Down
10 changes: 5 additions & 5 deletions Ubuntu.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: linux
Version: 6.1.0
Series: 23.04 (lunar)
Name: linux-nvidia-6.2
Version: 6.2.0
Series: 22.04 (jammy)
Description:
This is the source code for the Ubuntu linux kernel for the 23.04 series. This
source tree is used to produce the flavours: generic, generic-64k, generic-lpae.
This is the source code for the Ubuntu linux kernel for the 22.04 series. This
source tree is used to produce the flavours: nvidia, nvidia-64k.
This kernel is configured to support the widest range of desktop, laptop and
server configurations.
1 change: 1 addition & 0 deletions arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ config ALPHA
select GENERIC_SMP_IDLE_THREAD
select HAVE_ARCH_AUDITSYSCALL
select HAVE_MOD_ARCH_SPECIFIC
select LOCK_MM_AND_FIND_VMA
select MODULES_USE_ELF_RELA
select ODD_RT_SIGACTION
select OLD_SIGSUSPEND
Expand Down
13 changes: 3 additions & 10 deletions arch/alpha/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,12 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
flags |= FAULT_FLAG_USER;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
retry:
mmap_read_lock(mm);
vma = find_vma(mm, address);
vma = lock_mm_and_find_vma(mm, address, regs);
if (!vma)
goto bad_area;
if (vma->vm_start <= address)
goto good_area;
if (!(vma->vm_flags & VM_GROWSDOWN))
goto bad_area;
if (expand_stack(vma, address))
goto bad_area;
goto bad_area_nosemaphore;

/* Ok, we have a good vm_area for this memory access, so
we can handle it. */
good_area:
si_code = SEGV_ACCERR;
if (cause < 0) {
if (!(vma->vm_flags & VM_EXEC))
Expand Down Expand Up @@ -189,6 +181,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
bad_area:
mmap_read_unlock(mm);

bad_area_nosemaphore:
if (user_mode(regs))
goto do_sigsegv;

Expand Down
1 change: 1 addition & 0 deletions arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ config ARC
select HAVE_PERF_EVENTS
select HAVE_SYSCALL_TRACEPOINTS
select IRQ_DOMAIN
select LOCK_MM_AND_FIND_VMA
select MODULES_USE_ELF_RELA
select OF
select OF_EARLY_FLATTREE
Expand Down
11 changes: 3 additions & 8 deletions arch/arc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,9 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
retry:
mmap_read_lock(mm);

vma = find_vma(mm, address);
vma = lock_mm_and_find_vma(mm, address, regs);
if (!vma)
goto bad_area;
if (unlikely(address < vma->vm_start)) {
if (!(vma->vm_flags & VM_GROWSDOWN) || expand_stack(vma, address))
goto bad_area;
}
goto bad_area_nosemaphore;

/*
* vm_area is good, now check permissions for this memory access
Expand Down Expand Up @@ -161,6 +155,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
bad_area:
mmap_read_unlock(mm);

bad_area_nosemaphore:
/*
* Major/minor page fault accounting
* (in case of retry we only land here once)
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ config ARM
select HAVE_UID16
select HAVE_VIRT_CPU_ACCOUNTING_GEN
select IRQ_FORCED_THREADING
select LOCK_MM_AND_FIND_VMA
select MODULES_USE_ELF_REL
select NEED_DMA_MAP_STATE
select OF_EARLY_FLATTREE if OF
Expand Down
63 changes: 14 additions & 49 deletions arch/arm/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,37 +232,11 @@ static inline bool is_permission_fault(unsigned int fsr)
return false;
}

static vm_fault_t __kprobes
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int flags,
unsigned long vma_flags, struct pt_regs *regs)
{
struct vm_area_struct *vma = find_vma(mm, addr);
if (unlikely(!vma))
return VM_FAULT_BADMAP;

if (unlikely(vma->vm_start > addr)) {
if (!(vma->vm_flags & VM_GROWSDOWN))
return VM_FAULT_BADMAP;
if (addr < FIRST_USER_ADDRESS)
return VM_FAULT_BADMAP;
if (expand_stack(vma, addr))
return VM_FAULT_BADMAP;
}

/*
* ok, we have a good vm_area for this memory access, check the
* permissions on the VMA allow for the fault which occurred.
*/
if (!(vma->vm_flags & vma_flags))
return VM_FAULT_BADACCESS;

return handle_mm_fault(vma, addr & PAGE_MASK, flags, regs);
}

static int __kprobes
do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
int sig, code;
vm_fault_t fault;
unsigned int flags = FAULT_FLAG_DEFAULT;
Expand Down Expand Up @@ -301,31 +275,21 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);

/*
* As per x86, we may deadlock here. However, since the kernel only
* validly references user space from well defined areas of the code,
* we can bug out early if this is from code which shouldn't.
*/
if (!mmap_read_trylock(mm)) {
if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
goto no_context;
retry:
mmap_read_lock(mm);
} else {
/*
* The above down_read_trylock() might have succeeded in
* which case, we'll have missed the might_sleep() from
* down_read()
*/
might_sleep();
#ifdef CONFIG_DEBUG_VM
if (!user_mode(regs) &&
!search_exception_tables(regs->ARM_pc))
goto no_context;
#endif
vma = lock_mm_and_find_vma(mm, addr, regs);
if (unlikely(!vma)) {
fault = VM_FAULT_BADMAP;
goto bad_area;
}

fault = __do_page_fault(mm, addr, flags, vm_flags, regs);
/*
* ok, we have a good vm_area for this memory access, check the
* permissions on the VMA allow for the fault which occurred.
*/
if (!(vma->vm_flags & vm_flags))
fault = VM_FAULT_BADACCESS;
else
fault = handle_mm_fault(vma, addr & PAGE_MASK, flags, regs);

/* If we need to retry but a fatal signal is pending, handle the
* signal first. We do not need to release the mmap_lock because
Expand Down Expand Up @@ -356,6 +320,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS))))
return 0;

bad_area:
/*
* If we are in kernel mode at this point, we
* have no context to handle this fault with.
Expand Down
29 changes: 4 additions & 25 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ config ARM64
select HAVE_IOREMAP_PROT
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KVM
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
Expand All @@ -214,6 +215,7 @@ config ARM64
select IRQ_DOMAIN
select IRQ_FORCED_THREADING
select KASAN_VMALLOC if KASAN
select LOCK_MM_AND_FIND_VMA
select MODULES_USE_ELF_RELA
select NEED_DMA_MAP_STATE
select NEED_SG_DMA_LENGTH
Expand Down Expand Up @@ -552,7 +554,6 @@ config ARM64_ERRATUM_845719
config ARM64_ERRATUM_843419
bool "Cortex-A53: 843419: A load or store might access an incorrect address"
default y
select ARM64_MODULE_PLTS if MODULES
help
This option links the kernel with '--fix-cortex-a53-843419' and
enables PLT support to replace certain ADRP instructions, which can
Expand Down Expand Up @@ -2065,26 +2066,6 @@ config ARM64_SME
register state capable of holding two dimensional matrix tiles to
enable various matrix operations.

config ARM64_MODULE_PLTS
bool "Use PLTs to allow module memory to spill over into vmalloc area"
depends on MODULES
select HAVE_MOD_ARCH_SPECIFIC
help
Allocate PLTs when loading modules so that jumps and calls whose
targets are too far away for their relative offsets to be encoded
in the instructions themselves can be bounced via veneers in the
module's PLT. This allows modules to be allocated in the generic
vmalloc area after the dedicated module memory area has been
exhausted.

When running with address space randomization (KASLR), the module
region itself may be too far away for ordinary relative jumps and
calls, and so in that case, module PLTs are required and cannot be
disabled.

Specific errata workaround(s) might also force module PLTs to be
enabled (ARM64_ERRATUM_843419).

config ARM64_PSEUDO_NMI
bool "Support for NMI-like interrupts"
select ARM_GIC_V3
Expand Down Expand Up @@ -2125,7 +2106,6 @@ config RELOCATABLE

config RANDOMIZE_BASE
bool "Randomize the address of the kernel image"
select ARM64_MODULE_PLTS if MODULES
select RELOCATABLE
help
Randomizes the virtual address at which the kernel image is
Expand Down Expand Up @@ -2156,9 +2136,8 @@ config RANDOMIZE_MODULE_REGION_FULL
When this option is not set, the module region will be randomized over
a limited range that contains the [_stext, _etext] interval of the
core kernel, so branch relocations are almost always in range unless
ARM64_MODULE_PLTS is enabled and the region is exhausted. In this
particular case of region exhaustion, modules might be able to fall
back to a larger 2GB area.
the region is exhausted. In this particular case of region
exhaustion, modules might be able to fall back to a larger 2GB area.

config CC_HAVE_STACKPROTECTOR_SYSREG
def_bool $(cc-option,-mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=0)
Expand Down
15 changes: 14 additions & 1 deletion arch/arm64/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#define KIMAGE_VADDR (MODULES_END)
#define MODULES_END (MODULES_VADDR + MODULES_VSIZE)
#define MODULES_VADDR (_PAGE_END(VA_BITS_MIN))
#define MODULES_VSIZE (SZ_128M)
#define MODULES_VSIZE (SZ_2G)
#define VMEMMAP_START (-(UL(1) << (VA_BITS - VMEMMAP_SHIFT)))
#define VMEMMAP_END (VMEMMAP_START + VMEMMAP_SIZE)
#define PCI_IO_END (VMEMMAP_START - SZ_8M)
Expand Down Expand Up @@ -180,6 +180,7 @@
#include <linux/compiler.h>
#include <linux/mmdebug.h>
#include <linux/types.h>
#include <asm/boot.h>
#include <asm/bug.h>

#if VA_BITS > 48
Expand All @@ -203,6 +204,18 @@ static inline unsigned long kaslr_offset(void)
return kimage_vaddr - KIMAGE_VADDR;
}

#ifdef CONFIG_RANDOMIZE_BASE
void kaslr_init(void);
static inline bool kaslr_enabled(void)
{
extern bool __kaslr_is_enabled;
return __kaslr_is_enabled;
}
#else
static inline void kaslr_init(void) { }
static inline bool kaslr_enabled(void) { return false; }
#endif

/*
* Allow all memory at the discovery stage. We will clip it later.
*/
Expand Down
8 changes: 0 additions & 8 deletions arch/arm64/include/asm/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <asm-generic/module.h>

#ifdef CONFIG_ARM64_MODULE_PLTS
struct mod_plt_sec {
int plt_shndx;
int plt_num_entries;
Expand All @@ -21,7 +20,6 @@ struct mod_arch_specific {
/* for CONFIG_DYNAMIC_FTRACE */
struct plt_entry *ftrace_trampolines;
};
#endif

u64 module_emit_plt_entry(struct module *mod, Elf64_Shdr *sechdrs,
void *loc, const Elf64_Rela *rela,
Expand All @@ -30,12 +28,6 @@ u64 module_emit_plt_entry(struct module *mod, Elf64_Shdr *sechdrs,
u64 module_emit_veneer_for_adrp(struct module *mod, Elf64_Shdr *sechdrs,
void *loc, u64 val);

#ifdef CONFIG_RANDOMIZE_BASE
extern u64 module_alloc_base;
#else
#define module_alloc_base ((u64)_etext - MODULES_VSIZE)
#endif

struct plt_entry {
/*
* A program that conforms to the AArch64 Procedure Call Standard
Expand Down
2 changes: 0 additions & 2 deletions arch/arm64/include/asm/module.lds.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
SECTIONS {
#ifdef CONFIG_ARM64_MODULE_PLTS
.plt 0 : { BYTE(0) }
.init.plt 0 : { BYTE(0) }
.text.ftrace_trampoline 0 : { BYTE(0) }
#endif

#ifdef CONFIG_KASAN_SW_TAGS
/*
Expand Down
3 changes: 1 addition & 2 deletions arch/arm64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ obj-$(CONFIG_COMPAT) += sigreturn32.o
obj-$(CONFIG_COMPAT_ALIGNMENT_FIXUPS) += compat_alignment.o
obj-$(CONFIG_KUSER_HELPERS) += kuser32.o
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o entry-ftrace.o
obj-$(CONFIG_MODULES) += module.o
obj-$(CONFIG_ARM64_MODULE_PLTS) += module-plts.o
obj-$(CONFIG_MODULES) += module.o module-plts.o
obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o
obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/cpufeature.c
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,7 @@ bool kaslr_requires_kpti(void)
return false;
}

return kaslr_offset() > 0;
return kaslr_enabled();
}

static bool __meltdown_safe = true;
Expand Down
Loading