linux-stable/arch
Mark Brown 356e711640 arm64/sme: Set new vector length before reallocating
commit 05d881b85b upstream.

As part of fixing the allocation of the buffer for SVE state when changing
SME vector length we introduced an immediate reallocation of the SVE state,
this is also done when changing the SVE vector length for consistency.
Unfortunately this reallocation is done prior to writing the new vector
length to the task struct, meaning the allocation is done with the old
vector length and can lead to memory corruption due to an undersized buffer
being used.

Move the update of the vector length before the allocation to ensure that
the new vector length is taken into account.

For some reason this isn't triggering any problems when running tests on
the arm64 fixes branch (even after repeated tries) but is triggering
issues very often after merge into mainline.

Fixes: d4d5be94a8 ("arm64/fpsimd: Ensure SME storage is allocated after SVE VL changes")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230726-arm64-fix-sme-fix-v1-1-7752ec58af27@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-03 10:24:16 +02:00
..
alpha mm/fault: convert remaining simple cases to lock_mm_and_find_vma() 2023-07-01 13:16:25 +02:00
arc ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard 2023-07-19 16:21:42 +02:00
arm ARM: orion5x: fix d2net gpio initialization 2023-07-19 16:22:14 +02:00
arm64 arm64/sme: Set new vector length before reallocating 2023-08-03 10:24:16 +02:00
csky csky: fix up lock_mm_and_find_vma() conversion 2023-07-01 13:16:27 +02:00
hexagon mm/fault: convert remaining simple cases to lock_mm_and_find_vma() 2023-07-01 13:16:25 +02:00
ia64 mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
loongarch LoongArch: BPF: Enable bpf_probe_read{, str}() on LoongArch 2023-08-03 10:24:16 +02:00
m68k mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
microblaze mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
mips MIPS: Loongson: Fix build error when make modules_install 2023-08-03 10:23:50 +02:00
nios2 mm/fault: convert remaining simple cases to lock_mm_and_find_vma() 2023-07-01 13:16:25 +02:00
openrisc mm: always expand the stack with the mmap write lock held 2023-07-01 13:16:25 +02:00
parisc parisc: fix expand_stack() conversion 2023-07-01 13:16:26 +02:00
powerpc powerpc/pseries/vas: Hold mmap_mutex after mmap lock during window close 2023-08-03 10:23:48 +02:00
riscv riscv: mm: fix truncation warning on RV32 2023-07-23 13:49:26 +02:00
s390 KVM: s390: pv: fix index value of replaced ASCE 2023-08-03 10:23:48 +02:00
sh sh: hd64461: Handle virq offset for offchip IRQ base and HD64461 IRQ 2023-07-19 16:22:18 +02:00
sparc sparc32: fix lock_mm_and_find_vma() conversion 2023-07-01 13:16:26 +02:00
um Revert "um: Use swap() to make code cleaner" 2023-08-03 10:24:15 +02:00
x86 x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks 2023-08-03 10:24:13 +02:00
xtensa xtensa: ISS: fix call to split_if_spec 2023-07-23 13:49:45 +02:00
.gitignore
Kconfig ftrace: Allow WITH_ARGS flavour of graph tracer with shadow call stack 2022-12-31 13:32:45 +01:00