Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2072857rdh; Sat, 28 Oct 2023 22:23:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvaMWRJe8Weq3mQfQkZQ9LCa0UypfFjOLV1qDh2n2m3hiqfM49Xkdesym4fflgf50cpyBr X-Received: by 2002:a17:903:48f:b0:1cc:3544:ea41 with SMTP id jj15-20020a170903048f00b001cc3544ea41mr2720963plb.46.1698556984008; Sat, 28 Oct 2023 22:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698556983; cv=none; d=google.com; s=arc-20160816; b=Lm+Bt4L5WVQALNGTdeZysd4QjPrj732x2vCARAD+UoSFBvf7KFMiY9ANn66evWih0/ ddBemGQbS7cqiDyK0JcqroSJr5s5KDrglMEu/1IABPjRneOCitrY2pE1ds6vbPi/TYFf Mr5DxsGvPXJDjRmuqMFbTWkiBVEgKQmCbvMS2DeCuDWRqm95ETwjOPXsoH32CdTQibTt KYBP/+HFV588HZnu7bgziWC019/eW/zQSoPVX3TpMZbMQNovFNoiBi8AN2g0sDFIvUuG ymcbE9BDf+F0v2b5ycOYXSxiL/AeFMAP4BEM6rS3j5+jx1HMrHB9PPTEXH3ihTo+Vn47 uwXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sB1j55JC/El1p0jjkjVIArkqbmShYLGKj4KmRysP+N8=; fh=JpbH3x1Ijcx1MLZNZvgTl8MxseMIbQK07DXvat5rGpo=; b=QZUI3g/PuDNJmHgOVgmU6RNkgXODOoqqtCpdBiFPdkoSD8DcClJYlEmeHY/oWDfxii nIx+4KykceLBjnJgDnmlDV6KQ7LG14bDFBU4rnxGaD5UDnCoCgIxfffgtGE9IcPNFgd5 xdRp04o4S1orZmrRudJvja9Twc8Ptlwygk5e4zMlfINtmRxHwKKY8fcnfHr++aiiLA+X d2beI7lOsw/TVtKWb3uzw8jHDBbTMgDesvxjjtyhbfWM4N0rxjJQiW2Fbe2F21P/OmpO 0YYFJdzmjGNMqeyT4NOSjJi8M9priET2kPi+OACduhz8yBL0u+9v8eyVwPxmo7yDTCQw AETg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RwapE4d7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ld13-20020a170902facd00b001cc4107a515si630316plb.48.2023.10.28.22.23.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 22:23:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RwapE4d7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B4F6D804E796; Sat, 28 Oct 2023 22:23:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbjJ2FW7 (ORCPT + 99 others); Sun, 29 Oct 2023 01:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjJ2FW6 (ORCPT ); Sun, 29 Oct 2023 01:22:58 -0400 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F19ABCF for ; Sat, 28 Oct 2023 22:22:55 -0700 (PDT) Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b3e7f56ca4so1976185b6e.0 for ; Sat, 28 Oct 2023 22:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698556975; x=1699161775; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sB1j55JC/El1p0jjkjVIArkqbmShYLGKj4KmRysP+N8=; b=RwapE4d7hl8Bkxl8xX035KiVZBsxWpW+02VCNltiOLygXFSFg1epUSEbUEDDLdKGgP c9YXOv164yVT4uFdJlwkSiuiGdibV/srakpEIxYBts0BkVvMuuM26nHytR8SMEdb0dR5 o7rqGdY0XFWeoMFqSm9lgnzE21XQCiVXUNv7jgtftQem5qHDjqphSVYh4x6+gRw9jVVU evnjbAX6OgXpWtQ9TBhXrjrjNS1VRGzUcPsDDJAH6mzLXtZw9kD5vPm/NuMM1bxdlQmh PZNGx3wyrJmA0cWmQlq0X2qGm2Yl605+pQGA2Nf8oT43MgNLThqxM97bVn9yDVc6i1kS 0U/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698556975; x=1699161775; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sB1j55JC/El1p0jjkjVIArkqbmShYLGKj4KmRysP+N8=; b=fVJDEouEfYzXHOyOafBVLSf5rSvCtqa7rGQoEI1L043j3awwOUmb9b5sXuS5fRCUGA DjAd6fzsYs1TUg10eY12PUAGbUDbmAKnoAj5GXDToitPI6SuTNEVtAIyUUwIA2aVQgPR hKGbJ00gtk86VKQZ/7WiROX7GwAqvbYBOKAR9yE+IgmC9M6OZwGcbS3Ncw2f/LjdVFWT /aiHyC8XSda19OlhDNZXVqWZO5amtvG8SHHddMBJkQb7AZtFDMkeutCLsethbeSClTvp y9x3eyYYDj9AU0kefdsYW8HBkw+j5s01xuQ9iESmML93XSeFtkH8g3f+EU3trFcIm4Pb Nc2g== X-Gm-Message-State: AOJu0YyYjWyUv3v8m9TyWkiyAB7NEr+Xf3WfuNR3Zc2kv7MI67aeaxUj PBN7INJUFrcyQA247UadXW1xkLbI8B1N/Atu+Fz1Gg== X-Received: by 2002:a05:6808:209a:b0:3a7:2524:6d3b with SMTP id s26-20020a056808209a00b003a725246d3bmr7421000oiw.12.1698556975240; Sat, 28 Oct 2023 22:22:55 -0700 (PDT) MIME-Version: 1.0 References: <20231028163749.0d3429a1@rorschach.local.home> In-Reply-To: <20231028163749.0d3429a1@rorschach.local.home> From: Naresh Kamboju Date: Sun, 29 Oct 2023 10:52:43 +0530 Message-ID: Subject: Re: [PATCH] eventfs: Test for ei->is_freed when accessing ei->dentry To: Steven Rostedt Cc: LKML , Linux trace kernel , Masami Hiramatsu , Mark Rutland , Arnd Bergmann , Beau Belgrave , Ajay Kaher , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 28 Oct 2023 22:23:02 -0700 (PDT) On Sun, 29 Oct 2023 at 02:07, Steven Rostedt wrote: > > From: "Steven Rostedt (Google)" > > The eventfs_inode (ei) is protected by SRCU, but the ei->dentry is not. It > is protected by the eventfs_mutex. Anytime the eventfs_mutex is released, > and access to the ei->dentry needs to be done, it should first check if > ei->is_freed is set under the eventfs_mutex. If it is, then the ei->dentry > is invalid and must not be used. The ei->dentry must only be accessed > under the eventfs_mutex and after checking if ei->is_freed is set. > > When the ei is being freed, it will (under the eventfs_mutex) set is_freed > and at the same time move the dentry to a free list to be cleared after > the eventfs_mutex is released. This means that any access to the > ei->dentry must check first if ei->is_freed is set, because if it is, then > the dentry is on its way to be freed. > > Also add comments to describe this better. > > Link: https://lore.kernel.org/all/CA+G9fYt6pY+tMZEOg=SoEywQOe19fGP3uR15SGowkdK+_X85Cg@mail.gmail.com/ > Link: https://lore.kernel.org/all/CA+G9fYuDP3hVQ3t7FfrBAjd_WFVSurMgCepTxunSJf=MTe=6aA@mail.gmail.com/ > > Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode") > Reported-by: Reported-by: Linux Kernel Functional Testing In the above line "Reported-by:" is twice. > Reported-by: Naresh Kamboju > Reported-by: Beau Belgrave > Signed-off-by: Steven Rostedt (Google) I am running tests on this patch and will get back to you shortly. - Naresh