From patchwork Sat Sep 30 05:00:14 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: 146918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp335486vqb; Sat, 30 Sep 2023 04:43:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbyJBfR6A8TRcVSP7nD8oaWa9WEPdL8xBr7M3OnSgGQLFSsYAjAdhXsE9AoTQcqT0f+id2 X-Received: by 2002:a05:6e02:1524:b0:351:4cdd:f533 with SMTP id i4-20020a056e02152400b003514cddf533mr8424166ilu.4.1696074194670; Sat, 30 Sep 2023 04:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696074194; cv=none; d=google.com; s=arc-20160816; b=mVY/GrgYkdVcrNI1rNfJo+c9fPXOgh3s0ZohDPAc7wi35H9ZM9hclh8zqnlEg+IcAb nW4E0XxmeLx0LYnKLR0CJV6RGvzHwdImvqi03lyP58aN14AuujTfDwQEKOxX126kw3TM o6UplPbP67H/tD26rkfxuGjtgP5Fb9v3L0ybnqgEY+lxVXsoseGUKM5pVwzSl66y0yk2 4dIpEF122WfJBoYpOd1kTP8UiCu7UttNsQumZO5QQhdQkTPM6K2Ad9XA8r8mTveJ/Iii 39s1I/L7/KTY5oKmGynH5z8GkZT/8Qrlza+SsRRlWDr4CYT7n4ZtyLq0AdnIPfL9xgvf NZIg== 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=BqRIIscirReKomhnn9aWQqgUEl26ak+53Sd7DXm6yNk=; fh=sXF5oMUPjFgphFNVclC6g3RKea2HcSE68cSSCHM0Fvw=; b=ZPayS7zu3wU//chDAlRmI05ajO4C4yQnYlRzQh6lEXhNh2CdUeqHxW3ibNW2vrJ3Sv 8ArnA/4aGMFUbURlN0aLMK9hsI6UUwAttXZBTVPHEQrHamCgDbjQbs7OUIMzfGqcG2Sf Xkh976gvbfz5b+weghuDUPmw0rykAsFloKVhybI2qZHQTjRO2iLf8iDJbPQZhJ37C+aj 7F7emaW2jP2HMZr+PRG1D+IK01FH0GhXM0zcKtHKU52maWOsqZVctcY8Ft5EEzpdqvlh akNxUj4uGjF/lRUhEmHkgQKtVZiWBoMGIdOj2GF8gSKKUdno9jINSSp5lci/Kvo5kHlb VMJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="J/E/6cYh"; 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bg26-20020a056a02011a00b00563deb65f93si22228049pgb.200.2023.09.30.04.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 04:43:14 -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="J/E/6cYh"; 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 B3690832057B; Fri, 29 Sep 2023 22:03:37 -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 S234134AbjI3FC2 (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbjI3FBt (ORCPT ); Sat, 30 Sep 2023 01:01:49 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 899DACC2; Fri, 29 Sep 2023 22:01:31 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c5c91bece9so121451755ad.3; Fri, 29 Sep 2023 22:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050090; x=1696654890; 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=BqRIIscirReKomhnn9aWQqgUEl26ak+53Sd7DXm6yNk=; b=J/E/6cYhFXODUgKhgpw7KxO+RWk866Jd1T6p7wnebtV6nCbMczelHpVDQ7G1MSUy8W jqTwlRcS0CaFFCd3NcOuElMHkuTKgcEgeIqcvcf6RciT/SZ4kmmeL2BR3G5UKxX/Cqxd vEwbUEvfbRfEQ+5Ic4n8vFkVsIQMFUtDcflMf5bR0WSZ9rQt5MvWyFijaoOQyT1H1A33 Ir1vwtDCT1wAvPFyQPFzY5St53rmd4N18dRKX61lGuJvDEL14bznoikTycv07vTynHIA GpN2/NOrEGz9KZglogJFEMaKrBWuN1DKeuZFfnFRW9q6W6JRC23js+oPhHxRy1TnUzVV +KJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050090; x=1696654890; 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=BqRIIscirReKomhnn9aWQqgUEl26ak+53Sd7DXm6yNk=; b=d8yTDrbQ3CwV8jv489YYcOox37BekvmHzCNLdJKZUKfju6drmKt00SxgP8ooAc/bpn PMNT83p/tB15U9Zc4lzavd2AEkZ6qXYOwS16MdoTk02hu+GTjXqXa8y7pXaYzGn6noMi jxvSe7sHdnoW9wXymHVn1DKmiswpSyWgOidSL4Yth32MYIBpCoLm1AoZsBl2zkewhQHY /7HwulgTGDXGbKU4KYY5FlaAGamFZ2sWZtAC5PR4mZgA4qa2/d/Wv6uTboh1zZAUql7p b8dSngvvm08EGcnRgjfMLVnPZ3x0PnTSNbjnWJ8rW976VUAlx0aFPXipIp0jFtjgYMeq yZQQ== X-Gm-Message-State: AOJu0YxU5q1yKhu6s06Zo/dajpBCd1OHO4e19b5rSWZhYzgesaUZqVwV USgrQmbBS/v4Q4LF4h4vyok= X-Received: by 2002:a17:902:c94d:b0:1c7:4a8a:32d1 with SMTP id i13-20020a170902c94d00b001c74a8a32d1mr2347477pla.28.1696050090497; Fri, 29 Sep 2023 22:01:30 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:30 -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 , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Subject: [PATCH 10/29] f2fs: move f2fs_xattr_handlers and f2fs_xattr_handler_map to .rodata Date: Sat, 30 Sep 2023 02:00:14 -0300 Message-Id: <20230930050033.41174-11-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:03:37 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778462694709649651 X-GMAIL-MSGID: 1778462694709649651 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to f2fs_xattr_handlers or f2fs_xattr_handler_map at runtime. Cc: Jaegeuk Kim Cc: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net Signed-off-by: Wedson Almeida Filho Reviewed-by: Chao Yu --- fs/f2fs/xattr.c | 4 ++-- fs/f2fs/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 476b186b90a6..3895a066f36c 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -189,7 +189,7 @@ const struct xattr_handler f2fs_xattr_security_handler = { .set = f2fs_xattr_generic_set, }; -static const struct xattr_handler *f2fs_xattr_handler_map[] = { +static const struct xattr_handler * const f2fs_xattr_handler_map[] = { [F2FS_XATTR_INDEX_USER] = &f2fs_xattr_user_handler, #ifdef CONFIG_F2FS_FS_POSIX_ACL [F2FS_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, @@ -202,7 +202,7 @@ static const struct xattr_handler *f2fs_xattr_handler_map[] = { [F2FS_XATTR_INDEX_ADVISE] = &f2fs_xattr_advise_handler, }; -const struct xattr_handler *f2fs_xattr_handlers[] = { +const struct xattr_handler * const f2fs_xattr_handlers[] = { &f2fs_xattr_user_handler, &f2fs_xattr_trusted_handler, #ifdef CONFIG_F2FS_FS_SECURITY diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h index b1811c392e6f..a005ffdcf717 100644 --- a/fs/f2fs/xattr.h +++ b/fs/f2fs/xattr.h @@ -125,7 +125,7 @@ extern const struct xattr_handler f2fs_xattr_trusted_handler; extern const struct xattr_handler f2fs_xattr_advise_handler; extern const struct xattr_handler f2fs_xattr_security_handler; -extern const struct xattr_handler *f2fs_xattr_handlers[]; +extern const struct xattr_handler * const f2fs_xattr_handlers[]; extern int f2fs_setxattr(struct inode *, int, const char *, const void *, size_t, struct page *, int);