From: Greg Kroah-Hartman Date: Wed, 27 Oct 2021 16:20:57 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v4.4.291~44 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f5142f54e076c6fdd631d2772a5bf38c6d686a4;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: powerpc-bpf-fix-bpf_mod-when-imm-1.patch --- diff --git a/queue-5.4/powerpc-bpf-fix-bpf_mod-when-imm-1.patch b/queue-5.4/powerpc-bpf-fix-bpf_mod-when-imm-1.patch new file mode 100644 index 00000000000..df7cec5b98c --- /dev/null +++ b/queue-5.4/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 +@@ -408,8 +408,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-5.4/series b/queue-5.4/series index 8929742951c..eb2d01d1570 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -2,3 +2,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 arm-9141-1-only-warn-about-xip-address-when-not-compile-testing.patch +powerpc-bpf-fix-bpf_mod-when-imm-1.patch