Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp78114imm; Fri, 10 Aug 2018 07:55:13 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz10pmmo01v92tzrOpPac0KhT3mQMchG7IsbRkSl1rqVF0+shGluB3cDIeGrGcK3GDErwzC X-Received: by 2002:a63:c60:: with SMTP id 32-v6mr6839224pgm.155.1533912913747; Fri, 10 Aug 2018 07:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533912913; cv=none; d=google.com; s=arc-20160816; b=uAv7G241zOzQnWGIkD074b7cIM3+3wLCIH11dkzkTVGM0lK0fqLcN6SMPXBlrIbXLQ 3TPC8PIBnW7qRvaKpNhLjzvmXR196clEazxis4OjL+vbUO3KvBwJxYq+c1oZEqshdYmS xXrJXtpiivRmlXbpQCuOQAOjPgc9NHiCCqDfPOFQxUSDvOCavjCMs6HOkD5ygSDeEYOd hJlOAitBuiQVdzWNRS4U3/9JuR7QcnvNIa2wRkKBXQtlXNZPyy2N5WuaBkPp8BuclLQQ /gw4bOnNaeTM5V0OXMEg9uhPSUF2t8MHJ/rOCZMan9zosOl8YGb7AnjosI6Xamr8yma0 d3hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:cc:to:dkim-signature:arc-authentication-results; bh=l4exPuIDCDA8W0UtmqmVlHNqmSWc21B/e7TaXzFXwdU=; b=Cdc77jX0FlQ/ZXBvpUm5ne28Ky5E90CRRCmdNiwMrPy/lQIS56w4bdkhy2KiRlBX0m h2tSCYf7eyY0fvLZcZIzVhg+sAFHv/F522l+D2Q77HaCFgd1/d7I5wWDj/hPXmvJEVQY KrM+npVjCQxCdBIR/znlba/DBfALFn47Q6qxOP2vcRoP5//KTxr9WrRLFb6X7//kHSsq pCUjouCoUhD432go546Z8PfNjvTv5NMPrgHKBCH9dheHphG3EfnMOu5aPJzmt63xMArw rPjJXvjEDcBRFfvvoAjQCTrNKqYE6ZuVxkgJYcfbMGjivyQ87hsJF8ZYySTpi63Ms/Hv kKCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=brEzJvUT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si7696971plg.344.2018.08.10.07.54.56; Fri, 10 Aug 2018 07:55:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=brEzJvUT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728178AbeHJQhd (ORCPT + 99 others); Fri, 10 Aug 2018 12:37:33 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34094 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbeHJQhc (ORCPT ); Fri, 10 Aug 2018 12:37:32 -0400 Received: by mail-pg1-f193.google.com with SMTP id y5-v6so4473001pgv.1; Fri, 10 Aug 2018 07:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=l4exPuIDCDA8W0UtmqmVlHNqmSWc21B/e7TaXzFXwdU=; b=brEzJvUTw5cL0/adpiCv2tt32ig3+t7RM+6R2oiLoOw/FXVwOKGBhWTdznQiOJ0qAW LRTTsNZxj62Z/cIQ+dlQ7N9ELh71ak64qIAr/auZRpylm5QxUwFeGM+5HpUaWX8oQOlu Da3hy1KzMHJcJNxxL/HaLzhgFicdK/6y8LQ9EreAHgmcp4A4YB7cJgG62qt0LlR16t1S QsL1llKQKld+aQkYGY5rRkNY+n7p9GtG4nQgDufHyawTQCes5k48hPwRs/t2+/VzQ/2B 2vsFTBibOIl7NUxMvqHL48xQeLxkFMQIrygXPi/PX4yy2yR17+nO+liN/TA55PTXEwvx Wk8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=l4exPuIDCDA8W0UtmqmVlHNqmSWc21B/e7TaXzFXwdU=; b=B06gJmT+MvIlesNSlGtwXIycMw2X095EqNoGv2QxjERdHLPNGwWxAjx06ndU5cLhku 5NVgTa9Hydxa1nYZrPiYof1kOXni1VBLtg4vBXmrcmbQsnA3a8MUjdVv/LBzeN57eId6 +Ju2LU05Jzk1hkAPYn8biYvG98rqypAJeSfqkI7jftbRD2w4EMlIvLIOOrsZJrsSOxuy MSm0XWUKC9rzfuECxbsCdTsOtVUAJYDiuldTM73NlE7KVdSMlihVTm1jUrhEHZywVS5c VG7hf4BW4u19lO++GJ/YKfr7AmWxzmD5PmmerxNmuLwYnmSQumXdI3S5G24V4aTAk6on I9ng== X-Gm-Message-State: AOUpUlGaYyrZzwgbfPj+t4G+hWZ/0MoSBCkPRqKGQFhy9DrN/j5OxhfM G+lS0zyBnMPphDW90PqRIsCKCazj X-Received: by 2002:a62:83ca:: with SMTP id h193-v6mr7220187pfe.79.1533910048590; Fri, 10 Aug 2018 07:07:28 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.51? ([2402:f000:1:1501:200:5efe:a66f:4733]) by smtp.gmail.com with ESMTPSA id w72-v6sm18168279pfa.26.2018.08.10.07.07.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 07:07:28 -0700 (PDT) To: ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, Linux Kernel Mailing List From: Jia-Ju Bai Subject: [BUG] bpf: syscall: a possible sleep-in-atomic-context bug in map_update_elem() Message-ID: <65830741-bf35-4d32-e365-c32fc17c25cb@gmail.com> Date: Fri, 10 Aug 2018 22:07:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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