mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
bpf-for-netdev
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTFp0I1jqZrAX+hPRXbK58LschIgwUCZqIl1AAKCRDbK58LschI g/MdAP9oyZV9/IZ6Y6Z1fWfio0SB+yJGugcwbFjWcEtNrzsqJQEAwipQnemAI4NC HBMfK2a/w7vhAFMXrP/SbkB/gUJJ7QE= =vovf -----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 2024-07-25 We've added 14 non-merge commits during the last 8 day(s) which contain a total of 19 files changed, 177 insertions(+), 70 deletions(-). The main changes are: 1) Fix af_unix to disable MSG_OOB handling for sockets in BPF sockmap and BPF sockhash. Also add test coverage for this case, from Michal Luczaj. 2) Fix a segmentation issue when downgrading gso_size in the BPF helper bpf_skb_adjust_room(), from Fred Li. 3) Fix a compiler warning in resolve_btfids due to a missing type cast, from Liwei Song. 4) Fix stack allocation for arm64 to align the stack pointer at a 16 byte boundary in the fexit_sleep BPF selftest, from Puranjay Mohan. 5) Fix a xsk regression to require a flag when actuating tx_metadata_len, from Stanislav Fomichev. 6) Fix function prototype BTF dumping in libbpf for prototypes that have no input arguments, from Andrii Nakryiko. 7) Fix stacktrace symbol resolution in perf script for BPF programs containing subprograms, from Hou Tao. * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: selftests/bpf: Add XDP_UMEM_TX_METADATA_LEN to XSK TX metadata test xsk: Require XDP_UMEM_TX_METADATA_LEN to actuate tx_metadata_len bpf: Fix a segment issue when downgrading gso_size tools/resolve_btfids: Fix comparison of distinct pointer types warning in resolve_btfids bpf, events: Use prog to emit ksymbol event for main program selftests/bpf: Test sockmap redirect for AF_UNIX MSG_OOB selftests/bpf: Parametrize AF_UNIX redir functions to accept send() flags selftests/bpf: Support SOCK_STREAM in unix_inet_redir_to_connected() af_unix: Disable MSG_OOB handling for sockets in sockmap/sockhash bpftool: Fix typo in usage help libbpf: Fix no-args func prototype BTF dumping syntax MAINTAINERS: Update powerpc BPF JIT maintainers MAINTAINERS: Update email address of Naveen selftests/bpf: fexit_sleep: Fix stack allocation for arm64 ==================== Link: https://patch.msgid.link/20240725114312.32197-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
f7578df913
2
.mailmap
2
.mailmap
@ -474,6 +474,8 @@ Nadia Yvette Chambers <nyc@holomorphy.com> William Lee Irwin III <wli@holomorphy
|
|||||||
Naoya Horiguchi <nao.horiguchi@gmail.com> <n-horiguchi@ah.jp.nec.com>
|
Naoya Horiguchi <nao.horiguchi@gmail.com> <n-horiguchi@ah.jp.nec.com>
|
||||||
Naoya Horiguchi <nao.horiguchi@gmail.com> <naoya.horiguchi@nec.com>
|
Naoya Horiguchi <nao.horiguchi@gmail.com> <naoya.horiguchi@nec.com>
|
||||||
Nathan Chancellor <nathan@kernel.org> <natechancellor@gmail.com>
|
Nathan Chancellor <nathan@kernel.org> <natechancellor@gmail.com>
|
||||||
|
Naveen N Rao <naveen@kernel.org> <naveen.n.rao@linux.ibm.com>
|
||||||
|
Naveen N Rao <naveen@kernel.org> <naveen.n.rao@linux.vnet.ibm.com>
|
||||||
Neeraj Upadhyay <neeraj.upadhyay@kernel.org> <quic_neeraju@quicinc.com>
|
Neeraj Upadhyay <neeraj.upadhyay@kernel.org> <quic_neeraju@quicinc.com>
|
||||||
Neeraj Upadhyay <neeraj.upadhyay@kernel.org> <neeraju@codeaurora.org>
|
Neeraj Upadhyay <neeraj.upadhyay@kernel.org> <neeraju@codeaurora.org>
|
||||||
Neil Armstrong <neil.armstrong@linaro.org> <narmstrong@baylibre.com>
|
Neil Armstrong <neil.armstrong@linaro.org> <narmstrong@baylibre.com>
|
||||||
|
@ -11,12 +11,16 @@ metadata on the receive side.
|
|||||||
General Design
|
General Design
|
||||||
==============
|
==============
|
||||||
|
|
||||||
The headroom for the metadata is reserved via ``tx_metadata_len`` in
|
The headroom for the metadata is reserved via ``tx_metadata_len`` and
|
||||||
``struct xdp_umem_reg``. The metadata length is therefore the same for
|
``XDP_UMEM_TX_METADATA_LEN`` flag in ``struct xdp_umem_reg``. The metadata
|
||||||
every socket that shares the same umem. The metadata layout is a fixed UAPI,
|
length is therefore the same for every socket that shares the same umem.
|
||||||
refer to ``union xsk_tx_metadata`` in ``include/uapi/linux/if_xdp.h``.
|
The metadata layout is a fixed UAPI, refer to ``union xsk_tx_metadata`` in
|
||||||
Thus, generally, the ``tx_metadata_len`` field above should contain
|
``include/uapi/linux/if_xdp.h``. Thus, generally, the ``tx_metadata_len``
|
||||||
``sizeof(union xsk_tx_metadata)``.
|
field above should contain ``sizeof(union xsk_tx_metadata)``.
|
||||||
|
|
||||||
|
Note that in the original implementation the ``XDP_UMEM_TX_METADATA_LEN``
|
||||||
|
flag was not required. Applications might attempt to create a umem
|
||||||
|
with a flag first and if it fails, do another attempt without a flag.
|
||||||
|
|
||||||
The headroom and the metadata itself should be located right before
|
The headroom and the metadata itself should be located right before
|
||||||
``xdp_desc->addr`` in the umem frame. Within a frame, the metadata
|
``xdp_desc->addr`` in the umem frame. Within a frame, the metadata
|
||||||
|
@ -3946,8 +3946,10 @@ S: Odd Fixes
|
|||||||
F: drivers/net/ethernet/netronome/nfp/bpf/
|
F: drivers/net/ethernet/netronome/nfp/bpf/
|
||||||
|
|
||||||
BPF JIT for POWERPC (32-BIT AND 64-BIT)
|
BPF JIT for POWERPC (32-BIT AND 64-BIT)
|
||||||
M: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
|
|
||||||
M: Michael Ellerman <mpe@ellerman.id.au>
|
M: Michael Ellerman <mpe@ellerman.id.au>
|
||||||
|
M: Hari Bathini <hbathini@linux.ibm.com>
|
||||||
|
M: Christophe Leroy <christophe.leroy@csgroup.eu>
|
||||||
|
R: Naveen N Rao <naveen@kernel.org>
|
||||||
L: bpf@vger.kernel.org
|
L: bpf@vger.kernel.org
|
||||||
S: Supported
|
S: Supported
|
||||||
F: arch/powerpc/net/
|
F: arch/powerpc/net/
|
||||||
@ -12484,7 +12486,7 @@ F: mm/kmsan/
|
|||||||
F: scripts/Makefile.kmsan
|
F: scripts/Makefile.kmsan
|
||||||
|
|
||||||
KPROBES
|
KPROBES
|
||||||
M: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
|
M: Naveen N Rao <naveen@kernel.org>
|
||||||
M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
|
M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
|
||||||
M: "David S. Miller" <davem@davemloft.net>
|
M: "David S. Miller" <davem@davemloft.net>
|
||||||
M: Masami Hiramatsu <mhiramat@kernel.org>
|
M: Masami Hiramatsu <mhiramat@kernel.org>
|
||||||
@ -12861,7 +12863,7 @@ LINUX FOR POWERPC (32-BIT AND 64-BIT)
|
|||||||
M: Michael Ellerman <mpe@ellerman.id.au>
|
M: Michael Ellerman <mpe@ellerman.id.au>
|
||||||
R: Nicholas Piggin <npiggin@gmail.com>
|
R: Nicholas Piggin <npiggin@gmail.com>
|
||||||
R: Christophe Leroy <christophe.leroy@csgroup.eu>
|
R: Christophe Leroy <christophe.leroy@csgroup.eu>
|
||||||
R: Naveen N. Rao <naveen.n.rao@linux.ibm.com>
|
R: Naveen N Rao <naveen@kernel.org>
|
||||||
L: linuxppc-dev@lists.ozlabs.org
|
L: linuxppc-dev@lists.ozlabs.org
|
||||||
S: Supported
|
S: Supported
|
||||||
W: https://github.com/linuxppc/wiki/wiki
|
W: https://github.com/linuxppc/wiki/wiki
|
||||||
|
@ -41,6 +41,10 @@
|
|||||||
*/
|
*/
|
||||||
#define XDP_UMEM_TX_SW_CSUM (1 << 1)
|
#define XDP_UMEM_TX_SW_CSUM (1 << 1)
|
||||||
|
|
||||||
|
/* Request to reserve tx_metadata_len bytes of per-chunk metadata.
|
||||||
|
*/
|
||||||
|
#define XDP_UMEM_TX_METADATA_LEN (1 << 2)
|
||||||
|
|
||||||
struct sockaddr_xdp {
|
struct sockaddr_xdp {
|
||||||
__u16 sxdp_family;
|
__u16 sxdp_family;
|
||||||
__u16 sxdp_flags;
|
__u16 sxdp_flags;
|
||||||
|
@ -9327,21 +9327,19 @@ static void perf_event_bpf_emit_ksymbols(struct bpf_prog *prog,
|
|||||||
bool unregister = type == PERF_BPF_EVENT_PROG_UNLOAD;
|
bool unregister = type == PERF_BPF_EVENT_PROG_UNLOAD;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (prog->aux->func_cnt == 0) {
|
perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_BPF,
|
||||||
perf_event_ksymbol(PERF_RECORD_KSYMBOL_TYPE_BPF,
|
(u64)(unsigned long)prog->bpf_func,
|
||||||
(u64)(unsigned long)prog->bpf_func,
|
prog->jited_len, unregister,
|
||||||
prog->jited_len, unregister,
|
prog->aux->ksym.name);
|
||||||
prog->aux->ksym.name);
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < prog->aux->func_cnt; i++) {
|
|
||||||
struct bpf_prog *subprog = prog->aux->func[i];
|
|
||||||
|
|
||||||
perf_event_ksymbol(
|
for (i = 1; i < prog->aux->func_cnt; i++) {
|
||||||
PERF_RECORD_KSYMBOL_TYPE_BPF,
|
struct bpf_prog *subprog = prog->aux->func[i];
|
||||||
(u64)(unsigned long)subprog->bpf_func,
|
|
||||||
subprog->jited_len, unregister,
|
perf_event_ksymbol(
|
||||||
subprog->aux->ksym.name);
|
PERF_RECORD_KSYMBOL_TYPE_BPF,
|
||||||
}
|
(u64)(unsigned long)subprog->bpf_func,
|
||||||
|
subprog->jited_len, unregister,
|
||||||
|
subprog->aux->ksym.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3548,13 +3548,20 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 off, u32 len_diff,
|
|||||||
if (skb_is_gso(skb)) {
|
if (skb_is_gso(skb)) {
|
||||||
struct skb_shared_info *shinfo = skb_shinfo(skb);
|
struct skb_shared_info *shinfo = skb_shinfo(skb);
|
||||||
|
|
||||||
/* Due to header grow, MSS needs to be downgraded. */
|
|
||||||
if (!(flags & BPF_F_ADJ_ROOM_FIXED_GSO))
|
|
||||||
skb_decrease_gso_size(shinfo, len_diff);
|
|
||||||
|
|
||||||
/* Header must be checked, and gso_segs recomputed. */
|
/* Header must be checked, and gso_segs recomputed. */
|
||||||
shinfo->gso_type |= gso_type;
|
shinfo->gso_type |= gso_type;
|
||||||
shinfo->gso_segs = 0;
|
shinfo->gso_segs = 0;
|
||||||
|
|
||||||
|
/* Due to header growth, MSS needs to be downgraded.
|
||||||
|
* There is a BUG_ON() when segmenting the frag_list with
|
||||||
|
* head_frag true, so linearize the skb after downgrading
|
||||||
|
* the MSS.
|
||||||
|
*/
|
||||||
|
if (!(flags & BPF_F_ADJ_ROOM_FIXED_GSO)) {
|
||||||
|
skb_decrease_gso_size(shinfo, len_diff);
|
||||||
|
if (shinfo->frag_list)
|
||||||
|
return skb_linearize(skb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2721,10 +2721,49 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
|
|||||||
|
|
||||||
static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
|
static int unix_stream_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
|
||||||
{
|
{
|
||||||
|
struct unix_sock *u = unix_sk(sk);
|
||||||
|
struct sk_buff *skb;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED))
|
if (unlikely(READ_ONCE(sk->sk_state) != TCP_ESTABLISHED))
|
||||||
return -ENOTCONN;
|
return -ENOTCONN;
|
||||||
|
|
||||||
return unix_read_skb(sk, recv_actor);
|
mutex_lock(&u->iolock);
|
||||||
|
skb = skb_recv_datagram(sk, MSG_DONTWAIT, &err);
|
||||||
|
mutex_unlock(&u->iolock);
|
||||||
|
if (!skb)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_AF_UNIX_OOB)
|
||||||
|
if (unlikely(skb == READ_ONCE(u->oob_skb))) {
|
||||||
|
bool drop = false;
|
||||||
|
|
||||||
|
unix_state_lock(sk);
|
||||||
|
|
||||||
|
if (sock_flag(sk, SOCK_DEAD)) {
|
||||||
|
unix_state_unlock(sk);
|
||||||
|
kfree_skb(skb);
|
||||||
|
return -ECONNRESET;
|
||||||
|
}
|
||||||
|
|
||||||
|
spin_lock(&sk->sk_receive_queue.lock);
|
||||||
|
if (likely(skb == u->oob_skb)) {
|
||||||
|
WRITE_ONCE(u->oob_skb, NULL);
|
||||||
|
drop = true;
|
||||||
|
}
|
||||||
|
spin_unlock(&sk->sk_receive_queue.lock);
|
||||||
|
|
||||||
|
unix_state_unlock(sk);
|
||||||
|
|
||||||
|
if (drop) {
|
||||||
|
WARN_ON_ONCE(skb_unref(skb));
|
||||||
|
kfree_skb(skb);
|
||||||
|
return -EAGAIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return recv_actor(sk, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int unix_stream_read_generic(struct unix_stream_read_state *state,
|
static int unix_stream_read_generic(struct unix_stream_read_state *state,
|
||||||
|
@ -54,6 +54,9 @@ static int unix_bpf_recvmsg(struct sock *sk, struct msghdr *msg,
|
|||||||
struct sk_psock *psock;
|
struct sk_psock *psock;
|
||||||
int copied;
|
int copied;
|
||||||
|
|
||||||
|
if (flags & MSG_OOB)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ static int xdp_umem_account_pages(struct xdp_umem *umem)
|
|||||||
#define XDP_UMEM_FLAGS_VALID ( \
|
#define XDP_UMEM_FLAGS_VALID ( \
|
||||||
XDP_UMEM_UNALIGNED_CHUNK_FLAG | \
|
XDP_UMEM_UNALIGNED_CHUNK_FLAG | \
|
||||||
XDP_UMEM_TX_SW_CSUM | \
|
XDP_UMEM_TX_SW_CSUM | \
|
||||||
|
XDP_UMEM_TX_METADATA_LEN | \
|
||||||
0)
|
0)
|
||||||
|
|
||||||
static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
||||||
@ -204,8 +205,11 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
|||||||
if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
|
if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (mr->tx_metadata_len >= 256 || mr->tx_metadata_len % 8)
|
if (mr->flags & XDP_UMEM_TX_METADATA_LEN) {
|
||||||
return -EINVAL;
|
if (mr->tx_metadata_len >= 256 || mr->tx_metadata_len % 8)
|
||||||
|
return -EINVAL;
|
||||||
|
umem->tx_metadata_len = mr->tx_metadata_len;
|
||||||
|
}
|
||||||
|
|
||||||
umem->size = size;
|
umem->size = size;
|
||||||
umem->headroom = headroom;
|
umem->headroom = headroom;
|
||||||
@ -215,7 +219,6 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
|
|||||||
umem->pgs = NULL;
|
umem->pgs = NULL;
|
||||||
umem->user = NULL;
|
umem->user = NULL;
|
||||||
umem->flags = mr->flags;
|
umem->flags = mr->flags;
|
||||||
umem->tx_metadata_len = mr->tx_metadata_len;
|
|
||||||
|
|
||||||
INIT_LIST_HEAD(&umem->xsk_dma_list);
|
INIT_LIST_HEAD(&umem->xsk_dma_list);
|
||||||
refcount_set(&umem->users, 1);
|
refcount_set(&umem->users, 1);
|
||||||
|
@ -2489,7 +2489,7 @@ static int do_help(int argc, char **argv)
|
|||||||
" cgroup/connect_unix | cgroup/getpeername4 | cgroup/getpeername6 |\n"
|
" cgroup/connect_unix | cgroup/getpeername4 | cgroup/getpeername6 |\n"
|
||||||
" cgroup/getpeername_unix | cgroup/getsockname4 | cgroup/getsockname6 |\n"
|
" cgroup/getpeername_unix | cgroup/getsockname4 | cgroup/getsockname6 |\n"
|
||||||
" cgroup/getsockname_unix | cgroup/sendmsg4 | cgroup/sendmsg6 |\n"
|
" cgroup/getsockname_unix | cgroup/sendmsg4 | cgroup/sendmsg6 |\n"
|
||||||
" cgroup/sendmsg°unix | cgroup/recvmsg4 | cgroup/recvmsg6 | cgroup/recvmsg_unix |\n"
|
" cgroup/sendmsg_unix | cgroup/recvmsg4 | cgroup/recvmsg6 | cgroup/recvmsg_unix |\n"
|
||||||
" cgroup/getsockopt | cgroup/setsockopt | cgroup/sock_release |\n"
|
" cgroup/getsockopt | cgroup/setsockopt | cgroup/sock_release |\n"
|
||||||
" struct_ops | fentry | fexit | freplace | sk_lookup }\n"
|
" struct_ops | fentry | fexit | freplace | sk_lookup }\n"
|
||||||
" ATTACH_TYPE := { sk_msg_verdict | sk_skb_verdict | sk_skb_stream_verdict |\n"
|
" ATTACH_TYPE := { sk_msg_verdict | sk_skb_verdict | sk_skb_stream_verdict |\n"
|
||||||
|
@ -704,7 +704,7 @@ static int sets_patch(struct object *obj)
|
|||||||
* Make sure id is at the beginning of the pairs
|
* Make sure id is at the beginning of the pairs
|
||||||
* struct, otherwise the below qsort would not work.
|
* struct, otherwise the below qsort would not work.
|
||||||
*/
|
*/
|
||||||
BUILD_BUG_ON(set8->pairs != &set8->pairs[0].id);
|
BUILD_BUG_ON((u32 *)set8->pairs != &set8->pairs[0].id);
|
||||||
qsort(set8->pairs, set8->cnt, sizeof(set8->pairs[0]), cmp_id);
|
qsort(set8->pairs, set8->cnt, sizeof(set8->pairs[0]), cmp_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -41,6 +41,10 @@
|
|||||||
*/
|
*/
|
||||||
#define XDP_UMEM_TX_SW_CSUM (1 << 1)
|
#define XDP_UMEM_TX_SW_CSUM (1 << 1)
|
||||||
|
|
||||||
|
/* Request to reserve tx_metadata_len bytes of per-chunk metadata.
|
||||||
|
*/
|
||||||
|
#define XDP_UMEM_TX_METADATA_LEN (1 << 2)
|
||||||
|
|
||||||
struct sockaddr_xdp {
|
struct sockaddr_xdp {
|
||||||
__u16 sxdp_family;
|
__u16 sxdp_family;
|
||||||
__u16 sxdp_flags;
|
__u16 sxdp_flags;
|
||||||
|
@ -1559,10 +1559,12 @@ static void btf_dump_emit_type_chain(struct btf_dump *d,
|
|||||||
* Clang for BPF target generates func_proto with no
|
* Clang for BPF target generates func_proto with no
|
||||||
* args as a func_proto with a single void arg (e.g.,
|
* args as a func_proto with a single void arg (e.g.,
|
||||||
* `int (*f)(void)` vs just `int (*f)()`). We are
|
* `int (*f)(void)` vs just `int (*f)()`). We are
|
||||||
* going to pretend there are no args for such case.
|
* going to emit valid empty args (void) syntax for
|
||||||
|
* such case. Similarly and conveniently, valid
|
||||||
|
* no args case can be special-cased here as well.
|
||||||
*/
|
*/
|
||||||
if (vlen == 1 && p->type == 0) {
|
if (vlen == 0 || (vlen == 1 && p->type == 0)) {
|
||||||
btf_dump_printf(d, ")");
|
btf_dump_printf(d, "void)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
bpf_cookie/multi_kprobe_attach_api # kprobe_multi_link_api_subtest:FAIL:fentry_raw_skel_load unexpected error: -3
|
bpf_cookie/multi_kprobe_attach_api # kprobe_multi_link_api_subtest:FAIL:fentry_raw_skel_load unexpected error: -3
|
||||||
bpf_cookie/multi_kprobe_link_api # kprobe_multi_link_api_subtest:FAIL:fentry_raw_skel_load unexpected error: -3
|
bpf_cookie/multi_kprobe_link_api # kprobe_multi_link_api_subtest:FAIL:fentry_raw_skel_load unexpected error: -3
|
||||||
fexit_sleep # The test never returns. The remaining tests cannot start.
|
|
||||||
kprobe_multi_bench_attach # needs CONFIG_FPROBE
|
kprobe_multi_bench_attach # needs CONFIG_FPROBE
|
||||||
kprobe_multi_test # needs CONFIG_FPROBE
|
kprobe_multi_test # needs CONFIG_FPROBE
|
||||||
module_attach # prog 'kprobe_multi': failed to auto-attach: -95
|
module_attach # prog 'kprobe_multi': failed to auto-attach: -95
|
||||||
|
@ -21,13 +21,13 @@ static int do_sleep(void *skel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define STACK_SIZE (1024 * 1024)
|
#define STACK_SIZE (1024 * 1024)
|
||||||
static char child_stack[STACK_SIZE];
|
|
||||||
|
|
||||||
void test_fexit_sleep(void)
|
void test_fexit_sleep(void)
|
||||||
{
|
{
|
||||||
struct fexit_sleep_lskel *fexit_skel = NULL;
|
struct fexit_sleep_lskel *fexit_skel = NULL;
|
||||||
int wstatus, duration = 0;
|
int wstatus, duration = 0;
|
||||||
pid_t cpid;
|
pid_t cpid;
|
||||||
|
char *child_stack = NULL;
|
||||||
int err, fexit_cnt;
|
int err, fexit_cnt;
|
||||||
|
|
||||||
fexit_skel = fexit_sleep_lskel__open_and_load();
|
fexit_skel = fexit_sleep_lskel__open_and_load();
|
||||||
@ -38,6 +38,11 @@ void test_fexit_sleep(void)
|
|||||||
if (CHECK(err, "fexit_attach", "fexit attach failed: %d\n", err))
|
if (CHECK(err, "fexit_attach", "fexit attach failed: %d\n", err))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
child_stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE |
|
||||||
|
MAP_ANONYMOUS | MAP_STACK, -1, 0);
|
||||||
|
if (!ASSERT_NEQ(child_stack, MAP_FAILED, "mmap"))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
cpid = clone(do_sleep, child_stack + STACK_SIZE, CLONE_FILES | SIGCHLD, fexit_skel);
|
cpid = clone(do_sleep, child_stack + STACK_SIZE, CLONE_FILES | SIGCHLD, fexit_skel);
|
||||||
if (CHECK(cpid == -1, "clone", "%s\n", strerror(errno)))
|
if (CHECK(cpid == -1, "clone", "%s\n", strerror(errno)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -78,5 +83,6 @@ void test_fexit_sleep(void)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
munmap(child_stack, STACK_SIZE);
|
||||||
fexit_sleep_lskel__destroy(fexit_skel);
|
fexit_sleep_lskel__destroy(fexit_skel);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "sockmap_helpers.h"
|
#include "sockmap_helpers.h"
|
||||||
|
|
||||||
|
#define NO_FLAGS 0
|
||||||
|
|
||||||
static void test_insert_invalid(struct test_sockmap_listen *skel __always_unused,
|
static void test_insert_invalid(struct test_sockmap_listen *skel __always_unused,
|
||||||
int family, int sotype, int mapfd)
|
int family, int sotype, int mapfd)
|
||||||
{
|
{
|
||||||
@ -1376,7 +1378,8 @@ static void test_redir(struct test_sockmap_listen *skel, struct bpf_map *map,
|
|||||||
|
|
||||||
static void pairs_redir_to_connected(int cli0, int peer0, int cli1, int peer1,
|
static void pairs_redir_to_connected(int cli0, int peer0, int cli1, int peer1,
|
||||||
int sock_mapfd, int nop_mapfd,
|
int sock_mapfd, int nop_mapfd,
|
||||||
int verd_mapfd, enum redir_mode mode)
|
int verd_mapfd, enum redir_mode mode,
|
||||||
|
int send_flags)
|
||||||
{
|
{
|
||||||
const char *log_prefix = redir_mode_str(mode);
|
const char *log_prefix = redir_mode_str(mode);
|
||||||
unsigned int pass;
|
unsigned int pass;
|
||||||
@ -1396,12 +1399,11 @@ static void pairs_redir_to_connected(int cli0, int peer0, int cli1, int peer1,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = write(cli1, "a", 1);
|
/* Last byte is OOB data when send_flags has MSG_OOB bit set */
|
||||||
if (n < 0)
|
n = xsend(cli1, "ab", 2, send_flags);
|
||||||
FAIL_ERRNO("%s: write", log_prefix);
|
if (n >= 0 && n < 2)
|
||||||
if (n == 0)
|
FAIL("%s: incomplete send", log_prefix);
|
||||||
FAIL("%s: incomplete write", log_prefix);
|
if (n < 2)
|
||||||
if (n < 1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
key = SK_PASS;
|
key = SK_PASS;
|
||||||
@ -1416,6 +1418,25 @@ static void pairs_redir_to_connected(int cli0, int peer0, int cli1, int peer1,
|
|||||||
FAIL_ERRNO("%s: recv_timeout", log_prefix);
|
FAIL_ERRNO("%s: recv_timeout", log_prefix);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
FAIL("%s: incomplete recv", log_prefix);
|
FAIL("%s: incomplete recv", log_prefix);
|
||||||
|
|
||||||
|
if (send_flags & MSG_OOB) {
|
||||||
|
/* Check that we can't read OOB while in sockmap */
|
||||||
|
errno = 0;
|
||||||
|
n = recv(peer1, &b, 1, MSG_OOB | MSG_DONTWAIT);
|
||||||
|
if (n != -1 || errno != EOPNOTSUPP)
|
||||||
|
FAIL("%s: recv(MSG_OOB): expected EOPNOTSUPP: retval=%d errno=%d",
|
||||||
|
log_prefix, n, errno);
|
||||||
|
|
||||||
|
/* Remove peer1 from sockmap */
|
||||||
|
xbpf_map_delete_elem(sock_mapfd, &(int){ 1 });
|
||||||
|
|
||||||
|
/* Check that OOB was dropped on redirect */
|
||||||
|
errno = 0;
|
||||||
|
n = recv(peer1, &b, 1, MSG_OOB | MSG_DONTWAIT);
|
||||||
|
if (n != -1 || errno != EINVAL)
|
||||||
|
FAIL("%s: recv(MSG_OOB): expected EINVAL: retval=%d errno=%d",
|
||||||
|
log_prefix, n, errno);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unix_redir_to_connected(int sotype, int sock_mapfd,
|
static void unix_redir_to_connected(int sotype, int sock_mapfd,
|
||||||
@ -1432,7 +1453,8 @@ static void unix_redir_to_connected(int sotype, int sock_mapfd,
|
|||||||
goto close0;
|
goto close0;
|
||||||
c1 = sfd[0], p1 = sfd[1];
|
c1 = sfd[0], p1 = sfd[1];
|
||||||
|
|
||||||
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd, mode);
|
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd,
|
||||||
|
mode, NO_FLAGS);
|
||||||
|
|
||||||
xclose(c1);
|
xclose(c1);
|
||||||
xclose(p1);
|
xclose(p1);
|
||||||
@ -1722,7 +1744,8 @@ static void udp_redir_to_connected(int family, int sock_mapfd, int verd_mapfd,
|
|||||||
if (err)
|
if (err)
|
||||||
goto close_cli0;
|
goto close_cli0;
|
||||||
|
|
||||||
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd, mode);
|
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd,
|
||||||
|
mode, NO_FLAGS);
|
||||||
|
|
||||||
xclose(c1);
|
xclose(c1);
|
||||||
xclose(p1);
|
xclose(p1);
|
||||||
@ -1780,7 +1803,8 @@ static void inet_unix_redir_to_connected(int family, int type, int sock_mapfd,
|
|||||||
if (err)
|
if (err)
|
||||||
goto close;
|
goto close;
|
||||||
|
|
||||||
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd, mode);
|
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, -1, verd_mapfd,
|
||||||
|
mode, NO_FLAGS);
|
||||||
|
|
||||||
xclose(c1);
|
xclose(c1);
|
||||||
xclose(p1);
|
xclose(p1);
|
||||||
@ -1815,10 +1839,9 @@ static void inet_unix_skb_redir_to_connected(struct test_sockmap_listen *skel,
|
|||||||
xbpf_prog_detach2(verdict, sock_map, BPF_SK_SKB_VERDICT);
|
xbpf_prog_detach2(verdict, sock_map, BPF_SK_SKB_VERDICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unix_inet_redir_to_connected(int family, int type,
|
static void unix_inet_redir_to_connected(int family, int type, int sock_mapfd,
|
||||||
int sock_mapfd, int nop_mapfd,
|
int nop_mapfd, int verd_mapfd,
|
||||||
int verd_mapfd,
|
enum redir_mode mode, int send_flags)
|
||||||
enum redir_mode mode)
|
|
||||||
{
|
{
|
||||||
int c0, c1, p0, p1;
|
int c0, c1, p0, p1;
|
||||||
int sfd[2];
|
int sfd[2];
|
||||||
@ -1828,19 +1851,18 @@ static void unix_inet_redir_to_connected(int family, int type,
|
|||||||
if (err)
|
if (err)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sfd))
|
if (socketpair(AF_UNIX, type | SOCK_NONBLOCK, 0, sfd))
|
||||||
goto close_cli0;
|
goto close_cli0;
|
||||||
c1 = sfd[0], p1 = sfd[1];
|
c1 = sfd[0], p1 = sfd[1];
|
||||||
|
|
||||||
pairs_redir_to_connected(c0, p0, c1, p1,
|
pairs_redir_to_connected(c0, p0, c1, p1, sock_mapfd, nop_mapfd,
|
||||||
sock_mapfd, nop_mapfd, verd_mapfd, mode);
|
verd_mapfd, mode, send_flags);
|
||||||
|
|
||||||
xclose(c1);
|
xclose(c1);
|
||||||
xclose(p1);
|
xclose(p1);
|
||||||
close_cli0:
|
close_cli0:
|
||||||
xclose(c0);
|
xclose(c0);
|
||||||
xclose(p0);
|
xclose(p0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unix_inet_skb_redir_to_connected(struct test_sockmap_listen *skel,
|
static void unix_inet_skb_redir_to_connected(struct test_sockmap_listen *skel,
|
||||||
@ -1859,31 +1881,42 @@ static void unix_inet_skb_redir_to_connected(struct test_sockmap_listen *skel,
|
|||||||
skel->bss->test_ingress = false;
|
skel->bss->test_ingress = false;
|
||||||
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
||||||
sock_map, -1, verdict_map,
|
sock_map, -1, verdict_map,
|
||||||
REDIR_EGRESS);
|
REDIR_EGRESS, NO_FLAGS);
|
||||||
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
||||||
sock_map, -1, verdict_map,
|
sock_map, -1, verdict_map,
|
||||||
REDIR_EGRESS);
|
REDIR_EGRESS, NO_FLAGS);
|
||||||
|
|
||||||
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
||||||
sock_map, nop_map, verdict_map,
|
sock_map, nop_map, verdict_map,
|
||||||
REDIR_EGRESS);
|
REDIR_EGRESS, NO_FLAGS);
|
||||||
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
||||||
sock_map, nop_map, verdict_map,
|
sock_map, nop_map, verdict_map,
|
||||||
REDIR_EGRESS);
|
REDIR_EGRESS, NO_FLAGS);
|
||||||
|
|
||||||
|
/* MSG_OOB not supported by AF_UNIX SOCK_DGRAM */
|
||||||
|
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
||||||
|
sock_map, nop_map, verdict_map,
|
||||||
|
REDIR_EGRESS, MSG_OOB);
|
||||||
|
|
||||||
skel->bss->test_ingress = true;
|
skel->bss->test_ingress = true;
|
||||||
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
||||||
sock_map, -1, verdict_map,
|
sock_map, -1, verdict_map,
|
||||||
REDIR_INGRESS);
|
REDIR_INGRESS, NO_FLAGS);
|
||||||
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
||||||
sock_map, -1, verdict_map,
|
sock_map, -1, verdict_map,
|
||||||
REDIR_INGRESS);
|
REDIR_INGRESS, NO_FLAGS);
|
||||||
|
|
||||||
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
unix_inet_redir_to_connected(family, SOCK_DGRAM,
|
||||||
sock_map, nop_map, verdict_map,
|
sock_map, nop_map, verdict_map,
|
||||||
REDIR_INGRESS);
|
REDIR_INGRESS, NO_FLAGS);
|
||||||
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
||||||
sock_map, nop_map, verdict_map,
|
sock_map, nop_map, verdict_map,
|
||||||
REDIR_INGRESS);
|
REDIR_INGRESS, NO_FLAGS);
|
||||||
|
|
||||||
|
/* MSG_OOB not supported by AF_UNIX SOCK_DGRAM */
|
||||||
|
unix_inet_redir_to_connected(family, SOCK_STREAM,
|
||||||
|
sock_map, nop_map, verdict_map,
|
||||||
|
REDIR_INGRESS, MSG_OOB);
|
||||||
|
|
||||||
xbpf_prog_detach2(verdict, sock_map, BPF_SK_SKB_VERDICT);
|
xbpf_prog_detach2(verdict, sock_map, BPF_SK_SKB_VERDICT);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ static int open_xsk(int ifindex, struct xsk *xsk)
|
|||||||
.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
|
.fill_size = XSK_RING_PROD__DEFAULT_NUM_DESCS,
|
||||||
.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
|
.comp_size = XSK_RING_CONS__DEFAULT_NUM_DESCS,
|
||||||
.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
|
.frame_size = XSK_UMEM__DEFAULT_FRAME_SIZE,
|
||||||
.flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG | XDP_UMEM_TX_SW_CSUM,
|
.flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG | XDP_UMEM_TX_SW_CSUM |
|
||||||
|
XDP_UMEM_TX_METADATA_LEN,
|
||||||
.tx_metadata_len = sizeof(struct xsk_tx_metadata),
|
.tx_metadata_len = sizeof(struct xsk_tx_metadata),
|
||||||
};
|
};
|
||||||
__u32 idx;
|
__u32 idx;
|
||||||
|
@ -14,9 +14,9 @@ typedef int *ptr_arr_t[6];
|
|||||||
|
|
||||||
typedef int *ptr_multiarr_t[7][8][9][10];
|
typedef int *ptr_multiarr_t[7][8][9][10];
|
||||||
|
|
||||||
typedef int * (*fn_ptr_arr_t[11])();
|
typedef int * (*fn_ptr_arr_t[11])(void);
|
||||||
|
|
||||||
typedef int * (*fn_ptr_multiarr_t[12][13])();
|
typedef int * (*fn_ptr_multiarr_t[12][13])(void);
|
||||||
|
|
||||||
struct root_struct {
|
struct root_struct {
|
||||||
arr_t _1;
|
arr_t _1;
|
||||||
|
@ -100,7 +100,7 @@ typedef void (*printf_fn_t)(const char *, ...);
|
|||||||
* `int -> char *` function and returns pointer to a char. Equivalent:
|
* `int -> char *` function and returns pointer to a char. Equivalent:
|
||||||
* typedef char * (*fn_input_t)(int);
|
* typedef char * (*fn_input_t)(int);
|
||||||
* typedef char * (*fn_output_outer_t)(fn_input_t);
|
* typedef char * (*fn_output_outer_t)(fn_input_t);
|
||||||
* typedef const fn_output_outer_t (* fn_output_inner_t)();
|
* typedef const fn_output_outer_t (* fn_output_inner_t)(void);
|
||||||
* typedef const fn_output_inner_t fn_ptr_arr2_t[5];
|
* typedef const fn_output_inner_t fn_ptr_arr2_t[5];
|
||||||
*/
|
*/
|
||||||
/* ----- START-EXPECTED-OUTPUT ----- */
|
/* ----- START-EXPECTED-OUTPUT ----- */
|
||||||
@ -127,7 +127,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int);
|
|||||||
|
|
||||||
typedef char * (*fn_ptr_arr1_t[10])(int **);
|
typedef char * (*fn_ptr_arr1_t[10])(int **);
|
||||||
|
|
||||||
typedef char * (* (* const fn_ptr_arr2_t[5])())(char * (*)(int));
|
typedef char * (* (* const fn_ptr_arr2_t[5])(void))(char * (*)(int));
|
||||||
|
|
||||||
struct struct_w_typedefs {
|
struct struct_w_typedefs {
|
||||||
int_t a;
|
int_t a;
|
||||||
|
Loading…
Reference in New Issue
Block a user