android_kernel_xiaomi_sm8350/arch/mips/kernel
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
..
.gitignore
8250-platform.c
asm-offsets.c MIPS: Add hibernation support 2009-06-17 11:06:31 +01:00
binfmt_elfn32.c
binfmt_elfo32.c MIPS: 64-bit: Fix o32 core dump 2009-07-03 15:45:27 +01:00
branch.c
cevt-bcm1480.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
cevt-ds1287.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
cevt-gt641xx.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
cevt-r4k.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
cevt-sb1250.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
cevt-smtc.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
cevt-txx9.c MIPS: TXx9: micro optimization for clocksource and clock_event 2009-06-17 11:06:25 +01:00
cpu-bugs64.c
cpu-probe.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
csrc-bcm1480.c
csrc-ioasic.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
csrc-r4k.c
csrc-sb1250.c
early_printk.c
entry.S
genex.S
gpio_txx9.c
head.S
i8253.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
i8259.c
init_task.c mm: consolidate init_mm definition 2009-06-16 19:47:28 -07:00
irq_cpu.c
irq_txx9.c
irq-gic.c MIPS: CMP: Extend IPI handling to CPU number 2009-07-03 15:45:26 +01:00
irq-gt641xx.c Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
irq-msc01.c
irq-rm7000.c
irq-rm9000.c
irq.c
kgdb.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
kspd.c
linux32.c
machine_kexec.c
Makefile
mips_ksyms.c
mips-mt-fpaff.c
mips-mt.c
module.c module: cleanup FIXME comments about trimming exception table entries. 2009-06-12 21:47:05 +09:30
octeon_switch.S
proc.c MIPS: Outline udelay and fix a few issues. 2009-06-08 16:57:51 +01:00
process.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
ptrace32.c
ptrace.c
r4k_fpu.S
r4k_switch.S
r2300_fpu.S
r2300_switch.S
r6000_fpu.S
relocate_kernel.S
reset.c
rtlx.c
scall32-o32.S MIPS: Hookup new syscalls sys_rt_tgsigqueueinfo and sys_perf_counter_open. 2009-07-03 15:45:24 +01:00
scall64-64.S MIPS: Hookup new syscalls sys_rt_tgsigqueueinfo and sys_perf_counter_open. 2009-07-03 15:45:24 +01:00
scall64-n32.S net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
scall64-o32.S net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
setup.c
signal32.c
signal_n32.c
signal-common.h
signal.c
smp-cmp.c MIPS: CMP: activate CMP support 2009-07-03 15:45:26 +01:00
smp-mt.c
smp-up.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
smp.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
smtc-asm.S
smtc-proc.c
smtc.c MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
spram.c
stacktrace.c
sync-r4k.c MIPS: CMP: Update sync-r4k for current kernel 2009-07-03 15:45:27 +01:00
syscall.c
time.c
topology.c MIPS: Add arch generic CPU hotplug 2009-06-24 18:34:40 +01:00
traps.c MIPS: Move Cavium CP0 hwrena impl bits to cpu-feature-overrides.h 2009-06-17 11:06:31 +01:00
unaligned.c MIPS: Use force_sig when handling address errors. 2009-05-14 13:50:29 +01:00
vmlinux.lds.S
vpe.c MIPS: MT: Remove unnecessary semicolons 2009-07-03 15:45:23 +01:00
watch.c