From patchwork Sat Sep 30 05:00:29 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: 146919 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp338449vqb; Sat, 30 Sep 2023 04:51:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQ102cp/Jd4+fMY8DVg5IR5LbqdXlpZHaMVKJ080gsgE5YC77bn74CtafIJfsujKk9lR56 X-Received: by 2002:a05:6a20:12c5:b0:160:cf09:8019 with SMTP id v5-20020a056a2012c500b00160cf098019mr7575319pzg.32.1696074688411; Sat, 30 Sep 2023 04:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696074688; cv=none; d=google.com; s=arc-20160816; b=dPZN+FwQKb1Iq9md62/eCRRo/oZGYBX2otC/CDeUP0wIDbn/9rlEK7QFQs2UUF8L2o I2NyGpmq3TQWJ6/oZaC58eSv5qsxGToHFYtojdntGmPiSl1jXrXlfGTwPUuXloDHMkdJ gYbBHmvSNfOjKkUf1rlxYSeUz0OfFGZgJXP6Q1zl2LFzenp2GvFTVTudGaL+7MFhU+RI NBQDqH4CWFWDH3Gf6h2EN1wS74VLmLJu2XEY6v+l2E4EsQituJIs9mu5CMOtA5o9eZc+ Na9VKaCkne7HfcMif/tp/e+9fVKuNFwGgWUruJc2otT2TvJcSGNfJDuHxK7WYa4YrxHJ 8Rsw== 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=XFRp7G+qDWZEQApnHi6mmaUctO5D9NgBjXm6s7XGppI=; fh=Y+2iMCSwPetLWZG3xRabvxC7tR4Py5RqdoKcWMiiGCE=; b=C2JPNCEMxhhHIReXkEDGib6tUfim5VI2mhOIknT5CgbyFws/qw2yKBgR4NP2LfwBk8 Qb230vg+/9+++7Xqc/TLxhEAu5KQMOOyfNo8wNj070xDjB5JH/G2my/Nnvd05JEkRYOe nelCTlDDFj9xhkDsIdkp4JTY/emDH6UbjdMnOegUHk8Og4l+Z0w2JYV/OGKcybffBp4p 42gQIzyVb9PDninfpLQBYEWBzJ7YdtSEx7USUlehGxxBbooOH3xENzE2TPkABdv+SzM8 nldHuZ0bOa4TFGzure6EoiCqsENKgY24P0CKtp7GaTgVe4xDuL6ovqqD2N7O7u9SLMRz r5xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cmblsLyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id kn3-20020a170903078300b001bc6e60699dsi20656280plb.27.2023.09.30.04.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 04:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cmblsLyN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id B81C68065E07; Fri, 29 Sep 2023 22:06:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234178AbjI3FEK (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234196AbjI3FDk (ORCPT ); Sat, 30 Sep 2023 01:03:40 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 966481AB; Fri, 29 Sep 2023 22:02:21 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-578cc95db68so8226743a12.1; Fri, 29 Sep 2023 22:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050141; x=1696654941; 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=XFRp7G+qDWZEQApnHi6mmaUctO5D9NgBjXm6s7XGppI=; b=cmblsLyN05V9ss1mhetvhEbg3xK7fHaT8bPpk3rntyI57iWq4Gs4Lg3h2UuozUyql8 An0T32+uosTyEdHeMzopE+C14r2OlBXk3Cs6r9v6kOJCg82nKPe64BpUiXaTnRLzRD8w 4jh9rFWdbJqAbtLUcaqq123gF9UhMmC/eUYZmhy+ynCUt3mQ43K7k/vcmRdyD+dVXsmY bNkDkyqqztqNTW1j57mh20rI4YRATWCKtxeT5O+fHq4U3ejOrf03hRd7yA1edGy1Gbz4 R9Ej6UzhTwtYS3RUapRER1lEraC3B762qexArrPC53vl3kZW+KdQKNozkcuS5heH4Xx9 Qx4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050141; x=1696654941; 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=XFRp7G+qDWZEQApnHi6mmaUctO5D9NgBjXm6s7XGppI=; b=dz12R+S3pMTVqzdF5uh2tBJdWJl4BBnl2KLe24K+f31jRsBQF0idsEq9Qpll5s6OzB DPZcAHImIkb3PRx03IN/zj1J+Sd3ZQyrWwwjFLAf1LWJeV+7WrYZNpJmUcrCxbImROnt Zd3R4kB3ZOb0PKvB7tCDhAIvh1RvOXZWywxcyyECSWYgH7m5DQqwzCs5TC9ajlJHktIm 6n3MqM4eCl+H556GyTr4iCljrbs4wOZRDQh4U6ioyjxMmWjdOvsQkePfzisG9i0/IeAX zJy0sdpQLWzUE41COIazxUSMIxlqyycwgOUpvXu2Ui9h09ASS+vGqMYDi/vmKZvOQ70Z cLww== X-Gm-Message-State: AOJu0YwshEiloyNrepPY6ejCYX859cfRLtuwnB6wgkj5ZNcrdrw5v3yA quXDvhNE8YMOTsVA0j82598= X-Received: by 2002:a05:6a21:998a:b0:14c:84e6:1ab4 with SMTP id ve10-20020a056a21998a00b0014c84e61ab4mr7099900pzb.33.1696050140965; Fri, 29 Sep 2023 22:02:20 -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.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:20 -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 , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 25/29] ubifs: move ubifs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:29 -0300 Message-Id: <20230930050033.41174-26-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 pete.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 (pete.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:06:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778463212136821099 X-GMAIL-MSGID: 1778463212136821099 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ubifs_xattr_handlers at runtime. Cc: Richard Weinberger Cc: linux-mtd@lists.infradead.org Signed-off-by: Wedson Almeida Filho --- fs/ubifs/ubifs.h | 2 +- fs/ubifs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 4c36044140e7..8a9a66255e7e 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -2043,7 +2043,7 @@ ssize_t ubifs_xattr_get(struct inode *host, const char *name, void *buf, size_t size); #ifdef CONFIG_UBIFS_FS_XATTR -extern const struct xattr_handler *ubifs_xattr_handlers[]; +extern const struct xattr_handler * const ubifs_xattr_handlers[]; ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size); void ubifs_evict_xattr_inode(struct ubifs_info *c, ino_t xattr_inum); int ubifs_purge_xattrs(struct inode *host); diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 349228dd1191..5e17e9591e6e 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c @@ -735,7 +735,7 @@ static const struct xattr_handler ubifs_security_xattr_handler = { }; #endif -const struct xattr_handler *ubifs_xattr_handlers[] = { +const struct xattr_handler * const ubifs_xattr_handlers[] = { &ubifs_user_xattr_handler, &ubifs_trusted_xattr_handler, #ifdef CONFIG_UBIFS_FS_SECURITY