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:	Wed, 05 Jun 2013 12:37:37 -0700
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] net_sched: add 64bit rate estimators

On Wed, 2013-06-05 at 19:55 +0100, Ben Hutchings wrote:
> On Tue, 2013-06-04 at 22:00 -0700, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@...gle.com>
> > 
> > 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.

Its exported to userland so __packed is not available. Or has this been
changed lately ?

This structure is only used in very slow path, in the rate estimator
thing, so the unaligned accesses are not a problem at all.

I made this choice to not increase sizeof(struct Qdisc) and the
alignments as well.

If you think there is an issue with userland, we could use a
gnet_stats_rate_est64_packed in kernel, and a gnet_stats_rate_est64 in
userland.



--
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