Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1502403imm; Wed, 20 Jun 2018 20:22:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIGDuMHfsd54gKHa19iL55OUD9DabiGyzSoH9EwnzhSsNrFLXTio6yOXoiSoGcnuYUQfoIh X-Received: by 2002:a62:3fdd:: with SMTP id z90-v6mr25413025pfj.216.1529551344042; Wed, 20 Jun 2018 20:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529551344; cv=none; d=google.com; s=arc-20160816; b=TzfKd8aFOLM1Zn6JkvR5dlbKoiF5FP3eqlh1JH4x0aB/YY0sbZh4n9oZOukFy6I/O7 SRll/TT7eMg2aVieo1FU7yNtCVY7s56EWEqVolIvfpcoKVRTqvB6tp4nm35dxVTIwaaL W+JQNnQ9Zji1FYnPB4pbcPhSXkyw1hgGKOwo9xFfPdIGlFJ9EPtRSUKuhTxu1IYKzplR H3qgf3NYn9yGtC0ENfwaAcgJN92i+M80WXu7I0bRDC0BwiESvuBzLNCGVpyKOfXKev/l uV99aX684sebwhBWQGQErVgarScDlOAGpZcKjV5Xmf7Sb4SBSzdqgFCll7CHF2lXBqz5 R1oA== 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=7kY3i7BmDLb/n8wyrsOFnJPe4bMBBoW1BMNv5XmrVgU=; b=ecBQGpqCx0gNRbTUjFuqOQzJAmzc2AwAmTX2LjjXdnHjr5/Pj3ZppmX60hQmkb2aNf jzgu0BUTmWuei9DO9cWcq4zX6dD9AAbx8B4ib6nhUH+6WL7tgRFXXraE7PZhuOjv8l5G uUNKEPAfX205rPzvVRRzEP1qbxm8Iln9OComoPW08XlKwiaGiIES2gMtMfFNIm2fT98D VJqWu+tdadz3RJ0ipF72eI8mE364W2Ln/KcpRDygcW9HLFE+HfsIvpcs/f9nxCpLt8mD dfOl4lR/1AYyDqKjpGPIWOn3hFIE/3CrlDt7ifrzKzTYqcISvgYqxSwfPPW04594i3nH l8Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uYmsgk+z; 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 f9-v6si3036220pgt.128.2018.06.20.20.22.09; Wed, 20 Jun 2018 20:22:24 -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=uYmsgk+z; 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 S1754297AbeFUDVa (ORCPT + 99 others); Wed, 20 Jun 2018 23:21:30 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:45901 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754172AbeFUDV3 (ORCPT ); Wed, 20 Jun 2018 23:21:29 -0400 Received: by mail-pf0-f194.google.com with SMTP id a22-v6so773652pfo.12 for ; Wed, 20 Jun 2018 20:21: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=7kY3i7BmDLb/n8wyrsOFnJPe4bMBBoW1BMNv5XmrVgU=; b=uYmsgk+zFxu6ZztWlLzEFzIzLsYj9by17nw0SgDs9z8SivohAPktrv2XNMS6P/9wB7 R3NikJeF0IUhthrDLHUvLyLRMYEvieKMwSwtydz2oI1J+9ZuRf+Gz3UDPS8lik5bH5La DIMIlwGIL3bs1mmSsv7WnM13kG20S1PLOyBP4rHNMsGEND3DUN23Yj+I6GvLhVaiXP2w LUjYpBXiQOjbIUxvqbAomj6w9x96VbRy72e2LuPCHs7EZYncGh3GQBQU8RmWNWpAr4Cq nc91YAkRIrMWXVwin8k+Vsrn5GpBNGU7sW9kpr3Vwq154mvqs0PtWyqwGlG3Yc1AjeaY 27lg== 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=7kY3i7BmDLb/n8wyrsOFnJPe4bMBBoW1BMNv5XmrVgU=; b=eYRSsk44K5EbYoj9jTcg6wF3TDLGxIeVtdJ3uIUaN3BapROvJf5364DRE6Ec3ybFqD I6bKd0LivFhSBUuk7ufyOiv0P1gvUI+giefylXILZ6DUvJmszQyqtKR9g7fYyt7FzwCI y45IX6CvoKX1X6Ozl1WAlxcHk/lTHKpJuiSSO0VVSZavqG+8YL3puYc4u3cdFkhmaBQT rvvabN6sjZK7T87bVWqPbof82qbWJ5MMAJOLfEQamFviU83IckEpkL8s4lOq0Jbjemvu yy8BBE+2kGmwGyvQxrHkzJnr4qwymu0CxTIAAB/5cL5LRqogzD+Gkikt/+SPrSTa8TMn A0ag== X-Gm-Message-State: APt69E28WFZEUTY6upmNY5guxk1eHmUAXsCWunDcuuc7gfFIWsiyj9Y/ vlJKVGFmjVIcUXebLOHblMR6mEnD X-Received: by 2002:a62:234a:: with SMTP id j71-v6mr24921607pfj.221.1529551288674; Wed, 20 Jun 2018 20:21:28 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.70.11? ([2402:f000:1:1501:200:5efe:a66f:460b]) by smtp.gmail.com with ESMTPSA id b4-v6sm4357200pgq.51.2018.06.20.20.21.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 20:21:28 -0700 (PDT) To: akpm@linux-foundation.org, dvyukov@google.com, Greg KH , tchibo@google.com, aryabinin@virtuozzo.com Cc: Linux Kernel Mailing List From: Jia-Ju Bai Subject: [BUG] kernel: kcov: a possible sleep-in-atomic-context bug in kcov_ioctl() Message-ID: Date: Thu, 21 Jun 2018 11:20:59 +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 spinlock. The function call path (from bottom to top) in Linux-4.16.7 is: [FUNC] vfree --> can sleep kernel/kcov.c, 237: vfree in kcov_put kernel/kcov.c, 396: kcov_put in kcov_ioctl_locked kernel/kcov.c, 410: kcov_ioctl_locked in kcov_ioctl kernel/kcov.c, 409: spin_lock in kcov_ioctl This bug is found by my static analysis tool (DSAC-2) and checked by my code review. I do not know how to correctly fix this bug, so I just report them. Best wishes, Jia-Ju Bai