My WLI-UC-GNM up crash
John-Mark Gurney
jmg at funkthat.com
Mon Jul 29 21:15:54 UTC 2013
Hans Petter Selasky wrote this message on Mon, Jul 29, 2013 at 19:58 +0200:
> The aligned will make sure that the structure gets padded properly to the size specified. Only on ARM/MIPS etc, structures get automatically aligned according to the element in the structure requiring the greatest alignment. I've test-compiled the USB WLAN drivers, and the aligned makes a difference. The problem is that the radiotap header skews some following elements, so that they are no longer aligned. The radiotap header itself is packed, and this is not a problem.
Ouch, has anyone looked at the code that caused this?
in ieee80211_radiotap.c, it looks like the original fault was in either
set_channel, or set_xchannel, and both do (the equivalent of):
struct {
uint16_t freq;
uint16_t flags;
} *rc = p;
rc->freq = htole16(c->ic_freq);
rc->flags = htole16(c->ic_flags);
And then there is complicated code that calculates offsets, etc, in
radiotap_offset.. What we probably really need is to mark the above
as __packed or equiv so that we don't assume that the passed in pointer
is aligned...
The whole management of this radiochan and radiotap_offset is pretty
nasty... If marking the structures __packed works, it's probably
because two bugs are offsetting, and magicly making things align
again...
> -----Original message-----
> > From:Warner Losh <imp at bsdimp.com <mailto:imp at bsdimp.com> >
> > Sent: Monday 29th July 2013 17:04
> > To: Adrian Chadd <adrian at freebsd.org <mailto:adrian at freebsd.org> >
> > Cc: Hans Petter Selasky <hans.petter.selasky at bitfrost.no <mailto:hans.petter.selasky at bitfrost.no> >; freebsd-arm <freebsd-arm at freebsd.org <mailto:freebsd-arm at freebsd.org> >; freebsd-wireless at freebsd.org <mailto:freebsd-wireless at freebsd.org>
> > Subject: Re: My WLI-UC-GNM up crash
> >
> > Aren't structures already aligned to 4 bytes when placed inside other structures (unless marked __packed)?
> >
> > Warner
> >
> > On Jul 28, 2013, at 11:50 AM, Adrian Chadd wrote:
> >
> > > As long as that results in the radiotap structures being 4 or 8 byte
> > > padded when it's embedded in the softc - then yes, indeed.
> > >
> > > Xiao, can you try?
> > >
> > >
> > > -adrian
> > >
> > > On 28 July 2013 03:35, Hans Petter Selasky <hps at bitfrost.no <mailto:hps at bitfrost.no> > wrote:
> > >> Hi,
> > >>
> > >> Can you try the attached patch?
> > >>
> > >> --HPS
> > > _______________________________________________
> > > freebsd-arm at freebsd.org <mailto:freebsd-arm at freebsd.org> mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-arm <http://lists.freebsd.org/mailman/listinfo/freebsd-arm>
> > > To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org <mailto:freebsd-arm-unsubscribe at freebsd.org> "
> >
> >
>
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-wireless
mailing list