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  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:   Thu, 7 May 2020 16:49:15 +0100
From:   Edward Cree <ecree@...arflare.com>
To:     Pablo Neira Ayuso <pablo@...filter.org>
CC:     <netdev@...r.kernel.org>, <davem@...emloft.net>,
        <netfilter-devel@...r.kernel.org>, <jiri@...nulli.us>,
        <kuba@...nel.org>
Subject: Re: [RFC PATCH net] net: flow_offload: simplify hw stats check
 handling

On 07/05/2020 16:32, Pablo Neira Ayuso wrote:
> On Thu, May 07, 2020 at 03:59:09PM +0100, Edward Cree wrote:
>> Make FLOW_ACTION_HW_STATS_DONT_CARE be all bits, rather than none, so that
>>  drivers and __flow_action_hw_stats_check can use simple bitwise checks.
> 
> You have have to explain why this makes sense in terms of semantics.
> 
> _DISABLED and _ANY are contradicting each other.
No, they aren't.  The DISABLED bit means "I will accept disabled", it doesn't
 mean "I insist on disabled".  What _does_ mean "I insist on disabled" is if
 the DISABLED bit is set and no other bits are.
So DISABLED | ANY means "I accept disabled; I also accept immediate or
 delayed".  A.k.a. "I don't care, do what you like".

>> In mlxsw we check for DISABLED first, because we'd rather save the counter
>>  resources in the DONT_CARE case.
> 
> And this also is breaking netfilter again.
> 
> Turning DONT_CARE gives us nothing back at all.
If you set DONT_CARE, then because that includes the DISABLED bit, you will
 get no counter on mlxsw.  I thought that was what netfilter wanted (no
 counters by default)?

On 07/05/2020 16:36, Pablo Neira Ayuso wrote:
> What if the driver does not support to disable counters?
> 
> It will have to check for _DONT_CARE here.
No, it would just go
    if (hw_stats & _IMMEDIATE) {
        configure_me_a_counter();
    } else {
        error("Only hw_stats_type immediate supported");
    }
And this will work fine, because _DONT_CARE & _IMMEDIATE == _IMMEDIATE,
 whereas _DISABLED & _IMMEDIATE == 0.

> And _DISABLED implies "bail out if you cannot disable".
See above; with the new semantics, the "bail out" condition is "if you
 cannot satisfy any of the bits that were set".  Which means if
 _DISABLED is the only bit set, and you cannot disable, you bail out;
 but if _DISABLED and (say) _IMMEDIATE are both set, that means "bail
 out if you don't support _IMMEDIATE *and* cannot disable" (i.e. if you
 only support _DELAYED).

-ed

Powered by blists - more mailing lists