WSL2-Linux-Kernel/arch
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
..
alpha alpha: fix percpu build breakage 2009-06-30 18:55:59 -07:00
arm [ARM] 5562/2: at91: add gpio button support for at91sam9g20ek 2009-06-29 11:19:27 +01:00
avr32 Move FAULT_FLAG_xyz into handle_mm_fault() callers 2009-06-21 13:08:22 -07:00
blackfin Blackfin: fix dma-mapping build errors 2009-06-22 22:31:00 -04:00
cris Merge branch 'for-linus' of git://www.jni.nu/cris 2009-06-23 10:47:01 -07:00
frv FRV: Add basic performance counter support 2009-07-01 19:38:31 -07:00
h8300 h8/300: fix incorrect "select" directives in arch/h8300/Kconfig.cpu. 2009-06-23 12:50:05 -07:00
ia64 net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functions 2009-07-05 19:16:04 -07:00
m32r Move FAULT_FLAG_xyz into handle_mm_fault() callers 2009-06-21 13:08:22 -07:00
m68k Move FAULT_FLAG_xyz into handle_mm_fault() callers 2009-06-21 13:08:22 -07:00
m68knommu ptrace: remove PT_DTRACE from m68k, m68knommu 2009-06-18 13:03:48 -07:00
microblaze Move FAULT_FLAG_xyz into handle_mm_fault() callers 2009-06-21 13:08:22 -07:00
mips net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
mn10300 Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes 2009-07-04 09:46:01 -07:00
parisc parisc: use generic atomic64 on 32-bit 2009-07-03 03:34:13 +00:00
powerpc Merge branch 'perfcounters-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-06-30 19:02:59 -07:00
s390 KVM: s390: Allow stfle instruction in the guest 2009-06-28 14:10:30 +03:00
sh sh: Fix compiler error and include the definition of IS_ERR_VALUE 2009-07-02 03:32:48 +09:00
sparc net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
um net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functions 2009-07-05 19:16:04 -07:00
x86 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-07-09 20:18:24 -07:00
xtensa net: convert remaining non-symbolic return values in ndo_start_xmit() functions 2009-07-05 19:23:38 -07:00
.gitignore
Kconfig gcov: add gcov profiling infrastructure 2009-06-18 13:03:57 -07:00