[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1545259460-13376-4-git-send-email-jiong.wang@netronome.com>
Date: Wed, 19 Dec 2018 17:44:10 -0500
From: Jiong Wang <jiong.wang@...ronome.com>
To: ast@...nel.org, daniel@...earbox.net
Cc: netdev@...r.kernel.org, oss-drivers@...ronome.com,
Jiong Wang <jiong.wang@...ronome.com>
Subject: [PATH bpf-next 03/13] bpf: JIT blinds support JMP32
JIT blinds is building eBPF JMP insn directly, and is transforming BPF_K
into BPF_X.
Update the code to be aware of JMP32
Signed-off-by: Jiong Wang <jiong.wang@...ronome.com>
---
kernel/bpf/core.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 33609f3..0252e28 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -902,7 +902,13 @@ static int bpf_jit_blind_insn(const struct bpf_insn *from,
off -= 2;
*to++ = BPF_ALU64_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^ from->imm);
*to++ = BPF_ALU64_IMM(BPF_XOR, BPF_REG_AX, imm_rnd);
- *to++ = BPF_JMP_REG(from->code, from->dst_reg, BPF_REG_AX, off);
+ *to = BPF_JMP_REG(from->code, from->dst_reg, BPF_REG_AX, off);
+ if (from->src_reg)
+ /* NOTE: BPF_K has been transformed into BPF_X,
+ * mark imm instead of src_reg
+ */
+ to->imm |= BPF_JMP_SUBOP_32BIT;
+ to++;
break;
case BPF_LD | BPF_IMM | BPF_DW:
--
2.7.4
Powered by blists - more mailing lists