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: <5d317380-142e-c364-2793-68d0bed9efcd@iogearbox.net>
Date:   Tue, 2 Jun 2020 17:35:54 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Lorenz Bauer <lmb@...udflare.com>
Cc:     Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Alan Maguire <alan.maguire@...cle.com>,
        bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf 2/3] bpf: Add csum_level helper for fixing up csum
 levels

On 6/2/20 5:19 PM, Lorenz Bauer wrote:
> On Tue, 2 Jun 2020 at 15:58, Daniel Borkmann <daniel@...earbox.net> wrote:
>>
>> Add a bpf_csum_level() helper which BPF programs can use in combination
>> with bpf_skb_adjust_room() when they pass in BPF_F_ADJ_ROOM_NO_CSUM_RESET
>> flag to the latter to avoid falling back to CHECKSUM_NONE.
>>
>> The bpf_csum_level() allows to adjust CHECKSUM_UNNECESSARY skb->csum_levels
>> via BPF_CSUM_LEVEL_{INC,DEC} which calls __skb_{incr,decr}_checksum_unnecessary()
>> on the skb. The helper also allows a BPF_CSUM_LEVEL_RESET which sets the skb's
>> csum to CHECKSUM_NONE as well as a BPF_CSUM_LEVEL_QUERY to just return the
>> current level. Without this helper, there is no way to otherwise adjust the
>> skb->csum_level. I did not add an extra dummy flags as there is plenty of free
>> bitspace in level argument itself iff ever needed in future.
>>
>> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
>> ---
>>   include/uapi/linux/bpf.h       | 43 +++++++++++++++++++++++++++++++++-
>>   net/core/filter.c              | 38 ++++++++++++++++++++++++++++++
>>   tools/include/uapi/linux/bpf.h | 43 +++++++++++++++++++++++++++++++++-
>>   3 files changed, 122 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 3ba2bbbed80c..46622901cba7 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
>> @@ -3220,6 +3220,38 @@ union bpf_attr {
>>    *             calculation.
>>    *     Return
>>    *             Requested value, or 0, if flags are not recognized.
>> + *
>> + * int bpf_csum_level(struct sk_buff *skb, u64 level)
> 
> u64 flags? We can also stuff things into level I guess.

Yeah, I did mention it in the commit log. There is plenty of bit space to extend
with flags in there iff ever needed. Originally, helper was called bpf_csum_adjust()
but then renamed into bpf_csum_level() to be more 'topic specific' (aka do one thing
and do it well...) and avoid future api overloading, so if necessary level can be
used since I don't think the enum will be extended much further from what we have
here anyway.

[...]
> 
> Acked-by: Lorenz Bauer <lmb@...udflare.com>

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ