[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97aa2e6b-1863-f123-af2c-24a2e6333ba5@iogearbox.net>
Date: Fri, 10 Aug 2018 16:22:11 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Jia-Ju Bai <baijiaju1990@...il.com>, ast@...nel.org
Cc: netdev@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
brouer@...hat.com
Subject: Re: [BUG] bpf: syscall: a possible sleep-in-atomic-context bug in
map_update_elem()
On 08/10/2018 04:07 PM, Jia-Ju Bai wrote:
> The kernel may sleep with holding a rcu read lock.
>
> The function call paths (from bottom to top) in Linux-4.16 are:
>
> [FUNC] kmalloc(GFP_KERNEL)
> kernel/kthread.c, 283: kmalloc in __kthread_create_on_node
> kernel/kthread.c, 365: __kthread_create_on_node in kthread_create_on_node
> kernel/bpf/cpumap.c, 368: kthread_create_on_node in __cpu_map_entry_alloc
> kernel/bpf/cpumap.c, 490: __cpu_map_entry_alloc in cpu_map_update_elem
> kernel/bpf/syscall.c, 724: [FUNC_PTR]cpu_map_update_elem in map_update_elem
> kernel/bpf/syscall.c, 723: rcu_read_lock in map_update_elem
>
> Note that [FUNC_PTR] means a function pointer call is used.
>
> I do not find a good way to fix it, so I only report.
> This is found by my static analysis tool (DSAC).
Thanks for the report Jia-Ju! In the map_update_elem() from syscall
path there's a check map->map_type == BPF_MAP_TYPE_CPUMAP, where we
call the cpumap's map->ops->map_update_elem() while /not/ being under
rcu_read_lock() as in other cases, so looks okay to me. Could you point
out the case for being under rcu_read_lock() more specifically which
the tool found?
Thanks,
Daniel
Powered by blists - more mailing lists