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: <1326396510.6198.12.camel@lade.trondhjem.org>
Date:	Thu, 12 Jan 2012 14:28:30 -0500
From:	Trond Myklebust <Trond.Myklebust@...app.com>
To:	Tom Tucker <tom@...ngridcomputing.com>
Cc:	"J. Bruce Fields" <bfields@...ldses.org>,
	Dan Carpenter <dan.carpenter@...cle.com>,
	"David S. Miller" <davem@...emloft.net>, linux-nfs@...r.kernel.org,
	netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [patch] svcrdma: endian bug in send_write_chunks()

On Thu, 2012-01-12 at 13:24 -0600, Tom Tucker wrote: 
> On 1/12/12 1:15 PM, Trond Myklebust wrote:
> > On Thu, 2012-01-12 at 11:21 -0500, J. Bruce Fields wrote:
> >> On Thu, Jan 12, 2012 at 09:47:22AM +0300, Dan Carpenter wrote:
> >>> Sparse complains because arg_ch->rs_length is declared as network
> >>> endian but we're treating it as CPU endian.
> >> This looks like it would actually change behavior on a little endian
> >> architecture, so how did this work before?
> >>
> >> > From some quick grepping, I see assignments both of the form
> >>
> >> 	...rs_length = ntohl(...)
> >>
> >> and
> >>
> >> 	...rs_length = htonl(...)
> >>
> >> but only see one declaration for a field named rs_length.
> >>
> >> So my best guess would be that the code is ugly but working as is, and
> >> needs cleanup by someone who knows how this field was intended to be
> >> used.
> > It looks to me as if rs_handle and rs_offset are being similarly abused.
> > Basically, we need a serious clean up in svc_rdma_marshall.c to separate
> > out those variables that are in XDR-encoded form and those that are not.
> >
> The abuse is taking place because the marshal/unmarshall is being done 
> in-place and it seemed wasteful at the time to add a chunk of memory to 
> preserve the aesthetic. A union would 'work', but you still wouldn't 
> 'know' whether the data was NBO or not by where it was -- which seems like 
> the intent of the __beXX in the first place.

These are not variables that are used in hundreds of different places:
why not just do the conversion from big-endian to cpu-endian when you
actually need to use them?

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@...app.com
www.netapp.com

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