Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp276482lqp; Tue, 11 Jun 2024 04:27:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxwnXHMZDCaf8J0PPhsRW+EYeRiWHRGWPNojhHPXQKBN25wK18G0WcSSUi88xUX8EyxTr8CJ+L2Q03pxoUmp2dGhVN26O0C8uTeCmMEQ== X-Google-Smtp-Source: AGHT+IEHnr2YNhP00K1qFRalCs0O6Wy9voTOAp9TgeHfvb/KlegZ8cqqrjUaCldYZNgB+Gyc6zgR X-Received: by 2002:a05:6808:10c3:b0:3d2:18fd:2faf with SMTP id 5614622812f47-3d218fd31f1mr11608833b6e.58.1718105224888; Tue, 11 Jun 2024 04:27:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718105224; cv=pass; d=google.com; s=arc-20160816; b=HB/VcsVWiL7BeMzMvWwPzOfy1eedWSNE/PRI5ZNSP4zdQm3c8QJ6gFBZI5wguxEpO2 2SlAmyCOSsgX3dkYtN9ekGBCdAELyp8y3kLxGWxsY1urSVxbW7a3Y7GTOzypp1AH/EoT 9p0EmcX8vQWB/TmAVX0yyRefAv8WsZQVo6EN9pDpwZfNNkfzK1aIkMYJP/ZYwpSWlvmX 6zKYkRvkhnz0rEB6+WpP3rNVJR5tCgKV8N/JpkfVdHajIp+B7A7Vk/GSmdJb3Fgtj69N 0x0LpkDgZHNv2/EcbTu+3NMlMx0z21xro2moVdYJl+kGfcn3P4f0on3RtRju2LKbLuO6 UkyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Ct2faOqflrZfkFZbWfpkQItxoF/ht0542akQkf4ySIY=; fh=D5vhfpf1RPCWruuskg0WZPM1jJivtBWB2hrVLI+YHYI=; b=HmhOaK5wvaFZhKgM/vi9x4wVFu/UdaT7Vu4WUDyLw9F2TXlGy+7U1i9TgAJ2ui1z8Q 9nWZCreiI1490QWb2B9nVzD0SqUW8iM1S8rWDaCyPqxNwln2nDgm5axl4WjMQBfxaWbs MnPJRIbIxh9NztTVa7MElrF3vM+pPVAZZ7t+2XzYsflkC6iQVBBH0kOGuCmwlktAz+C2 eVg5FessCv3lbJwGhvqnugwpTaLxPqJoFoez87Sx2C4c2iFpqfvOaRhdSCVfilt0SkV1 nPb5zNFOU7LvRp6276QtvE5wyeNG/KZLzLG/J0aAmc+LOzd5pt41BXr/qe3xFWYv6tSh p2Ig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WgV5M1cC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-44118781771si30223871cf.447.2024.06.11.04.27.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:27:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WgV5M1cC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8C6661C22660 for ; Tue, 11 Jun 2024 11:27:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBD8F17B437; Tue, 11 Jun 2024 11:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WgV5M1cC" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7040617A930; Tue, 11 Jun 2024 11:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105217; cv=none; b=mruRQl1EtuX8gPArvFWteTF8UaCouY6gbnLdI4pDoWEIM7n7Ry24yZIUOWqmjZ1WI16QP67toKzoYrFD3YcRM/Rc2Q46fUWllsav+/Zqz8uz6DxF+jqkCtjcnpExHFssB6z4TLCmrgbjB03P6fyzM0c/gjXQNltLbt0JRaYpUH4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718105217; c=relaxed/simple; bh=0vttU6plmC/ACJPGa8Cko9Nk6HM7dRc0+cN+OvUCcGI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Mi2Xqiy0opMEiuAwciNN+saBo18vTaUebMqzjymq/Bu2N9zDH1LfhmUt3soIpWcDuEG3R7tth55R1bVLkG4FE4HQYxcJn22WJ+EMZE69dJGFipP/WpHW7t5TxCwz/j27PqpxiLxFhU5t74ZM3J4vaEm+taYFRHg8hgGxZea9ac0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WgV5M1cC; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2eadaac1d28so49008711fa.3; Tue, 11 Jun 2024 04:26:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718105213; x=1718710013; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Ct2faOqflrZfkFZbWfpkQItxoF/ht0542akQkf4ySIY=; b=WgV5M1cC0afnhw5hOemidlXmsBNy/WPVGm9UmP7o5v9JmSNYZCD0qxFRN5MT5ZChln 1UGv3eogE0U9rcabdYCKgapEJIX6zK22vkYt1SqitWeEMk0k85g+M1hlwy3htgTzjhY0 0F4G7xuR3SYnFu+OBJDwj3Eg/V9sT7CAP/Ev0OnA7MwG++d5SzeZbbSkH+zMPL4tQVXg SABAi+BC0aWFj9zwU/JzBFsYQ2ZX/eBYe/6QJreHtoFP4IPAShX1L2RiexEbrJYSUWKW x0qGa0xA0Gh+iq7BDNhXzat8I2RU5RWY6eng9euATLpk9815rIcOkZ6Kb8XqgAk9jb8u Gsxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718105213; x=1718710013; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Ct2faOqflrZfkFZbWfpkQItxoF/ht0542akQkf4ySIY=; b=ju6U4cpcH6LmvdiYxU2um/SEYkwslVdGZ7JCgthg60i1CGkJI++x9t6JCY7JpmRUJT T96p8/ITAnL57Hf3HCnqT1WR8Zz7v3Bh3ANz4F6qWE/6vcOYlrVjKVRRkrrxI7rC8tbm D1wziP4PhaWxbAA9vuFCdxE9X71QyRX3flr1m10fR0HJiddfVHjYiYYTKHQShpk/AkJM 3DzZIcBWmIoo+VkIUkwcoPoq/lEQ4plWwcwq0VJIZRb3Pg5QWept3maWCWweR4C7ckfp oEG3k7IHuAeRf3A6jmtUSCB0wNCLgt87FC9EFkJsF4Gk4vIhjS6Z2iP/S/lycNXj+b0Z AVNw== X-Forwarded-Encrypted: i=1; AJvYcCU+3upz1aXTJnp4TmphPCCajjkFdvjFlS0k0oDiNwohugUsVaLuhOnUIt7YD/ht5LnhlYMpndhMd/zduEEvwJCg9yBOWet8beUgzOmc5W3SSwk5k7TiQ3kPar41LEru7051IQnTE4I2n1xMrQ== X-Gm-Message-State: AOJu0Yx9R9NZywxSCXlHV/49eFFQMG6d8kxlrg+x/kQh5BuWChtXABAv zFTef+D1e1VW/Cj8dF0JgsX8Iw4ubwSj0ZORTPGfYvswMZjSwMMV X-Received: by 2002:a2e:a988:0:b0:2ea:ea80:5328 with SMTP id 38308e7fff4ca-2eaea8057ebmr71681461fa.45.1718105213204; Tue, 11 Jun 2024 04:26:53 -0700 (PDT) Received: from f (cst-prg-65-249.cust.vodafone.cz. [46.135.65.249]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35f1a7c663asm8277814f8f.115.2024.06.11.04.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 04:26:52 -0700 (PDT) Date: Tue, 11 Jun 2024 13:26:45 +0200 From: Mateusz Guzik To: Dave Chinner Cc: Jan Kara , brauner@kernel.org, viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] vfs: partially sanitize i_state zeroing on inode creation Message-ID: References: <20240611041540.495840-1-mjguzik@gmail.com> <20240611100222.htl43626sklgso5p@quack3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, Jun 11, 2024 at 08:56:40PM +1000, Dave Chinner wrote: > On Tue, Jun 11, 2024 at 12:23:59PM +0200, Mateusz Guzik wrote: > > I did not patch inode_init_always because it is exported and xfs uses it > > in 2 spots, only one of which zeroing the thing immediately after. > > Another one is a little more involved, it probably would not be a > > problem as the value is set altered later anyway, but I don't want to > > mess with semantics of the func if it can be easily avoided. > > Better to move the zeroing to inode_init_always(), do the basic > save/restore mod to xfs_reinit_inode(), and let us XFS people worry > about whether inode_init_always() is the right thing to be calling > in their code... > > All you'd need to do in xfs_reinit_inode() is this > > + unsigned long state = inode->i_state; > > ..... > error = inode_init_always(mp->m_super, inode); > ..... > + inode->i_state = state; > ..... > > And it should behave as expected. > Ok, so what would be the logistics of submitting this? Can I submit one patch which includes the above + i_state moved to inode_init_always? Do I instead ship a two-part patchset, starting with the xfs change and stating it was your idea? Something else? Fwiw inode_init_always consumer rundown is: - fs/inode.c which is automagically covered - bcachefs pre-zeroing state before even calling inode_init_always - xfs with one spot which zeroes immediately after the call - xfs with one spot which possibly avoids zeroing