From: Greg Kroah-Hartman Date: Wed, 27 Oct 2021 16:20:28 +0000 (+0200) Subject: 4.14-stable patches X-Git-Tag: v4.4.291~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f58b6ba6335ce3cfea9aaffb87c0b34b2286d01a;p=thirdparty%2Fkernel%2Fstable-queue.git 4.14-stable patches added patches: powerpc-bpf-fix-bpf_mod-when-imm-1.patch --- diff --git a/queue-4.14/powerpc-bpf-fix-bpf_mod-when-imm-1.patch b/queue-4.14/powerpc-bpf-fix-bpf_mod-when-imm-1.patch new file mode 100644 index 00000000000..1e1f42bd6d6 --- /dev/null +++ b/queue-4.14/powerpc-bpf-fix-bpf_mod-when-imm-1.patch @@ -0,0 +1,45 @@ +From 8bbc9d822421d9ac8ff9ed26a3713c9afc69d6c8 Mon Sep 17 00:00:00 2001 +From: "Naveen N. Rao" +Date: Wed, 6 Oct 2021 01:55:22 +0530 +Subject: powerpc/bpf: Fix BPF_MOD when imm == 1 + +From: Naveen N. Rao + +commit 8bbc9d822421d9ac8ff9ed26a3713c9afc69d6c8 upstream. + +Only ignore the operation if dividing by 1. + +Fixes: 156d0e290e969c ("powerpc/ebpf/jit: Implement JIT compiler for extended BPF") +Signed-off-by: Naveen N. Rao +Tested-by: Johan Almbladh +Reviewed-by: Christophe Leroy +Acked-by: Song Liu +Acked-by: Johan Almbladh +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/c674ca18c3046885602caebb326213731c675d06.1633464148.git.naveen.n.rao@linux.vnet.ibm.com +[cascardo: use PPC_LI instead of EMIT(PPC_RAW_LI)] +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Greg Kroah-Hartman +--- + arch/powerpc/net/bpf_jit_comp64.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/net/bpf_jit_comp64.c ++++ b/arch/powerpc/net/bpf_jit_comp64.c +@@ -426,8 +426,14 @@ static int bpf_jit_build_body(struct bpf + case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */ + if (imm == 0) + return -EINVAL; +- else if (imm == 1) +- goto bpf_alu32_trunc; ++ if (imm == 1) { ++ if (BPF_OP(code) == BPF_DIV) { ++ goto bpf_alu32_trunc; ++ } else { ++ PPC_LI(dst_reg, 0); ++ break; ++ } ++ } + + PPC_LI32(b2p[TMP_REG_1], imm); + switch (BPF_CLASS(code)) { diff --git a/queue-4.14/series b/queue-4.14/series index c053e8bee06..acaf97e95f3 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1,3 +1,4 @@ arm-9133-1-mm-proc-macros-ensure-_tlb_fns-are-4b-aligned.patch arm-9134-1-remove-duplicate-memcpy-definition.patch arm-9139-1-kprobes-fix-arch_init_kprobes-prototype.patch +powerpc-bpf-fix-bpf_mod-when-imm-1.patch