From patchwork Mon Jan 29 14:34:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13535770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EFC9C47422 for ; Mon, 29 Jan 2024 14:35:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE3776B00A2; Mon, 29 Jan 2024 09:35:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E43A16B00B1; Mon, 29 Jan 2024 09:35:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBE0B6B00A2; Mon, 29 Jan 2024 09:35:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AABE86B00B0 for ; Mon, 29 Jan 2024 09:35:52 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 5C0691A0A36 for ; Mon, 29 Jan 2024 14:35:52 +0000 (UTC) X-FDA: 81732597744.04.9C53AE5 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf06.hostedemail.com (Postfix) with ESMTP id A5DC118001D for ; Mon, 29 Jan 2024 14:35:50 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XU4lx99Q; dmarc=none; spf=none (imf06.hostedemail.com: domain of BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706538950; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WZPrkSzC6JP8KIWSSwxcdUJBQA5TQKYe+UX++Ksig+4=; b=0LrBiTKrd/EZYeaZTjaB+C1Bw95sTu9NQhvQqguc9FD4tkS50km01kK8opMMB/3dDi8SQ5 MSHzyjzS2JRkyhq78VnNsRcPuahqKM/7JjL+bhPSRL8o7Ev9VUzY0koIT9/TRtBqV7Feze uTjnGwEQh22kdsRM/H+THelwR4MDeFk= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=XU4lx99Q; dmarc=none; spf=none (imf06.hostedemail.com: domain of BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706538950; a=rsa-sha256; cv=none; b=QAlivDFMrqLMFV6SuOFmlLOYJ8fxXtIDslyr44LxigoIGTi54h+LqrWzjtxO4bfhy22CfT oRhsUKcy1Su/GZLfrY8wMgoQu/4RHJehMe9ZAtfdBH2tD2vpbXfpbuwmSn2l3rxKbJckfy kZaF7cIiFE1qMFXZKbsw3dbJYO3WIAg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WZPrkSzC6JP8KIWSSwxcdUJBQA5TQKYe+UX++Ksig+4=; b=XU4lx99QKPPKmDgve+lLL6ig3j BLlmqQ1Pp7IJC2RnK+90IsIg/JiwDBGW4sSQhoKXo2cLYwVMBJPTgBFsXc7x4rccgqhY0ZMuPbsTP G/jiTROM8vMNGQxyIQGOIlBR4VcHP/Zvd1LuIlTmprOqgmYZDOomYkWFKDUOTom9HaatTvLOMc4SY ivE/cFH/7Ld/uKB2gG4+zPILYWnKw5OecUJXYv3G7+/SlWGB48DHSnTmpNCnsWmepYdeqqfNq8ksY dlSCoUciXUs/je+p5B4zN/JkXDubOOr/FRZ6H43RJBtlipdiO/94EB5twwyh00wm+i9E7yZJfjbYz Y24Xi/xw==; Received: from [2001:4bb8:182:6550:c70:4a89:bc61:3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUSjk-0000000D6L4-0ciP; Mon, 29 Jan 2024 14:35:48 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/20] xfs: don't modify file and inode flags for shmem files Date: Mon, 29 Jan 2024 15:34:54 +0100 Message-Id: <20240129143502.189370-13-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129143502.189370-1-hch@lst.de> References: <20240129143502.189370-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A5DC118001D X-Stat-Signature: cjbkd89exnxi8zc33qnp33aadby7ga3n X-HE-Tag: 1706538950-719602 X-HE-Meta: U2FsdGVkX1+Sza0jDBq4PYSsukdKJsHc9vMGmwcrVlqGF5K3diiVS9ys4XXOJZ7VrZAiSHWLoryc046P/WiA9ABUPsDetu+zOK6Fcd3jP9vgwcZbrTdwUqkktZ6faqdigtpJHawevHzl/jWpuso73HXfI8WN3ByJDi3Lggy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QszWKDf4gG3mIYS7emSNvB0yMLPVTssK2i8DMG+ToeYC6BiqxMSZNFHU0K40LzlW51zsIybPmBpTpmOzd/vIazw9/D5QW36hHR1wqlU4hFsttg20HoL6y6VtXb/qW6nzcg4ECWengcXhvNt84BB1il+vvZGHURTOXFMnmVgH8571n3qzWvj13EwcwOA79pY/8isTREqm5D8SdQseE5GYA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: shmem_file_setup is explicitly intended for a file that can be fully read and written by kernel users without restrictions. Don't poke into internals to change random flags in the file or inode. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/xfs/scrub/xfile.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c index 7785afacf21809..7e915385ef0011 100644 --- a/fs/xfs/scrub/xfile.c +++ b/fs/xfs/scrub/xfile.c @@ -68,28 +68,13 @@ xfile_create( if (!xf) return -ENOMEM; - xf->file = shmem_file_setup(description, isize, 0); + xf->file = shmem_kernel_file_setup(description, isize, 0); if (IS_ERR(xf->file)) { error = PTR_ERR(xf->file); goto out_xfile; } - /* - * We want a large sparse file that we can pread, pwrite, and seek. - * xfile users are responsible for keeping the xfile hidden away from - * all other callers, so we skip timestamp updates and security checks. - * Make the inode only accessible by root, just in case the xfile ever - * escapes. - */ - xf->file->f_mode |= FMODE_PREAD | FMODE_PWRITE | FMODE_NOCMTIME | - FMODE_LSEEK; - xf->file->f_flags |= O_RDWR | O_LARGEFILE | O_NOATIME; inode = file_inode(xf->file); - inode->i_flags |= S_PRIVATE | S_NOCMTIME | S_NOATIME; - inode->i_mode &= ~0177; - inode->i_uid = GLOBAL_ROOT_UID; - inode->i_gid = GLOBAL_ROOT_GID; - lockdep_set_class(&inode->i_rwsem, &xfile_i_mutex_key); trace_xfile_create(xf);