summaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>2019-03-15 20:21:19 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-03 06:26:21 +0200
commit92d4ee2e82767998f1300e6ac4fc9f95bf860b7c (patch)
tree03c609a3c053b6d63b0b52e75958e86776750de4 /drivers/s390
parent9397f0d9948c466612799899e7205d403b0621ce (diff)
downloadlinux-rpi3-92d4ee2e82767998f1300e6ac4fc9f95bf860b7c.tar.gz
linux-rpi3-92d4ee2e82767998f1300e6ac4fc9f95bf860b7c.tar.bz2
linux-rpi3-92d4ee2e82767998f1300e6ac4fc9f95bf860b7c.zip
powerpc: bpf: Fix generation of load/store DW instructions
commit 86be36f6502c52ddb4b85938145324fd07332da1 upstream. 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: 156d0e290e96 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390')
0 files changed, 0 insertions, 0 deletions