linux/arch/arm
Alexei Starovoitov d45ed4a4e3 net: fix unsafe set_memory_rw from softirq
on x86 system with net.core.bpf_jit_enable = 1

sudo tcpdump -i eth1 'tcp port 22'

causes the warning:
[   56.766097]  Possible unsafe locking scenario:
[   56.766097]
[   56.780146]        CPU0
[   56.786807]        ----
[   56.793188]   lock(&(&vb->lock)->rlock);
[   56.799593]   <Interrupt>
[   56.805889]     lock(&(&vb->lock)->rlock);
[   56.812266]
[   56.812266]  *** DEADLOCK ***
[   56.812266]
[   56.830670] 1 lock held by ksoftirqd/1/13:
[   56.836838]  #0:  (rcu_read_lock){.+.+..}, at: [<ffffffff8118f44c>] vm_unmap_aliases+0x8c/0x380
[   56.849757]
[   56.849757] stack backtrace:
[   56.862194] CPU: 1 PID: 13 Comm: ksoftirqd/1 Not tainted 3.12.0-rc3+ #45
[   56.868721] Hardware name: System manufacturer System Product Name/P8Z77 WS, BIOS 3007 07/26/2012
[   56.882004]  ffffffff821944c0 ffff88080bbdb8c8 ffffffff8175a145 0000000000000007
[   56.895630]  ffff88080bbd5f40 ffff88080bbdb928 ffffffff81755b14 0000000000000001
[   56.909313]  ffff880800000001 ffff880800000000 ffffffff8101178f 0000000000000001
[   56.923006] Call Trace:
[   56.929532]  [<ffffffff8175a145>] dump_stack+0x55/0x76
[   56.936067]  [<ffffffff81755b14>] print_usage_bug+0x1f7/0x208
[   56.942445]  [<ffffffff8101178f>] ? save_stack_trace+0x2f/0x50
[   56.948932]  [<ffffffff810cc0a0>] ? check_usage_backwards+0x150/0x150
[   56.955470]  [<ffffffff810ccb52>] mark_lock+0x282/0x2c0
[   56.961945]  [<ffffffff810ccfed>] __lock_acquire+0x45d/0x1d50
[   56.968474]  [<ffffffff810cce6e>] ? __lock_acquire+0x2de/0x1d50
[   56.975140]  [<ffffffff81393bf5>] ? cpumask_next_and+0x55/0x90
[   56.981942]  [<ffffffff810cef72>] lock_acquire+0x92/0x1d0
[   56.988745]  [<ffffffff8118f52a>] ? vm_unmap_aliases+0x16a/0x380
[   56.995619]  [<ffffffff817628f1>] _raw_spin_lock+0x41/0x50
[   57.002493]  [<ffffffff8118f52a>] ? vm_unmap_aliases+0x16a/0x380
[   57.009447]  [<ffffffff8118f52a>] vm_unmap_aliases+0x16a/0x380
[   57.016477]  [<ffffffff8118f44c>] ? vm_unmap_aliases+0x8c/0x380
[   57.023607]  [<ffffffff810436b0>] change_page_attr_set_clr+0xc0/0x460
[   57.030818]  [<ffffffff810cfb8d>] ? trace_hardirqs_on+0xd/0x10
[   57.037896]  [<ffffffff811a8330>] ? kmem_cache_free+0xb0/0x2b0
[   57.044789]  [<ffffffff811b59c3>] ? free_object_rcu+0x93/0xa0
[   57.051720]  [<ffffffff81043d9f>] set_memory_rw+0x2f/0x40
[   57.058727]  [<ffffffff8104e17c>] bpf_jit_free+0x2c/0x40
[   57.065577]  [<ffffffff81642cba>] sk_filter_release_rcu+0x1a/0x30
[   57.072338]  [<ffffffff811108e2>] rcu_process_callbacks+0x202/0x7c0
[   57.078962]  [<ffffffff81057f17>] __do_softirq+0xf7/0x3f0
[   57.085373]  [<ffffffff81058245>] run_ksoftirqd+0x35/0x70

cannot reuse jited filter memory, since it's readonly,
so use original bpf insns memory to hold work_struct

defer kfree of sk_filter until jit completed freeing

tested on x86_64 and i386

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-10-07 15:16:45 -04:00
..
boot omap device tree changes that are needed to fix 2013-09-18 14:01:39 -07:00
common Merge branch 'timers/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-16 16:10:26 -04:00
configs ARM: multi_v7: add HREFv60 to multi_v7 defconfig 2013-09-18 12:16:08 -07:00
crypto ARM: 7837/3: fix Thumb-2 bug in AES assembler code 2013-09-22 11:43:38 +01:00
include ARM: 7836/1: add __get_user_unaligned/__put_user_unaligned 2013-09-18 10:58:23 +01:00
kernel Merge branches 'sched-urgent-for-linus', 'timers-urgent-for-linus' and 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-28 14:22:17 -07:00
kvm ARM: kvm: rename cpu_reset to avoid name clash 2013-09-24 11:15:05 -07:00
lib ARM: 7835/2: fix modular build of xor_blocks() with NEON enabled 2013-09-09 15:24:47 +01:00
mach-at91 ARM: SoC late changes for v3.12 2013-09-09 16:35:29 -07:00
mach-bcm ARM: bcm: Make secure API call optional 2013-08-20 10:51:39 -07:00
mach-bcm2835
mach-clps711x ARM: clps711x: edb7211: Remove extra iotable_init() call 2013-08-13 23:29:16 -07:00
mach-cns3xxx
mach-davinci ARM: SoC platform changes for 3.12 2013-09-06 13:30:06 -07:00
mach-dove ARM: SoC board updates for 3.12 2013-09-06 13:34:43 -07:00
mach-ebsa110 ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-ep93xx ARM: SoC fixes for 3.12 2013-09-12 13:59:31 -07:00
mach-exynos ARM: SoC late changes for v3.12 2013-09-09 16:35:29 -07:00
mach-footbridge ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-gemini ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-highbank ARM: SoC late changes for v3.12 2013-09-09 16:35:29 -07:00
mach-imx ACPI and power management fixes for 3.12-rc2 2013-09-20 15:17:14 -07:00
mach-integrator ARM: debug: move PL01X debug include into arch/arm/include/debug/ 2013-08-25 17:11:06 +01:00
mach-iop13xx ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-iop32x ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-iop33x ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-ixp4xx ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-keystone Omap fixes for the merge window that are not urgent enough 2013-08-29 19:12:04 -07:00
mach-kirkwood ARM: SoC board updates for 3.12 2013-09-06 13:34:43 -07:00
mach-ks8695 gpio: (gpio-pca953x) move header to linux/platform_data/ 2013-08-29 12:33:52 -07:00
mach-lpc32xx ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-mmp ARM: SoC late changes for v3.12 2013-09-09 16:35:29 -07:00
mach-msm ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
mach-mv78xx0 ARM: SoC platform changes for 3.12 2013-09-06 13:30:06 -07:00
mach-mvebu Merge branch 'timers/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-09-16 16:10:26 -04:00
mach-mxs ARM: mxs: pm: Include "pm.h" 2013-08-18 16:34:57 +08:00
mach-netx
mach-nomadik ARM: nomadik: switch to use the Nomadik I2C driver 2013-08-07 00:59:06 +02:00
mach-nspire
mach-omap1 ARM: DRA7: id: Add cpu detection support for DRA7xx based SoCs' 2013-08-13 16:58:08 +05:30
mach-omap2 ARM: OMAP2+: mux: fix trivial typo in name 2013-09-18 12:02:01 -07:00
mach-orion5x ARM: SoC board updates for 3.12 2013-09-06 13:34:43 -07:00
mach-picoxcell
mach-prima2 ARM: SoC platform changes for 3.12 2013-09-06 13:30:06 -07:00
mach-pxa ARM: SoC DT updates for 3.12 2013-09-06 13:26:27 -07:00
mach-realview ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
mach-rockchip
mach-rpc ARM: debug: move 8250 debug include into arch/arm/include/debug/ 2013-08-25 17:11:02 +01:00
mach-s3c24xx ARM: SAMSUNG: Remove pwm-clock infrastructure 2013-08-12 21:53:24 +02:00
mach-s3c64xx gpio: (gpio-pca953x) move header to linux/platform_data/ 2013-08-29 12:33:52 -07:00
mach-s5p64x0 ARM: SAMSUNG: Remove remaining uses of plat/regs-timer.h header 2013-08-12 21:53:24 +02:00
mach-s5pc100 ARM: SAMSUNG: Remove pwm-clock infrastructure 2013-08-12 21:53:24 +02:00
mach-s5pv210 ARM: SAMSUNG: Remove remaining uses of plat/regs-timer.h header 2013-08-12 21:53:24 +02:00
mach-sa1100 ARM: sa1100: collie.c: fall back to jedec_probe flash detection 2013-09-18 08:20:27 -07:00
mach-shark
mach-shmobile ARM: shmobile: change dev_id to cpu0 while registering cpu clock 2013-09-19 03:53:44 +02:00
mach-socfpga
mach-spear ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
mach-sti
mach-sunxi ARM: sunxi: Introduce Allwinner A20 support 2013-08-16 23:23:41 +02:00
mach-tegra ARM: SoC platform changes for 3.12 2013-09-06 13:30:06 -07:00
mach-u300 ARM: u300: hide submenus 2013-09-18 08:16:46 -07:00
mach-ux500 ARM: ux500: disable outer cache debug 2013-09-17 09:08:13 -07:00
mach-versatile Merge branch 'versatile/fixes' into fixes 2013-09-09 17:31:04 -07:00
mach-vexpress ARM: vexpress: allow dcscb and tc2_pm in a combined ARMv6+v7 build 2013-09-09 17:38:20 -07:00
mach-virt
mach-vt8500
mach-w90x900
mach-zynq arm: Xilinx Zynq cleanup patches for v3.12 2013-08-20 15:05:31 -07:00
mm arch: mm: pass userspace fault flag to generic fault handler 2013-09-12 15:38:01 -07:00
net net: fix unsafe set_memory_rw from softirq 2013-10-07 15:16:45 -04:00
nwfpe
oprofile
plat-iop
plat-omap ARM: SoC platform changes for 3.12 2013-09-06 13:30:06 -07:00
plat-orion
plat-pxa ARM: pxa: ssp: Check return values from phandle lookups 2013-09-09 17:14:09 -07:00
plat-samsung ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
plat-versatile
tools
vfp
xen Linux 3.11-rc7 2013-09-09 12:05:37 -04:00
Kconfig ARM: only allow kernel mode neon with AEABI 2013-09-22 11:08:50 +01:00
Kconfig-nommu
Kconfig.debug ARM: SoC cleanups for 3.12 2013-09-06 13:21:16 -07:00
Makefile Merge branch 'zynq/dt' into next/dt 2013-08-14 08:14:50 -07:00