Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp358144imu; Thu, 3 Jan 2019 22:05:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Pvpwibyt+szhsXTP97vU/z6C5WEWA2dkVNaxW4TI8xR5d/cCPFIkTgL47rIkH9kEmaQTR X-Received: by 2002:a63:7b06:: with SMTP id w6mr536261pgc.288.1546581926734; Thu, 03 Jan 2019 22:05:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546581926; cv=none; d=google.com; s=arc-20160816; b=U0c+PAndd9xhpPB8XUO/k9SgrqoNd/yqGXdvzFJV0FxDfUHGUhGcQsKw5MJYZ7MnFo rkQy3Ve7Exi0UzCxgWV0Y8lBiM0CSKOV2czCIOOGQHN6DQsI4hRvql8hLFH385RMOxMD Fbc24ClkjRjHb3mtZh1wngJlS0lsbON5DTHD+c9moYFmxv2zdK/iA4QK458C+wceUC+o 3BCDFU7I9YUvey2Oyq4Vwo9jR0suDjgbq6K/kmiBYjhqToa3bBIh1LOBggBl+6tNgDaL dZFUtiHgBkv99J32vK9ycRxbed90Tsnc0HEDphAEdQTDRzLCBEKc4k27+vBaVtJgl18s Zzew== 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:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=t6FXvHIoL5V6ieq/6gT4KVrc2DPo1EeQkePL34Ostbg=; b=l8XVpSNlXHyERrNnBSbrY1h9wCUY3LJHkQ+VoxZxBUslZPIHqDCMz53/PAyeL+LsUB aj7+fmHtsq60tPuObkZSIvEEprbFtRMest7dodTE2UcciqTXH1sG1wAAuMIzfvEnLO9P jEExMY06mrPstmwM+tXsal8TbPtTvRl2XbepWg1H+Gxbw4cmSVNRExmRnJ1DB4yaU2Gr a+a+RoPtsnIiB44UnI5RwqliOn82wpav4UA2zGbbS2wY4pIEWFoi/rEGnRVm9ZsJdLHj lDaQ+ogzBirTv95qbHljsj7/mn9p5tpowmJd5hMPbqSa5ggIXYNkWIxd6O2VhwOzO2ul YFbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ssbc8c61; 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 u186si16459214pgd.131.2019.01.03.22.05.11; Thu, 03 Jan 2019 22:05:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ssbc8c61; 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 S1726500AbfADC0e (ORCPT + 99 others); Thu, 3 Jan 2019 21:26:34 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44686 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726437AbfADC0e (ORCPT ); Thu, 3 Jan 2019 21:26:34 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so17536241pfh.11 for ; Thu, 03 Jan 2019 18:26:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=t6FXvHIoL5V6ieq/6gT4KVrc2DPo1EeQkePL34Ostbg=; b=Ssbc8c611j+YmWU6sLtBHTxqO1NqcHVz8Gg4no8nU286aGYMR6odZcfwQl37rRd2kQ v80GiiCSNArWNoDZAYPlnH0VGKKldcU/V0JMaRdKyMHKO88Ia/MOrg9G53TyhNs29TU3 TeWxkORHWGKx9bDbwSQBsbIajsuNFwqPc02JrmdN/qBAqjn+qe7eASBofBoHw6hFhkKY EGHWcpXzxFkg+BzxA0DeZxijzK4UBIZvffCC5zWOJrmiVLpRdgpaD/xbGlwN84X6Qkgw HSchPANIMmXs4gvOG3LwCujYdmRnVtRxaMrqTauOCfWVbXkuMMAHlKVYNFoeF6ArRSgw L/Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=t6FXvHIoL5V6ieq/6gT4KVrc2DPo1EeQkePL34Ostbg=; b=Xh49BlbmAEgOpBp2VWHNeGC53FH1/hZV9R5afyo6FIVLayiZpxJmC88hpHLzQtFUZx dNbyIlG5vgPrOhfB96vUvzDUyQpEqImjjsMvTP+/dSPyclYBUV8gbeBWNpwcpFgPkLTm R5/eHRzAiw8MqLi4b60F4f85Gs4Q7QQYlz7jKokoptm7DRYj9FisZpEVYP1FpOXFmD/M ybS5ZfLcL1B2rqxW5GRLa7iQ2zm0pa3/9HSKeNyAG1xTvcagJJyYH2yiGgr2KGxDKkzl W+FEsAghZsJpux3bOdP+93NUAF/2cMB3xh3VeN/9cBMTjFdX7+BEBNT0Z5M7MCThiaaj FyxQ== X-Gm-Message-State: AJcUukeSpIxjhWEKJzHJ/ktPomulCzZJLKnEsE06YctW80a5xScKVXAZ a9orU/AisI8BjB9LlXvNtmE8SyZj X-Received: by 2002:a65:4b82:: with SMTP id t2mr110706pgq.189.1546568793497; Thu, 03 Jan 2019 18:26:33 -0800 (PST) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.49? ([2402:f000:1:1501:200:5efe:a66f:4731]) by smtp.gmail.com with ESMTPSA id g26sm74036839pfh.61.2019.01.03.18.26.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 18:26:33 -0800 (PST) Subject: Re: [PATCH] fsi:fsi-sbefifo: Fix possible concurrency use-after-free bugs in sbefifo_user_release To: Benjamin Herrenschmidt , dhowells@redhat.com, joel@jms.id.au, eajames@linux.vnet.ibm.com, andrew@aj.id.au Cc: linux-kernel@vger.kernel.org References: <20181226135618.12784-1-baijiaju1990@gmail.com> <0adee96b58a533bc8c5927039e96b5ed77c9bbad.camel@kernel.crashing.org> From: Jia-Ju Bai Message-ID: <798fbb98-0cba-07f8-2165-180c63012e95@gmail.com> Date: Fri, 4 Jan 2019 10:26:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <0adee96b58a533bc8c5927039e96b5ed77c9bbad.camel@kernel.crashing.org> 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 On 2019/1/4 8:47, Benjamin Herrenschmidt wrote: > On Wed, 2018-12-26 at 21:56 +0800, Jia-Ju Bai wrote: >> In drivers/fsi/fsi-sbefifo.c, the functions sbefifo_user_release(), >> sbefifo_user_read() and sbefifo_user_write() may be concurrently executed. > So after refreshing my mind, looking at the code and talking with Al, I > really dont' see what race you are trying to fix here. > > read/write should never be concurrent with release for a given file and > the stuff we are protecting here is local to the file instance. > > Do you have an actual problem you observed ? > Thanks for the reply. In fact, this report is found by a static tool written by myself, instead of real execution. My tool found that in some drivers, for the structure "struct file_operations", the code in intetrfaces ".read" , "write" and ".release" are protected by the same lock. The functions kcs_bmc_read(), kcs_bmc_write() and kcs_bmc_release() are examples. Thus, my tool inferred that the intetrfaces ".read" , "write" and ".release" of "struct file_operations" can be concurrently executed, and generated this report. I manually checked this report, but I was not very sure of it, so I marked it as a "possible bug" and reported it. From your message, now I know my report is false, and ".read" , "write" cannot be concurrently executed with ".release" for a given file. Sorry for my false report, and thanks for your message. Best wishes, Jia-Ju Bai