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: <1343059184.2626.11027.camel@edumazet-glaptop>
Date:	Mon, 23 Jul 2012 17:59:44 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Kevin Groeneveld <kgroeneveld@...il.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] ppp: add 64 bit stats

On Mon, 2012-07-23 at 11:25 -0400, Kevin Groeneveld wrote:

> I am curious if you can elaborate on what is racy about the patch, I
> am still trying to learn.  I assumed (possibly incorrectly) that
> because I was using percpu variables that the stats updates didn't
> need any extra synchronization as any concurrent updates would be on
> different cpus.
> 

ppp paths (xmit versus receive) are reentrant.

Therefore several cpus might do the
u64_stats_update_begin(&stats->syncp) at the same moment : one increment
could be lost forever, making all readers looping forever in
u64_stats_fetch_begin_bh()

include/linux/u64_stats_sync.h

* 3) Write side must ensure mutual exclusion or one seqcount update could
 *    be lost, thus blocking readers forever.
 *    If this synchronization point is not a mutex, but a spinlock or
 *    spinlock_bh() or disable_bh() :


> > I really doubt ppp is performance sensitive, it so doesnt need percpu
> > counter.
> >
> > If you really want 64bits stats on ppp, use proper synchronization
> > around u64 counters (but shared ones)
> 
> I will work on an updated patch without the percpu variables.  I
> didn't really think about servers with many cpus and many ppp sessions
> when I created the patch, I was mainly thinking about my Linksys
> router and other simple clients.  Many of the other network drivers
> use percpu variables for their stats so I just followed along.

Because there is one loopback device only, not thousands ;)

> 
> Would proper synchronization in this case just be wrapping the updates
> in a spin_lock/spin_unlock?

Would be fine (if the proper BH safe variant is used), or you could also
use atomic64_t.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ