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-next>] [day] [month] [year] [list]
Date:	Mon, 06 Jun 2011 11:23:40 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Jens Rottmann <JRottmann@...PERTEmbedded.de>
Cc:	Martin Hein <MHein@...PERTEmbedded.com>,
	Jeff Garzik <jgarzik@...hat.com>,
	netdev <netdev@...r.kernel.org>
Subject: Re: ethtool -E rejects magic >= 80000000

On Mon, 2011-06-06 at 12:10 +0200, Jens Rottmann wrote:
> Hi,
> 
> we tripped over the fact that commands like e.g.
> 
> ethtool -E ... magic 0xCCCC8086 ...
> 
> are no longer accepted with a new Debian though the same worked on an
> ancient Slackware. Current ethtool now firmly insists on a -0x80000000
> .. +0x7FFFFFFF range for "magic", so instead of the PCI ID (usually) you
> have to provide its negative two's complement:
> 
> ethtool -E ... magic -0x33337F7A ...
> 
> This works, but is rather nonintuitive and akward.

Indeed.  I would think that the input format for the magic value on the
command line should match the output format from 'ethtool -e', except
that the magic value is never output!

> A bit of gitweb browsing led us to a commit dated 25 Jun 2010, which we
> think triggered the new behaviour:
> 
> ethtool: Parse integers into variables of different sizes and byte orders
> 
> The commit changed
> 
> { "magic", CMDL_INT, &seeprom_magic, NULL },
> ...
> case CMDL_INT: {
> 	*p = get_int(argp[i],0);
> 
> into
> 
> { "magic", CMDL_S32, &seeprom_magic, NULL },
> ...
> case CMDL_S32: {
> 	s32 *p = info[idx].wanted_val;
> 	*p = get_int_range(argp[i], 0, -0x80000000LL, 0x7fffffff);
> 
> which introduces a strict range check. The kernel sources' struct
> ethtool_eeprom defines __u32 magic, so probably ethtool's "magic" should
> be CMDL_U32 instead. (Meaning it should have been CMDL_UINT originally,
> i.e. the patch did not cause the problem, but only made it visible.)

Yes, I agree with this.

Of course, some users and scripts may now assume that this parameter is
signed.  So perhaps the range should be -0x80000000 to 0xffffffff (union
of s32 and u32 ranges)?  I'm not sure whether it's worth the trouble to
do this.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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