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]
Date: Wed, 20 Sep 2023 14:11:19 -0700
From: Kui-Feng Lee <sinquersw@...il.com>
To: Jakub Sitnicki <jakub@...udflare.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, kernel-team@...udflare.com,
 Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
 Andrii Nakryiko <andrii@...nel.org>,
 John Fastabend <john.fastabend@...il.com>,
 Cong Wang <cong.wang@...edance.com>
Subject: Re: [PATCH bpf] bpf, sockmap: Reject sk_msg egress redirects to
 non-TCP sockets



On 9/20/23 13:59, Jakub Sitnicki wrote:
> On Wed, Sep 20, 2023 at 11:19 AM -07, Kui-Feng Lee wrote:
>> On 9/20/23 03:20, Jakub Sitnicki wrote:
>>> diff --git a/net/core/sock_map.c b/net/core/sock_map.c
>>> index cb11750b1df5..4292c2ed1828 100644
>>> --- a/net/core/sock_map.c
>>> +++ b/net/core/sock_map.c
>>> @@ -668,6 +668,8 @@ BPF_CALL_4(bpf_msg_redirect_map, struct sk_msg *, msg,
>>>    	sk = __sock_map_lookup_elem(map, key);
>>>    	if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
>>>    		return SK_DROP;
>>> +	if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
>>> +		return SK_DROP;
>>>      	msg->flags = flags;
>>>    	msg->sk_redir = sk;
>>> @@ -1267,6 +1269,8 @@ BPF_CALL_4(bpf_msg_redirect_hash, struct sk_msg *, msg,
>>>    	sk = __sock_hash_lookup_elem(map, key);
>>>    	if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
>>>    		return SK_DROP;
>>> +	if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
>>> +		return SK_DROP;
>>>      	msg->flags = flags;
>>>    	msg->sk_redir = sk;
>>
>> Just be curious! Can it happen to other socket types?
>> I mean to redirect a msg from a sk of any type to one of another type.
> 
> Today sk_msg redirects are implemented only for tcp4 and tcp6.
> 
> Here's a full matrix of what redirects are supported [1].
> 
> [1] https://gist.github.com/jsitnicki/578fdd614d181bed2b02922b17972b4e

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ