linux_dsm_epyc7002/arch
Naveen N. Rao 86be36f650 powerpc: bpf: Fix generation of load/store DW instructions
Yauheni Kaliuta pointed out that PTR_TO_STACK store/load verifier test
was failing on powerpc64 BE, and rightfully indicated that the PPC_LD()
macro is not masking away the last two bits of the offset per the ISA,
resulting in the generation of 'lwa' instruction instead of the intended
'ld' instruction.

Segher also pointed out that we can't simply mask away the last two bits
as that will result in loading/storing from/to a memory location that
was not intended.

This patch addresses this by using ldx/stdx if the offset is not
word-aligned. We load the offset into a temporary register (TMP_REG_2)
and use that as the index register in a subsequent ldx/stdx. We fix
PPC_LD() macro to mask off the last two bits, but enhance PPC_BPF_LL()
and PPC_BPF_STL() to factor in the offset value and generate the proper
instruction sequence. We also convert all existing users of PPC_LD() and
PPC_STD() to use these macros. All existing uses of these macros have
been audited to ensure that TMP_REG_2 can be clobbered.

Fixes: 156d0e290e ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF")
Cc: stable@vger.kernel.org # v4.9+

Reported-by: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-03-16 01:28:22 +01:00
..
alpha a.out: remove core dumping support 2019-03-05 10:00:35 -08:00
arc ARCv2: don't assume core 0x54 has dual issue 2019-02-21 14:53:36 -08:00
arm ARM: dts: stm32: Add Ethernet support on stm32h7 SOC and activate it for eval and disco boards 2019-03-08 11:48:19 -08:00
arm64 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-03-05 09:09:55 -08:00
c6x arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
csky get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
h8300 get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
hexagon arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
ia64 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2019-03-05 08:26:13 -08:00
m68k m68k updates for v5.1 2019-03-05 11:02:12 -08:00
microblaze get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
mips Here's the main MIPS pull request for v5.1: 2019-03-05 11:28:25 -08:00
nds32 get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
nios2 get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
openrisc get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
parisc Merge branch 'parisc-5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux 2019-03-05 11:17:23 -08:00
powerpc powerpc: bpf: Fix generation of load/store DW instructions 2019-03-16 01:28:22 +01:00
riscv Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2019-03-05 08:26:13 -08:00
s390 s390 updates for the 5.1 merge window 2019-03-05 11:13:10 -08:00
sh regulator: Updates for v5.1 2019-03-04 19:20:52 -08:00
sparc Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-03-05 09:09:55 -08:00
um a.out: remove core dumping support 2019-03-05 10:00:35 -08:00
unicore32 arch: unexport asm/shmparam.h for all architectures 2019-02-01 15:46:22 -08:00
x86 x86: Deprecate a.out support 2019-03-05 10:39:38 -08:00
xtensa Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2019-03-05 08:26:13 -08:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-01-06 09:46:51 +09:00