bpf-for-netdev
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTFp0I1jqZrAX+hPRXbK58LschIgwUCZDCaHgAKCRDbK58LschI g2CXAP9sgjqCaRhfSSYWbESKWxokJAa1j6v7phNjR9iqHrBjzwEAg6aDHOUqcYpD Zlp/5JV9HIkc1wTmuIUuI74YAVZBJAU= =V2jo -----END PGP SIGNATURE----- Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf Daniel Borkmann says: ==================== pull-request: bpf 2023-04-08 We've added 4 non-merge commits during the last 11 day(s) which contain a total of 5 files changed, 39 insertions(+), 6 deletions(-). The main changes are: 1) Fix BPF TCP socket iterator to use correct helper for dropping socket's refcount, that is, sock_gen_put instead of sock_put, from Martin KaFai Lau. 2) Fix a BTI exception splat in BPF trampoline-generated code on arm64, from Xu Kuohai. 3) Fix a LongArch JIT error from missing BPF_NOSPEC no-op, from George Guo. 4) Fix dynamic XDP feature detection of veth in xdp_redirect selftest, from Lorenzo Bianconi. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: selftests/bpf: fix xdp_redirect xdp-features selftest for veth driver bpf, arm64: Fixed a BTI error on returning to patched function LoongArch, bpf: Fix jit to skip speculation barrier opcode bpf: tcp: Use sock_gen_put instead of sock_put in bpf_iter_tcp ==================== Link: https://lore.kernel.org/r/20230407224642.30906-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
029294d019
|
@ -281,4 +281,8 @@
|
|||
/* DMB */
|
||||
#define A64_DMB_ISH aarch64_insn_gen_dmb(AARCH64_INSN_MB_ISH)
|
||||
|
||||
/* ADR */
|
||||
#define A64_ADR(Rd, offset) \
|
||||
aarch64_insn_gen_adr(0, offset, Rd, AARCH64_INSN_ADR_TYPE_ADR)
|
||||
|
||||
#endif /* _BPF_JIT_H */
|
||||
|
|
|
@ -1900,7 +1900,8 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
|
|||
restore_args(ctx, args_off, nargs);
|
||||
/* call original func */
|
||||
emit(A64_LDR64I(A64_R(10), A64_SP, retaddr_off), ctx);
|
||||
emit(A64_BLR(A64_R(10)), ctx);
|
||||
emit(A64_ADR(A64_LR, AARCH64_INSN_SIZE * 2), ctx);
|
||||
emit(A64_RET(A64_R(10)), ctx);
|
||||
/* store return value */
|
||||
emit(A64_STR64I(A64_R(0), A64_SP, retval_off), ctx);
|
||||
/* reserve a nop for bpf_tramp_image_put */
|
||||
|
|
|
@ -1022,6 +1022,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext
|
|||
emit_atomic(insn, ctx);
|
||||
break;
|
||||
|
||||
/* Speculation barrier */
|
||||
case BPF_ST | BPF_NOSPEC:
|
||||
break;
|
||||
|
||||
default:
|
||||
pr_err("bpf_jit: unknown opcode %02x\n", code);
|
||||
return -EINVAL;
|
||||
|
|
|
@ -2780,7 +2780,7 @@ static int tcp_prog_seq_show(struct bpf_prog *prog, struct bpf_iter_meta *meta,
|
|||
static void bpf_iter_tcp_put_batch(struct bpf_tcp_iter_state *iter)
|
||||
{
|
||||
while (iter->cur_sk < iter->end_sk)
|
||||
sock_put(iter->batch[iter->cur_sk++]);
|
||||
sock_gen_put(iter->batch[iter->cur_sk++]);
|
||||
}
|
||||
|
||||
static int bpf_iter_tcp_realloc_batch(struct bpf_tcp_iter_state *iter,
|
||||
|
@ -2941,7 +2941,7 @@ static void *bpf_iter_tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
|||
* st->bucket. See tcp_seek_last_pos().
|
||||
*/
|
||||
st->offset++;
|
||||
sock_put(iter->batch[iter->cur_sk++]);
|
||||
sock_gen_put(iter->batch[iter->cur_sk++]);
|
||||
}
|
||||
|
||||
if (iter->cur_sk < iter->end_sk)
|
||||
|
|
|
@ -167,8 +167,7 @@ void test_xdp_do_redirect(void)
|
|||
|
||||
if (!ASSERT_EQ(query_opts.feature_flags,
|
||||
NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
|
||||
NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG |
|
||||
NETDEV_XDP_ACT_NDO_XMIT_SG,
|
||||
NETDEV_XDP_ACT_RX_SG,
|
||||
"veth_src query_opts.feature_flags"))
|
||||
goto out;
|
||||
|
||||
|
@ -176,11 +175,36 @@ void test_xdp_do_redirect(void)
|
|||
if (!ASSERT_OK(err, "veth_dst bpf_xdp_query"))
|
||||
goto out;
|
||||
|
||||
if (!ASSERT_EQ(query_opts.feature_flags,
|
||||
NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
|
||||
NETDEV_XDP_ACT_RX_SG,
|
||||
"veth_dst query_opts.feature_flags"))
|
||||
goto out;
|
||||
|
||||
/* Enable GRO */
|
||||
SYS("ethtool -K veth_src gro on");
|
||||
SYS("ethtool -K veth_dst gro on");
|
||||
|
||||
err = bpf_xdp_query(ifindex_src, XDP_FLAGS_DRV_MODE, &query_opts);
|
||||
if (!ASSERT_OK(err, "veth_src bpf_xdp_query gro on"))
|
||||
goto out;
|
||||
|
||||
if (!ASSERT_EQ(query_opts.feature_flags,
|
||||
NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
|
||||
NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG |
|
||||
NETDEV_XDP_ACT_NDO_XMIT_SG,
|
||||
"veth_dst query_opts.feature_flags"))
|
||||
"veth_src query_opts.feature_flags gro on"))
|
||||
goto out;
|
||||
|
||||
err = bpf_xdp_query(ifindex_dst, XDP_FLAGS_DRV_MODE, &query_opts);
|
||||
if (!ASSERT_OK(err, "veth_dst bpf_xdp_query gro on"))
|
||||
goto out;
|
||||
|
||||
if (!ASSERT_EQ(query_opts.feature_flags,
|
||||
NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
|
||||
NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG |
|
||||
NETDEV_XDP_ACT_NDO_XMIT_SG,
|
||||
"veth_dst query_opts.feature_flags gro on"))
|
||||
goto out;
|
||||
|
||||
memcpy(skel->rodata->expect_dst, &pkt_udp.eth.h_dest, ETH_ALEN);
|
||||
|
|
Loading…
Reference in New Issue