mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Pull BPF fixes from Daniel Borkmann: - Fix a soft-lockup in BPF arena_map_free on 64k page size kernels (Alan Maguire) - Fix a missing allocation failure check in BPF verifier's acquire_lock_state (Kumar Kartikeya Dwivedi) - Fix a NULL-pointer dereference in trace_kfree_skb by adding kfree_skb to the raw_tp_null_args set (Kuniyuki Iwashima) - Fix a deadlock when freeing BPF cgroup storage (Abel Wu) - Fix a syzbot-reported deadlock when holding BPF map's freeze_mutex (Andrii Nakryiko) - Fix a use-after-free issue in bpf_test_init when eth_skb_pkt_type is accessing skb data not containing an Ethernet header (Shigeru Yoshida) - Fix skipping non-existing keys in generic_map_lookup_batch (Yan Zhai) - Several BPF sockmap fixes to address incorrect TCP copied_seq calculations, which prevented correct data reads from recv(2) in user space (Jiayuan Chen) - Two fixes for BPF map lookup nullness elision (Daniel Xu) - Fix a NULL-pointer dereference from vmlinux BTF lookup in bpf_sk_storage_tracing_allowed (Jared Kangas) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: selftests: bpf: test batch lookup on array of maps with holes bpf: skip non exist keys in generic_map_lookup_batch bpf: Handle allocation failure in acquire_lock_state bpf: verifier: Disambiguate get_constant_map_key() errors bpf: selftests: Test constant key extraction on irrelevant maps bpf: verifier: Do not extract constant map keys for irrelevant maps bpf: Fix softlockup in arena_map_free on 64k page kernel net: Add rx_skb of kfree_skb to raw_tp_null_args[]. bpf: Fix deadlock when freeing cgroup storage selftests/bpf: Add strparser test for bpf selftests/bpf: Fix invalid flag of recv() bpf: Disable non stream socket for strparser bpf: Fix wrong copied_seq calculation strparser: Add read_sock callback bpf: avoid holding freeze_mutex during mmap operation bpf: unify VM_WRITE vs VM_MAYWRITE use in BPF map mmaping logic selftests/bpf: Adjust data size to have ETH_HLEN bpf, test_run: Fix use-after-free issue in eth_skb_pkt_type() bpf: Remove unnecessary BTF lookups in bpf_sk_storage_tracing_allowed
This commit is contained in:
@@ -526,8 +526,8 @@ static void test_sockmap_skb_verdict_shutdown(void)
|
||||
if (!ASSERT_EQ(err, 1, "epoll_wait(fd)"))
|
||||
goto out_close;
|
||||
|
||||
n = recv(c1, &b, 1, SOCK_NONBLOCK);
|
||||
ASSERT_EQ(n, 0, "recv_timeout(fin)");
|
||||
n = recv(c1, &b, 1, MSG_DONTWAIT);
|
||||
ASSERT_EQ(n, 0, "recv(fin)");
|
||||
out_close:
|
||||
close(c1);
|
||||
close(p1);
|
||||
@@ -535,57 +535,6 @@ out:
|
||||
test_sockmap_pass_prog__destroy(skel);
|
||||
}
|
||||
|
||||
static void test_sockmap_stream_pass(void)
|
||||
{
|
||||
int zero = 0, sent, recvd;
|
||||
int verdict, parser;
|
||||
int err, map;
|
||||
int c = -1, p = -1;
|
||||
struct test_sockmap_pass_prog *pass = NULL;
|
||||
char snd[256] = "0123456789";
|
||||
char rcv[256] = "0";
|
||||
|
||||
pass = test_sockmap_pass_prog__open_and_load();
|
||||
verdict = bpf_program__fd(pass->progs.prog_skb_verdict);
|
||||
parser = bpf_program__fd(pass->progs.prog_skb_parser);
|
||||
map = bpf_map__fd(pass->maps.sock_map_rx);
|
||||
|
||||
err = bpf_prog_attach(parser, map, BPF_SK_SKB_STREAM_PARSER, 0);
|
||||
if (!ASSERT_OK(err, "bpf_prog_attach stream parser"))
|
||||
goto out;
|
||||
|
||||
err = bpf_prog_attach(verdict, map, BPF_SK_SKB_STREAM_VERDICT, 0);
|
||||
if (!ASSERT_OK(err, "bpf_prog_attach stream verdict"))
|
||||
goto out;
|
||||
|
||||
err = create_pair(AF_INET, SOCK_STREAM, &c, &p);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
/* sk_data_ready of 'p' will be replaced by strparser handler */
|
||||
err = bpf_map_update_elem(map, &zero, &p, BPF_NOEXIST);
|
||||
if (!ASSERT_OK(err, "bpf_map_update_elem(p)"))
|
||||
goto out_close;
|
||||
|
||||
/*
|
||||
* as 'prog_skb_parser' return the original skb len and
|
||||
* 'prog_skb_verdict' return SK_PASS, the kernel will just
|
||||
* pass it through to original socket 'p'
|
||||
*/
|
||||
sent = xsend(c, snd, sizeof(snd), 0);
|
||||
ASSERT_EQ(sent, sizeof(snd), "xsend(c)");
|
||||
|
||||
recvd = recv_timeout(p, rcv, sizeof(rcv), SOCK_NONBLOCK,
|
||||
IO_TIMEOUT_SEC);
|
||||
ASSERT_EQ(recvd, sizeof(rcv), "recv_timeout(p)");
|
||||
|
||||
out_close:
|
||||
close(c);
|
||||
close(p);
|
||||
|
||||
out:
|
||||
test_sockmap_pass_prog__destroy(pass);
|
||||
}
|
||||
|
||||
static void test_sockmap_skb_verdict_fionread(bool pass_prog)
|
||||
{
|
||||
@@ -632,7 +581,7 @@ static void test_sockmap_skb_verdict_fionread(bool pass_prog)
|
||||
ASSERT_EQ(avail, expected, "ioctl(FIONREAD)");
|
||||
/* On DROP test there will be no data to read */
|
||||
if (pass_prog) {
|
||||
recvd = recv_timeout(c1, &buf, sizeof(buf), SOCK_NONBLOCK, IO_TIMEOUT_SEC);
|
||||
recvd = recv_timeout(c1, &buf, sizeof(buf), MSG_DONTWAIT, IO_TIMEOUT_SEC);
|
||||
ASSERT_EQ(recvd, sizeof(buf), "recv_timeout(c0)");
|
||||
}
|
||||
|
||||
@@ -1133,8 +1082,6 @@ void test_sockmap_basic(void)
|
||||
test_sockmap_progs_query(BPF_SK_SKB_VERDICT);
|
||||
if (test__start_subtest("sockmap skb_verdict shutdown"))
|
||||
test_sockmap_skb_verdict_shutdown();
|
||||
if (test__start_subtest("sockmap stream parser and verdict pass"))
|
||||
test_sockmap_stream_pass();
|
||||
if (test__start_subtest("sockmap skb_verdict fionread"))
|
||||
test_sockmap_skb_verdict_fionread(true);
|
||||
if (test__start_subtest("sockmap skb_verdict fionread on drop"))
|
||||
|
||||
Reference in New Issue
Block a user