Message ID | 20230930050033.41174-1-wedsonaf@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp200409vqb; Fri, 29 Sep 2023 22:03:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNJ/bFpNr/Y82DMWL6Z4+v6CAyhWLZeN21Z8+yj+viqzPf9NEoDNHA4fDLs3kEJz3fOq8K X-Received: by 2002:a17:903:428b:b0:1b8:2c6f:3248 with SMTP id ju11-20020a170903428b00b001b82c6f3248mr5538223plb.39.1696050218969; Fri, 29 Sep 2023 22:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696050218; cv=none; d=google.com; s=arc-20160816; b=dB8zq6SiD/vfeR9rYxQRVaHQwOoSprJtm7wQ4yMaBxhLcWc8oTY2lxAzLQ+09wYZj5 Bw30r9YEN5+lDqOwIc0sHdrpYxR4LO5Wt8BsbbxebjpXqxPeIgk2zNc11ARYOEzTqW0e RqBrKjaysf8+2NVyAvtGYErk+flHbRsZNUw8MdqTS9TZxrD9/r7gtIaBFIT8+J+JnahU Bs0b4zm5SnxFQWbtF34qYrjJExKNCPenttbugDzJOZqu7MqSQ6HtHcmT/kpDqPJMeTrM PmXIMq0wh+i5ZJBffeeP6o/n66Hc/RBTKs4+sqey3eAHP+7VpJ56tpf+oEYYMFxJEFN6 wD/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gMv4JB25eIKmXmuOUK/GNC/1oaLVZUgAaz4JD4n4uhE=; fh=SK2xQ5WvE6tbwSQN9TMkRjbkm0hotbQhx6y1kSOUb0Q=; b=CYQf+Un62PEMxJW/c2prTYrABNnuQZidWIaY8mEiwACQoi2FPANLZoo2w0YDJFkA58 7QT82ztCdww/k3MDNVL37LnTJBVF31XInlTNrpI+T8ciSXRFR1hx7y81e9FG2qyAYzaS 4QSO/cLIZ6nxNvx7izjtwQ5MbnSK+AfoHPOfoZdw6Deq8RGR780DTy3xiLVsbnRmCr1p 1SafcDB7KEouealGhZD7wEitCztFDdQepYQKV1zHcVKL0bnUpI+7c0mCAnvQdQY9AKtR en2GhVq1BE7lBl8ax8oDQzIIzH5jqdbynPDMkIvZdiP7mYHBz/buV2xgDDnczgkper3S lWrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kft86MAS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j4-20020a170903028400b001b9c992945fsi23135242plr.555.2023.09.29.22.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kft86MAS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4984A80B1984; Fri, 29 Sep 2023 22:01:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231823AbjI3FA6 (ORCPT <rfc822;pwkd43@gmail.com> + 19 others); Sat, 30 Sep 2023 01:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjI3FA5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 30 Sep 2023 01:00:57 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB21B9; Fri, 29 Sep 2023 22:00:55 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-5859b1c92a0so1386497a12.2; Fri, 29 Sep 2023 22:00:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050055; x=1696654855; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gMv4JB25eIKmXmuOUK/GNC/1oaLVZUgAaz4JD4n4uhE=; b=Kft86MASrOJ8TXsgsreVvDHLifX8thNK6ZcWZaFQJEUubjXdZcIXx2zCu5q4sYtLOt QRsIh1R4LHvHCKBu/27nu7wu/Q49Gm6Hjxi6KFh9d7/PmtbGiMNWnSA2CkvK2KoTlwQG s2/mr7kKQH0E0WDkvhm1F4cD/rNPnHNHewNuOj2J9yxWRNxgpPwxWQNxbIw0Wrj2U56U /u5HqG+Ga6m7HrkJCqXjHn1b1/cdQyQEX1gjW5uQiX8EVVPPbSyA9UIKATH30rUZ1/XK ZRuyhjE+Fas4xzcbVXNcLW/6AKPA23bF8vXr3WnaqGlH2FjG91s1wJF1uoupkzYmJ1Bo AaEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050055; x=1696654855; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gMv4JB25eIKmXmuOUK/GNC/1oaLVZUgAaz4JD4n4uhE=; b=BPVEMZuJVLNw+D623m3M/Xhqgp9A4yVldq7HDVzFLOEz1jhUo4ZLvwXePSjKM2MdRC E2TAFhLuLqOOagnpHM44ljicJtapz6Wm5n0r+F6wbozZeIUvxwKrrB4AQnIxaICgw3VW /1vqeumCqsIAHGgY6KgoYO0pLS5vtIGqkEeTEH6UAZrbXera9ib8hEe93yjxl6h3KThV Qx9SFKnstaD+bOzzh6A9wMeHOmsEGHij8jRL2VCUQOcuJDnfn0AKIHr3tXGgGM3UMYbm 2Q0iDO/xRHREJdZkWrxk2yR0Ibwgmr5kGaghRviEJ52ceE42WV1vC/0suEjIo/CmcQzz Fc4w== X-Gm-Message-State: AOJu0YwehaIQbrB5LdPK/aYDg8tMjCZhHsnG3R2DWEtaow4aic49SLdk y0byZZH3WBNrQjxHc9oe+Dw= X-Received: by 2002:a05:6a20:729c:b0:15e:bb88:b76e with SMTP id o28-20020a056a20729c00b0015ebb88b76emr6804458pzk.14.1696050054633; Fri, 29 Sep 2023 22:00:54 -0700 (PDT) Received: from wedsonaf-dev.home.lan ([189.124.190.154]) by smtp.googlemail.com with ESMTPSA id y10-20020a17090322ca00b001c322a41188sm392136plg.117.2023.09.29.22.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:00:54 -0700 (PDT) From: Wedson Almeida Filho <wedsonaf@gmail.com> To: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wedson Almeida Filho <walmeida@microsoft.com> Subject: [PATCH 00/29] const xattr tables Date: Sat, 30 Sep 2023 02:00:04 -0300 Message-Id: <20230930050033.41174-1-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:01:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778437554181463781 X-GMAIL-MSGID: 1778437554181463781 |
Series |
const xattr tables
|
|
Message
Wedson Almeida Filho
Sept. 30, 2023, 5 a.m. UTC
From: Wedson Almeida Filho <walmeida@microsoft.com>
The 's_xattr' field of 'struct super_block' currently requires a mutable
table of 'struct xattr_handler' entries (although each handler itself is
const). However, no code in vfs actually modifies the tables.
So this series changes the type of 's_xattr' to allow const tables, and
modifies existing file system to move their tables to .rodata. This is
desirable because these tables contain entries with function pointers in
them; moving them to .rodata makes it considerably less likely to be
modified accidentally or maliciously at runtime.
I found this while writing Rust abstractions for vfs.
Wedson Almeida Filho (29):
xattr: make the xattr array itself const
ext4: move ext4_xattr_handlers to .rodata
9p: move xattr-related structs to .rodata
afs: move afs_xattr_handlers to .rodata
btrfs: move btrfs_xattr_handlers to .rodata
ceph: move ceph_xattr_handlers to .rodata
ecryptfs: move ecryptfs_xattr_handlers to .rodata
erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata
ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata
f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata
fuse: move fuse_xattr_handlers to .rodata
gfs2: move gfs2_xattr_handlers_max to .rodata
hfs: move hfs_xattr_handlers to .rodata
hfsplus: move hfsplus_xattr_handlers to .rodata
jffs2: move jffs2_xattr_handlers to .rodata
jfs: move jfs_xattr_handlers to .rodata
kernfs: move kernfs_xattr_handlers to .rodata
nfs: move nfs4_xattr_handlers to .rodata
ntfs3: move ntfs_xattr_handlers to .rodata
ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to
.rodata
orangefs: move orangefs_xattr_handlers to .rodata
reiserfs: move reiserfs_xattr_handlers to .rodata
smb: move cifs_xattr_handlers to .rodata
squashfs: move squashfs_xattr_handlers to .rodata
ubifs: move ubifs_xattr_handlers to .rodata
xfs: move xfs_xattr_handlers to .rodata
overlayfs: move xattr tables to .rodata
shmem: move shmem_xattr_handlers to .rodata
net: move sockfs_xattr_handlers to .rodata
fs/9p/xattr.c | 8 ++++----
fs/9p/xattr.h | 2 +-
fs/afs/internal.h | 2 +-
fs/afs/xattr.c | 2 +-
fs/btrfs/xattr.c | 2 +-
fs/btrfs/xattr.h | 2 +-
fs/ceph/super.h | 2 +-
fs/ceph/xattr.c | 2 +-
fs/ecryptfs/ecryptfs_kernel.h | 2 +-
fs/ecryptfs/inode.c | 2 +-
fs/erofs/xattr.c | 2 +-
fs/erofs/xattr.h | 4 ++--
fs/ext2/xattr.c | 4 ++--
fs/ext2/xattr.h | 2 +-
fs/ext4/xattr.c | 2 +-
fs/ext4/xattr.h | 2 +-
fs/f2fs/xattr.c | 4 ++--
fs/f2fs/xattr.h | 2 +-
fs/fuse/fuse_i.h | 2 +-
fs/fuse/xattr.c | 2 +-
fs/gfs2/super.h | 4 ++--
fs/gfs2/xattr.c | 4 ++--
fs/hfs/attr.c | 2 +-
fs/hfs/hfs_fs.h | 2 +-
fs/hfsplus/xattr.c | 2 +-
fs/hfsplus/xattr.h | 2 +-
fs/jffs2/xattr.c | 2 +-
fs/jffs2/xattr.h | 2 +-
fs/jfs/jfs_xattr.h | 2 +-
fs/jfs/xattr.c | 2 +-
fs/kernfs/inode.c | 2 +-
fs/kernfs/kernfs-internal.h | 2 +-
fs/nfs/nfs.h | 2 +-
fs/nfs/nfs4_fs.h | 2 +-
fs/nfs/nfs4proc.c | 2 +-
fs/ntfs3/ntfs_fs.h | 2 +-
fs/ntfs3/xattr.c | 2 +-
fs/ocfs2/xattr.c | 4 ++--
fs/ocfs2/xattr.h | 2 +-
fs/orangefs/orangefs-kernel.h | 2 +-
fs/orangefs/xattr.c | 2 +-
fs/overlayfs/super.c | 4 ++--
fs/reiserfs/reiserfs.h | 2 +-
fs/reiserfs/xattr.c | 2 +-
fs/smb/client/cifsfs.h | 2 +-
fs/smb/client/xattr.c | 2 +-
fs/squashfs/squashfs.h | 2 +-
fs/squashfs/xattr.c | 2 +-
fs/ubifs/ubifs.h | 2 +-
fs/ubifs/xattr.c | 2 +-
fs/xattr.c | 6 +++---
fs/xfs/xfs_xattr.c | 2 +-
fs/xfs/xfs_xattr.h | 2 +-
include/linux/fs.h | 2 +-
include/linux/pseudo_fs.h | 2 +-
mm/shmem.c | 2 +-
net/socket.c | 2 +-
57 files changed, 69 insertions(+), 69 deletions(-)
base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c
Comments
On Sat, Sep 30, 2023 at 02:00:04AM -0300, Wedson Almeida Filho wrote: > From: Wedson Almeida Filho <walmeida@microsoft.com> > > The 's_xattr' field of 'struct super_block' currently requires a mutable > table of 'struct xattr_handler' entries (although each handler itself is > const). However, no code in vfs actually modifies the tables. > > So this series changes the type of 's_xattr' to allow const tables, and > modifies existing file system to move their tables to .rodata. This is > desirable because these tables contain entries with function pointers in > them; moving them to .rodata makes it considerably less likely to be > modified accidentally or maliciously at runtime. Fine by me and good idea. On vacation this week but I'll wait for individual fs maintainers to ack their portions anyway and then pick up next week.
On Sat, Sep 30, 2023 at 02:00:04AM -0300, Wedson Almeida Filho wrote: > From: Wedson Almeida Filho <walmeida@microsoft.com> > > The 's_xattr' field of 'struct super_block' currently requires a mutable > table of 'struct xattr_handler' entries (although each handler itself is > const). However, no code in vfs actually modifies the tables. > > So this series changes the type of 's_xattr' to allow const tables, and > modifies existing file system to move their tables to .rodata. This is > desirable because these tables contain entries with function pointers in > them; moving them to .rodata makes it considerably less likely to be > modified accidentally or maliciously at runtime. > > I found this while writing Rust abstractions for vfs. Applied to the vfs.xattr branch of the vfs/vfs.git tree. Patches in the vfs.xattr branch should appear in linux-next soon. Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it. It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated. Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch. tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.xattr [01/29] xattr: make the xattr array itself const https://git.kernel.org/vfs/vfs/c/e346fb6d774a [02/29] ext4: move ext4_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e60ac1283340 [03/29] 9p: move xattr-related structs to .rodata https://git.kernel.org/vfs/vfs/c/b6079dc9cb51 [04/29] afs: move afs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f710c2e48135 [05/29] btrfs: move btrfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/8a25b4189896 [06/29] ceph: move ceph_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/10f9fbe9f25a [07/29] ecryptfs: move ecryptfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f354ed981066 [08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/3591f40e223c [09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/ce78a1ec1c3b [10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/a1c0752c33d2 [11/29] fuse: move fuse_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/34271edb1878 [12/29] gfs2: move gfs2_xattr_handlers_max to .rodata https://git.kernel.org/vfs/vfs/c/89491fafa81c [13/29] hfs: move hfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e27a45b65070 [14/29] hfsplus: move hfsplus_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2c323f2c5650 [15/29] jffs2: move jffs2_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/13a75c3abcbe [16/29] jfs: move jfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/ea780283e2c0 [17/29] kernfs: move kernfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/ffb2e0650827 [18/29] nfs: move nfs4_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/f496647e3b09 [19/29] ntfs3: move ntfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/5bf1dd9441da [20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata https://git.kernel.org/vfs/vfs/c/2cba9af99b3f [21/29] orangefs: move orangefs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2e9440ac0716 [22/29] reiserfs: move reiserfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/c063254b7de8 [23/29] smb: move cifs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/e45679b0d2e4 [24/29] squashfs: move squashfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/8a2ae79c7db0 [25/29] ubifs: move ubifs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/582f1ebe32a9 [26/29] xfs: move xfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/6fca42a3b168 [27/29] overlayfs: move xattr tables to .rodata https://git.kernel.org/vfs/vfs/c/3f644c1cd7b5 [28/29] shmem: move shmem_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/2f8e5f98045e [29/29] net: move sockfs_xattr_handlers to .rodata https://git.kernel.org/vfs/vfs/c/dcff22588d9a