Received: by 10.223.176.5 with SMTP id f5csp1755193wra; Sun, 28 Jan 2018 07:41:46 -0800 (PST) X-Google-Smtp-Source: AH8x227//rzz74+dia81G1DFz2zdGoRpvEdPRSLCqaMXVoMQURGHwOTujP3CQu2j0EgbG7YjAfhl X-Received: by 10.98.75.91 with SMTP id y88mr24513927pfa.178.1517154106615; Sun, 28 Jan 2018 07:41:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517154106; cv=none; d=google.com; s=arc-20160816; b=GA/47sJ6W/xvXDp30j8cV4RIdYVvPMpfulQYpI2NDjODX14qLlWuDlVbZfAIh5iC2l v7ofca6orPzb8yDtcR/hABdXsFNER+yZwpBLQY8Uz7U0rby7zP++FElh2tHEHIecz0H/ PnNdgMx+bQTjlpH9yocTtcnRBp7T0zpbspgynG2BCQ6YyjWNe9CPTTbKZhwybX2+MxZw krXhTXA8qRh2cWBxwChZXSamH5cyz33v4qa6q6j4DSvei4Im6KZQ4G3XPUilIvag2Eep jB9o7RSf+hfMGHTgiHqARXVCSLKTXx2xZwcczTHEQipU1JibKc3xI3g+uGd+09fI4nQj L3/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:arc-authentication-results; bh=5UEV9lEImkoOSt2nj47GfsW7IvX5ZI/wPI4GHPwwUiU=; b=wmNTFUwIjY495ZBRADwNKLxUx1vrJtlqR4Fu4lSIW30rgAw2xCbxzrk3hlStFD7+80 3ebWFRaBNxmYY8Zl0Ccwzuqf746LDztgu1ADJ7q1vVBCpMywUzgQYG8THk4wjU9MnQrl muI2u1bLBTdmHZPbXpBC22wsHtHs+rYCdjvTRNEks8M/uGyPbdBvHLTDx52GLW6eEJ9G VBIQrIIT9HUiTL/npf2HsbuIhEVJjc8HWyyJDhuCozEGz7tq9pb4iYbncBZEOcADLcG2 TQOOgB0GTLZziuXSuilvjHhHK/YkmV3mT09OZaVN8AfbcJQb8VxAz8ojXFQ3B4vtLYH9 Hp/A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si5895087pgp.431.2018.01.28.07.41.21; Sun, 28 Jan 2018 07:41:46 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751934AbeA1Pkr convert rfc822-to-8bit (ORCPT + 99 others); Sun, 28 Jan 2018 10:40:47 -0500 Received: from qproxy6-pub.mail.unifiedlayer.com ([69.89.23.12]:50215 "EHLO qproxy6-pub.mail.unifiedlayer.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbeA1Pkq (ORCPT ); Sun, 28 Jan 2018 10:40:46 -0500 Received: from CMOut01 (unknown [10.0.90.82]) by qproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id 3B86A140899 for ; Sun, 28 Jan 2018 08:40:44 -0700 (MST) Received: from box320.bluehost.com ([69.89.31.120]) by CMOut01 with id 3rgg1x00K2bWBD901rgjmU; Sun, 28 Jan 2018 08:40:44 -0700 X-Authority-Analysis: v=2.2 cv=Rf/gMxlv c=1 sm=1 tr=0 a=6lV6tj8ir7tGSl/9xQZNPA==:117 a=6lV6tj8ir7tGSl/9xQZNPA==:17 a=kj9zAlcOel0A:10 a=RgaUWeydRksA:10 a=pGLkceISAAAA:8 a=ba6vp1zcuibvPpkEdrUA:9 a=CjuIK1q_8ugA:10 Received: from c-24-99-197-19.hsd1.ga.comcast.net ([24.99.197.19]:53401 helo=[10.0.0.100]) by box320.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1efp4S-00499K-6m; Sun, 28 Jan 2018 08:40:40 -0700 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] block: aoenet: Replace GFP_ATOMIC with GFP_KERNEL in aoenet_rcv From: Ed Cashin X-Mailer: iPhone Mail (15C202) In-Reply-To: Date: Sun, 28 Jan 2018 10:40:36 -0500 Cc: ed.cashin@acm.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <1516959434-829-1-git-send-email-baijiaju1990@gmail.com> <219E4594-88B1-4501-A897-9A4B3296163B@cashinworks.com> To: Jia-Ju Bai X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box320.bluehost.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - cashinworks.com X-BWhitelist: no X-Source-IP: 24.99.197.19 X-Exim-ID: 1efp4S-00499K-6m X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: c-24-99-197-19.hsd1.ga.comcast.net ([10.0.0.100]) [24.99.197.19]:53401 X-Source-Auth: nobody X-Email-Count: 0 X-Source-Cap: bm9ib2R5Oztib3gzMjAuYmx1ZWhvc3QuY29t X-Local-Domain: no Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Good luck in your efforts, and thanks for your work on static analysis. > On Jan 27, 2018, at 9:12 PM, Jia-Ju Bai wrote: > > > >> On 2018/1/28 1:48, Ed Cashin wrote: >> If the tool cannot tell whether the protected state is manipulated by *another* piece of code called in atomic context, then it's insufficient. >> >>> On Jan 26, 2018, at 4:37 AM, Jia-Ju Bai wrote: >>> >>> After checking all possible call chains to aoenet_rcv(), >>> my tool finds that aoenet_rcv() is never called in atomic context, >>> namely never in an interrupt handler or holding a spinlock. >>> Thus GFP_ATOMIC is not necessary, and it can be replaced with GFP_KERNEL. >>> >>> This is found by a static analysis tool named DCNS written by myself. >>> >>> Signed-off-by: Jia-Ju Bai >>> --- >>> drivers/block/aoe/aoenet.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c >>> index 63773a9..d5fff7a 100644 >>> --- a/drivers/block/aoe/aoenet.c >>> +++ b/drivers/block/aoe/aoenet.c >>> @@ -138,7 +138,7 @@ static int __init aoe_iflist_setup(char *str) >>> if (dev_net(ifp) != &init_net) >>> goto exit; >>> >>> - skb = skb_share_check(skb, GFP_ATOMIC); >>> + skb = skb_share_check(skb, GFP_KERNEL); >>> if (skb == NULL) >>> return 0; >>> if (!is_aoe_netif(ifp)) >>> -- >>> 1.7.9.5 >>> >>> > > Sorry, I find my report is false positive after I manually check the code. > aoenet_rcv() is used as function pointer via "->func", and it is called in dev_queue_xmit_nit() in net/core/dev.c. > dev_queue_xmit_nit() calls a rcu_read_lock() before it calls pt_prev->func(). > Thus it is right to use GFP_ATOMIC in aoenet_rcv(). > Sorry again for my incorrect report... > > Thanks, > Jia-Ju Bai