2007-11-20 21:58:42

by David Miller

[permalink] [raw]
Subject: Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

From: Jean Tourrilhes <[email protected]>
Date: Tue, 20 Nov 2007 10:00:16 -0800

> This is a special version of Wireless Tools with some debug
> code. It will help me understand what's happening with the bus error
> while scanning and see what fix I can come up with.
> What you need to do is :
> o untar, make
> o ./iwlist scan > scan.log
> And send me the result.

I already know what's happening. Your "fixup" code is deferencing
the wrong part of the iw_point pointer, it only works on little
endian.

The fix is to remove the userland fixup code entirely and fixup
the stream in the kernel.


2007-11-20 22:38:32

by David Miller

[permalink] [raw]
Subject: Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

From: "John W. Linville" <[email protected]>
Date: Tue, 20 Nov 2007 17:08:50 -0500

> On Tue, Nov 20, 2007 at 01:58:42PM -0800, David Miller wrote:
> > From: Jean Tourrilhes <[email protected]>
> > Date: Tue, 20 Nov 2007 10:00:16 -0800
> >
> > > This is a special version of Wireless Tools with some debug
> > > code. It will help me understand what's happening with the bus error
> > > while scanning and see what fix I can come up with.
> > > What you need to do is :
> > > o untar, make
> > > o ./iwlist scan > scan.log
> > > And send me the result.
> >
> > I already know what's happening. Your "fixup" code is deferencing
> > the wrong part of the iw_point pointer, it only works on little
> > endian.
> >
> > The fix is to remove the userland fixup code entirely and fixup
> > the stream in the kernel.
>
> What a mess...are there going to be userland ABI implications of this?
> Hopefully the fact that 64-bit kernels were just broken is enough
> justifcation to fix this?

I think we'll be OK, to my knowledge only the wireless tools
tried to "correct" this in userspace and it only triggers
when a specific length check fails.

So if we fix the kernel, the length check won't trigger any more
and things will just work.

2007-11-20 22:41:18

by David Miller

[permalink] [raw]
Subject: Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

From: Jean Tourrilhes <[email protected]>
Date: Tue, 20 Nov 2007 14:16:36 -0800

> > The fix is to remove the userland fixup code entirely and fixup
> > the stream in the kernel.
>
> If you look at the overall picture, that would introduce a lot
> of complex and tricky code in the kernel, you would need pretty much
> the full parser (the metadata, you can get from the wext code). I'm
> not sure it's practical where the userspace fix is way simpler.

Please, just drop this, I'm going to fix it up since you seem
persistent on just passing the buck around and not realizing what the
core issue is.

You can't fix these problems in userspace, it's not elegant, and
it buys nothing but pain for users.

Everyone who writes some user code that uses wext ioctls has to do
this conversion crap, that's totally bogus and absolutely beyond
unreasonable.

2007-11-20 22:16:48

by Jean Tourrilhes

[permalink] [raw]
Subject: Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

On Tue, Nov 20, 2007 at 01:58:42PM -0800, David Miller wrote:
> From: Jean Tourrilhes <[email protected]>
> Date: Tue, 20 Nov 2007 10:00:16 -0800
>
> > This is a special version of Wireless Tools with some debug
> > code. It will help me understand what's happening with the bus error
> > while scanning and see what fix I can come up with.
> > What you need to do is :
> > o untar, make
> > o ./iwlist scan > scan.log
> > And send me the result.
>
> I already know what's happening. Your "fixup" code is deferencing
> the wrong part of the iw_point pointer, it only works on little
> endian.

I personally want to see the hard data, to make sure I fully
understand it. I'm sorry, but I'm not as experienced as you guys
dealing with endianess and alignement.
I'll try to look at it when I can find cycles for it.

> The fix is to remove the userland fixup code entirely and fixup
> the stream in the kernel.

If you look at the overall picture, that would introduce a lot
of complex and tricky code in the kernel, you would need pretty much
the full parser (the metadata, you can get from the wext code). I'm
not sure it's practical where the userspace fix is way simpler.
Also, it was my long term goal to fix the event code in the
kernel to always make it 32 bit aligned. That would be the simpler
solutions, but we can't get there immediately.

Regards,

Jean


2007-11-20 22:16:00

by John W. Linville

[permalink] [raw]
Subject: Re: zd1211rw (2.6.22 sparc64): unaligned access (do_rx)

On Tue, Nov 20, 2007 at 01:58:42PM -0800, David Miller wrote:
> From: Jean Tourrilhes <[email protected]>
> Date: Tue, 20 Nov 2007 10:00:16 -0800
>
> > This is a special version of Wireless Tools with some debug
> > code. It will help me understand what's happening with the bus error
> > while scanning and see what fix I can come up with.
> > What you need to do is :
> > o untar, make
> > o ./iwlist scan > scan.log
> > And send me the result.
>
> I already know what's happening. Your "fixup" code is deferencing
> the wrong part of the iw_point pointer, it only works on little
> endian.
>
> The fix is to remove the userland fixup code entirely and fixup
> the stream in the kernel.

What a mess...are there going to be userland ABI implications of this?
Hopefully the fact that 64-bit kernels were just broken is enough
justifcation to fix this?

John
--
John W. Linville
[email protected]