linux/kernel/bpf
Alexei Starovoitov 8ebe667c41 bpf: rcu lock must not be held when calling copy_to_user()
BUG: sleeping function called from invalid context at mm/memory.c:3732
in_atomic(): 0, irqs_disabled(): 0, pid: 671, name: test_maps
1 lock held by test_maps/671:
 #0:  (rcu_read_lock){......}, at: [<0000000000264190>] map_lookup_elem+0xe8/0x260
Call Trace:
([<0000000000115b7e>] show_trace+0x12e/0x150)
 [<0000000000115c40>] show_stack+0xa0/0x100
 [<00000000009b163c>] dump_stack+0x74/0xc8
 [<000000000017424a>] ___might_sleep+0x23a/0x248
 [<00000000002b58e8>] might_fault+0x70/0xe8
 [<0000000000264230>] map_lookup_elem+0x188/0x260
 [<0000000000264716>] SyS_bpf+0x20e/0x840

Fix it by allocating temporary buffer to store map element value.

Fixes: db20fd2b01 ("bpf: add lookup/update/delete/iterate methods to BPF maps")
Reported-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-01-26 17:20:40 -08:00
..
arraymap.c bpf: fix arraymap NULL deref and missing overflow and zero size checks 2014-11-19 15:40:00 -05:00
core.c bpf: split eBPF out of NET 2014-10-27 19:09:59 -04:00
hashtab.c bpf: fix arraymap NULL deref and missing overflow and zero size checks 2014-11-19 15:40:00 -05:00
helpers.c bpf: allow eBPF programs to use maps 2014-11-18 13:44:00 -05:00
Makefile bpf: allow eBPF programs to use maps 2014-11-18 13:44:00 -05:00
syscall.c bpf: rcu lock must not be held when calling copy_to_user() 2015-01-26 17:20:40 -08:00
test_stub.c bpf: remove test map scaffolding and user proper types 2014-11-18 13:44:00 -05:00
verifier.c bpf: verifier: add checks for BPF_ABS | BPF_IND instructions 2014-12-05 21:47:32 -08:00