android_kernel_xiaomi_sm8350/arch/mips
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
..
alchemy MIPS: Alchemy: devboards: Convert to gpio calls. 2009-06-17 11:06:29 +01:00
ar7 MIPS: Add support for Texas Instruments AR7 System-on-a-Chip 2009-07-03 15:45:23 +01:00
basler/excite
bcm47xx
boot
cavium-octeon MIPS: Reorganize Cavium OCTEON PCI support. 2009-07-03 15:45:29 +01:00
cobalt Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
configs MIPS: Add support for Texas Instruments AR7 System-on-a-Chip 2009-07-03 15:45:23 +01:00
dec
emma
fw
gt64120/wrppmc Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
include/asm MIPS: Fix CONFIG_FLATMEM version of pfn_valid() 2009-07-03 15:45:29 +01:00
jazz MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
kernel net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
lasat
lemote/lm2e
lib MIPS: Fix __ndelay build error and add 'ull' suffix for 32-bit kernel 2009-06-17 11:06:24 +01:00
math-emu
mipssim MIPS: MIPSsim: Fix build error if MSC01E_INT_BASE is undefined. 2009-06-24 18:34:39 +01:00
mm MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
mti-malta MIPS: CMP: Move gcmp_probe to before the SMP ops 2009-07-03 15:45:26 +01:00
nxp
oprofile
pci MIPS: Reorganize Cavium OCTEON PCI support. 2009-07-03 15:45:29 +01:00
pmc-sierra MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
power MIPS: Hibernation: Remove SMP TLB and cacheflushing code. 2009-06-24 18:34:39 +01:00
rb532 MIPS: RB532: Check irq number when handling GPIO interrupts 2009-06-17 11:06:27 +01:00
sgi-ip22
sgi-ip27 MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
sgi-ip32
sibyte MIPS: Sibyte: Fix build error if CONFIG_SERIAL_SB1250_DUART is undefined. 2009-06-24 18:34:39 +01:00
sni MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
txx9 MIPS: TXx9: Add TX4939 RNG support 2009-06-17 11:06:27 +01:00
vr41xx Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
Kconfig MIPS: Allow suspend and hibernation again on uniprocessor kernels. 2009-07-03 15:45:28 +01:00
Kconfig.debug
Makefile MIPS: Add support for Texas Instruments AR7 System-on-a-Chip 2009-07-03 15:45:23 +01:00