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
| ||
|
Date: Wed, 06 Jun 2012 10:45:41 +0200 From: Eric Dumazet <eric.dumazet@...il.com> To: Jason Wang <jasowang@...hat.com> Cc: netdev@...r.kernel.org, rusty@...tcorp.com.au, linux-kernel@...r.kernel.org, virtualization@...ts.linux-foundation.org, mst@...hat.com, Stephen Hemminger <shemminger@...tta.com> Subject: Re: [PATCH] virtio-net: fix a race on 32bit arches On Wed, 2012-06-06 at 10:35 +0200, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@...gle.com> > > commit 3fa2a1df909 (virtio-net: per cpu 64 bit stats (v2)) added a race > on 32bit arches. > > We must use separate syncp for rx and tx path as they can be run at the > same time on different cpus. Thus one sequence increment can be lost and > readers spin forever. > > Signed-off-by: Eric Dumazet <edumazet@...gle.com> > Cc: Stephen Hemminger <shemminger@...tta.com> > Cc: Michael S. Tsirkin <mst@...hat.com> > Cc: Jason Wang <jasowang@...hat.com> > --- Just to make clear : even using percpu stats/syncp, we have no guarantee that write_seqcount_begin() is done with one instruction. [1] It is OK on x86 if "incl" instruction is generated by the compiler, but on a RISC cpu, the "load memory,%reg ; inc %reg ; store %reg,memory" can be interrupted. So if you are 100% sure all paths are safe against preemption/BH, then this patch is not needed, but a big comment in the code would avoid adding possible races in the future. [1] If done with one instruction, we still have a race, since a reader might see an even sequence and conclude no writer is inside the critical section. So read values could be wrong. -- 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