[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7076@saturn3.aculab.com>
Date: Mon, 29 Oct 2012 15:07:07 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "David Miller" <davem@...emloft.net>, <nhorman@...driver.com>
Cc: <vyasevich@...il.com>, <netdev@...r.kernel.org>,
<linux-sctp@...r.kernel.org>
Subject: RE: [PATCH] sctp: Clean up type-punning in sctp_cmd_t union
> > On Fri, Oct 26, 2012 at 03:12:11PM -0400, Vlad Yasevich wrote:
> >> Look at commit 19c7e9ee that introduced this. I don't remember all
> >> the details any more, but the problem only occurred on ia64
> >> (probably due its speculative load handling).
> >>
> >> -vlad
> >>
> > Thanks Vlad, I'll have a look see.
>
> Ok, so this IA64 issue is all about accesses to uninitialized memory.
>
> I think Neil's change is thus the most desirable thing to do. Simple
> memset the object to zero.
I'd guess it an artifact of the C memory aliasing rules and unions.
If you write to a location as a one type but read it as another type
(and neither type is char) then the compiler is generally allowed to
schedule the read before the write (and may even optimise the write away).
This shouldn't happen if the fields are both members of the same union,
but casting some other address to a 'union *' separately for the
write and read isn't enough.
This probably means that this entire type-punning argument passing
scheme is actually broken.
David
--
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