Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1526787pxb; Thu, 4 Mar 2021 13:47:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwP0tOS5G1zeyJ/TgxchY6aHhGZqVAeYBOv5d62KfECiSA3eHKazdIa7D0NM5LWnWzEYO57 X-Received: by 2002:a17:906:1754:: with SMTP id d20mr6390099eje.221.1614894446347; Thu, 04 Mar 2021 13:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614894446; cv=none; d=google.com; s=arc-20160816; b=gWvH0rgJa51C33ahoJrpCvLrZ2ya77o05epECwzN5HUwjk/4Jo7mwL+FaqvNAPO/CP hfQ9A5kzqQOm/BfHHqAhMVmtTTDUB7maNYvckjiNwivjFfAF7wHEGhSVvNzAAF7sVl38 wapgB5pDS5BZ7jvIyj/vPHDUmxYNbiDREMN09BjfRBKEwfB67MQbTi3J/IaxIm6C7xwL 4H6td8kVhzmKPiA8kjNeXM9n+A/qizrCYnH8zw6tvwd9kC5sEjL/SHaRqS1BHOF25hvZ Rym9ZVEGzS5jlqZvJtvDapgqCj4sfnLTFSTgHPCOcf81KYrpPDDhMqfpEsNbOjo+H/66 XFjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XJSPnpXOUcQ9Lu7FqcpViyjrzP6H/GvGt1ms5kzy3AQ=; b=tUmfGfy/2iVMCyM72VO7cL//hF/iLooSeOl8Fi2joap9vCSsn4b2D/0XfmNLTJq9Bi HJ5dTqc088pjdRrKmU84HmJatqlCVqKmPHpwFL1dBODz2rYMjdZzqs8XVzMybItaeFd7 UR7cTEv08Xd4WfzdoIeqsqNncskPyNfMeySGyICBKhtVoInz5UtXXzsiLtl4G+2WrcMa 2pwiU+uNKmeYlJSoIiDvcIuWkncnPJFmuf2oZSuaEb90zjKUb8XCnPyj09FjsESWbCrQ E5djEt3IwrWBOd56YqjUribyqUOIZeW7U1GJG3V6QgULJ9YNkXPTgqGGjRWVR6ot0zUX aABA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mK8uAQYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt8si245582ejc.111.2021.03.04.13.47.02; Thu, 04 Mar 2021 13:47:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mK8uAQYu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359638AbhCCOuH (ORCPT + 99 others); Wed, 3 Mar 2021 09:50:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:43180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843033AbhCCKYj (ORCPT ); Wed, 3 Mar 2021 05:24:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 63150601FF; Wed, 3 Mar 2021 10:23:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614767038; bh=g13f1wNwycJzQzB482148MxXAKUri2zU2+znvRzH904=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mK8uAQYuWJevNgoGLCLA335nUMVwWOK/wmlcHdG6KcuJjhRwwYtZyZPQpuUNVltjO ZLMSqrkfncvAe3WcDuYZVgSbYNZ5r1iBViT9aMoiOEHGsPwiaTzNmWCABeaLmZZlzM /VGJFijW5wpXPzaPGsogAyGk1gxj1zlbihiSEh9Y= Date: Wed, 3 Mar 2021 11:23:54 +0100 From: Greg KH To: Marco Elver Cc: rafael@kernel.org, "Paul E. McKenney" , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , kasan-dev , LKML , stable Subject: Re: [PATCH] kcsan, debugfs: Move debugfs file creation out of early init Message-ID: References: <20210303093845.2743309-1-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 03, 2021 at 11:18:06AM +0100, Marco Elver wrote: > On Wed, 3 Mar 2021 at 10:57, Greg KH wrote: > > > > On Wed, Mar 03, 2021 at 10:38:45AM +0100, Marco Elver wrote: > > > Commit 56348560d495 ("debugfs: do not attempt to create a new file > > > before the filesystem is initalized") forbids creating new debugfs files > > > until debugfs is fully initialized. This breaks KCSAN's debugfs file > > > creation, which happened at the end of __init(). > > > > How did it "break" it? The files shouldn't have actually been created, > > right? > > Right, with 56348560d495 the debugfs file isn't created anymore, which > is the problem. Before 56348560d495 the file exists (syzbot wants the > file to exist.) > > > > There is no reason to create the debugfs file during early > > > initialization. Therefore, move it into a late_initcall() callback. > > > > > > Cc: Greg Kroah-Hartman > > > Cc: "Rafael J. Wysocki" > > > Cc: stable > > > Fixes: 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized") > > > Signed-off-by: Marco Elver > > > --- > > > I've marked this for 'stable', since 56348560d495 is also intended for > > > stable, and would subsequently break KCSAN in all stable kernels where > > > KCSAN is available (since 5.8). > > > > No objection from me, just odd that this actually fixes anything :) > > 56348560d495 causes the file to just not be created if we try to > create at the end of __init(). Having it created as late as > late_initcall() gets us the file back. > > When you say "fixes anything", should the file be created even though > it's at the end of __init()? Perhaps I misunderstood what 56348560d495 > changes, but I verified it to be the problem by reverting (upon which > the file exists as expected). All my change did is explicitly not allow you to create a file if debugfs had not been initialized. If you tried to do that before, you should have gotten an error from the vfs layer that the file was not created, as otherwise how would it have succeeded? I just moved the check up higher in the "stack" to the debugfs code, and not relied on the vfs layer to do a lot of work only to reject things later on. So there "should" not have been any functional change with this patch. If there was, then something is really odd as how can the vfs layer create a file for a filesystem _before_ that filesystem has been registered with the vfs layer? thanks, greg k-h