From patchwork Sat Sep 30 05:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wedson Almeida Filho X-Patchwork-Id: 146913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp326100vqb; Sat, 30 Sep 2023 04:22:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGohm/nnA58XCj0PNpJjaZ9er6Au+w3FZ2IyCgivDfDe7a0oVIzAzlSZKA97rV255Zaik4F X-Received: by 2002:a17:903:246:b0:1c0:b84d:3f73 with SMTP id j6-20020a170903024600b001c0b84d3f73mr7926830plh.53.1696072925831; Sat, 30 Sep 2023 04:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696072925; cv=none; d=google.com; s=arc-20160816; b=BQxZ+m+ZMFtfLoAvI0V1j01JS2AuHUvKPADBwzCeKKqSaHO8pdZnIVE863Hex2TpGL XCvU9teVXizrQCJcubLWpmgjM9mtU5N87Mv3hqILLGlRjtAyqKYoKT/jagitSlxg+8pa BBil+AYkc+fUgydyuihy4uZ7PupsMvG4MwWxksqbEom6vvcnqwHxPuyc2JA9D6Xe0xbE kGqYMtetwon1Y9/tdauN6KiwYorp3iiBbgIC1WHAM2pehryNXhA6WTM12aKzecujCOz0 erZuh2fSkgdUhHDMN2Nps5kX4vXIXobYDu4CpPopX+auKk0C7LYPdE0E9X0Uf9VLT0TL bbqw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9WSGeyDZriCKRNJzS9a5bpAtYgU4j64EZGl2o5ZwnHo=; fh=FuoT2ZXwwNf3AqTXhk6OYKOpcoWevX2yEIIkNtDaXns=; b=wWQwV6NCYL4ect9XtmzLEgdSeLYSQtDMEnWULIicaDhNsZSWZoOLYbOu06ot91EWgS mRbS2052sbfs27qeuO4OM66gDqQbQ8MGmLNdR0OzodDdG7u6QFrSiatDxaMc0fWeqIuT cjW1Bw/LSC36L2dJtpwtl62HmB+8AAa3QHBvbCJt8uDM3f7uUVBR2HaV79s3fEADQ8mB CMkPNNY9wkb+6g/7578W5NLCO5mL37aSornP0eKCmA+0/ld8DIbjGXk0/sKArwdWnKah b/Tvhgcg9VjldosA7dD8v95R/98tKTggEgBpwvpQpvfR+5z16Q1wxjrk2dk4EjqbWMcu F3cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=chixZPn6; 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 k15-20020a170902c40f00b001b895572179si24884984plk.184.2023.09.30.04.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 04:22:05 -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=chixZPn6; 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 3ED7A825A0FF; Fri, 29 Sep 2023 22:02:14 -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 S234008AbjI3FBL (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233564AbjI3FBD (ORCPT ); Sat, 30 Sep 2023 01:01:03 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C2E1B0; Fri, 29 Sep 2023 22:01:00 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-5859b2eaa67so1169926a12.0; Fri, 29 Sep 2023 22:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050060; x=1696654860; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9WSGeyDZriCKRNJzS9a5bpAtYgU4j64EZGl2o5ZwnHo=; b=chixZPn68wPzpPaXBpXJPcHLVyqXmkdsyx7keiyCNsq5Q/LuRkXMQwJW9byonEhY98 MlOlXnUK0mE3HgI/Z393vQklX5+643Ozs2KFXRWsvktZEB/S2evUqFpvM48mkBmUVz3W a6Ifh7sCBz0cldhuUpwzWq7MvRDOyPalK9eKHRWxLiiAPIt/oBRQweVURwzbBHlwMZwV ZqZvH+6vQWepBtLxmnSF1UHY6J9WMhetMEE+5K3MAuFb5+YUmDrQUBxD/4WDY5ClS5mu ZqcrGWQn3Ja6e7Ir0meuLgpCjlnsdaEEs1+fcOo+05GSY+lxsZmyJfDa4Bz4FXvbCwjI y74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050060; x=1696654860; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9WSGeyDZriCKRNJzS9a5bpAtYgU4j64EZGl2o5ZwnHo=; b=VP+QLVy37z5qONJ1a8BccL1oT+RDVGpv72nky+vE5f44BDqQs1dsJw4RSrO95LNiRN jdCCuNYDNOSGRe8aLr7PwfTFNjjzMMoQi2aYriTpk3oRC3oHz18vdgq6SQXbrWEVEW+a ftlEOpelT8qA7Bl2shMSY3lln8Sytj0iq5lBkXyE5ZqxeFEsSd3ierzz4N6mECCxVARd UuH5ZzbnaHFyU/WtMr8H+Ftwx9UxrKZdnfV4h6BeWSuRFB1h5XHgFsXoKVbCc+j2KPf8 +514OZunSFJ9WfYwraYelCwtobzG7iwzBjiMxhvfESv3o7zF9jV88fi9Q8VQ7nluw5sp 83oA== X-Gm-Message-State: AOJu0YxzZzpDwFF1onMqVnVkPfRWnrxcrDZzl68iohkiIzEDkcxEgzni NKk/hEIGaP6YJxmhYkHUMlQ= X-Received: by 2002:a05:6a21:3d8b:b0:163:4288:1c3d with SMTP id bj11-20020a056a213d8b00b0016342881c3dmr3036924pzc.43.1696050060285; Fri, 29 Sep 2023 22:01:00 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:00 -0700 (PDT) From: Wedson Almeida Filho To: Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Wedson Almeida Filho , "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org Subject: [PATCH 02/29] ext4: move ext4_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:06 -0300 Message-Id: <20230930050033.41174-3-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230930050033.41174-1-wedsonaf@gmail.com> References: <20230930050033.41174-1-wedsonaf@gmail.com> MIME-Version: 1.0 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: 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:02:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778461364195910589 X-GMAIL-MSGID: 1778461364195910589 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ext4_xattr_handlers at runtime. Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/ext4/xattr.c | 2 +- fs/ext4/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 05151d61b00b..5e8a7328fe4e 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -98,7 +98,7 @@ static const struct xattr_handler * const ext4_xattr_handler_map[] = { [EXT4_XATTR_INDEX_HURD] = &ext4_xattr_hurd_handler, }; -const struct xattr_handler *ext4_xattr_handlers[] = { +const struct xattr_handler * const ext4_xattr_handlers[] = { &ext4_xattr_user_handler, &ext4_xattr_trusted_handler, #ifdef CONFIG_EXT4_FS_SECURITY diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h index 824faf0b15a8..bd97c4aa8177 100644 --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -193,7 +193,7 @@ extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, struct ext4_inode *raw_inode, handle_t *handle); extern void ext4_evict_ea_inode(struct inode *inode); -extern const struct xattr_handler *ext4_xattr_handlers[]; +extern const struct xattr_handler * const ext4_xattr_handlers[]; extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, struct ext4_xattr_ibody_find *is);