diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 07:26:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-07-15 11:53:39 -0400 |
commit | 1dacc76d0014a034b8aca14237c127d7c19d7726 (patch) | |
tree | d3ba044578fab9076ef4a73694fa7d23d4a50969 /net/Kconfig | |
parent | 4f45b2cd4e78b5e49d7d41548345b879d3fdfeae (diff) |
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>
Diffstat (limited to 'net/Kconfig')
-rw-r--r-- | net/Kconfig | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/Kconfig b/net/Kconfig index 7051b971067..041c35edb76 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -23,6 +23,26 @@ menuconfig NET | |||
23 | 23 | ||
24 | if NET | 24 | if NET |
25 | 25 | ||
26 | config WANT_COMPAT_NETLINK_MESSAGES | ||
27 | bool | ||
28 | help | ||
29 | This option can be selected by other options that need compat | ||
30 | netlink messages. | ||
31 | |||
32 | config COMPAT_NETLINK_MESSAGES | ||
33 | def_bool y | ||
34 | depends on COMPAT | ||
35 | depends on WIRELESS_EXT || WANT_COMPAT_NETLINK_MESSAGES | ||
36 | help | ||
37 | This option makes it possible to send different netlink messages | ||
38 | to tasks depending on whether the task is a compat task or not. To | ||
39 | achieve this, you need to set skb_shinfo(skb)->frag_list to the | ||
40 | compat skb before sending the skb, the netlink code will sort out | ||
41 | which message to actually pass to the task. | ||
42 | |||
43 | Newly written code should NEVER need this option but do | ||
44 | compat-independent messages instead! | ||
45 | |||
26 | menu "Networking options" | 46 | menu "Networking options" |
27 | 47 | ||
28 | source "net/packet/Kconfig" | 48 | source "net/packet/Kconfig" |