acrn-kernel/arch
Alexandre Ghiti d2ebb8143b riscv: Fix module_alloc() that did not reset the linear mapping permissions
[ Upstream commit 749b94b08005929bbc636df21a23322733166e35 ]

After unloading a module, we must reset the linear mapping permissions,
see the example below:

Before unloading a module:

0xffffaf809d65d000-0xffffaf809d6dc000    0x000000011d65d000       508K PTE .   ..     ..   D A G . . W R V
0xffffaf809d6dc000-0xffffaf809d6dd000    0x000000011d6dc000         4K PTE .   ..     ..   D A G . . . R V
0xffffaf809d6dd000-0xffffaf809d6e1000    0x000000011d6dd000        16K PTE .   ..     ..   D A G . . W R V
0xffffaf809d6e1000-0xffffaf809d6e7000    0x000000011d6e1000        24K PTE .   ..     ..   D A G . X . R V

After unloading a module:

0xffffaf809d65d000-0xffffaf809d6e1000    0x000000011d65d000       528K PTE .   ..     ..   D A G . . W R V
0xffffaf809d6e1000-0xffffaf809d6e7000    0x000000011d6e1000        24K PTE .   ..     ..   D A G . X W R V

The last mapping is not reset and we end up with WX mappings in the linear
mapping.

So add VM_FLUSH_RESET_PERMS to our module_alloc() definition.

Fixes: 0cff8bff7a ("riscv: avoid the PIC offset of static percpu data in module beyond 2G limits")
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20231213134027.155327-2-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 15:27:45 -08:00
..
alpha
arc ARC: fix spare error 2024-01-20 11:50:08 +01:00
arm ARM: 9330/1: davinci: also select PINCTRL 2024-01-25 15:27:44 -08:00
arm64 KVM: arm64: vgic-its: Avoid potential UAF in LPI translation cache 2024-01-25 15:27:44 -08:00
csky csky: fix arch_jump_label_transform_static override 2024-01-25 15:27:23 -08:00
hexagon
ia64
loongarch LoongArch: Fix and simplify fcsr initialization on execve() 2024-01-25 15:27:43 -08:00
m68k
microblaze
mips mips: Fix incorrect max_low_pfn adjustment 2024-01-25 15:27:45 -08:00
nios2
openrisc
parisc parisc: Fix asm operand number out of range build error in bug table 2023-12-13 18:39:24 +01:00
powerpc powerpc/64s: Increase default stack size to 32KB 2024-01-25 15:27:39 -08:00
riscv riscv: Fix module_alloc() that did not reset the linear mapping permissions 2024-01-25 15:27:45 -08:00
s390 s390/cpumf: support user space events for counting 2024-01-10 17:10:30 +01:00
sh sh: bios: Revive earlyprintk support 2023-11-20 11:52:07 +01:00
sparc sparc32: fix a braino in fault handling in csum_and_copy_..._user() 2023-11-02 09:35:32 +01:00
um
x86 x86/kvm: Do not try to disable kvmclock if it was not enabled 2024-01-25 15:27:44 -08:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-06 14:56:49 +02:00
.gitignore
Kconfig cpu/SMT: Create topology_smt_thread_allowed() 2024-01-10 17:10:26 +01:00