lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220517012055.loesbaunau2bxbt5@kafai-mbp.dhcp.thefacebook.com>
Date:   Mon, 16 May 2022 18:20:55 -0700
From:   Martin KaFai Lau <kafai@...com>
To:     Geliang Tang <geliang.tang@...e.com>,
        Mat Martineau <mathew.j.martineau@...ux.intel.com>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org, mptcp@...ts.linux.dev,
        Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: Re: [PATCH bpf-next v4 4/7] selftests/bpf: test bpf_skc_to_mptcp_sock

On Fri, May 13, 2022 at 03:48:24PM -0700, Mat Martineau wrote:
[ ... ]
> diff --git a/tools/testing/selftests/bpf/progs/mptcp_sock.c b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> index bc09dba0b078..3feb7ff578e2 100644
> --- a/tools/testing/selftests/bpf/progs/mptcp_sock.c
> +++ b/tools/testing/selftests/bpf/progs/mptcp_sock.c
> @@ -7,6 +7,7 @@
>  #include "bpf_tcp_helpers.h"
>  
>  char _license[] SEC("license") = "GPL";
> +extern bool CONFIG_MPTCP __kconfig;
>  
>  struct mptcp_storage {
>  	__u32 invoked;
> @@ -24,6 +25,7 @@ SEC("sockops")
>  int _sockops(struct bpf_sock_ops *ctx)
>  {
>  	struct mptcp_storage *storage;
> +	struct mptcp_sock *msk;
>  	int op = (int)ctx->op;
>  	struct tcp_sock *tsk;
>  	struct bpf_sock *sk;
> @@ -41,11 +43,24 @@ int _sockops(struct bpf_sock_ops *ctx)
>  		return 1;
>  
>  	is_mptcp = bpf_core_field_exists(tsk->is_mptcp) ? tsk->is_mptcp : 0;
> -	storage = bpf_sk_storage_get(&socket_storage_map, sk, 0,
> -				     BPF_SK_STORAGE_GET_F_CREATE);
> -	if (!storage)
> -		return 1;
> +	if (!is_mptcp) {
> +		storage = bpf_sk_storage_get(&socket_storage_map, sk, 0,
> +					     BPF_SK_STORAGE_GET_F_CREATE);
> +		if (!storage)
> +			return 1;
> +	} else {
> +		if (!CONFIG_MPTCP)
hmm... how is it possible ?  The above just tested "!is_mptcp".

> +			return 1;
> +
> +		msk = bpf_skc_to_mptcp_sock(sk);
> +		if (!msk)
> +			return 1;
>  
> +		storage = bpf_sk_storage_get(&socket_storage_map, msk, 0,
> +					     BPF_SK_STORAGE_GET_F_CREATE);
> +		if (!storage)
> +			return 1;
> +	}
>  	storage->invoked++;
>  	storage->is_mptcp = is_mptcp;
>  
> -- 
> 2.36.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ