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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181120.150122.966909501495254169.davem@davemloft.net>
Date:   Tue, 20 Nov 2018 15:01:22 -0800 (PST)
From:   David Miller <davem@...emloft.net>
To:     dcaratti@...hat.com
Cc:     edumazet@...gle.com, jhs@...atatu.com, xiyou.wangcong@...il.com,
        jiri@...nulli.us, netdev@...r.kernel.org, ivecera@...hat.com
Subject: Re: [PATCH net v2] net/sched: act_police: fix race condition on
 state variables

From: Davide Caratti <dcaratti@...hat.com>
Date: Tue, 20 Nov 2018 22:18:44 +0100

> after 'police' configuration parameters were converted to use RCU instead
> of spinlock, the state variables used to compute the traffic rate (namely
> 'tcfp_toks', 'tcfp_ptoks' and 'tcfp_t_c') are erroneously read/updated in
> the traffic path without any protection.
> 
> Use a dedicated spinlock to avoid race conditions on these variables, and
> ensure proper cache-line alignment. In this way, 'police' is still faster
> than what we observed when 'tcf_lock' was used in the traffic path _ i.e.
> reverting commit 2d550dbad83c ("net/sched: act_police: don't use spinlock
> in the data path"). Moreover, we preserve the throughput improvement that
> was obtained after 'police' started using per-cpu counters, when 'avrate'
> is used instead of 'rate'.
> 
> Changes since v1 (thanks to Eric Dumazet):
> - call ktime_get_ns() before acquiring the lock in the traffic path
> - use a dedicated spinlock instead of tcf_lock
> - improve cache-line usage
> 
> Fixes: 2d550dbad83c ("net/sched: act_police: don't use spinlock in the data path")
> Reported-and-suggested-by: Eric Dumazet <eric.dumazet@...il.com>
> Signed-off-by: Davide Caratti <dcaratti@...hat.com>

Applied.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ