Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp379709rdb; Sat, 30 Sep 2023 08:01:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwK9yMnyFgpLj36heAyMoKwUcEub0U1uDXDllyc56rhboFXlEIwD+kbUlV/rv1wRTsgUj/ X-Received: by 2002:a05:6a00:2491:b0:68f:c9df:2ccb with SMTP id c17-20020a056a00249100b0068fc9df2ccbmr7576891pfv.1.1696086078707; Sat, 30 Sep 2023 08:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696086078; cv=none; d=google.com; s=arc-20160816; b=w5ajdY/53FunXS0rX5Q8IGMiBXzBNGT08pYTTiEj8lgmVSRxuETwtINTX3RwzajV/g +KPqB2pPtqFaj47abo9xY7yqfXjPFNSAiWKr+8unMdzmLVI1DzFA9sX6JCCuOz0QOn8N XTEETPGWfgXCi2fYaKKrGdioM53ZxAqILvHcFGrefoAa65HGW0vsyIu+7lvSftOlLJS3 MhLtDJSML9OCG6EdOXKXUwz4F4j3D/sg+CwA/ldyU3BmLu2ctvZRm1mYG9JlD7NPnyr0 sKJHQuqgCFGqskIOk34O2vW0D2EW06+zi/BStwf2sUiY7flIX9bIOSa/70+2mKFw4cc2 ulcw== 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=XF2XqSbh4bo4XlOeQPlKNJjJGH1v1k5zwfAqr3Sp+Eg=; fh=HvUWffv6igOXu2P73Ql2rtRnUEf5y7cGaDDfC8KwO9k=; b=G8Tq0S5KNiFjuAgwMUG3WDeZaxNo1vAjY9RAipHl9s6ktqYCCuvekF2/TnodWgxcup Q0NBAZbjZu3+YO/oBBayCtZStADCBjQ6AQLRIo/E63WRkK/H6s5bx3bEMfOk7KFr+96G SZOwNexJmk6GdcaxjGJ+5+UuXV351hMJkelAcl+mRmQBtghAyHhDFZEiMR9fYPlU9z7I KeJw5hdSIWvF/+m598FhxMESAXoRRCu4N8H3aftPvnpOz1ZpCy+mnUP5AQ5ezspvgr3+ P2nDl6QMssZ/7uRWovTtakJbS2sz63/BBlT2cWkmtvMiLEQiFMdeUmlTgFIF3zt0z153 Nb/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uqg4XSc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x190-20020a6386c7000000b005859c81f1f0si4164212pgd.137.2023.09.30.08.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 08:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Uqg4XSc8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 E4F4F8260099; Fri, 29 Sep 2023 22:02:21 -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 S229929AbjI3FB5 (ORCPT + 99 others); Sat, 30 Sep 2023 01:01:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234103AbjI3FBp (ORCPT ); Sat, 30 Sep 2023 01:01:45 -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 E0BB9171D; Fri, 29 Sep 2023 22:01:25 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-577e62e2adfso10221040a12.2; Fri, 29 Sep 2023 22:01:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050085; x=1696654885; 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=XF2XqSbh4bo4XlOeQPlKNJjJGH1v1k5zwfAqr3Sp+Eg=; b=Uqg4XSc8LOXnjixz7zU3bwd86/0oR3nfdfPp7D1FuNFzHUUgS9qLlrWBclpd0ukjD6 yfXo7mlJKWZvuySlQyhXif7oLX9TVekbMd+P3Zt6Ls7lejpK7MNIte4D6e64ukeFz+Om wVrDxIOmYshBZAo6UvsRoUkJr7am0oNt3c+GBgwmVA5IOWBZP60wforu41Mo4Ly90lI4 e04H/PBO3TT48CWBzLNTXPfHlHfX7pGet6Jpula/Hg5LzZxykQdrcWtmxVa1CinC7B9E tQjqHsQcZXOeX9wjm3cajHjZ8uv9OHbbHYBZbXatylxh2qZthSyIidm8eUo+5rn24OFX QZKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050085; x=1696654885; 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=XF2XqSbh4bo4XlOeQPlKNJjJGH1v1k5zwfAqr3Sp+Eg=; b=FQAWd07JQuTQXi3Be6MHh7s1//+E5UIwWZ8EwXWEMH1aTyTbO5Vg8ezNxZbliEZ7If LKYp4p7HbmWcNkM53zHDfULvsun3EkAuXjlynADsnB2CRzD8mgmNuh07hOjR04+3IxvJ 27iwhc/moPsAFPGed0DoUnZyFWEpBTQ3ncTog1CRXwVmSovfzXN9Z1vf58USazmBk79e WEzSOkhDxkNMJWToeLrRrWxaedkIXjJ43tpo+cT3yLN1ddybrsdKqbmXGoESLxdL/rtT TDQiQ7snt0F4lTUc6FgGbedmazZk/B9ZHArNK9I8X++HCQ0Gqe4ZWRVE/TiXOkOKclOS XVjg== X-Gm-Message-State: AOJu0YwO+lIdFP/zdATKnMNiswyp7+UA0cXUjJHF/W9+EP/zZIh9lJAq POMlBzkDEUiEGOc4+cvRNrE= X-Received: by 2002:a05:6a20:3c87:b0:15e:bcd:57f5 with SMTP id b7-20020a056a203c8700b0015e0bcd57f5mr6763988pzj.3.1696050084677; Fri, 29 Sep 2023 22:01:24 -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.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:24 -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 , Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , linux-erofs@lists.ozlabs.org Subject: [PATCH 08/29] erofs: move erofs_xattr_handlers and xattr_handler_map to .rodata Date: Sat, 30 Sep 2023 02:00:12 -0300 Message-Id: <20230930050033.41174-9-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 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: 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:22 -0700 (PDT) From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to erofs_xattr_handlers or xattr_handler_map at runtime. Cc: Gao Xiang Cc: Chao Yu Cc: Yue Hu Cc: Jeffle Xu Cc: linux-erofs@lists.ozlabs.org Signed-off-by: Wedson Almeida Filho --- fs/erofs/xattr.c | 2 +- fs/erofs/xattr.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c index 40178b6e0688..a6dd68ea5df2 100644 --- a/fs/erofs/xattr.c +++ b/fs/erofs/xattr.c @@ -166,7 +166,7 @@ const struct xattr_handler __maybe_unused erofs_xattr_security_handler = { }; #endif -const struct xattr_handler *erofs_xattr_handlers[] = { +const struct xattr_handler * const erofs_xattr_handlers[] = { &erofs_xattr_user_handler, &erofs_xattr_trusted_handler, #ifdef CONFIG_EROFS_FS_SECURITY diff --git a/fs/erofs/xattr.h b/fs/erofs/xattr.h index f16283cb8c93..b246cd0e135e 100644 --- a/fs/erofs/xattr.h +++ b/fs/erofs/xattr.h @@ -23,7 +23,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx, { const struct xattr_handler *handler = NULL; - static const struct xattr_handler *xattr_handler_map[] = { + static const struct xattr_handler * const xattr_handler_map[] = { [EROFS_XATTR_INDEX_USER] = &erofs_xattr_user_handler, #ifdef CONFIG_EROFS_FS_POSIX_ACL [EROFS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, @@ -44,7 +44,7 @@ static inline const char *erofs_xattr_prefix(unsigned int idx, return xattr_prefix(handler); } -extern const struct xattr_handler *erofs_xattr_handlers[]; +extern const struct xattr_handler * const erofs_xattr_handlers[]; int erofs_xattr_prefixes_init(struct super_block *sb); void erofs_xattr_prefixes_cleanup(struct super_block *sb); -- 2.34.1