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]
Date:	Thu, 6 Jun 2013 09:39:59 +0100
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Ben Hutchings" <bhutchings@...arflare.com>,
	"Eric Dumazet" <eric.dumazet@...il.com>
Cc:	"David Miller" <davem@...emloft.net>,
	"netdev" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next] net_sched: add 64bit rate estimators

> > struct gnet_stats_rate_est contains u32 fields, so the byte per second
> > field can wrap at 34360Mbit.
> >
> > Add a new gnet_stats_rate_est64 structure to get 64bit bps field, and
> > switch the kernel to use this structure natively.
> [...]
> >  /**
> > + * struct gnet_stats_rate_est64 - rate estimator
> > + * @bps: current byte rate
> > + * @pps: current packet rate
> > + */
> > +struct gnet_stats_rate_est64 {
> > +	__u64	bps;
> > +	__u32	pps;
> > +} __attribute__ ((packed));
> [...]
> 
> Using attribute packed (which should be written as __packed) forces the
> alignment of each member and the structure as a whole to be 1.  For an
> architecture where unaligned access is expensive, gcc will make all
> reads and writes use byte operations.
> 
> I think you have to add a dummy __u32 member instead.

Or mark the __u64 with (IIRC) __attribute__((aligned,4))
so that gcc will generate two 32bit accesses rather than
the eight byte accesses is the structure is packed.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ