* alignment issue between 32bit userland and 64bit kernel
@ 2007-07-09 12:00 Masakazu Mokuno
2007-07-09 12:03 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Masakazu Mokuno @ 2007-07-09 12:00 UTC (permalink / raw)
To: linux-wireless; +Cc: Geert Uytterhoeven, geoffrey.levand
Hi,
While developing the wireless support for PS3, I'd noticed there were alignment
issues if we issued some wireless ioctl from 32bit userland to 64bit
kernel (ppc64 PS3 does have).
- IW_EV_LCP_LEN in 32bit userland and 64bit kernel differ
- offsetof(struct iw_point, length) differ
The former issue could be fixed if we added 'packed' attribute to
iw_event structure, but it would break existing 64bit userland. I have
no idea to resolve latter issue because the first member of struct
iw_point is a pointer.
Does anyone have idea to fix these issues?
(except compiling all userland apps in 64bit mode...)
The following is the output from a test code on my PS3.
> # cat test.c
> #include <stdio.h>
> #include <netdb.h>
> #include <linux/wireless.h>
> /* packed version */
> struct iw_event_p {
> __u16 len;
> __u16 cmd;
> union iwreq_data u;
> } __attribute__((packed));
>
> int main(void)
> {
> printf("IW_EV_LCP_LEN=%d offset=%d,%d\n",
> IW_EV_LCP_LEN,
> offsetof(struct iw_event, u),
> offsetof(struct iw_event_p, u));
> printf("iw_event=%d iw_event_p=%d iwreq_data=%d\n",
> sizeof(struct iw_event),
> sizeof(struct iw_event_p),
> sizeof(union iwreq_data));
>
> /* --- */
>
> printf("iw_point=%d length=%d flags=%d\n",
> sizeof(struct iw_point),
> offsetof(struct iw_point, length),
> offsetof(struct iw_point, flags));
> return 0;
> }
> # cc -m64 -o test_64 test.c; cc -o test_32 test.c
> # ./test_64
> IW_EV_LCP_LEN=8 offset=8,4
> iw_event=24 iw_event_p=20 iwreq_data=16
> iw_point=16 length=8 flags=10
> # ./test_32
> IW_EV_LCP_LEN=4 offset=4,4
> iw_event=20 iw_event_p=20 iwreq_data=16
> iw_point=8 length=4 flags=6
> #
regards
--
Masakazu MOKUNO
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: alignment issue between 32bit userland and 64bit kernel
2007-07-09 12:00 alignment issue between 32bit userland and 64bit kernel Masakazu Mokuno
@ 2007-07-09 12:03 ` Johannes Berg
2007-07-09 16:46 ` Jean Tourrilhes
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2007-07-09 12:03 UTC (permalink / raw)
To: Masakazu Mokuno
Cc: linux-wireless, Geert Uytterhoeven, geoffrey.levand,
Jean Tourrilhes
[-- Attachment #1: Type: text/plain, Size: 962 bytes --]
Hi,
> While developing the wireless support for PS3, I'd noticed there were alignment
> issues if we issued some wireless ioctl from 32bit userland to 64bit
> kernel (ppc64 PS3 does have).
>
> - IW_EV_LCP_LEN in 32bit userland and 64bit kernel differ
> - offsetof(struct iw_point, length) differ
Yeah, we're aware of them.
> The former issue could be fixed if we added 'packed' attribute to
> iw_event structure, but it would break existing 64bit userland. I have
> no idea to resolve latter issue because the first member of struct
> iw_point is a pointer.
>
> Does anyone have idea to fix these issues?
> (except compiling all userland apps in 64bit mode...)
Jean wants to fix them in userspace. In fact, if you upgrade your
userspace to the really latest version it *should* work. wpa_supplicant
still doesn't work, nor do most distribution's versions of network
manager because the fixes haven't been backported.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 190 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: alignment issue between 32bit userland and 64bit kernel
2007-07-09 12:03 ` Johannes Berg
@ 2007-07-09 16:46 ` Jean Tourrilhes
2007-07-10 7:13 ` Masakazu Mokuno
0 siblings, 1 reply; 4+ messages in thread
From: Jean Tourrilhes @ 2007-07-09 16:46 UTC (permalink / raw)
To: Johannes Berg, Jouni Malinen
Cc: Masakazu Mokuno, linux-wireless, Geert Uytterhoeven,
geoffrey.levand
On Mon, Jul 09, 2007 at 02:03:23PM +0200, Johannes Berg wrote:
> Hi,
>
> > While developing the wireless support for PS3, I'd noticed there were alignment
> > issues if we issued some wireless ioctl from 32bit userland to 64bit
> > kernel (ppc64 PS3 does have).
> >
> > - IW_EV_LCP_LEN in 32bit userland and 64bit kernel differ
> > - offsetof(struct iw_point, length) differ
>
> Yeah, we're aware of them.
>
> > The former issue could be fixed if we added 'packed' attribute to
> > iw_event structure, but it would break existing 64bit userland. I have
> > no idea to resolve latter issue because the first member of struct
> > iw_point is a pointer.
> >
> > Does anyone have idea to fix these issues?
> > (except compiling all userland apps in 64bit mode...)
>
> Jean wants to fix them in userspace. In fact, if you upgrade your
> userspace to the really latest version it *should* work. wpa_supplicant
> still doesn't work, nor do most distribution's versions of network
> manager because the fixes haven't been backported.
You need :
Wireless Tools 29-pre20 or later
network manager 0.6.5 or later
Distro that have those versions :
Gentoo 2007.0
Debian unstable
Ubuntu Gutsy
OpenSuSE 10.3a5
We are getting there...
The situation with wpa_supplicant is most unfortunate,
fortunately x-supplicant should work properly, as it uses libiw.
> johannes
Thanks...
Jean
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: alignment issue between 32bit userland and 64bit kernel
2007-07-09 16:46 ` Jean Tourrilhes
@ 2007-07-10 7:13 ` Masakazu Mokuno
0 siblings, 0 replies; 4+ messages in thread
From: Masakazu Mokuno @ 2007-07-10 7:13 UTC (permalink / raw)
To: jt
Cc: Johannes Berg, Jouni Malinen, linux-wireless, Geert Uytterhoeven,
geoffrey.levand
Hi
On Mon, 9 Jul 2007 09:46:32 -0700
Jean Tourrilhes <jt@hpl.hp.com> wrote:
> > Jean wants to fix them in userspace. In fact, if you upgrade your
> > userspace to the really latest version it *should* work. wpa_supplicant
> > still doesn't work, nor do most distribution's versions of network
> > manager because the fixes haven't been backported.
>
> You need :
> Wireless Tools 29-pre20 or later
I downloaded Wireless Tools 29 pre22 and its iwlist worked fine on my
PS3.
Thank you.
--
Masakazu MOKUNO
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-10 7:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-09 12:00 alignment issue between 32bit userland and 64bit kernel Masakazu Mokuno
2007-07-09 12:03 ` Johannes Berg
2007-07-09 16:46 ` Jean Tourrilhes
2007-07-10 7:13 ` Masakazu Mokuno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox