linux/net/wireless
Johannes Berg 1dacc76d00 net/compat/wext: send different messages to compat tasks
Wireless extensions have the unfortunate problem that events
are multicast netlink messages, and are not independent of
pointer size. Thus, currently 32-bit tasks on 64-bit platforms
cannot properly receive events and fail with all kinds of
strange problems, for instance wpa_supplicant never notices
disassociations, due to the way the 64-bit event looks (to a
32-bit process), the fact that the address is all zeroes is
lost, it thinks instead it is 00:00:00:00:01:00.

The same problem existed with the ioctls, until David Miller
fixed those some time ago in an heroic effort.

A different problem caused by this is that we cannot send the
ASSOCREQIE/ASSOCRESPIE events because sending them causes a
32-bit wpa_supplicant on a 64-bit system to overwrite its
internal information, which is worse than it not getting the
information at all -- so we currently resort to sending a
custom string event that it then parses. This, however, has a
severe size limitation we are frequently hitting with modern
access points; this limitation would can be lifted after this
patch by sending the correct binary, not custom, event.

A similar problem apparently happens for some other netlink
users on x86_64 with 32-bit tasks due to the alignment for
64-bit quantities.

In order to fix these problems, I have implemented a way to
send compat messages to tasks. When sending an event, we send
the non-compat event data together with a compat event data in
skb_shinfo(main_skb)->frag_list. Then, when the event is read
from the socket, the netlink code makes sure to pass out only
the skb that is compatible with the task. This approach was
suggested by David Miller, my original approach required
always sending two skbs but that had various small problems.

To determine whether compat is needed or not, I have used the
MSG_CMSG_COMPAT flag, and adjusted the call path for recv and
recvfrom to include it, even if those calls do not have a cmsg
parameter.

I have not solved one small part of the problem, and I don't
think it is necessary to: if a 32-bit application uses read()
rather than any form of recvmsg() it will still get the wrong
(64-bit) event. However, neither do applications actually do
this, nor would it be a regression.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-15 08:53:39 -07:00
..
core.c cfg80211: disallow configuring unsupported interfaces 2009-07-10 15:02:33 -04:00
core.h cfg80211: clean up naming once and for all 2009-07-10 15:02:33 -04:00
debugfs.c cfg80211: clean up naming once and for all 2009-07-10 15:02:33 -04:00
debugfs.h cfg80211: clean up naming once and for all 2009-07-10 15:02:33 -04:00
ibss.c cfg80211: fix locking 2009-07-10 15:02:32 -04:00
Kconfig cfg80211: implement iwpower 2009-07-10 15:01:51 -04:00
lib80211_crypt_ccmp.c lib80211: silence excessive crypto debugging messages 2009-03-16 18:01:58 -04:00
lib80211_crypt_tkip.c lib80211: silence excessive crypto debugging messages 2009-03-16 18:01:58 -04:00
lib80211_crypt_wep.c lib80211: absorb crypto bits from net/ieee80211 2008-11-21 11:08:17 -05:00
lib80211.c lib80211: consolidate crypt init routines 2008-11-21 11:08:17 -05:00
Makefile cfg80211: managed mode wext compatibility 2009-07-10 15:01:51 -04:00
mlme.c cfg80211: fix locking 2009-07-10 15:02:32 -04:00
nl80211.c genetlink: make netns aware 2009-07-12 14:03:27 -07:00
nl80211.h cfg80211: fix locking 2009-07-10 15:02:32 -04:00
radiotap.c wireless: use get/put_unaligned_* helpers 2008-05-14 16:29:32 -04:00
reg.c cfg80211: clean up naming once and for all 2009-07-10 15:02:33 -04:00
reg.h cfg80211: make __regulatory_hint() static 2009-02-27 14:52:59 -05:00
scan.c cfg80211: fix locking 2009-07-10 15:02:32 -04:00
sme.c cfg80211: clean up naming once and for all 2009-07-10 15:02:33 -04:00
sysfs.c cfg80211: rename cfg80211_registered_device's idx to wiphy_idx 2009-02-27 14:52:54 -05:00
sysfs.h [WIRELESS] cfg80211: New wireless config infrastructure. 2007-04-25 22:29:41 -07:00
util.c cfg80211: assimilate and export ieee80211_bss_get_ie 2009-07-10 15:01:53 -04:00
wext-compat.c cfg80211: fix MFP bug, sparse warnings 2009-07-10 15:02:32 -04:00
wext-sme.c cfg80211: fix locking 2009-07-10 15:02:32 -04:00
wext.c net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00