linux/arch/s390
Josh Poimboeuf b0d4993c4b s390: fix nospec table alignments
commit c9305b6c1f upstream.

Add proper alignment for .nospec_call_table and .nospec_return_table in
vmlinux.

[hca@linux.ibm.com]: The problem with the missing alignment of the nospec
tables exist since a long time, however only since commit e6ed91fd07
("s390/alternatives: remove padding generation code") and with
CONFIG_RELOCATABLE=n the kernel may also crash at boot time.

The above named commit reduced the size of struct alt_instr by one byte,
so its new size is 11 bytes. Therefore depending on the number of cpu
alternatives the size of the __alt_instructions array maybe odd, which
again also causes that the addresses of the nospec tables will be odd.

If the address of __nospec_call_start is odd and the kernel is compiled
With CONFIG_RELOCATABLE=n the compiler may generate code that loads the
address of __nospec_call_start with a 'larl' instruction.

This will generate incorrect code since the 'larl' instruction only works
with even addresses. In result the members of the nospec tables will be
accessed with an off-by-one offset, which subsequently may lead to
addressing exceptions within __nospec_revert().

Fixes: f19fbd5ed6 ("s390: introduce execute-trampolines for branches")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org
Cc: <stable@vger.kernel.org> # 4.16
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-08 11:11:40 +02:00
..
appldata
boot s390/boot: fix use of expolines in the DMA code 2021-07-28 14:35:42 +02:00
configs
crypto s390/archrandom: simplify back to earlier design and initialize earlier 2022-07-07 17:52:16 +02:00
hypfs s390/hypfs: avoid error message under KVM 2022-09-05 10:28:57 +02:00
include s390/hugetlb: fix prepare_hugepage_range() check for 2 GB hugepages 2022-09-08 11:11:39 +02:00
kernel s390: fix nospec table alignments 2022-09-08 11:11:40 +02:00
kvm KVM: s390: pv: leak the topmost page table when destroy fails 2022-08-21 15:15:58 +02:00
lib s390/test_unwind: use raw opcode instead of invalid instruction 2021-12-17 10:14:39 +01:00
mm s390/mm: do not trigger write fault when vma does not allow VM_WRITE 2022-09-05 10:28:55 +02:00
net bpf, s390: Fix potential memory leak about jit_data 2021-10-13 10:04:29 +02:00
oprofile
pci s390/pci: improve zpci_dev reference counting 2022-05-25 09:17:53 +02:00
purgatory
tools
Kbuild
Kconfig s390: remove unneeded 'select BUILD_BIN2C' 2022-07-07 17:52:18 +02:00
Kconfig.debug
Makefile s390: disable -Warray-bounds 2022-05-18 10:23:45 +02:00