[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <18ae853a-9456-b017-f088-4aff056efafc@fb.com>
Date: Tue, 15 Sep 2020 13:14:56 -0700
From: Yonghong Song <yhs@...com>
To: Martin KaFai Lau <kafai@...com>
CC: <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, <kernel-team@...com>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH bpf] bpf: bpf_skc_to_* casting helpers require a NULL
check on sk
On 9/15/20 1:04 PM, Martin KaFai Lau wrote:
> On Tue, Sep 15, 2020 at 11:58:01AM -0700, Yonghong Song wrote:
>>
>>
>> On 9/15/20 11:29 AM, Martin KaFai Lau wrote:
>>> The bpf_skc_to_* type casting helpers are available to
>>> BPF_PROG_TYPE_TRACING. The traced PTR_TO_BTF_ID may be NULL.
>>> For example, the skb->sk may be NULL. Thus, these casting helpers
>>> need to check "!sk" also and this patch fixes them.
>>>
>>> Fixes: 0d4fad3e57df ("bpf: Add bpf_skc_to_udp6_sock() helper")
>>> Fixes: 478cfbdf5f13 ("bpf: Add bpf_skc_to_{tcp, tcp_timewait, tcp_request}_sock() helpers")
>>> Fixes: af7ec1383361 ("bpf: Add bpf_skc_to_tcp6_sock() helper")
>>> Signed-off-by: Martin KaFai Lau <kafai@...com>
>>
>> Thanks for the fix!
>>
>> Acked-by: Yonghong Song <yhs@...com>
> Thanks for the review. A follow up question.
> Is PTR_TO_BTF_ID_OR_NULL still needed?
I would still like to preserve PTR_TO_BTF_ID_OR_NULL vs. PTR_TO_BTF_ID
difference for ctx arguments. PTR_TO_BTF_ID_OR_NULL means a NULL check
is required and PTR_TO_BTF_ID means NULL check is not required.
Powered by blists - more mailing lists