History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Daniel Borkmann says: ==================== pull-request: bpf 2021-07-29 The following pull-request contains BPF updates for your *net* tree. We've added 9 non-merge commits during the last 14 day(s) which contain a total of 20 files changed, 446 insertions(+), 138 deletions(-). The main changes are: 1) Fix UBSAN out-of-bounds splat for showing XDP link fdinfo, from Lorenz Bauer. 2) Fix insufficient Spectre v4 mitigation in BPF runtime, from Daniel Borkmann, Piotr Krysiuk and Benedict Schlueter. 3) Batch of fixes for BPF sockmap found under stress testing, from John Fastabend. ====================

David S. Miller committed 5 years ago

Commit fc16a532 parents 89fb62f 2039f2620 files · +446 −138Browse files

Unified · Split

20 files
  1. arch/arm/net/bpf_jit_32.c +3 −0
  2. arch/arm64/net/bpf_jit_comp.c +13 −0
  3. arch/mips/net/ebpf_jit.c +3 −0
  4. arch/powerpc/net/bpf_jit_comp32.c +6 −0
  5. arch/powerpc/net/bpf_jit_comp64.c +6 −0
  6. arch/riscv/net/bpf_jit_comp32.c +4 −0
  7. arch/riscv/net/bpf_jit_comp64.c +4 −0
  8. arch/s390/net/bpf_jit_comp.c +5 −0
  9. arch/sparc/net/bpf_jit_comp_64.c +3 −0
  10. arch/x86/net/bpf_jit_comp.c +7 −0
  11. arch/x86/net/bpf_jit_comp32.c +6 −0
  12. include/linux/bpf_types.h +1 −0
  13. include/linux/bpf_verifier.h +2 −1
  14. include/linux/filter.h +15 −0
  15. include/linux/skmsg.h +35 −19
  16. kernel/bpf/core.c +18 −1
  17. kernel/bpf/disasm.c +9 −7
  18. kernel/bpf/verifier.c +49 −99
  19. net/core/skmsg.c +28 −11
  20. tools/testing/selftests/bpf/verifier/value_ptr_arith.c +229 −0
arch/arm/net/bpf_jit_32.c+3−0
@@ -1602,6 +1602,9 @@ exit: · 1601 unmodified lines
16021602 rn = arm_bpf_get_reg32(src_lo, tmp2[1], ctx);
16031603 emit_ldx_r(dst, rn, off, ctx, BPF_SIZE(code));
16041604 break;
1605+ /* speculation barrier */
1606+ case BPF_ST | BPF_NOSPEC:
1607+ break;
16051608 /* ST: *(size *)(dst + off) = imm */
16061609 case BPF_ST | BPF_MEM | BPF_W:
16071610 case BPF_ST | BPF_MEM | BPF_H:
arch/arm64/net/bpf_jit_comp.c+13−0
@@ -823,6 +823,19 @@ emit_cond_jmp: · 822 unmodified lines
823823 return ret;
824824 break;
825825
826+ /* speculation barrier */
827+ case BPF_ST | BPF_NOSPEC:
828+ /*
829+ * Nothing required here.
830+ *
831+ * In case of arm64, we rely on the firmware mitigation of
832+ * Speculative Store Bypass as controlled via the ssbd kernel
833+ * parameter. Whenever the mitigation is enabled, it works
834+ * for all of the kernel code with no need to provide any
835+ * additional instructions.
836+ */
837+ break;
838+
826839 /* ST: *(size *)(dst + off) = imm */
827840 case BPF_ST | BPF_MEM | BPF_W:
828841 case BPF_ST | BPF_MEM | BPF_H:
arch/mips/net/ebpf_jit.c+3−0
@@ -1355,6 +1355,9 @@ jeq_common: · 1354 unmodified lines
13551355 }
13561356 break;
13571357
1358+ case BPF_ST | BPF_NOSPEC: /* speculation barrier */
1359+ break;
1360+
13581361 case BPF_ST | BPF_B | BPF_MEM:
13591362 case BPF_ST | BPF_H | BPF_MEM:
13601363 case BPF_ST | BPF_W | BPF_MEM:
arch/powerpc/net/bpf_jit_comp32.c+6−0
@@ -737,6 +737,12 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, struct codegen_context * · 736 unmodified lines
737737 }
738738 break;
739739
740+ /*
741+ * BPF_ST NOSPEC (speculation barrier)
742+ */
743+ case BPF_ST | BPF_NOSPEC:
744+ break;
745+
740746 /*
741747 * BPF_ST(X)
742748 */
arch/powerpc/net/bpf_jit_comp64.c+6−0
@@ -627,6 +627,12 @@ emit_clear: · 626 unmodified lines
627627 }
628628 break;
629629
630+ /*
631+ * BPF_ST NOSPEC (speculation barrier)
632+ */
633+ case BPF_ST | BPF_NOSPEC:
634+ break;
635+
630636 /*
631637 * BPF_ST(X)
632638 */
arch/riscv/net/bpf_jit_comp32.c+4−0
@@ -1251,6 +1251,10 @@ int bpf_jit_emit_insn(const struct bpf_insn *insn, struct rv_jit_context *ctx, · 1250 unmodified lines
12511251 return -1;
12521252 break;
12531253
1254+ /* speculation barrier */
1255+ case BPF_ST | BPF_NOSPEC:
1256+ break;
1257+
12541258 case BPF_ST | BPF_MEM | BPF_B:
12551259 case BPF_ST | BPF_MEM | BPF_H:
12561260 case BPF_ST | BPF_MEM | BPF_W:
arch/riscv/net/bpf_jit_comp64.c+4−0
@@ -939,6 +939,10 @@ out_be: · 938 unmodified lines
939939 emit_ld(rd, 0, RV_REG_T1, ctx);
940940 break;
941941
942+ /* speculation barrier */
943+ case BPF_ST | BPF_NOSPEC:
944+ break;
945+
942946 /* ST: *(size *)(dst + off) = imm */
943947 case BPF_ST | BPF_MEM | BPF_B:
944948 emit_imm(RV_REG_T1, imm, ctx);
arch/s390/net/bpf_jit_comp.c+5−0
@@ -1153,6 +1153,11 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, · 1152 unmodified lines
11531153 break;
11541154 }
11551155 break;
1156+ /*
1157+ * BPF_NOSPEC (speculation barrier)
1158+ */
1159+ case BPF_ST | BPF_NOSPEC:
1160+ break;
11561161 /*
11571162 * BPF_ST(X)
11581163 */
arch/sparc/net/bpf_jit_comp_64.c+3−0
@@ -1287,6 +1287,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) · 1286 unmodified lines
12871287 return 1;
12881288 break;
12891289 }
1290+ /* speculation barrier */
1291+ case BPF_ST | BPF_NOSPEC:
1292+ break;
12901293 /* ST: *(size *)(dst + off) = imm */
12911294 case BPF_ST | BPF_MEM | BPF_W:
12921295 case BPF_ST | BPF_MEM | BPF_H:
arch/x86/net/bpf_jit_comp.c+7−0
@@ -1219,6 +1219,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 1218 unmodified lines
12191219 }
12201220 break;
12211221
1222+ /* speculation barrier */
1223+ case BPF_ST | BPF_NOSPEC:
1224+ if (boot_cpu_has(X86_FEATURE_XMM2))
1225+ /* Emit 'lfence' */
1226+ EMIT3(0x0F, 0xAE, 0xE8);
1227+ break;
1228+
12221229 /* ST: *(u8*)(dst_reg + off) = imm */
12231230 case BPF_ST | BPF_MEM | BPF_B:
12241231 if (is_ereg(dst_reg))
arch/x86/net/bpf_jit_comp32.c+6−0
@@ -1886,6 +1886,12 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, · 1885 unmodified lines
18861886 i++;
18871887 break;
18881888 }
1889+ /* speculation barrier */
1890+ case BPF_ST | BPF_NOSPEC:
1891+ if (boot_cpu_has(X86_FEATURE_XMM2))
1892+ /* Emit 'lfence' */
1893+ EMIT3(0x0F, 0xAE, 0xE8);
1894+ break;
18891895 /* ST: *(u8*)(dst_reg + off) = imm */
18901896 case BPF_ST | BPF_MEM | BPF_H:
18911897 case BPF_ST | BPF_MEM | BPF_B:
include/linux/bpf_types.h+1−0
@@ -134,4 +134,5 @@ BPF_LINK_TYPE(BPF_LINK_TYPE_CGROUP, cgroup) · 133 unmodified lines
134134 BPF_LINK_TYPE(BPF_LINK_TYPE_ITER, iter)
135135 #ifdef CONFIG_NET
136136 BPF_LINK_TYPE(BPF_LINK_TYPE_NETNS, netns)
137+BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp)
137138 #endif
include/linux/bpf_verifier.h+2−1
@@ -340,8 +340,8 @@ struct bpf_insn_aux_data { · 339 unmodified lines
340340 };
341341 u64 map_key_state; /* constant (32 bit) key tracking for maps */
342342 int ctx_field_size; /* the ctx field size for load insn, maybe 0 */
343− int sanitize_stack_off; /* stack slot to be cleared */
344343 u32 seen; /* this insn was processed by the verifier at env->pass_cnt */
344+ bool sanitize_stack_spill; /* subject to Spectre v4 sanitation */
345345 bool zext_dst; /* this insn zero extends dst reg */
346346 u8 alu_state; /* used in combination with alu_limit */
347347
@@ -414,6 +414,7 @@ struct bpf_verifier_env { · 66 unmodified lines
414414 u32 used_map_cnt; /* number of used maps */
415415 u32 used_btf_cnt; /* number of used BTF objects */
416416 u32 id_gen; /* used to generate unique reg IDs */
417+ bool explore_alu_limits;
417418 bool allow_ptr_leaks;
418419 bool allow_uninit_stack;
419420 bool allow_ptr_to_map_access;
include/linux/filter.h+15−0
@@ -73,6 +73,11 @@ struct ctl_table_header; · 72 unmodified lines
7373 /* unused opcode to mark call to interpreter with arguments */
7474 #define BPF_CALL_ARGS 0xe0
7575
76+/* unused opcode to mark speculation barrier for mitigating
77+ * Speculative Store Bypass
78+ */
79+#define BPF_NOSPEC 0xc0
80+
7681 /* As per nm, we expose JITed images as text (code) section for
7782 * kallsyms. That way, tools like perf can find it to match
7883 * addresses.
@@ -390,6 +395,16 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) · 311 unmodified lines
390395 .off = 0, \
391396 .imm = 0 })
392397
398+/* Speculation barrier */
399+
400+#define BPF_ST_NOSPEC() \
401+ ((struct bpf_insn) { \
402+ .code = BPF_ST | BPF_NOSPEC, \
403+ .dst_reg = 0, \
404+ .src_reg = 0, \
405+ .off = 0, \
406+ .imm = 0 })
407+
393408 /* Internal classic blocks for direct assignment */
394409
395410 #define __BPF_STMT(CODE, K) \
include/linux/skmsg.h+35−19
@@ -285,11 +285,45 @@ static inline struct sk_psock *sk_psock(const struct sock *sk) · 284 unmodified lines
285285 return rcu_dereference_sk_user_data(sk);
286286 }
287287
288+static inline void sk_psock_set_state(struct sk_psock *psock,
289+ enum sk_psock_state_bits bit)
290+{
291+ set_bit(bit, &psock->state);
292+}
293+
294+static inline void sk_psock_clear_state(struct sk_psock *psock,
295+ enum sk_psock_state_bits bit)
296+{
297+ clear_bit(bit, &psock->state);
298+}
299+
300+static inline bool sk_psock_test_state(const struct sk_psock *psock,
301+ enum sk_psock_state_bits bit)
302+{
303+ return test_bit(bit, &psock->state);
304+}
305+
306+static inline void sock_drop(struct sock *sk, struct sk_buff *skb)
307+{
308+ sk_drops_add(sk, skb);
309+ kfree_skb(skb);
310+}
311+
312+static inline void drop_sk_msg(struct sk_psock *psock, struct sk_msg *msg)
313+{
314+ if (msg->skb)
315+ sock_drop(psock->sk, msg->skb);
316+ kfree(msg);
317+}
318+
288319 static inline void sk_psock_queue_msg(struct sk_psock *psock,
289320 struct sk_msg *msg)
290321 {
291322 spin_lock_bh(&psock->ingress_lock);
292− list_add_tail(&msg->list, &psock->ingress_msg);
323+ if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED))
324+ list_add_tail(&msg->list, &psock->ingress_msg);
325+ else
326+ drop_sk_msg(psock, msg);
293327 spin_unlock_bh(&psock->ingress_lock);
294328 }
295329
@@ -406,24 +440,6 @@ static inline void sk_psock_restore_proto(struct sock *sk, · 110 unmodified lines
406440 psock->psock_update_sk_prot(sk, psock, true);
407441 }
408442
409−static inline void sk_psock_set_state(struct sk_psock *psock,
410− enum sk_psock_state_bits bit)
411−{
412− set_bit(bit, &psock->state);
413−}
414−
415−static inline void sk_psock_clear_state(struct sk_psock *psock,
416− enum sk_psock_state_bits bit)
417−{
418− clear_bit(bit, &psock->state);
419−}
420−
421−static inline bool sk_psock_test_state(const struct sk_psock *psock,
422− enum sk_psock_state_bits bit)
423−{
424− return test_bit(bit, &psock->state);
425−}
426−
427443 static inline struct sk_psock *sk_psock_get(struct sock *sk)
428444 {
429445 struct sk_psock *psock;
kernel/bpf/core.c+18−1
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232 #include <linux/perf_event.h>
3333 #include <linux/extable.h>
3434 #include <linux/log2.h>
35+
36+#include <asm/barrier.h>
3537 #include <asm/unaligned.h>
3638
3739 /* Registers */
@@ -1377,6 +1379,7 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn) · 1339 unmodified lines
13771379 /* Non-UAPI available opcodes. */
13781380 [BPF_JMP | BPF_CALL_ARGS] = &&JMP_CALL_ARGS,
13791381 [BPF_JMP | BPF_TAIL_CALL] = &&JMP_TAIL_CALL,
1382+ [BPF_ST | BPF_NOSPEC] = &&ST_NOSPEC,
13801383 [BPF_LDX | BPF_PROBE_MEM | BPF_B] = &&LDX_PROBE_MEM_B,
13811384 [BPF_LDX | BPF_PROBE_MEM | BPF_H] = &&LDX_PROBE_MEM_H,
13821385 [BPF_LDX | BPF_PROBE_MEM | BPF_W] = &&LDX_PROBE_MEM_W,
@@ -1621,7 +1624,21 @@ out: · 238 unmodified lines
16211624 COND_JMP(s, JSGE, >=)
16221625 COND_JMP(s, JSLE, <=)
16231626 #undef COND_JMP
1624− /* STX and ST and LDX*/
1627+ /* ST, STX and LDX*/
1628+ ST_NOSPEC:
1629+ /* Speculation barrier for mitigating Speculative Store Bypass.
1630+ * In case of arm64, we rely on the firmware mitigation as
1631+ * controlled via the ssbd kernel parameter. Whenever the
1632+ * mitigation is enabled, it works for all of the kernel code
1633+ * with no need to provide any additional instructions here.
1634+ * In case of x86, we use 'lfence' insn for mitigation. We
1635+ * reuse preexisting logic from Spectre v1 mitigation that
1636+ * happens to produce the required code on x86 for v4 as well.
1637+ */
1638+#ifdef CONFIG_X86
1639+ barrier_nospec();
1640+#endif
1641+ CONT;
16251642 #define LDST(SIZEOP, SIZE) \
16261643 STX_MEM_##SIZEOP: \
16271644 *(SIZE *)(unsigned long) (DST + insn->off) = SRC; \
kernel/bpf/disasm.c+9−7
@@ -206,15 +206,17 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs, · 205 unmodified lines
206206 verbose(cbs->private_data, "BUG_%02x\n", insn->code);
207207 }
208208 } else if (class == BPF_ST) {
209− if (BPF_MODE(insn->code) != BPF_MEM) {
209+ if (BPF_MODE(insn->code) == BPF_MEM) {
210+ verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n",
211+ insn->code,
212+ bpf_ldst_string[BPF_SIZE(insn->code) >> 3],
213+ insn->dst_reg,
214+ insn->off, insn->imm);
215+ } else if (BPF_MODE(insn->code) == 0xc0 /* BPF_NOSPEC, no UAPI */) {
216+ verbose(cbs->private_data, "(%02x) nospec\n", insn->code);
217+ } else {
210218 verbose(cbs->private_data, "BUG_st_%02x\n", insn->code);
211− return;
212219 }
213− verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n",
214− insn->code,
215− bpf_ldst_string[BPF_SIZE(insn->code) >> 3],
216− insn->dst_reg,
217− insn->off, insn->imm);
218220 } else if (class == BPF_LDX) {
219221 if (BPF_MODE(insn->code) != BPF_MEM) {
220222 verbose(cbs->private_data, "BUG_ldx_%02x\n", insn->code);
kernel/bpf/verifier.c+49−99
@@ -2610,6 +2610,19 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env, · 2609 unmodified lines
26102610 cur = env->cur_state->frame[env->cur_state->curframe];
26112611 if (value_regno >= 0)
26122612 reg = &cur->regs[value_regno];
2613+ if (!env->bypass_spec_v4) {
2614+ bool sanitize = reg && is_spillable_regtype(reg->type);
2615+
2616+ for (i = 0; i < size; i++) {
2617+ if (state->stack[spi].slot_type[i] == STACK_INVALID) {
2618+ sanitize = true;
2619+ break;
2620+ }
2621+ }
2622+
2623+ if (sanitize)
2624+ env->insn_aux_data[insn_idx].sanitize_stack_spill = true;
2625+ }
26132626
26142627 if (reg && size == BPF_REG_SIZE && register_is_bounded(reg) &&
26152628 !register_is_null(reg) && env->bpf_capable) {
@@ -2632,47 +2645,10 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env, · 16 unmodified lines
26322645 verbose(env, "invalid size of register spill\n");
26332646 return -EACCES;
26342647 }
2635−
26362648 if (state != cur && reg->type == PTR_TO_STACK) {
26372649 verbose(env, "cannot spill pointers to stack into stack frame of the caller\n");
26382650 return -EINVAL;
26392651 }
2640−
2641− if (!env->bypass_spec_v4) {
2642− bool sanitize = false;
2643−
2644− if (state->stack[spi].slot_type[0] == STACK_SPILL &&
2645− register_is_const(&state->stack[spi].spilled_ptr))
2646− sanitize = true;
2647− for (i = 0; i < BPF_REG_SIZE; i++)
2648− if (state->stack[spi].slot_type[i] == STACK_MISC) {
2649− sanitize = true;
2650− break;
2651− }
2652− if (sanitize) {
2653− int *poff = &env->insn_aux_data[insn_idx].sanitize_stack_off;
2654− int soff = (-spi - 1) * BPF_REG_SIZE;
2655−
2656− /* detected reuse of integer stack slot with a pointer
2657− * which means either llvm is reusing stack slot or
2658− * an attacker is trying to exploit CVE-2018-3639
2659− * (speculative store bypass)
2660− * Have to sanitize that slot with preemptive
2661− * store of zero.
2662− */
2663− if (*poff && *poff != soff) {
2664− /* disallow programs where single insn stores
2665− * into two different stack slots, since verifier
2666− * cannot sanitize them
2667− */
2668− verbose(env,
2669− "insn %d cannot access two stack slots fp%d and fp%d",
2670− insn_idx, *poff, soff);
2671− return -EINVAL;
2672− }
2673− *poff = soff;
2674− }
2675− }
26762652 save_register_state(state, spi, reg);
26772653 } else {
26782654 u8 type = STACK_MISC;
@@ -6561,6 +6537,12 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, · 3882 unmodified lines
65616537 alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0;
65626538 alu_state |= ptr_is_dst_reg ?
65636539 BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST;
6540+
6541+ /* Limit pruning on unknown scalars to enable deep search for
6542+ * potential masking differences from other program paths.
6543+ */
6544+ if (!off_is_imm)
6545+ env->explore_alu_limits = true;
65646546 }
65656547
65666548 err = update_alu_sanitation_state(aux, alu_state, alu_limit);
@@ -9936,8 +9918,8 @@ next: · 3369 unmodified lines
99369918 }
99379919
99389920 /* Returns true if (rold safe implies rcur safe) */
9939−static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur,
9940− struct bpf_id_pair *idmap)
9921+static bool regsafe(struct bpf_verifier_env *env, struct bpf_reg_state *rold,
9922+ struct bpf_reg_state *rcur, struct bpf_id_pair *idmap)
99419923 {
99429924 bool equal;
99439925
@@ -9963,6 +9945,8 @@ static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, · 19 unmodified lines
99639945 return false;
99649946 switch (rold->type) {
99659947 case SCALAR_VALUE:
9948+ if (env->explore_alu_limits)
9949+ return false;
99669950 if (rcur->type == SCALAR_VALUE) {
99679951 if (!rold->precise && !rcur->precise)
99689952 return true;
@@ -10053,9 +10037,8 @@ static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, · 84 unmodified lines
1005310037 return false;
1005410038 }
1005510039
10056−static bool stacksafe(struct bpf_func_state *old,
10057− struct bpf_func_state *cur,
10058− struct bpf_id_pair *idmap)
10040+static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old,
10041+ struct bpf_func_state *cur, struct bpf_id_pair *idmap)
1005910042 {
1006010043 int i, spi;
1006110044
@@ -10100,9 +10083,8 @@ static bool stacksafe(struct bpf_func_state *old, · 38 unmodified lines
1010010083 continue;
1010110084 if (old->stack[spi].slot_type[0] != STACK_SPILL)
1010210085 continue;
10103− if (!regsafe(&old->stack[spi].spilled_ptr,
10104− &cur->stack[spi].spilled_ptr,
10105− idmap))
10086+ if (!regsafe(env, &old->stack[spi].spilled_ptr,
10087+ &cur->stack[spi].spilled_ptr, idmap))
1010610088 /* when explored and current stack slot are both storing
1010710089 * spilled registers, check that stored pointers types
1010810090 * are the same as well.
@@ -10159,10 +10141,11 @@ static bool func_states_equal(struct bpf_verifier_env *env, struct bpf_func_stat · 50 unmodified lines
1015910141
1016010142 memset(env->idmap_scratch, 0, sizeof(env->idmap_scratch));
1016110143 for (i = 0; i < MAX_BPF_REG; i++)
10162− if (!regsafe(&old->regs[i], &cur->regs[i], env->idmap_scratch))
10144+ if (!regsafe(env, &old->regs[i], &cur->regs[i],
10145+ env->idmap_scratch))
1016310146 return false;
1016410147
10165− if (!stacksafe(old, cur, env->idmap_scratch))
10148+ if (!stacksafe(env, old, cur, env->idmap_scratch))
1016610149 return false;
1016710150
1016810151 if (!refsafe(old, cur))
@@ -11906,35 +11889,33 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) · 1737 unmodified lines
1190611889
1190711890 for (i = 0; i < insn_cnt; i++, insn++) {
1190811891 bpf_convert_ctx_access_t convert_ctx_access;
11892+ bool ctx_access;
1190911893
1191011894 if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) ||
1191111895 insn->code == (BPF_LDX | BPF_MEM | BPF_H) ||
1191211896 insn->code == (BPF_LDX | BPF_MEM | BPF_W) ||
11913− insn->code == (BPF_LDX | BPF_MEM | BPF_DW))
11897+ insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) {
1191411898 type = BPF_READ;
11915− else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) ||
11916− insn->code == (BPF_STX | BPF_MEM | BPF_H) ||
11917− insn->code == (BPF_STX | BPF_MEM | BPF_W) ||
11918− insn->code == (BPF_STX | BPF_MEM | BPF_DW))
11899+ ctx_access = true;
11900+ } else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) ||
11901+ insn->code == (BPF_STX | BPF_MEM | BPF_H) ||
11902+ insn->code == (BPF_STX | BPF_MEM | BPF_W) ||
11903+ insn->code == (BPF_STX | BPF_MEM | BPF_DW) ||
11904+ insn->code == (BPF_ST | BPF_MEM | BPF_B) ||
11905+ insn->code == (BPF_ST | BPF_MEM | BPF_H) ||
11906+ insn->code == (BPF_ST | BPF_MEM | BPF_W) ||
11907+ insn->code == (BPF_ST | BPF_MEM | BPF_DW)) {
1191911908 type = BPF_WRITE;
11920− else
11909+ ctx_access = BPF_CLASS(insn->code) == BPF_STX;
11910+ } else {
1192111911 continue;
11912+ }
1192211913
1192311914 if (type == BPF_WRITE &&
11924− env->insn_aux_data[i + delta].sanitize_stack_off) {
11915+ env->insn_aux_data[i + delta].sanitize_stack_spill) {
1192511916 struct bpf_insn patch[] = {
11926− /* Sanitize suspicious stack slot with zero.
11927− * There are no memory dependencies for this store,
11928− * since it's only using frame pointer and immediate
11929− * constant of zero
11930− */
11931− BPF_ST_MEM(BPF_DW, BPF_REG_FP,
11932− env->insn_aux_data[i + delta].sanitize_stack_off,
11933− 0),
11934− /* the original STX instruction will immediately
11935− * overwrite the same stack slot with appropriate value
11936− */
1193711917 *insn,
11918+ BPF_ST_NOSPEC(),
1193811919 };
1193911920
1194011921 cnt = ARRAY_SIZE(patch);
@@ -11948,6 +11929,9 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) · 7 unmodified lines
1194811929 continue;
1194911930 }
1195011931
11932+ if (!ctx_access)
11933+ continue;
11934+
1195111935 switch (env->insn_aux_data[i + delta].ptr_type) {
1195211936 case PTR_TO_CTX:
1195311937 if (!ops->convert_ctx_access)
@@ -12752,37 +12736,6 @@ static void free_states(struct bpf_verifier_env *env) · 798 unmodified lines
1275212736 }
1275312737 }
1275412738
12755−/* The verifier is using insn_aux_data[] to store temporary data during
12756− * verification and to store information for passes that run after the
12757− * verification like dead code sanitization. do_check_common() for subprogram N
12758− * may analyze many other subprograms. sanitize_insn_aux_data() clears all
12759− * temporary data after do_check_common() finds that subprogram N cannot be
12760− * verified independently. pass_cnt counts the number of times
12761− * do_check_common() was run and insn->aux->seen tells the pass number
12762− * insn_aux_data was touched. These variables are compared to clear temporary
12763− * data from failed pass. For testing and experiments do_check_common() can be
12764− * run multiple times even when prior attempt to verify is unsuccessful.
12765− *
12766− * Note that special handling is needed on !env->bypass_spec_v1 if this is
12767− * ever called outside of error path with subsequent program rejection.
12768− */
12769−static void sanitize_insn_aux_data(struct bpf_verifier_env *env)
12770−{
12771− struct bpf_insn *insn = env->prog->insnsi;
12772− struct bpf_insn_aux_data *aux;
12773− int i, class;
12774−
12775− for (i = 0; i < env->prog->len; i++) {
12776− class = BPF_CLASS(insn[i].code);
12777− if (class != BPF_LDX && class != BPF_STX)
12778− continue;
12779− aux = &env->insn_aux_data[i];
12780− if (aux->seen != env->pass_cnt)
12781− continue;
12782− memset(aux, 0, offsetof(typeof(*aux), orig_idx));
12783− }
12784−}
12785−
1278612739 static int do_check_common(struct bpf_verifier_env *env, int subprog)
1278712740 {
1278812741 bool pop_log = !(env->log.level & BPF_LOG_LEVEL2);
@@ -12859,9 +12812,6 @@ out: · 70 unmodified lines
1285912812 if (!ret && pop_log)
1286012813 bpf_vlog_reset(&env->log, 0);
1286112814 free_states(env);
12862− if (ret)
12863− /* clean aux data in case subprog was rejected */
12864− sanitize_insn_aux_data(env);
1286512815 return ret;
1286612816 }
1286712817
net/core/skmsg.c+28−11
@@ -584,29 +584,42 @@ static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *skb, · 583 unmodified lines
584584 return sk_psock_skb_ingress(psock, skb);
585585 }
586586
587−static void sock_drop(struct sock *sk, struct sk_buff *skb)
587+static void sk_psock_skb_state(struct sk_psock *psock,
588+ struct sk_psock_work_state *state,
589+ struct sk_buff *skb,
590+ int len, int off)
588591 {
589− sk_drops_add(sk, skb);
590− kfree_skb(skb);
592+ spin_lock_bh(&psock->ingress_lock);
593+ if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED)) {
594+ state->skb = skb;
595+ state->len = len;
596+ state->off = off;
597+ } else {
598+ sock_drop(psock->sk, skb);
599+ }
600+ spin_unlock_bh(&psock->ingress_lock);
591601 }
592602
593603 static void sk_psock_backlog(struct work_struct *work)
594604 {
595605 struct sk_psock *psock = container_of(work, struct sk_psock, work);
596606 struct sk_psock_work_state *state = &psock->work_state;
597− struct sk_buff *skb;
607+ struct sk_buff *skb = NULL;
598608 bool ingress;
599609 u32 len, off;
600610 int ret;
601611
602612 mutex_lock(&psock->work_mutex);
603− if (state->skb) {
613+ if (unlikely(state->skb)) {
614+ spin_lock_bh(&psock->ingress_lock);
604615 skb = state->skb;
605616 len = state->len;
606617 off = state->off;
607618 state->skb = NULL;
608− goto start;
619+ spin_unlock_bh(&psock->ingress_lock);
609620 }
621+ if (skb)
622+ goto start;
610623
611624 while ((skb = skb_dequeue(&psock->ingress_skb))) {
612625 len = skb->len;
@@ -621,9 +634,8 @@ start: · 8 unmodified lines
621634 len, ingress);
622635 if (ret <= 0) {
623636 if (ret == -EAGAIN) {
624− state->skb = skb;
625− state->len = len;
626− state->off = off;
637+ sk_psock_skb_state(psock, state, skb,
638+ len, off);
627639 goto end;
628640 }
629641 /* Hard errors break pipe and stop xmit. */
@@ -722,6 +734,11 @@ static void __sk_psock_zap_ingress(struct sk_psock *psock) · 92 unmodified lines
722734 skb_bpf_redirect_clear(skb);
723735 sock_drop(psock->sk, skb);
724736 }
737+ kfree_skb(psock->work_state.skb);
738+ /* We null the skb here to ensure that calls to sk_psock_backlog
739+ * do not pick up the free'd skb.
740+ */
741+ psock->work_state.skb = NULL;
725742 __sk_psock_purge_ingress_msg(psock);
726743 }
727744
@@ -773,8 +790,6 @@ static void sk_psock_destroy(struct work_struct *work) · 45 unmodified lines
773790
774791 void sk_psock_drop(struct sock *sk, struct sk_psock *psock)
775792 {
776− sk_psock_stop(psock, false);
777−
778793 write_lock_bh(&sk->sk_callback_lock);
779794 sk_psock_restore_proto(sk, psock);
780795 rcu_assign_sk_user_data(sk, NULL);
@@ -784,6 +799,8 @@ void sk_psock_drop(struct sock *sk, struct sk_psock *psock) · 3 unmodified lines
784799 sk_psock_stop_verdict(sk, psock);
785800 write_unlock_bh(&sk->sk_callback_lock);
786801
802+ sk_psock_stop(psock, false);
803+
787804 INIT_RCU_WORK(&psock->rwork, sk_psock_destroy);
788805 queue_rcu_work(system_wq, &psock->rwork);
789806 }
tools/testing/selftests/bpf/verifier/value_ptr_arith.c+229−0
@@ -1,3 +1,232 @@
1+{
2+ "map access: known scalar += value_ptr unknown vs const",
3+ .insns = {
4+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
5+ offsetof(struct __sk_buff, len)),
6+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
7+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
8+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
9+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
10+ BPF_LD_MAP_FD(BPF_REG_1, 0),
11+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
12+ BPF_LD_MAP_FD(BPF_REG_1, 0),
13+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
14+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
15+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
16+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4),
17+ BPF_MOV64_IMM(BPF_REG_1, 6),
18+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
19+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
20+ BPF_JMP_IMM(BPF_JA, 0, 0, 1),
21+ BPF_MOV64_IMM(BPF_REG_1, 3),
22+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
23+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
24+ BPF_MOV64_IMM(BPF_REG_0, 1),
25+ BPF_EXIT_INSN(),
26+ },
27+ .fixup_map_hash_16b = { 5 },
28+ .fixup_map_array_48b = { 8 },
29+ .result_unpriv = REJECT,
30+ .errstr_unpriv = "R1 tried to add from different maps, paths or scalars",
31+ .result = ACCEPT,
32+ .retval = 1,
33+},
34+{
35+ "map access: known scalar += value_ptr const vs unknown",
36+ .insns = {
37+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
38+ offsetof(struct __sk_buff, len)),
39+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
40+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
41+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
42+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
43+ BPF_LD_MAP_FD(BPF_REG_1, 0),
44+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
45+ BPF_LD_MAP_FD(BPF_REG_1, 0),
46+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
47+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 9),
48+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
49+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2),
50+ BPF_MOV64_IMM(BPF_REG_1, 3),
51+ BPF_JMP_IMM(BPF_JA, 0, 0, 3),
52+ BPF_MOV64_IMM(BPF_REG_1, 6),
53+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
54+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
55+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
56+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
57+ BPF_MOV64_IMM(BPF_REG_0, 1),
58+ BPF_EXIT_INSN(),
59+ },
60+ .fixup_map_hash_16b = { 5 },
61+ .fixup_map_array_48b = { 8 },
62+ .result_unpriv = REJECT,
63+ .errstr_unpriv = "R1 tried to add from different maps, paths or scalars",
64+ .result = ACCEPT,
65+ .retval = 1,
66+},
67+{
68+ "map access: known scalar += value_ptr const vs const (ne)",
69+ .insns = {
70+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
71+ offsetof(struct __sk_buff, len)),
72+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
73+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
74+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
75+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
76+ BPF_LD_MAP_FD(BPF_REG_1, 0),
77+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
78+ BPF_LD_MAP_FD(BPF_REG_1, 0),
79+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
80+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
81+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
82+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2),
83+ BPF_MOV64_IMM(BPF_REG_1, 3),
84+ BPF_JMP_IMM(BPF_JA, 0, 0, 1),
85+ BPF_MOV64_IMM(BPF_REG_1, 5),
86+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
87+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
88+ BPF_MOV64_IMM(BPF_REG_0, 1),
89+ BPF_EXIT_INSN(),
90+ },
91+ .fixup_map_hash_16b = { 5 },
92+ .fixup_map_array_48b = { 8 },
93+ .result_unpriv = REJECT,
94+ .errstr_unpriv = "R1 tried to add from different maps, paths or scalars",
95+ .result = ACCEPT,
96+ .retval = 1,
97+},
98+{
99+ "map access: known scalar += value_ptr const vs const (eq)",
100+ .insns = {
101+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
102+ offsetof(struct __sk_buff, len)),
103+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
104+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
105+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
106+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
107+ BPF_LD_MAP_FD(BPF_REG_1, 0),
108+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
109+ BPF_LD_MAP_FD(BPF_REG_1, 0),
110+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
111+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 7),
112+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
113+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 2),
114+ BPF_MOV64_IMM(BPF_REG_1, 5),
115+ BPF_JMP_IMM(BPF_JA, 0, 0, 1),
116+ BPF_MOV64_IMM(BPF_REG_1, 5),
117+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
118+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
119+ BPF_MOV64_IMM(BPF_REG_0, 1),
120+ BPF_EXIT_INSN(),
121+ },
122+ .fixup_map_hash_16b = { 5 },
123+ .fixup_map_array_48b = { 8 },
124+ .result = ACCEPT,
125+ .retval = 1,
126+},
127+{
128+ "map access: known scalar += value_ptr unknown vs unknown (eq)",
129+ .insns = {
130+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
131+ offsetof(struct __sk_buff, len)),
132+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
133+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
134+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
135+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
136+ BPF_LD_MAP_FD(BPF_REG_1, 0),
137+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
138+ BPF_LD_MAP_FD(BPF_REG_1, 0),
139+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
140+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11),
141+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
142+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4),
143+ BPF_MOV64_IMM(BPF_REG_1, 6),
144+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
145+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
146+ BPF_JMP_IMM(BPF_JA, 0, 0, 3),
147+ BPF_MOV64_IMM(BPF_REG_1, 6),
148+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
149+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
150+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
151+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
152+ BPF_MOV64_IMM(BPF_REG_0, 1),
153+ BPF_EXIT_INSN(),
154+ },
155+ .fixup_map_hash_16b = { 5 },
156+ .fixup_map_array_48b = { 8 },
157+ .result = ACCEPT,
158+ .retval = 1,
159+},
160+{
161+ "map access: known scalar += value_ptr unknown vs unknown (lt)",
162+ .insns = {
163+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
164+ offsetof(struct __sk_buff, len)),
165+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
166+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
167+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
168+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
169+ BPF_LD_MAP_FD(BPF_REG_1, 0),
170+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
171+ BPF_LD_MAP_FD(BPF_REG_1, 0),
172+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
173+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11),
174+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
175+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4),
176+ BPF_MOV64_IMM(BPF_REG_1, 6),
177+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
178+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x3),
179+ BPF_JMP_IMM(BPF_JA, 0, 0, 3),
180+ BPF_MOV64_IMM(BPF_REG_1, 6),
181+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
182+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
183+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
184+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
185+ BPF_MOV64_IMM(BPF_REG_0, 1),
186+ BPF_EXIT_INSN(),
187+ },
188+ .fixup_map_hash_16b = { 5 },
189+ .fixup_map_array_48b = { 8 },
190+ .result_unpriv = REJECT,
191+ .errstr_unpriv = "R1 tried to add from different maps, paths or scalars",
192+ .result = ACCEPT,
193+ .retval = 1,
194+},
195+{
196+ "map access: known scalar += value_ptr unknown vs unknown (gt)",
197+ .insns = {
198+ BPF_LDX_MEM(BPF_W, BPF_REG_0, BPF_REG_1,
199+ offsetof(struct __sk_buff, len)),
200+ BPF_ST_MEM(BPF_DW, BPF_REG_10, -8, 0),
201+ BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
202+ BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
203+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 1, 3),
204+ BPF_LD_MAP_FD(BPF_REG_1, 0),
205+ BPF_JMP_IMM(BPF_JNE, BPF_REG_0, 1, 2),
206+ BPF_LD_MAP_FD(BPF_REG_1, 0),
207+ BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_map_lookup_elem),
208+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 11),
209+ BPF_LDX_MEM(BPF_B, BPF_REG_4, BPF_REG_0, 0),
210+ BPF_JMP_IMM(BPF_JEQ, BPF_REG_4, 1, 4),
211+ BPF_MOV64_IMM(BPF_REG_1, 6),
212+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
213+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x7),
214+ BPF_JMP_IMM(BPF_JA, 0, 0, 3),
215+ BPF_MOV64_IMM(BPF_REG_1, 6),
216+ BPF_ALU64_IMM(BPF_NEG, BPF_REG_1, 0),
217+ BPF_ALU64_IMM(BPF_AND, BPF_REG_1, 0x3),
218+ BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
219+ BPF_LDX_MEM(BPF_B, BPF_REG_0, BPF_REG_1, 0),
220+ BPF_MOV64_IMM(BPF_REG_0, 1),
221+ BPF_EXIT_INSN(),
222+ },
223+ .fixup_map_hash_16b = { 5 },
224+ .fixup_map_array_48b = { 8 },
225+ .result_unpriv = REJECT,
226+ .errstr_unpriv = "R1 tried to add from different maps, paths or scalars",
227+ .result = ACCEPT,
228+ .retval = 1,
229+},
1230 {
2231 "map access: known scalar += value_ptr from different maps",
3232 .insns = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t