Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp224483imm; Tue, 19 Jun 2018 19:50:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLNqQXoGoJLNfrhUNGHYjYcKgRRjjgjssVMeEmG0R0KzXT2JqVARQ3ehJM+Co52MplJTYyX X-Received: by 2002:a17:902:42e4:: with SMTP id h91-v6mr21450647pld.27.1529463057569; Tue, 19 Jun 2018 19:50:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529463057; cv=none; d=google.com; s=arc-20160816; b=A6c0K6vhALC+gRjW+SvoQe3vXaMRnXDbYNd2rvZFgQNMVXLONxbccLYQDKVzTukme1 rmXnouNvxsS88EWPvtDREEIs8dZKW67fzEbVM5Dq0glwo19odOKspQcOZi8pX6nvVBAq vCT4tDO7sAef2P/JW2BL3aeUk3JFSe0MvqNdohyexP2T6jcCGdDNB9NwWWbuLI3CQ7UN fw/8mh2K5uSNrWrCJvD3w5cVlx27olKcb8ghSKwZt5XC4VxcDGlOMXrCjZ0dwYpP66KV 2pX1V4r00mhHb/act2PwzDPiTkBbVuQJed3dUyJs2Cc+EUaL9zEyd0YhvxftuOiispBt FAmQ== 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 :cc:to:subject:from:dkim-signature:arc-authentication-results; bh=M0rGZgWWY7dcASiTp0hDxNvg+Zcgxe+cBW6GCM7sAgg=; b=vypRnQtZqfzqO7oCgNyVAyc8hbBn/Qagd+Dubm64swmtpup30r/DVSfkM4maGfbaze NzuvhgT6vZL8Hbgr97a5DbSnup8uu2oSdJYPYUGzwkTUMraVgvbtZAp7N0j+6W3r+fZR NraV2kf8AYzWacSecHcWFDTFLmKt/ne2UJBOb0kDCK0vPle+R6O72uWbQP9rXxaoVuMS NGKKapMqJcH0Vwi/zBOOKePzv4H2xdU0VRKRXp+DWiGCP5myx1PoKVdU3e97av17aWL+ IsxZLrE6cJiQbDgAC8+KP7I2FHxdAeOzFclXnvSlBP1Kd1o1hrl+1vMCx1ud41r43YwF ktpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZtKvuFi4; 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 g14-v6si1192801plq.41.2018.06.19.19.50.43; Tue, 19 Jun 2018 19:50:57 -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=ZtKvuFi4; 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 S1754072AbeFTCuB (ORCPT + 99 others); Tue, 19 Jun 2018 22:50:01 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:42072 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753730AbeFTCt7 (ORCPT ); Tue, 19 Jun 2018 22:49:59 -0400 Received: by mail-pl0-f67.google.com with SMTP id w17-v6so897787pll.9 for ; Tue, 19 Jun 2018 19:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=M0rGZgWWY7dcASiTp0hDxNvg+Zcgxe+cBW6GCM7sAgg=; b=ZtKvuFi4Zx5mS1jKGTFWPfH1XROdksRaz4PRn6IpGRqVdsyWJ061lqoLHcmq2W/okN pdyQwrsUf922lDonh32uoi2tsnRiBT/9rZuRNrQhobTLB5pQFyZ66RnYdg9GzyqHpBgF 51T2gB+dcpt4nPeQO0UMseozKlZIo6gW1b2fmOotiEqo8O2oIymarJOVcou8uXQWIrcl zaIGG4n2CRUAJUrkJtKlSkmrYeyJ+H5Urtqyl4s+Q8V+5hWmR8BonlkCNo0Ila9Jx8fW +sgdi7qyQ7UIAaVQU9zOOHIRcB3FrtqHQDgnHIR+gZryLBXLmH4uUe8pMJ3aFfCzYAQh ArBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=M0rGZgWWY7dcASiTp0hDxNvg+Zcgxe+cBW6GCM7sAgg=; b=ZvwMUKUFic7YeL5I0JqgZGCL8qiP7TqFzRjeZLIvfvGX9kvFxijbtJcPqS1L5yBdkv 895olJPg0chs0wAjGoJGltB3zBdwHB6ei2gQhqPchmonEIiUiV8drAVlR+Qz9DyC4vOM d83n1sUv6Zz6uPmIlsW7qZKzBHw0kw3yCVGUO0jvVTkd327tdrHImPFs4DbDZAyhxBWo GlTmOQns5NeJtjvrH8lqfIGM57f8OmGWfTGFWqMqUHoBT2Omdw5H+YytwjbnflN/8hCg OzXRV5Xia9OdD78R8W/Rva1tgkdHAPDPOH7qDNJfSQHsiNPSm4DF5q9ASZ/qdkYPNnzM 1VLg== X-Gm-Message-State: APt69E0Bb6M4wm6lEVWmWojLiIX3yW5P2DKQvc0p6WQ3ifGQPs0PnsNs 2ELvA7yIeygQDZVEm+wRMpvLfwEq X-Received: by 2002:a17:902:822:: with SMTP id 31-v6mr21357157plk.172.1529462999133; Tue, 19 Jun 2018 19:49:59 -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 i71-v6sm1044403pgd.22.2018.06.19.19.49.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 19:49:58 -0700 (PDT) From: Jia-Ju Bai Subject: [BUG] xen: Two possible sleep-in-atomic-context bugs in bind_evtchn_to_irqhandler() To: Boris Ostrovsky , jgross@suse.com Cc: xen-devel@lists.xenproject.org, Linux Kernel Mailing List Message-ID: <80315b22-63c1-c8cc-1035-11fa36bee83a@gmail.com> Date: Wed, 20 Jun 2018 10:49:28 +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 driver may sleep with holding a spinlock. The function call paths (from bottom to top) in Linux-4.16.7 are: [FUNC] mutex_lock_nested --> can sleep drivers/xen/events/events_base.c, 839: mutex_lock_nested in bind_evtchn_to_irq drivers/xen/events/events_base.c, 1030: bind_evtchn_to_irq in bind_evtchn_to_irqhandler drivers/xen/pvcalls-front.c, 371: bind_evtchn_to_irqhandler in create_active drivers/xen/pvcalls-front.c, 417: create_active in pvcalls_front_connect drivers/xen/pvcalls-front.c, 410: spin_lock in pvcalls_front_connect [FUNC] request_irq --> can sleep drivers/xen/events/events_base.c, 1003: request_irq in bind_evtchn_to_irqhandler drivers/xen/pvcalls-front.c, 371: bind_evtchn_to_irqhandler in create_active drivers/xen/pvcalls-front.c, 417: create_active in pvcalls_front_connect drivers/xen/pvcalls-front.c, 410: spin_lock in pvcalls_front_connect These bugs are found by my static analysis tool (DSAC-2) and checked by my code review. I do not know how to correctly fix these bugs, so I just report them. Maybe create_active() should not be called with holding a spinlock. Best wishes, Jia-Ju Bai