From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jia-Ju Bai Subject: [BUG] bpf: syscall: a possible sleep-in-atomic-context bug in map_update_elem() Date: Fri, 10 Aug 2018 22:07:23 +0800 Message-ID: <65830741-bf35-4d32-e365-c32fc17c25cb@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Linux Kernel Mailing List To: ast@kernel.org, daniel@iogearbox.net Return-path: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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). Best wishes, Jia-Ju Bai