From patchwork Sat Sep 30 05:00:05 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: 146946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp454801vqb; Sat, 30 Sep 2023 08:51:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoqftZeXs014980wXJfNdSbENRmm9BICqw2RxH0R9YhVoMYXpyZf8fYYktByZKXQo34Wd9 X-Received: by 2002:a17:902:ce92:b0:1be:384:7b29 with SMTP id f18-20020a170902ce9200b001be03847b29mr8920047plg.34.1696089080282; Sat, 30 Sep 2023 08:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696089080; cv=none; d=google.com; s=arc-20160816; b=R4PFgxhRwJvhJ11DVkcHqbhAHrew9F/uiOJ5xaKFkxdeZLaIE+HWz7zbA+uHmeUpFY 5hbgKDGkH0GXkfXJCt63EYOwfPjh7+rA8pABm/xX/pNlJUgIPRJTNjhkemQNHKSsV+Ba 6vIGVdYbzgXaEwxfZRB3EAffWV/JXClCXj/ByGNsbCZF6WuRWN1ada6P2bYxt0MX2Y7c cRKOD2NQ4F+KLeHfE1+9ETPf473aYB9fsVZuT7EaNcr1VMXz3zurzLwmlnCgz9+gH3ME 3Wz6Gr0D/WtJrkccsqedCaGfqlsXHDWsOLJgel1R3X6A4/DW29yY6mo/LQy+DrM+KoI2 KQTQ== 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=P+kwTjR+CWDbHNLH7Vi6T+1DkOngNTu95bmWBQQSjqM=; fh=SK2xQ5WvE6tbwSQN9TMkRjbkm0hotbQhx6y1kSOUb0Q=; b=GSOo65FWjOShm3ugFWRr3EVBTbklCpl8dfrrMyfPLZRo2s2xxw00+Njm5NTUzSknd0 lxcTs1gF50O+CFIR1e/CbLOorsj9xgVV52Zp8aWFNLMDw4e/AlBX+bTsAZtL535OF0x2 bx/Gyss+SvQTuTvF7/j19g72oUDjcCaiVirMCknzcleOcwjgvItNmLWtEMgC2QpZR8/z F/MJcKS/yzhIsw9lVmcXTMSGfgmTSPrC6eh8rDMw4RYST7xDVjyJzYP7hGp/SYulogD/ 8GWnO+lKVE5mkDULgt6K2RE1g8yy4pSHA+MGQsVoOKzSQy8BOfZk7LFlMWcI7tsd6pU0 o/IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S7sYrmck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e11-20020a17090301cb00b001bc5a4f56fcsi26748923plh.554.2023.09.30.08.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 08:51:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S7sYrmck; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 7697782848FF; Fri, 29 Sep 2023 22:01:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233998AbjI3FBG (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233053AbjI3FA7 (ORCPT ); Sat, 30 Sep 2023 01:00:59 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA4EB9; Fri, 29 Sep 2023 22:00:57 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1c3cbfa40d6so133398475ad.1; Fri, 29 Sep 2023 22:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050057; x=1696654857; 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=P+kwTjR+CWDbHNLH7Vi6T+1DkOngNTu95bmWBQQSjqM=; b=S7sYrmck40xgfqrsFLnX3leo2dQykimaZ9ibzIv7/8SJX/CovuEHpyX47jhZeLSztM rUWNYvhA+gQP3j3f+/Q/A9TTcwyyNpswjpMiUjb8WYssZA+2nbL+ulQ9dxR/yikDQH6e beZNU9JYKZ/hZ4TLPY0HT40BRC1k3jWs+Z1Kn+7pTLKPxs8w1A2gCNRa8vUe4wqNfGrc isvIJNOAxUahbuw1bm4bpEJNOp7VGbGKBNNTsGIfNnzrWCCwSldeLYKujUu2GqVr51Ag 548GRaKLYo9dqzhWyI9nOIjCrhHVKOJFhxEsTspNJeq/FDM47n8XXdKj5PDgpQ52750s UzyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050057; x=1696654857; 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=P+kwTjR+CWDbHNLH7Vi6T+1DkOngNTu95bmWBQQSjqM=; b=adjT2LI56iZkFtzP7pZpKDJw0tenQBFYC3OrGpfrxF29hMU0Qk2nzA22ZFI0x3HNaj bQsKcaBWDN5lhlgSMEhuveEueoSUK2fehAzq7Vj6zKnupbf/rKtIlK5NxNkI+INPo74J bKSowyMsuwjechH/nnUNjZcCylbM49s1Zzu2I4SRhYAXAn2AAg/DLUNOKdSa95KP99iL FNRvRpYDfrqozfUH+vgOHQi/QuUBwbKzA5sdiHCMPReBF1YUKIk5yYyOdaRTe3ynm5Xu NkCILWJndt4IBevOD83f9TIyM9czFpkkaUY165bnCdzqRPgE4QM+rK2OQD1wMoo2Dxtz 3R3w== X-Gm-Message-State: AOJu0YySZcacFIj6LIFh88h3gJElFj39vMSPszuqe+8N3DfsW8ckpHgi 12vYq0+7sUkwhAaDM/K2uVs= X-Received: by 2002:a17:903:2445:b0:1c4:fae:bf4a with SMTP id l5-20020a170903244500b001c40faebf4amr6676418pls.16.1696050056932; Fri, 29 Sep 2023 22:00:56 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:00:56 -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 Subject: [PATCH 01/29] xattr: make the xattr array itself const Date: Sat, 30 Sep 2023 02:00:05 -0300 Message-Id: <20230930050033.41174-2-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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:01:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778445457089568363 X-GMAIL-MSGID: 1778478303253588976 From: Wedson Almeida Filho As it is currently declared, the xattr_handler structs are const but the array containing their pointers is not. This patch makes it so that fs modules can place them in .rodata, which makes it harder for accidental/malicious modifications at runtime. Signed-off-by: Wedson Almeida Filho --- fs/xattr.c | 6 +++--- include/linux/fs.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/xattr.c b/fs/xattr.c index e7bbb7f57557..1905f8ede13d 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -56,7 +56,7 @@ strcmp_prefix(const char *a, const char *a_prefix) static const struct xattr_handler * xattr_resolve_name(struct inode *inode, const char **name) { - const struct xattr_handler **handlers = inode->i_sb->s_xattr; + const struct xattr_handler * const *handlers = inode->i_sb->s_xattr; const struct xattr_handler *handler; if (!(inode->i_opflags & IOP_XATTR)) { @@ -162,7 +162,7 @@ xattr_permission(struct mnt_idmap *idmap, struct inode *inode, int xattr_supports_user_prefix(struct inode *inode) { - const struct xattr_handler **handlers = inode->i_sb->s_xattr; + const struct xattr_handler * const *handlers = inode->i_sb->s_xattr; const struct xattr_handler *handler; if (!(inode->i_opflags & IOP_XATTR)) { @@ -999,7 +999,7 @@ int xattr_list_one(char **buffer, ssize_t *remaining_size, const char *name) ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) { - const struct xattr_handler *handler, **handlers = dentry->d_sb->s_xattr; + const struct xattr_handler *handler, * const *handlers = dentry->d_sb->s_xattr; ssize_t remaining_size = buffer_size; int err = 0; diff --git a/include/linux/fs.h b/include/linux/fs.h index 562f2623c9c9..4d8003f48216 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1172,7 +1172,7 @@ struct super_block { #ifdef CONFIG_SECURITY void *s_security; #endif - const struct xattr_handler **s_xattr; + const struct xattr_handler * const *s_xattr; #ifdef CONFIG_FS_ENCRYPTION const struct fscrypt_operations *s_cop; struct fscrypt_keyring *s_master_keys; /* master crypto keys in use */ 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); From patchwork Sat Sep 30 05:00:07 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: 146896 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp282051vqb; Sat, 30 Sep 2023 02:16:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0eX4f9BNe32lLn1UUXr4tmPEqhGO2H0R4E1o7UkHo9oXoWKeWc2Z7s7fmb0S0H6Um71CB X-Received: by 2002:a05:6a21:32a6:b0:15d:8eea:27a3 with SMTP id yt38-20020a056a2132a600b0015d8eea27a3mr10622310pzb.3.1696065401261; Sat, 30 Sep 2023 02:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696065401; cv=none; d=google.com; s=arc-20160816; b=xd6qHxJB/e90wyj2qxSQxZGfq+1AIkBOEKRp6x+AIEX5J0e8hEBYqFvuvssxuPYtxf Vui9AdbsuhS38gUi+wgv9o6YxDv0OAnyXmwa9csG1CJCcIKueVYM5UavDXFYuL86dJJ5 XdyLcf3FgD2qh6stRcIh2DFy2vZxaLSUe0leJN4E1CvXC0rIXlQeUVN1N7e+IBFdcPRd sCOYp/bKIPV458M/Y+5jOT7k+wVyZbJczhFRiOjxyR7f+4gMlmalI6ScVQ7a6LumKkat vuXd0wpiTwoKACsA2JuI0tDq2tLPPL/+Xvn97fB8PBaa8PgMtKyJTmdTcoe/Xu6XTIVA qS/A== 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=ZcuxStbjNijxSJq8zEaQg95VP+4PBlgl17JsgSzTRFE=; fh=wBUngCcKaRcWqf6HA/BgHgkNWrFHB+d21JS9o95oYJ8=; b=lzSU4kUg6XeoxFiFV8zf1pIk3ImvE5RsXaK63j9GPIhOFf/VhtLUedNT96DwhmY74n CABQgmxfviL5oE2zvMPKXaJZKLnyX6jW4GwkcOfqJqjqDvN1YWjjkYqRu3hIYRpkxJDw mH4tuhx72d8ddkaMvHuEA9xgNLNXiryjJEKpwtujPLj04EV8pDg+PURzl83u01+kj0o0 7W7KyvfTzVSDvPlusCQkIEBrNOVmxxGNhIFFldf5H6ImnWEjnQ+Tp+VeOBpB9zL476Pb j+bwg0y0hyL7hwhyc3kEqsBsw0A+TCCrneAZV43E0DfbJg0dVDFeTpJa7q3bHfPqGJyV UWWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WCZJ1Jdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a7-20020a056a000c8700b00690f8edee16si23375754pfv.275.2023.09.30.02.16.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 02:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WCZJ1Jdy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 24D2982F9250; Fri, 29 Sep 2023 22:01:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234017AbjI3FBP (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbjI3FBG (ORCPT ); Sat, 30 Sep 2023 01:01:06 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057361AE; Fri, 29 Sep 2023 22:01:05 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1c60f1a2652so10351695ad.0; Fri, 29 Sep 2023 22:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050064; x=1696654864; 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=ZcuxStbjNijxSJq8zEaQg95VP+4PBlgl17JsgSzTRFE=; b=WCZJ1JdysZkIZlPqNO3x9kE5YTnAV8X2ft3sbU6A5sIdyIZ55bEe/m3IB4pJPNgGnG 4QMjrazQ4otQQLZg74QKzKdOVl68rmAWYihEhSER9kKOgvRY6aapjx4HpDh7aujaHYoz jWI+njEs8+vqver587Le2gTP8sjsdlF5Q5XawTHuIuNI2WSExlQMGcto6tyLGHw4sUW4 mxsrRLVz6TJ4Vl05B5pHYKFBmwkJgS6CTmiV+35iHB6XQ/AUTVD0AxrX7tlHE2/GCHCa 3WoQUCTgpd7uJhe6QGFqmJQchFMnB4swNHG75prfcTQRj+jIg0cjsxVOLqbJk4NcFMIz eMiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050064; x=1696654864; 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=ZcuxStbjNijxSJq8zEaQg95VP+4PBlgl17JsgSzTRFE=; b=eDi1E2em9gkvffdv+J/hUInGCf/3m/15ic0PRYswDu6QZsJRiQdHd32RK/fRfdlE9C w828p5SXm5UJNs3QykdDFAXJijQ9w2TiYQmZiTuLa2MPHZS6TuVeb+jX70qImgFp2zEM R1KfTyz/owNiFahHiROLoMvlbY1wqYJPqve+DSmmCr7E1rXUoV5MzHHkPIUt9Pwqx0sm lzgZXBBK13QAf4iIt1Kkj8Ecnn7wSxqrBaONG+BIQo44bunn0tMmBFZEYphf0o2cc6jb c6bUd56jWh+Mzd/BMRugSARqaESMSCugZSZ9jEQDKXZ0wDRK+IVbIG6qV0LiTIioGsZE iGJQ== X-Gm-Message-State: AOJu0YwArFK7ieI3f6oyZ6iDvQRRC1sEQICi+tGiL2MmRHLS389Z2mU3 T17GrGxxR313d7SF3euxag8= X-Received: by 2002:a17:903:184:b0:1bc:5e36:9ab4 with SMTP id z4-20020a170903018400b001bc5e369ab4mr9385815plg.21.1696050064402; Fri, 29 Sep 2023 22:01:04 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:04 -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 , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , v9fs@lists.linux.dev Subject: [PATCH 03/29] 9p: move xattr-related structs to .rodata Date: Sat, 30 Sep 2023 02:00:07 -0300 Message-Id: <20230930050033.41174-4-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:01:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778453474197564898 X-GMAIL-MSGID: 1778453474197564898 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to v9fs_xattr_user_handler, v9fs_xattr_trusted_handler, v9fs_xattr_security_handler, or v9fs_xattr_handlers at runtime. Cc: Eric Van Hensbergen Cc: Latchesar Ionkov Cc: Dominique Martinet Cc: Christian Schoenebeck Cc: v9fs@lists.linux.dev Signed-off-by: Wedson Almeida Filho Reviewed-by: Christian Schoenebeck Acked-by: Dominique Martinet --- fs/9p/xattr.c | 8 ++++---- fs/9p/xattr.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c index e00cf8109b3f..053d1cef6e13 100644 --- a/fs/9p/xattr.c +++ b/fs/9p/xattr.c @@ -162,27 +162,27 @@ static int v9fs_xattr_handler_set(const struct xattr_handler *handler, return v9fs_xattr_set(dentry, full_name, value, size, flags); } -static struct xattr_handler v9fs_xattr_user_handler = { +static const struct xattr_handler v9fs_xattr_user_handler = { .prefix = XATTR_USER_PREFIX, .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, }; -static struct xattr_handler v9fs_xattr_trusted_handler = { +static const struct xattr_handler v9fs_xattr_trusted_handler = { .prefix = XATTR_TRUSTED_PREFIX, .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, }; #ifdef CONFIG_9P_FS_SECURITY -static struct xattr_handler v9fs_xattr_security_handler = { +static const struct xattr_handler v9fs_xattr_security_handler = { .prefix = XATTR_SECURITY_PREFIX, .get = v9fs_xattr_handler_get, .set = v9fs_xattr_handler_set, }; #endif -const struct xattr_handler *v9fs_xattr_handlers[] = { +const struct xattr_handler * const v9fs_xattr_handlers[] = { &v9fs_xattr_user_handler, &v9fs_xattr_trusted_handler, #ifdef CONFIG_9P_FS_SECURITY diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h index b5636e544c8a..3ad5a802352a 100644 --- a/fs/9p/xattr.h +++ b/fs/9p/xattr.h @@ -10,7 +10,7 @@ #include #include -extern const struct xattr_handler *v9fs_xattr_handlers[]; +extern const struct xattr_handler * const v9fs_xattr_handlers[]; ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name, void *buffer, size_t buffer_size); From patchwork Sat Sep 30 05:00:08 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: 146873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp200488vqb; Fri, 29 Sep 2023 22:03:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYT/KV19y2IuS50P9y6Mu3Xy7MzY7cp6k/m772ZlXl9eYjckvs0i+yu4kaF7xiMUmGb18a X-Received: by 2002:a05:6a20:430a:b0:15c:b7ba:9137 with SMTP id h10-20020a056a20430a00b0015cb7ba9137mr6761780pzk.2.1696050235569; Fri, 29 Sep 2023 22:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696050235; cv=none; d=google.com; s=arc-20160816; b=ZREptPM5nY/RvGYEwI5yCCWaq0t5MI6sdih3bq63SAPdX4ah/+vzOiK6014MPDTSgL dYZXMZHy1WpUVvNhdmc20NV6WMGrSHEyIZlBg6XPMW98PZENYYkTvaqhTV2xHWc0zUmE 2kc66uYyseBerVZUn+l+eQlcBW5MievbkQwRLFXTvi4k0Z+IYlFmMAgOTbeA1qoUxuZB MezGmCFC5GIoQ8hd1bAsKmAs78WaCDYIrvnBklCu6zApqk/4II+TXv/phAcNSTqzLkc6 8/LXbTHROKYraws+AMJiMMsV1JWyyvCEZLbdBue1Rr9vWVkEXJ/SXdu4O8zBuSGk1hP4 Saxw== 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=/GtFO6vuSssICdkJfKNyb2r68AOrzMFP2HioLeCz7V4=; fh=iPBEmCaeL2mb+zQvxH0TWqLHRRoNgBr8xTn2y/ZKiLQ=; b=U0iLmA0lD2bLHfyZYfswqOT2h9sJBaUYYMp4jVoH/vUrQvnI/rx5DbPaZUe5nWccT8 hCHG8FyUXP9wPsuLKeEN7o+7fT/SmzfeGFCg7y2iUBArFenmoAegPtItq7MBuX+32Rqx 1G447yTOHaEFnfjtZTli1Cm7M8LyR2OSFvh36hLDHar2ABOz1im3PG2cSMl4nSdIsSdQ /AMqRilQJe5oYAhBNwNxAzN22sTmaueKmxrvoVWOvXRoXPn0wZPgGTRkwz5GattENv8w tiY77JfiZq9Av7nQpK4R7pnhag+vN+4l5RZ2EmV7HDbLQwgWu1IojHvrWk9h6AbMHsbe odsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CF9F6ZMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id kg14-20020a170903060e00b001b89b1bae72si12507797plb.528.2023.09.29.22.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:03:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CF9F6ZMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 184B28118774; Fri, 29 Sep 2023 22:02:06 -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 S234028AbjI3FBQ (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234009AbjI3FBL (ORCPT ); Sat, 30 Sep 2023 01:01:11 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157A81B7; Fri, 29 Sep 2023 22:01:09 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1c5ff5f858dso87310675ad.2; Fri, 29 Sep 2023 22:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050068; x=1696654868; 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=/GtFO6vuSssICdkJfKNyb2r68AOrzMFP2HioLeCz7V4=; b=CF9F6ZMXs4tS7I5BphwJiO7DM3J4c0nlEf6bVj85qGyOGo9VJtGLLMlWWJHWukH7sz wuyHd5dGgSPMmu2W/oMJR1TGBnzSXDFm7CLkjk0PeaqNrn2J9+Ca1CDurOR/ue5ZRLq2 XJa8cBVB4wekSCyqp/JprH12ZLE8vM+JsSzzjwyjDodv9U5qd0hOOyb1TTB78V76wUr8 cX5hXZP9iGZ6ONRiyzpcK/sRKZpKsiDcsvtKhjEL0ha4z9CWGhlVDnkRtbmuV4pnC0DD wj8fqO0KZn+KbSlb3chO2T2uOGMSraivDa+PeKs0KnXzDPfZEVstyCGik95RTTXZ9rBF 4qVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050068; x=1696654868; 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=/GtFO6vuSssICdkJfKNyb2r68AOrzMFP2HioLeCz7V4=; b=GovwltfyFu6y5UOUQH5R9O1rlwg0ByXpl086SgyoBuwZwKcfR2ToeJzQLA7k2oPidZ TpIYKyNU2ZQiXbZaQZ+p5lPahpksMiwv9LIS9bRzghCvRPlNADvivTLb3u15jwNLj6LV 66IZxOwK1A06eE5AGeTkdGXwLKy6VaAB16ine9MMf0phl8iXis2mX6RekLbkOgwNQ4D8 HwNaVmSfpmZWWxdCuJ//3z0frxzmq7yXgo2hNHpRORO2/Lp/qqewqmP/sOLb/C4PIyno SyufpvKX2SRqQQvgL7joIQ5b2S0mxuusK07hnGZuNBIGL6lmWDpYE1iL1BcglrB1Q61s kOew== X-Gm-Message-State: AOJu0YwYyrl+LRQXEpjm2A0MetBpHkznn9nmBFanqhgQLKwwsCYy4VDP oczE1pCHmBOUfyAJ3aoNz6k= X-Received: by 2002:a17:902:f54b:b0:1c3:86cf:8cc0 with SMTP id h11-20020a170902f54b00b001c386cf8cc0mr6608621plf.10.1696050068454; Fri, 29 Sep 2023 22:01:08 -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.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:08 -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 , David Howells , Marc Dionne , linux-afs@lists.infradead.org Subject: [PATCH 04/29] afs: move afs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:08 -0300 Message-Id: <20230930050033.41174-5-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:02:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778437572072785993 X-GMAIL-MSGID: 1778437572072785993 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to afs_xattr_handlers at runtime. Cc: David Howells Cc: Marc Dionne Cc: linux-afs@lists.infradead.org Signed-off-by: Wedson Almeida Filho --- fs/afs/internal.h | 2 +- fs/afs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 9d3d64921106..a01d1f71ae8c 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -1539,7 +1539,7 @@ int afs_launder_folio(struct folio *); /* * xattr.c */ -extern const struct xattr_handler *afs_xattr_handlers[]; +extern const struct xattr_handler * const afs_xattr_handlers[]; /* * yfsclient.c diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c index 9048d8ccc715..64b2c0224f62 100644 --- a/fs/afs/xattr.c +++ b/fs/afs/xattr.c @@ -353,7 +353,7 @@ static const struct xattr_handler afs_xattr_afs_volume_handler = { .get = afs_xattr_get_volume, }; -const struct xattr_handler *afs_xattr_handlers[] = { +const struct xattr_handler * const afs_xattr_handlers[] = { &afs_xattr_afs_acl_handler, &afs_xattr_afs_cell_handler, &afs_xattr_afs_fid_handler, From patchwork Sat Sep 30 05:00:09 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: 146894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp269126vqb; Sat, 30 Sep 2023 01:36:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFGAw0WyB3+Dbp9YrAPfOIWvhBUsm60B5UCIkpt/wjkpIJhkbSdy3TXsD1+0clKy00ocLq X-Received: by 2002:a05:6a21:4841:b0:161:76a4:4f6e with SMTP id au1-20020a056a21484100b0016176a44f6emr5669005pzc.32.1696063001805; Sat, 30 Sep 2023 01:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696063001; cv=none; d=google.com; s=arc-20160816; b=rFYjkvxRN8msroGMvmEOf3o3sSkWByYZ7+uRdbnXhxaG+13uldASySDdvWROytLkNF 8SxtQ31V3oZd7boEiQ6cNkhx6WNYJZIhEwhkd278Na2oFMX/eLQ2k71HtTgN+ebNBB5T uhyndRyRBl09spMK9BrWPNEgxgw/nPLYFcHClA2ZpmwpRZgvQAcuewD01o0nsodd9aoW Tfov8X3Ue1+j8pV8X5LQLJz/H4VUqylO/u+Xg2eI6oGRIuZ66sIXI/WvzqGjcrXhfuTt AR+/6dc3bh7GRrhQro/q83QC0EE+Xx1LFef/+in/nkfC8o+ao3r2OuToWP6wH3xHRvsX AUIQ== 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=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; fh=hwKC6vzNCAbIGbDldwO9jgfg/tFiycdYxLr0CZ8lBz8=; b=MBHuoh6hUpMvuC3VGrJZ+Gt/rkHJJZoqd7OJOaIymFWeyfnGNDpXER6exbAFgjpqub f4RYszQD1OJEUH8yc/8jyG+iOC0IX3ipZ9yDc8xzna5c2WhKTIaKOWlX6JTLGwOfsssR Q3Nl7T3IJ30YHdyq3dQUacieSXEDMXtxTHP0NmJDiG6SvmaIIzHED8/h2QED83hAYa2D c9WZTWZrR3VGV/e5ajtw2wsGw6gpJ3I3IimP37ADyYAeL+hFxnzD9QTonYNZFbX1q/ev BCX6w5TttaEsPsG6TA0wZnnl1DfO1Y6LAMFm2ghvUbq3SiMmcDo2BebG+vVqyI2ncvs4 74nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SFpLc4tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id em9-20020a17090b014900b00276bdabe471si3168263pjb.163.2023.09.30.01.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 01:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SFpLc4tu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 2407C8311BF2; Fri, 29 Sep 2023 22:02:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234074AbjI3FBf (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234037AbjI3FBc (ORCPT ); Sat, 30 Sep 2023 01:01:32 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8E3C1AE; Fri, 29 Sep 2023 22:01:14 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c328b53aeaso133639595ad.2; Fri, 29 Sep 2023 22:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050074; x=1696654874; 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=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; b=SFpLc4tua/KoIENLihOJW6ASf/vqC+aDrOhpgPkrnx7JjTjM/Fd/d/FchnRUM0mjvO lHeP8Qdr0rqgsxiKboNjGoTp5owKliBGUtbbd6UcEyOpmsdpgyEvURiHvkKBdQIZ+Y8U GJzT0W0sThdkbqqhG70jWKxy3zMMhy/Jk6pJuRpeF1hyGttAx2fYlmmVbJ/ogzuyygRd jJCQ2AWPx5m18cCdQKooZOD3MDMDmUCFz8cMlALw15SsRrOg5QwmBUgeeFHQpRgw1f0c 4dj6xdivEvPMlUJUgfIjTyLPsOF+mSauJMa1WD10HmFPZ1kDPDl2Vpsp4+/wjrOL83Tl wccw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050074; x=1696654874; 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=ViPm2eeZWez7GosgS7Ec0gZyjCavTFF5oxKm8MbpuGg=; b=L/DAsQzv6T/gihmw4t9BevCBzCbhOXEdXa5kUU8u0MbNIQuHClZBgA2MuHd1SSqN6D /cysk1N13FwTiE5cnnRzlpfhOMsLHHigRD6MSPxzybtBm9qibHI1THt8ZqpPlvpyGzXJ qAJS+mVTKa+DdLtiEvvYeCN+C+oSIRoZDkXkgFWoGsXey9riJPupyi4a4sKnjCxp/VRP RR+OSj5H+2IzGDEHfLN1OEGVJo1tvmQrcIHQLUGP7P1Q7l1uqTlWmQdXF7hXvUNfc0w5 7iJpViBbAqovJnMS05Jk9ehRcDK46zAUyy37fxozh/7AJt8T+OsBBZ2EDOyBKTlDPnom ja/w== X-Gm-Message-State: AOJu0Yxum6JAxLGlH4xfEI7zL3u//Wy6zAy1wF7eDRj6HPK3t6swaUuE InX/nq9wJ7YMbuhXvBS6ygk= X-Received: by 2002:a17:903:120b:b0:1c6:d1f:514d with SMTP id l11-20020a170903120b00b001c60d1f514dmr5924330plh.45.1696050073856; Fri, 29 Sep 2023 22:01:13 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:13 -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 , Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: [PATCH 05/29] btrfs: move btrfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:09 -0300 Message-Id: <20230930050033.41174-6-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:02:12 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778450958401311612 X-GMAIL-MSGID: 1778450958401311612 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to btrfs_xattr_handlers at runtime. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/btrfs/xattr.c | 2 +- fs/btrfs/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index fc4b20c2688a..d82d9545386a 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -442,7 +442,7 @@ static const struct xattr_handler btrfs_btrfs_xattr_handler = { .set = btrfs_xattr_handler_set_prop, }; -const struct xattr_handler *btrfs_xattr_handlers[] = { +const struct xattr_handler * const btrfs_xattr_handlers[] = { &btrfs_security_xattr_handler, &btrfs_trusted_xattr_handler, &btrfs_user_xattr_handler, diff --git a/fs/btrfs/xattr.h b/fs/btrfs/xattr.h index 1cd3fc0a8f17..118118ca3e1d 100644 --- a/fs/btrfs/xattr.h +++ b/fs/btrfs/xattr.h @@ -8,7 +8,7 @@ #include -extern const struct xattr_handler *btrfs_xattr_handlers[]; +extern const struct xattr_handler * const btrfs_xattr_handlers[]; int btrfs_getxattr(struct inode *inode, const char *name, void *buffer, size_t size); From patchwork Sat Sep 30 05:00:10 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: 146882 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp222384vqb; Fri, 29 Sep 2023 23:15:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFx//w+n1ym6RrT/gk5O10ZnWVhgw2udkYxTK194lRK/CWA2kUomqhsCtIrvNoDmuRQc3w4 X-Received: by 2002:a17:902:f546:b0:1c5:b622:6fcd with SMTP id h6-20020a170902f54600b001c5b6226fcdmr7021125plf.22.1696054503501; Fri, 29 Sep 2023 23:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696054503; cv=none; d=google.com; s=arc-20160816; b=hVyeMSx8zavDL04BVz8aLlF/6lnHv9mSRR7d7dF2PcIgpYXYibCMPqVfTyjyG7+mQQ NeErRba5pnN7XDTbzXcBt2Dw0fxa4l3pouRyRibZREVfp8vYK+E3cvoUfNZ6+xhZIsJm s2vPr+735rXIEYIBbzxO0lqGT8Hm5HUXSvuyEBY3i1ixWDiCNw0yMlX82s8halH/tWQj ImKHMPE3NFftd3FgQ3vsJKTk/dOsO8FB0R0q5OgK2hckPSmhzx5AZu0bV9xxR+a2k5uh O7rNWGonzTTZUyaZ6Z8TI6t3DZ0wWN2uUp/6NOhPyyjUDcASYhmhfmkcVtJGyfs1q7fX ZS6Q== 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=moKe2A8erbuVLM63RNmgB8NBsCNapPq9yq0WoyHwDmA=; fh=EebsGN/W+exuuZUzWnD/FKm5/tvyp0uP/PJSbp9U39I=; b=cCuU6zq4SVm34FB7TLMBnIhLN3h6ySea1wtjVN58+komLm8CN1n0/TEfgKCsgMbDN7 0vFF3fZIQd14dhHaV+OaGLEXt2dXmq6Zd4Q5opGuXJ1Ab9+mpk7Y0i/LuRNN79ihJS++ 8wf/ZZMED54P+vX0foMZWfcLs6RHRTGOD9ceR9xxIrL3A8xl00uRxr7Ap3ZKwoxEk6jD p3L9brHISWUERIhgq5AjWKO6UXmEOHIpxdMLVxBlKtp6FhwyCfoSnZEBlQorIdpx+iHM wno5XV+rHIp4X80p+cwwEOALYd1wfXVbmedI6BbFaIvP5wlviuLpsa8woWBJnh+oLeGY MVhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lVOh9VrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l13-20020a170902f68d00b001c6083dbfe9si19513164plg.593.2023.09.29.23.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 23:15:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lVOh9VrI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 686028311BF6; Fri, 29 Sep 2023 22:02:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234061AbjI3FCF (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234022AbjI3FBe (ORCPT ); Sat, 30 Sep 2023 01:01:34 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F30FCF5; Fri, 29 Sep 2023 22:01:19 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2774f6943b1so8389147a91.0; Fri, 29 Sep 2023 22:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050078; x=1696654878; 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=moKe2A8erbuVLM63RNmgB8NBsCNapPq9yq0WoyHwDmA=; b=lVOh9VrIg2nHAqimSf5mDWMmLaMsjN66R02bvnGHtoKo0G2dwCmHLbuiXgJoqf4oYz 7KpkKugKRuBTMjuXUG8M6Hz63eaSeajASjwOM2brUVl6lcS78jLAAhYHcyiSXEUzn6UY /YtLASjjlDx5vJWg3SVJ3TQObsKdU5hSAMGko8149z/b+cqkkank1cF5lV4zgzQarEck jUA2dVHH3a7c052SbzubZ/QTd0GYJCcvxYaQc25XnIlOUnoFy1MAcBVx2BvPfXvEOYQK NxZXB82tu3TVgu5grpDpCuao/LDYcJHv4oPeZdE2Vcl3Uxwl7KaEQxN912JFXYQDlhhg YbJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050078; x=1696654878; 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=moKe2A8erbuVLM63RNmgB8NBsCNapPq9yq0WoyHwDmA=; b=LASJagE8y5klTlW1gvDuYifSTNoqyw6660n4kZCU9uPLhSUqdRcGdUbGfgfYwgVk3d 0dbii0wzow8SktjXYplK+96JsxLp0YjKygkBE8wyPTM5wCBIOfVUWEzxa7Ut5CzjmH9C wif2pAUU1sfp+cBVTxSN7YW06wFoSOkUx03pWS9vYeiBSIaclMHvzP+U1iGBXbKdh4fW NJ7zLfv+SG112CdRmwzycTVerzhdVhGi/SnC4GNliafhdhlPQ62xWgbTXIPhJ7ZB+fCK jvjexbhgOEUA7/3OVKZXtvauym+i1KGondA2U1rTs3ax0864nmrR7idyUuQfKTIX7ttg GQag== X-Gm-Message-State: AOJu0Yw3ECrOw3yLt39V3zq4o5H7v61DKXVVgf5G0eMRxPe6Gc1dIxPd KydF4+ZH96VyZoKN/x4iG3w= X-Received: by 2002:a17:90b:383:b0:26d:416a:b027 with SMTP id ga3-20020a17090b038300b0026d416ab027mr6303354pjb.31.1696050078485; Fri, 29 Sep 2023 22:01:18 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:18 -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 , Xiubo Li , Ilya Dryomov , Jeff Layton , ceph-devel@vger.kernel.org Subject: [PATCH 06/29] ceph: move ceph_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:10 -0300 Message-Id: <20230930050033.41174-7-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:02:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778442047123197115 X-GMAIL-MSGID: 1778442047123197115 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ceph_xattr_handlers at runtime. Cc: Xiubo Li Cc: Ilya Dryomov Cc: Jeff Layton Cc: ceph-devel@vger.kernel.org Signed-off-by: Wedson Almeida Filho Acked-by: Ilya Dryomov --- fs/ceph/super.h | 2 +- fs/ceph/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 3bfddf34d488..b40be1a0f778 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -1089,7 +1089,7 @@ ssize_t __ceph_getxattr(struct inode *, const char *, void *, size_t); extern ssize_t ceph_listxattr(struct dentry *, char *, size_t); extern struct ceph_buffer *__ceph_build_xattrs_blob(struct ceph_inode_info *ci); extern void __ceph_destroy_xattrs(struct ceph_inode_info *ci); -extern const struct xattr_handler *ceph_xattr_handlers[]; +extern const struct xattr_handler * const ceph_xattr_handlers[]; struct ceph_acl_sec_ctx { #ifdef CONFIG_CEPH_FS_POSIX_ACL diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 806183959c47..0350d7465bbb 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -1416,7 +1416,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx) * List of handlers for synthetic system.* attributes. Other * attributes are handled directly. */ -const struct xattr_handler *ceph_xattr_handlers[] = { +const struct xattr_handler * const ceph_xattr_handlers[] = { &ceph_other_xattr_handler, NULL, }; From patchwork Sat Sep 30 05:00:11 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: 146941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp424372vqb; Sat, 30 Sep 2023 07:46:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6878WWpVAnexYjumg5LIlExHyaQwIFdBNHKo429D79BiGkOdgMhaqwVaGermwsZpwYJF7 X-Received: by 2002:a05:6a20:3d87:b0:161:a795:2322 with SMTP id s7-20020a056a203d8700b00161a7952322mr8386239pzi.18.1696085177545; Sat, 30 Sep 2023 07:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696085177; cv=none; d=google.com; s=arc-20160816; b=j+XzsN6llKepGs+b17uVwBRMnVLa1jBHDwqHNUkKZj3svolVdem/QcEXRjo2ywrfjq +hLgMSPzpyzue4aYR1S+C1N5SCS8T9rbI9LA89g6emQt4z6StUmRfxnT9efILyBqnWP0 8/x9HQfH+4Mp404CamA37Zr5hCqcELW5ZIkpCWfMDT1Srj/fqTf92M0OPgnapDak8C7S ZlATmPOaaS9HF6C997nuSuioqA3C4rArRhrOSUiTRK0JlA5NnKqzmHTumUz1fvnObqZj pklYQV+7A6okxeJX6z9oCqYG0SzHgy07vVtQ/Wn4MxnwBDRjXQQY55MV+L5UM8Q3eNjt eD6w== 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=Cc7EZI0QTgBVujG8JfkUP0DGPINpthmbr1tCtQXff5c=; fh=vXxELTddpcrZm8PW6QI1xfB0RMJZyV877vBe68wFE7c=; b=q+ZP+YsGpFDB2HBR71v9DNIsdF0yH9p92m6Z8Dv/xE9k3jI4Ow5SDk3AaRdKgynP7Q IqDYFpWIvrjBvjr2ndY3gy7NbnMdTiuiJIxsF1UZn7kIZKQYJn+W68gAJgYUuh0MKamq 6YXJfmMj2aj/TqnrGrAK49ddCr2U6/T6C/C/3o52BrxxPhOksAIwrLParFyX7X6oOxVS D6LCAYYM9cLf+Fpfettr1KLSexhmTmD7fN0dypOlaAdLHvg26UEV/Gk/k4FFyphBOWIY W6mdPVKH84xkRRgWupUErNTghJ77OFXaX9F8u4G2tQ7e1/o2jtg1TSmzq6MjoIGjVwJw E1Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ag/RLoUD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id na10-20020a17090b4c0a00b0026b49c1aa50si4171631pjb.111.2023.09.30.07.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 07:46:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="ag/RLoUD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id BCFB98367201; Fri, 29 Sep 2023 22:02:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234174AbjI3FBx (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234046AbjI3FBn (ORCPT ); Sat, 30 Sep 2023 01:01:43 -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 9802310E5; Fri, 29 Sep 2023 22:01:22 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c1ff5b741cso134162965ad.2; Fri, 29 Sep 2023 22:01:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050081; x=1696654881; 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=Cc7EZI0QTgBVujG8JfkUP0DGPINpthmbr1tCtQXff5c=; b=ag/RLoUDLaiw5u/Lqe1u/h247avxIsqNkzwSKhP1E6bmFzaiYP9QNEIrgAwzxCsrzE NlZP1rwmrvPhd9GAPKCeaJvJMKErBy9IAWfOHpsj60o0U2rtO+aN3JVZIKoJdr+Xch53 ds9iYTO5q+ab2vwqoHDIbI2XkPWgUosu58q8w7AP8JA5PZqpz7C07O2nQwkcNTufEcEi nfRLYIX2BCqsAzOM2IvrHWzsXRfxAgQ9e3q96rZaAdkuKDYbvfuWk3jK6/wnr5nuY4J7 iNE/ab0mJ30/9jVIL/zkfIse5BjobJ0lM5e0abpAiSLskZYbZUYmu845vPRenxcHkT5f OFFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050081; x=1696654881; 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=Cc7EZI0QTgBVujG8JfkUP0DGPINpthmbr1tCtQXff5c=; b=ipu6kMqemGxiiuEPv5JI4BjcGACxdGy+iL0q++UzJoGzcrCcTue8NF5nBGdsmqGuwj cDWnWIgjLxfmmXPkcB0ETfawKnFnbyWHvcT/C3c39cyhvWFc2tmPDaB/06WoZqJgq4oM LYQ0Jg+2UpaxDRqKIXYdS8FvefMJnCsQ9HeHPuNoQFtB+7104d7zwUnq491Rv7aH+g4/ mu9dqv0fFK6Wwn6phosTFWWyCk9Z6dG2/iIT+nq/lk8IhJZmb23aXrWGw6qasm1Dvezb baTZ24W7E4lnIoinLdC5HCUocKiIcB2PrbRlV4BQLsQCkKhH82TfKu11jJ6JTKQ5G2PC F8kA== X-Gm-Message-State: AOJu0YwXe4Pc+I3lX6B/cs9PqanogiUfT0drsApSLnEMIbWSfSNOZebk b4k1zzpvI2f7iAT5sDixk2+6SiuE/mRK6w== X-Received: by 2002:a17:903:1247:b0:1c4:3cd5:4298 with SMTP id u7-20020a170903124700b001c43cd54298mr7127633plh.18.1696050081179; Fri, 29 Sep 2023 22:01:21 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01: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 , Tyler Hicks , ecryptfs@vger.kernel.org Subject: [PATCH 07/29] ecryptfs: move ecryptfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:11 -0300 Message-Id: <20230930050033.41174-8-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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:02:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778474210941172905 X-GMAIL-MSGID: 1778474210941172905 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ecryptfs_xattr_handlers at runtime. Cc: Tyler Hicks Cc: ecryptfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/ecryptfs/ecryptfs_kernel.h | 2 +- fs/ecryptfs/inode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index f2ed0c0266cb..c586c5db18b5 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h @@ -702,6 +702,6 @@ int ecryptfs_set_f_namelen(long *namelen, long lower_namelen, int ecryptfs_derive_iv(char *iv, struct ecryptfs_crypt_stat *crypt_stat, loff_t offset); -extern const struct xattr_handler *ecryptfs_xattr_handlers[]; +extern const struct xattr_handler * const ecryptfs_xattr_handlers[]; #endif /* #ifndef ECRYPTFS_KERNEL_H */ diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 83274915ba6d..18fcec208d9d 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -1209,7 +1209,7 @@ static const struct xattr_handler ecryptfs_xattr_handler = { .set = ecryptfs_xattr_set, }; -const struct xattr_handler *ecryptfs_xattr_handlers[] = { +const struct xattr_handler * const ecryptfs_xattr_handlers[] = { &ecryptfs_xattr_handler, NULL }; From patchwork Sat Sep 30 05:00:12 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: 146874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp201137vqb; Fri, 29 Sep 2023 22:05:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlhWA2kdMOui3eEUShZV7Kbh6YCKHIV6Uz34XadCj/0y3VzZh89A8eww9oEKOVmifHn1c5 X-Received: by 2002:a05:6a00:1894:b0:68e:2f6e:b4c0 with SMTP id x20-20020a056a00189400b0068e2f6eb4c0mr6247468pfh.28.1696050356276; Fri, 29 Sep 2023 22:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696050356; cv=none; d=google.com; s=arc-20160816; b=QMX/Z5AixBB0YhkCULW9dZHKyd0+WLDkiWlpspvKX70onUenqeyJzlAI4Vt2YSabnp ZfR0iE8AZR7KSFW0q1LXiEUYqMDmm8YZAuYIe5C8FyR1FBivZcNWR4jgUeUK8vc9dqua X3CDpshd/ulHeupBehNfxyf2dZ+5mfvo1h+paqVMUEMeSqHEAI4Xu8IfghZHT1deXxOo f4YwKwA7MGBIVfx5BxX4fh0X39OsGnvCe8pubPQYMLOtDgBdWcGT02r7O9yhfMFqnKhB ySRpReafd8/0kgM/zZ/grlPJ2XcAwW5s5Y0FclGgxfDiOo7svafhzuEWi21lcpCdCrHl F8Qw== 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 Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id cd15-20020a056a00420f00b006933caa6f03si7945458pfb.165.2023.09.29.22.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:05:56 -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 1B610825B4BD; Fri, 29 Sep 2023 22:02:13 -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 S234101AbjI3FB6 (ORCPT + 19 others); Sat, 30 Sep 2023 01:01:58 -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 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:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778437698846833700 X-GMAIL-MSGID: 1778437698846833700 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 Acked-by: Gao Xiang --- 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); From patchwork Sat Sep 30 05:00:13 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: 146956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp503923vqb; Sat, 30 Sep 2023 10:27:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZmLXP7K9iAKI6qo6jW0iWvKitM58sSEYBeZ2wiLPh00SRaxZslbc5p/Anx6dX6UOjhaTb X-Received: by 2002:a05:6e02:188a:b0:352:749b:720e with SMTP id o10-20020a056e02188a00b00352749b720emr1993565ilu.12.1696094866761; Sat, 30 Sep 2023 10:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696094866; cv=none; d=google.com; s=arc-20160816; b=Gxj4FoHZMfYo3G99aw7Jyk5eMxZu89cwGr223b6rn6aathZMgymIYj3M3ijmXgioKI 60BZ6QNHIaHCEtJmxYzOGdAuIOrWi6haFNBs1iAPnaB+ds/zWvBDZ9O2pC6ZheQWJcv4 11YEzmL12N/Swma4AIBhasJtnRpGqYFroU3yWY9H2jGg3swOrv9HcuDnxDKoWhY6TJTO zPL4eo9UthEwIM+y46Q+QxbW5q7drKug7K9mh8zIlGj8Sruj0WislVLRTuUNDT/2pafu wXT0jPxT6eqQ+cDj69iK1EtoeKdVYPcGNNPFqh1mfEJNHKNnWVyXHbqmjdpKp3u5zxid VJzw== 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=xs6PHcuMqp3EC+KxYSNZ8/WH8PkZyTmto6O1b+gZZPE=; fh=Uv6YmDU3N8MpEnDCkz28swSwhn5WdxLb8bHJvPC7SKg=; b=LHH+MIyOgDVuw549CcIgCwmaUirr98ifO93ED/7WM+fxlWvcjXncQJEx0558/Rb6Qn C4hhCPt6VZhsqKJ0aGEPGfG5GhsqwG02WNQuK8YjkSCvKDZPw3SvdQwwSwMoN1hVJCan eGYkktEwn8RI14l04L/po/bO42xPqd8kyFtaS8FaQVk249fkNc1izvgl9PNr9fM9dSxJ BLHU1ygSBzYMNVmRkzG+3vRZxo/shV6CPlngQS7Q/AFn8XkO5eYOIrfKw1BODsUQxyKl sh/22VmbVF7yQSRtlRskb/7ifbluAtI+Dt4TyFwLDEZ75gPjd29wH38GEjerFdO0COPg cV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WGoZ93sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g10-20020a63110a000000b0055ace8caef9si23895286pgl.309.2023.09.30.10.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 10:27:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WGoZ93sL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 01953829C222; Fri, 29 Sep 2023 22:03:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234127AbjI3FCX (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbjI3FBr (ORCPT ); Sat, 30 Sep 2023 01:01:47 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F5F61981; Fri, 29 Sep 2023 22:01:29 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-53fa455cd94so10168441a12.2; Fri, 29 Sep 2023 22:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050087; x=1696654887; 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=xs6PHcuMqp3EC+KxYSNZ8/WH8PkZyTmto6O1b+gZZPE=; b=WGoZ93sLPHX8oeOwmjBE/faiAhK3db/DhACNLKBkyeabwg/YHXqmQqrLg7VijkplBO h7JbmMBGTt4uq/wAgNpYTHXcIE+EBBIz4YUIDjS0mGgzCRs5mRqB+cddKcs6kOmy4kyi KcWyf4PbO6r7yJzcNRkeCeOEMMjJbKraSbCg9BObA3vGjSVjdPoL4qEnMfvAw1b+6Wfb 4pKs+a3Dj88IJ2/b4McJDHWujJjCkeaU9ZkEFXJY27Qd3BPI9MFMZitb0Xanl0pZF2n2 Na5Z8TjSDLR9qoQ4TOSg6Vj6o2AsWB3P4ivAvDyER7wom0Nav/PdsgE8NFENZ3QQn9l8 3ryA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050087; x=1696654887; 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=xs6PHcuMqp3EC+KxYSNZ8/WH8PkZyTmto6O1b+gZZPE=; b=LYB63Uzyzaf4t8wRk0c7hGO8qqs6tO3QpxWw+Zc7fgZS0IyDrxk2f+/wh6HHYpi5Cd YJxjJr7V3Qh3dnWAmGxlcyPC62IovgytWuxp6jiaPrfNMtB5Kqny/wwQxh2Rry2ews6f 1dgYVjA+Yci3E5M3Bjoz119mKsFFvPuM3dnJpWrylpr10J8veNqAMQp5Z8xMWaOtZ/Fp boJsypCec7GIZAzrwmCqjNQDrddsuJkVSGFod5TgzhQ3eZOjtkpO4nnZj9CG1eQ8+qvY gLyfqbYJGKGBPRlboNPu0Ie2UJrS+UtkdPV04gScLbWqyAzZWl6S/C2Z7h/fNW7HdHMO 3kqA== X-Gm-Message-State: AOJu0YyMbp05vB6d5pWn8jMEqh6CudRrKtUr1tXtNiowqFn8HYd1YDQP t1caTrKshYB+w1NjQxgBC/0= X-Received: by 2002:a17:902:ce8b:b0:1c0:d5b1:2de8 with SMTP id f11-20020a170902ce8b00b001c0d5b12de8mr6916994plg.9.1696050087440; Fri, 29 Sep 2023 22:01:27 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:27 -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 , Jan Kara , linux-ext4@vger.kernel.org Subject: [PATCH 09/29] ext2: move ext2_xattr_handlers and ext2_xattr_handler_map to .rodata Date: Sat, 30 Sep 2023 02:00:13 -0300 Message-Id: <20230930050033.41174-10-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778484371099821695 X-GMAIL-MSGID: 1778484371099821695 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ext2_xattr_handlers or ext2_xattr_handler_map at runtime. Cc: Jan Kara Cc: linux-ext4@vger.kernel.org Signed-off-by: Wedson Almeida Filho Acked-by: Jan Kara --- fs/ext2/xattr.c | 4 ++-- fs/ext2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 8906ba479aaf..cfbe376da612 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c @@ -98,7 +98,7 @@ static struct buffer_head *ext2_xattr_cache_find(struct inode *, static void ext2_xattr_rehash(struct ext2_xattr_header *, struct ext2_xattr_entry *); -static const struct xattr_handler *ext2_xattr_handler_map[] = { +static const struct xattr_handler * const ext2_xattr_handler_map[] = { [EXT2_XATTR_INDEX_USER] = &ext2_xattr_user_handler, #ifdef CONFIG_EXT2_FS_POSIX_ACL [EXT2_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, @@ -110,7 +110,7 @@ static const struct xattr_handler *ext2_xattr_handler_map[] = { #endif }; -const struct xattr_handler *ext2_xattr_handlers[] = { +const struct xattr_handler * const ext2_xattr_handlers[] = { &ext2_xattr_user_handler, &ext2_xattr_trusted_handler, #ifdef CONFIG_EXT2_FS_SECURITY diff --git a/fs/ext2/xattr.h b/fs/ext2/xattr.h index 7925f596e8e2..6a4966949047 100644 --- a/fs/ext2/xattr.h +++ b/fs/ext2/xattr.h @@ -72,7 +72,7 @@ extern void ext2_xattr_delete_inode(struct inode *); extern struct mb_cache *ext2_xattr_create_cache(void); extern void ext2_xattr_destroy_cache(struct mb_cache *cache); -extern const struct xattr_handler *ext2_xattr_handlers[]; +extern const struct xattr_handler * const ext2_xattr_handlers[]; # else /* CONFIG_EXT2_FS_XATTR */ 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); From patchwork Sat Sep 30 05:00:15 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: 146923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp345477vqb; Sat, 30 Sep 2023 05:06:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEuCc6GudPk/sUtIjXbLl78tl/tPK3wQNYI83TWDEIzk3yIo3crekULwbD1Jp4dYgT9hphO X-Received: by 2002:a17:902:c084:b0:1c6:349e:fa43 with SMTP id j4-20020a170902c08400b001c6349efa43mr5076203pld.67.1696075591390; Sat, 30 Sep 2023 05:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696075591; cv=none; d=google.com; s=arc-20160816; b=ENnoAlVJ8VT+2JnA2M32RhqVgUZ1rS3sKYgemxTe7udR0AgIJvnzAGU8E0hEmcFJYg zyYBxTxUCb9bpK9w45kQCgiPUmO+H9i1WGBcW4K7PVdSwWvquwaGC2pIDLZo+B4MMvQ3 jCfahTlOCH1x28aYiGMA9rJdTLgeHm+McUNZ7LNId8O/Rl10Iggo6FnVdnmCA796xxv1 l1n1yy4O+GWZzJ5Dpw5TOGDo07WuI469fsBEa78RlcG24N/iS66t81qGfyL9dk0I9tC6 WzmQgnOprfL22IQuSPHIicEksqfguzntCpBJ7AApX4LF3r5WLCRJVinf4C5IE1PpSRm+ b3Xg== 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=0Di+r7igCO4YXKaYMIYrRDbHqqg+poxo6bQkzPMC2DI=; fh=vWWVjyogHmx4gJAvHUgO6OyUsO/WDpiRN4hlQsj+x64=; b=SHB9aFL/fvIn3grh5+MH7GpmDndd4ESf2vB83UDSC6Hg00GgXn2cJvQZOxwVRepa4N 09n2GQ48s44PWUEEXW4VfrKnA7fgzvyOe3hQiL8HyXInEViL9BOkkKYTje3tSMe37cCC C+arTYdgvxztxWm+QYuND0wEKW57tNLYmrJO6vj+ie8l5VH1AcVL6qZVN066WVZLn8X8 +LxrL17VE1wG34zFB6YxL3a5bIBo4OGed9sGyBfXnahE8LeFzada3DG4bPRmYD+j7Qpj I4XC75WxcQx1qflKXQcTabQXhZJyVg596ER1e5O4WFQ3WNQAKoBt/6neptyZoMzG/pRN Wj8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JAbDr6eN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p1-20020a170902e74100b001b3d27ca12fsi12533805plf.207.2023.09.30.05.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 05:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JAbDr6eN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 1426B831334D; Fri, 29 Sep 2023 22:02:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbjI3FCb (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234034AbjI3FBu (ORCPT ); Sat, 30 Sep 2023 01:01:50 -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 B38D41B0; Fri, 29 Sep 2023 22:01:33 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-578b4981526so9576823a12.0; Fri, 29 Sep 2023 22:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050093; x=1696654893; 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=0Di+r7igCO4YXKaYMIYrRDbHqqg+poxo6bQkzPMC2DI=; b=JAbDr6eNg1PJBrpWcF8pM+0gTBU5L1Rb/qIi7ESh/AgzEYudfdwjj6dGUmvfmeiRio nYC1NT5PCjsfhqp9xY/0jn+l61MfbRgU/IqzjV+fHBiW6w2LSejWh6JODKqh2xm5ckWu LbdwHEL3f+uHVoZtZgrn60uIGvyNw87JRlO47CA5uH6aWWaIsiaTzvBigZcdHb2pKpJ/ Pn1g08XSQY+DJ+Nex//hWmKuJIT2F5hfZ+hdNblxQ16ghd30Kt3EsoXRY8sR91iySO2W rKDTM4T3tc+yhmhOpmZ9eE73BNHC3YO2Y0kUz7URRsobQCRM4IOf4BsFdIDOO7Zn9XTi DiMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050093; x=1696654893; 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=0Di+r7igCO4YXKaYMIYrRDbHqqg+poxo6bQkzPMC2DI=; b=hkWOoD49HjHd4v6F7j2jvwStrWzphLV2iV7b1nQ++pMKtiGjzEC8jSkD42ruNb54Xj yP7NwYI3XM/HqF/svmSjZIm33yaQiLOHY9j+dECsfC6str9Xm08FJTPr5xAUvz7j+BLM h3OsjjReQA3SxlD6BZReid2Fvm3erwfZgk7FBspyVvAxaUpXgutaF5bYK8GnxjFH0dq8 l462CwykCrpxoZaUIvul8fRIAurelxGL0mT1RKnaTvfkObU5g76aUkyRw0tm2W7NE3q8 y7OibQiMt/LjWOeoOlMkEAhOkMwyV4L4Nsk5N1jOWAjE9Vqpqwf+5EFiJnuccoTtARwQ 1nzQ== X-Gm-Message-State: AOJu0YzZaj1ggWga1TYfQGWUs8mCoQfbvAOv8gSGbr2MvY3hkKZDLmei V8nB0uOjlKmluFMB0TcE1A4= X-Received: by 2002:a05:6a20:258d:b0:161:27c5:9c41 with SMTP id k13-20020a056a20258d00b0016127c59c41mr6192739pzd.28.1696050093022; Fri, 29 Sep 2023 22:01:33 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:32 -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 , Miklos Szeredi Subject: [PATCH 11/29] fuse: move fuse_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:15 -0300 Message-Id: <20230930050033.41174-12-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:02:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778464159440335278 X-GMAIL-MSGID: 1778464159440335278 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to fuse_xattr_handlers at runtime. Cc: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/fuse/fuse_i.h | 2 +- fs/fuse/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 9b7fc7d3c7f1..2e8c2e06cf78 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1268,7 +1268,7 @@ ssize_t fuse_getxattr(struct inode *inode, const char *name, void *value, size_t size); ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size); int fuse_removexattr(struct inode *inode, const char *name); -extern const struct xattr_handler *fuse_xattr_handlers[]; +extern const struct xattr_handler * const fuse_xattr_handlers[]; struct posix_acl; struct posix_acl *fuse_get_inode_acl(struct inode *inode, int type, bool rcu); diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c index 49c01559580f..5b423fdbb13f 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -209,7 +209,7 @@ static const struct xattr_handler fuse_xattr_handler = { .set = fuse_xattr_set, }; -const struct xattr_handler *fuse_xattr_handlers[] = { +const struct xattr_handler * const fuse_xattr_handlers[] = { &fuse_xattr_handler, NULL }; From patchwork Sat Sep 30 05:00:16 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: 146942 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp426231vqb; Sat, 30 Sep 2023 07:50:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFo/2EvPKYj0vK15LAlGjAmh1kgGmQDqTI1sd8G/j6OoJPw0CFWtkX+Ut1vCmjxHehu5Utw X-Received: by 2002:a05:6870:6111:b0:1d6:40f9:804a with SMTP id s17-20020a056870611100b001d640f9804amr8214325oae.57.1696085458406; Sat, 30 Sep 2023 07:50:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696085458; cv=none; d=google.com; s=arc-20160816; b=jCE3ZV4oxPMB9JeyxNavgGGMj2KxXgSSGMDhybC+75q+71Cy94reGdCajibn7rLoZN HEV44spKAaFr8nKvYkwc8sOJIznzJFnzeISH5XDDsVbyM5MRsCxBR7jEoUi5Fq9qf5FL ImFvv0uzmN+aY2nVlWnGN30+R3Ibv2WEz66NNb0sp110W5rrX/aCM2nQcqlZJreOItnu M099TyHLSey8AsbcuoXrGWRkv+VQo/NJrHKEk6SASZbPKToLIrS3kjscAjdTisQuth7Q qscnkIp/HR5d3XvE/J7cZX1NU3T431VsLhd9fIUZUAdhEMaLXAxhQTEn+F77+4qOSQMF ujwg== 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=GwKeB2GcV8X8HT4SX1MXoeR5H7ol3LfqqF5Xgl3DCSk=; fh=b5sWXaoLZk8H0GNvsiXJqaP+wylgwwXKHKMnG4XlhuE=; b=zmnQUtRJpDcXW+qX2uJkBrvGUiwzjk0FVFB3Pd1S6WuOny+y5f14N5Sl+kJ2iQlSnd e7qNIfk86qfIxQ3eR779PdfDSaXmf40BY6KTA5vyPIutUvhN5r+5zPll0iTaUCf2Uriw 1AKjCl2yT0z7smzkcQ09MJQSwxNFNQVZKr6KteVwg9BNkjrgqSyIquNFI06PqLK4OWuR 80pvFJwY3TlPkvagG1up4jg7uTFQMWyJy4SviBQmsCLul+xRD8uleVXGxInHAq+3qL6N M01jYQAwe/0B4iNXIrATdsitcTIHxvcTQDrgx8lTkMBkonSaYgrDYe5HG6XWJNYOh0K/ M/iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=L7afGCid; 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 19-20020a631753000000b00565eb0cf702si23338221pgx.310.2023.09.30.07.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 07:50:58 -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=L7afGCid; 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 6B904832057D; Fri, 29 Sep 2023 22:03:02 -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 S234156AbjI3FCe (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234142AbjI3FBu (ORCPT ); Sat, 30 Sep 2023 01:01:50 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B19A91B9; Fri, 29 Sep 2023 22:01:36 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5859d13f73dso1084558a12.1; Fri, 29 Sep 2023 22:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050096; x=1696654896; 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=GwKeB2GcV8X8HT4SX1MXoeR5H7ol3LfqqF5Xgl3DCSk=; b=L7afGCidyMkbrsdDhyIwgZMneQ2xkh5v/HjCcVhs7WfvhegSN0iZ7ObGm7Yd6JtVyh gJmuFBS9SmvwpgoOWyZkkMYJU5jzfuU+pDD+UgwX6FLlioRBYHphCI/8TtsyouvgDneA ZrSqF6zREYD7mMg4WgrbkP+Vn7tRAzLtDZcxXZfp85uqA0Vx4u8k4pb85btNSkYw4DSh eA359rKPGLLSt9d4TyCJQuLNYRhbnugWtY2T+bzr17bQHjV7DIbxOiii7VVHo2FIKeOr diX8S//jz4WM/CX/y66u0CJ5WMxY7MbkO2zLAzH4zAqJGSNt2Ta6WIeB5cZXRQMbQ5xA jAWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050096; x=1696654896; 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=GwKeB2GcV8X8HT4SX1MXoeR5H7ol3LfqqF5Xgl3DCSk=; b=YhFMRV73kwDTgt5vGdi06u6Kix5CRSQ3NFy8WaKm9Cr3jJ7+U/oTJ/GpEBOIk/3KQX 4F0XGObGbbZeonmrCjnO7dnqngyibBhcfauOBxylQ4YgfbNE7L+yOaApuTgUbrLmeQnN xe+35f8ytFYF5nX+J1/3XGscDkhTDyKNKUvs79w50iii17Rnu5m3mMAGH9RCrmmXhBi8 OLJynVckz8DlCSlRGt1zxsUtoVZt27KA1z3RMwQcIiyJpm06NGTIGY5ED5BXD9+4W3Hb Ftdr0F4o6zjQqgq+52oFWoFIOwdn1sBr8bscU1y/kWfdVlQY1z665gewHFsSdeb9Vko9 U5vw== X-Gm-Message-State: AOJu0YxQBN+erSeY+LGl0mkqOCC28xiDA0D6N597eVh1ABReUqMxnxiA Q7vVdXAVyUhHFwtxC0BIFpE= X-Received: by 2002:a17:903:456:b0:1c3:1c74:5d0a with SMTP id iw22-20020a170903045600b001c31c745d0amr5368060plb.34.1696050096054; Fri, 29 Sep 2023 22:01:36 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:35 -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 , Bob Peterson , Andreas Gruenbacher , cluster-devel@redhat.com Subject: [PATCH 12/29] gfs2: move gfs2_xattr_handlers_max to .rodata Date: Sat, 30 Sep 2023 02:00:16 -0300 Message-Id: <20230930050033.41174-13-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:02 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778474505462995827 X-GMAIL-MSGID: 1778474505462995827 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to gfs2_xattr_handlers_max at runtime. Cc: Bob Peterson Cc: Andreas Gruenbacher Cc: cluster-devel@redhat.com Signed-off-by: Wedson Almeida Filho --- fs/gfs2/super.h | 4 ++-- fs/gfs2/xattr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h index bba58629bc45..3555dc69183a 100644 --- a/fs/gfs2/super.h +++ b/fs/gfs2/super.h @@ -59,8 +59,8 @@ extern const struct export_operations gfs2_export_ops; extern const struct super_operations gfs2_super_ops; extern const struct dentry_operations gfs2_dops; -extern const struct xattr_handler *gfs2_xattr_handlers_max[]; -extern const struct xattr_handler **gfs2_xattr_handlers_min; +extern const struct xattr_handler * const gfs2_xattr_handlers_max[]; +extern const struct xattr_handler * const *gfs2_xattr_handlers_min; #endif /* __SUPER_DOT_H__ */ diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 93b36d026bb4..146c32d44bd1 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c @@ -1494,7 +1494,7 @@ static const struct xattr_handler gfs2_xattr_trusted_handler = { .set = gfs2_xattr_set, }; -const struct xattr_handler *gfs2_xattr_handlers_max[] = { +const struct xattr_handler * const gfs2_xattr_handlers_max[] = { /* GFS2_FS_FORMAT_MAX */ &gfs2_xattr_trusted_handler, @@ -1504,4 +1504,4 @@ const struct xattr_handler *gfs2_xattr_handlers_max[] = { NULL, }; -const struct xattr_handler **gfs2_xattr_handlers_min = gfs2_xattr_handlers_max + 1; +const struct xattr_handler * const *gfs2_xattr_handlers_min = gfs2_xattr_handlers_max + 1; From patchwork Sat Sep 30 05:00:17 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: 146939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp416605vqb; Sat, 30 Sep 2023 07:30:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkIwfFgdwXzbEisydRPR/pPs8CC1Yb0DNa1q/j+hJn5irF6nfokf6FdoUIllF9W3f5SCU+ X-Received: by 2002:a17:90a:fb83:b0:277:7b0a:76d8 with SMTP id cp3-20020a17090afb8300b002777b0a76d8mr6594144pjb.30.1696084215260; Sat, 30 Sep 2023 07:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696084215; cv=none; d=google.com; s=arc-20160816; b=DYLec5uT14VkXFglqnxyPbj7O20ejrx4uomegRfJtAyMjqrMSzQr5bpLaYWd+K2HCy a1+ANIPyzX+DjnwtPR9Kp0+3AnNGRofYU+vG9tvxkPISxyaUjjgAfXNmv4sOdMHCKHLF ul0NQ8pQBy/aTQVc7H6x/0G7H6kumV7stYlJ5Rzc1UyExLZnVfGA6lbVBHtf4/44EZq7 TltIltNym5BGhOw3ewcvkUV5UnEpyFUGEk5I3SLJuqb7oa66Pmk8dEYXbqxpBOm4iBQi 0k2oxLyKEUIKCyvIRSR7dGt5uhiTOf7rXcG8n5os3bs1iHncxtIF/7ii4Ni5vrIdXlNa AuMA== 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=b5KC1lIhnxi9Th80hMfT8J4dZJX49vz6ed13a2jWNxs=; fh=SK2xQ5WvE6tbwSQN9TMkRjbkm0hotbQhx6y1kSOUb0Q=; b=JVD8uVWvrKaBVv+Jtlc+nfFX7sxTdIavfT4Cz2V3zg6cmAtuqkiwoHE8A0cQJoAgYC pP6LIS+ixsy5qw0jlrKBow54ktGs9z+pa2Kkr94NEchJ0sUqGODKkM7dUrsoV2O5xzjl M3luFaqMfytJM0N9gGhZKIK8NEB7ml1ef5O7GcalLt9d0htA5e92hvPo4usM7NCBBtH6 Yca5CrrOgcUEcaPuAuOqSIgsBTHGAr5w30h2Olu2tmRjmH1I6ktD5GvK7QDxLSr4EInZ irjz7dp0S6Vc7Gdrx2P/PntzaoAyGLViRIFFBGokkMR+d4uocBx4eJjt977rNyZLURQ8 nq+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="W/Mx/brX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id na10-20020a17090b4c0a00b0026b49c1aa50si4143207pjb.111.2023.09.30.07.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 07:30:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="W/Mx/brX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 79A3F81D55FA; Fri, 29 Sep 2023 22:03:34 -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 S234094AbjI3FCp (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234090AbjI3FBw (ORCPT ); Sat, 30 Sep 2023 01:01:52 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B999CDA; Fri, 29 Sep 2023 22:01:41 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c3cbfa40d6so133402195ad.1; Fri, 29 Sep 2023 22:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050100; x=1696654900; 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=b5KC1lIhnxi9Th80hMfT8J4dZJX49vz6ed13a2jWNxs=; b=W/Mx/brX96BBz3iv5W8RnOve62gxCGsJFCMkxVZIBCcF+8s8mwnw9Fzw4dQj3Z+6a8 /P38+yDY5FyN2bsB+W801qr7Cc0r10DkTGb8SgaO3E+66gcDDGuh2tj16kMqeBYIbm1+ cqk26NCOVq/QiqbMxqQW13Xdwi2gEmDgGywQJiNM4M6C365yP1hbk0ASC01V6NCuQrRb HqhrQuzl2CIs9wEr5vqxJAiXFwONh69tCFIJskEzy3/fjUON71C1MzGUEN+1YfQKPoz4 1Q1vjP8YuL6OGpJ4g8xUup//KmljEwwbQ4YW5dFZztfODFJOo+ddXx4t0XMfCqkKwTKn D2Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050100; x=1696654900; 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=b5KC1lIhnxi9Th80hMfT8J4dZJX49vz6ed13a2jWNxs=; b=dH6JRzOPVT6pgYYBI9p728CI0pV2VCWAF5uRtJAgVKlzqoxls5etg0+qquLx9kSrZC wyquDzR+zYV+4ZkTfpv6yG3nYyXPxFsFpfiuZbviqne2RawMCsDwpxrVmM3/slvXb113 Zkt3E3uBeuUcOQPDkJs8W31POBhzqPmELpucVpKtvJoLljuKi5gy4VIxCHOcow5yQcrw A8iHTXIV5areoPmCajz1MksRHNb+HZT1MqFDhZj6318UJzDcWlqrCwthU6R6wMchHrVk axVOFI27Ptc/LXTvgnznIOZi9gukllgIoOUpKLJARb5vJxfUQ/thJ0TodoAbvxObTkIv NKGw== X-Gm-Message-State: AOJu0YxigxQdTSezfUFSus6ldF/EQeLLM7AypiIot+hgGjd4E7g2AV10 VzzOY6jBTWhz89hB/zVSxmQ= X-Received: by 2002:a17:903:2348:b0:1c7:2661:91e1 with SMTP id c8-20020a170903234800b001c7266191e1mr7489101plh.15.1696050100397; Fri, 29 Sep 2023 22:01:40 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:40 -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 Subject: [PATCH 13/29] hfs: move hfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:17 -0300 Message-Id: <20230930050033.41174-14-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:03:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778473202042308425 X-GMAIL-MSGID: 1778473202042308425 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to hfs_xattr_handlers at runtime. Signed-off-by: Wedson Almeida Filho --- fs/hfs/attr.c | 2 +- fs/hfs/hfs_fs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hfs/attr.c b/fs/hfs/attr.c index 6341bb248247..f8395cdd1adf 100644 --- a/fs/hfs/attr.c +++ b/fs/hfs/attr.c @@ -146,7 +146,7 @@ static const struct xattr_handler hfs_type_handler = { .set = hfs_xattr_set, }; -const struct xattr_handler *hfs_xattr_handlers[] = { +const struct xattr_handler * const hfs_xattr_handlers[] = { &hfs_creator_handler, &hfs_type_handler, NULL diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index 49d02524e667..b5a6ad5df357 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h @@ -215,7 +215,7 @@ extern void hfs_evict_inode(struct inode *); extern void hfs_delete_inode(struct inode *); /* attr.c */ -extern const struct xattr_handler *hfs_xattr_handlers[]; +extern const struct xattr_handler * const hfs_xattr_handlers[]; /* mdb.c */ extern int hfs_mdb_get(struct super_block *); From patchwork Sat Sep 30 05:00:18 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: 146881 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp210024vqb; Fri, 29 Sep 2023 22:36:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbcMxlSzSgMgqtwWcizA7W3tEtOrf/YUMyDXdPkCWb1RjDUFF4y5jnbrLk/2BFJ40Ly4c4 X-Received: by 2002:a05:620a:4486:b0:770:96a1:5580 with SMTP id x6-20020a05620a448600b0077096a15580mr6633961qkp.14.1696052201587; Fri, 29 Sep 2023 22:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696052201; cv=none; d=google.com; s=arc-20160816; b=dwkEMfhTk14RKxxP+Yq51Ipl+Z697Z0JmDbJD3MfFBa9M0C3EaFrkKDSpSFRDxeE9p t6BgBraP5Y6kE4wZsl55iCpUmkajL8GC4NPUDW3lIGoMhPBuyDyOsVScaX6V0GBAepJb 8uVgikP86hbKonb5mVkU8IcqqivKQAFgUkwgC+OpHjiDrciE7jCln+hxN/Tl6lUEkcXk UjcDisAscIwvojWFBK/RfNRqZb5MHVRUxSCQtbwqdoLR4smqJYGTrNQ0xoQSCrNnvCNH WKgv71YxuOH6Gzo8DTlVDeSMRA+1dgbJf42dGeTmFCaCNBiHHlUz/CgbcuSJNKLSKrTc /Ujg== 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=YvbnXtkeP9vLNSIc1O3qas9xHaLQIqu8ISSeZ0t4O0M=; fh=SK2xQ5WvE6tbwSQN9TMkRjbkm0hotbQhx6y1kSOUb0Q=; b=bo5QFYUG+/+N6evYRoQWV+KQaI4EUCRQQtMKIh7TtjOToavKCphTcfE0PQU0QOCFxo bDEfpvUsyq7npdTlyPDCz8ussGhcAzL83Epd9NHFj5KPwLXRrmxzOV/K9WMBXOgu2Ls6 UmTzkmD5CAQsb+w2gM1PzNuEvHGr4FEgYcye0DC/Alss7iVI2T64FrMuYXNmteenefZt ZqC2QxmVzG7+miolBBDSXDx36s4AieIijsXgdrmVWIYl45+l95/52t/w0Px4AH2W1/E5 6Elq8Vw2w2rkxFXH92cZkdB1+NS1xFQvR0/zFTrSBgcdPZpVKqfxnAGM2I3Dv8kUUf+P n9EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WR4dBCwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m21-20020a656a15000000b00578b9fb24f6si25248032pgu.616.2023.09.29.22.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:36:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WR4dBCwq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 804398319230; Fri, 29 Sep 2023 22:03:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234167AbjI3FCt (ORCPT + 19 others); Sat, 30 Sep 2023 01:02:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234171AbjI3FBx (ORCPT ); Sat, 30 Sep 2023 01:01:53 -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 5D6E2CE6; Fri, 29 Sep 2023 22:01:43 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c61bde0b4bso90823145ad.3; Fri, 29 Sep 2023 22:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050103; x=1696654903; 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=YvbnXtkeP9vLNSIc1O3qas9xHaLQIqu8ISSeZ0t4O0M=; b=WR4dBCwqwdsx8Zi6fJhEwjZBXszFELf+jxpKQoDJlszfZ1N+ref7hEoS/7yiUtSdCJ KZKZsenU9t7s1aYxZWobCH83vle/GqEaJpxGpwB4NHMOlGdqP6Xnm9RDrrDMjIHOMNYh kRWX4It7l7W+aQ0f9UQhzzRm4x1e3oAR+tRnZoDuNuCwWeVgOpWSe6y1I+oqdQaHD2RE lA9IMNa1NImMxs6PrwIk1IZJNNgrnccjEYPvq8DBzGWp4geffLNzJ2lCYEbPq43gK80T x0t4AZDZ3hBo4PQvuTvokTYV2wbhrX6j/qAgJ45a5Cw3EMKkwiNcGw1Vy+Oa/zIcCXuL 4aZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050103; x=1696654903; 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=YvbnXtkeP9vLNSIc1O3qas9xHaLQIqu8ISSeZ0t4O0M=; b=BNbj2At8ThQDsZ6tWha3lWGxrgddodErKLy8a38TRbRF9ZK/dv4hhNyg+W907xT0wM hkm2mgYJQ+vqPkr8CRRGLsiXvWE7N+Ygb3/+yKkV0xG/cS8dVTIAoi+zpzBpnnBQobWX 6i3UVrG/YyqFkgbOHdTVRO9B9Q0ivHy5Pz/HUwzPvMPADy9HYEzig+4+M7vLweN42Avu 4aWKN5l4VpImQJSAOw4HEOFT1tJBvMigzwCLogYTpNdKMAAoiekgcjPio1FsGs88tJmr XmH/Aeq1kP4Hw5Rgu16mP+wmuKaZhSQLIVkWEmrZZrQPB6msuNnbqXr3/jrwvUlXkqth 4Dzg== X-Gm-Message-State: AOJu0Yzhzl2zXhk3V71+dwCYf2C2slWxeAEwEJFQ5k8ZUnCZDGZIVStF DbJSX8vG1a+ocq/DBgh55eg= X-Received: by 2002:a17:902:7445:b0:1c5:ce3c:c399 with SMTP id e5-20020a170902744500b001c5ce3cc399mr6626185plt.39.1696050102764; Fri, 29 Sep 2023 22:01:42 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:42 -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 Subject: [PATCH 14/29] hfsplus: move hfsplus_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:18 -0300 Message-Id: <20230930050033.41174-15-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:08 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778439633561311022 X-GMAIL-MSGID: 1778439633561311022 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to hfsplus_xattr_handlers at runtime. Signed-off-by: Wedson Almeida Filho --- fs/hfsplus/xattr.c | 2 +- fs/hfsplus/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index 58021e73c00b..9c9ff6b8c6f7 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c @@ -13,7 +13,7 @@ static int hfsplus_removexattr(struct inode *inode, const char *name); -const struct xattr_handler *hfsplus_xattr_handlers[] = { +const struct xattr_handler * const hfsplus_xattr_handlers[] = { &hfsplus_xattr_osx_handler, &hfsplus_xattr_user_handler, &hfsplus_xattr_trusted_handler, diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h index d14e362b3eba..15cc55e41410 100644 --- a/fs/hfsplus/xattr.h +++ b/fs/hfsplus/xattr.h @@ -17,7 +17,7 @@ extern const struct xattr_handler hfsplus_xattr_user_handler; extern const struct xattr_handler hfsplus_xattr_trusted_handler; extern const struct xattr_handler hfsplus_xattr_security_handler; -extern const struct xattr_handler *hfsplus_xattr_handlers[]; +extern const struct xattr_handler * const hfsplus_xattr_handlers[]; int __hfsplus_setxattr(struct inode *inode, const char *name, const void *value, size_t size, int flags); From patchwork Sat Sep 30 05:00:19 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: 146880 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp204632vqb; Fri, 29 Sep 2023 22:17:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsZumEeCNg7n079AUZfQwtlSqvf5zj8B4woZ9yEIuf7X2HiJomebd/kQOQjryHBtVOhM2Y X-Received: by 2002:a05:6a20:12d1:b0:15e:7323:5bf3 with SMTP id v17-20020a056a2012d100b0015e73235bf3mr9791968pzg.26.1696051033494; Fri, 29 Sep 2023 22:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696051033; cv=none; d=google.com; s=arc-20160816; b=KpXtnJPHRJoIM1qknPtYHCyBIAC5pr4VM+Ac1t8pkNQwEceKwZIa16PL3aMQVKu5Bd DV3Y9rvx5rTd+fgeFlR2k1t4WCaijhN/SvRsxikVJN5lW3Qrl6wAq2EqfGG9Hn8nLnQE 1llh+BmOBkmlvX3DozaREVTcx3+Pb/jwZFTVjFk30ZtwPVQdKm53Ztoa3lSyDpQv3xZ6 J2bPx/jOROnvcCYTPyoLUbdtdtxB9K8ZRej7dA4FEkyYDJXKe1diL03PwP85zf5Tzc1H Khclgfj+nUvg+Dc/x+tFLimTEoaxFm7x3/VlWdiY/MuIEblOqnEFbCuolZ+uph/Y7jnu aHRQ== 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; fh=2hKbA38J/0D7ONeud+Nfm7+vtN0CZnGnMYAncAgVqYw=; b=XB1d7fRI2hbECnJSn+G68aqWr0sDbgpHkXjocVdkofz/zlr7LHEet2KVcIaSCzeN8N VtD3p0E4NjN07q6iCDP7i+epzjgw/uL6BdoZVp4srFEZZ0tCr71A4U04LGoDYpKHFpZF kmVcZKgz7o/Vc5UH5U+sbIQQJaaIWq3+PJXgsSNn0nJItJ4HMm7xfcBg6hF+7ygtcfEL gIreRvKQkHS/quBYiWtQEmHw2Eq3BbJlSMGFC6YyNxKLECUudoC3tQBjFVdceGoPG3vu tXDr1wtPtAFkbaHET0x+NIm6cIerHJWW9oBizqs+z69GGIc/dBU4V3CJczpKVt4wbJ+4 HfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Lk93wttL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x190-20020a6386c7000000b005859c29ce86si3383904pgd.84.2023.09.29.22.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Lk93wttL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 449BF826EB87; Fri, 29 Sep 2023 22:03:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234199AbjI3FDB (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234072AbjI3FCH (ORCPT ); Sat, 30 Sep 2023 01:02:07 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2EC10C1; Fri, 29 Sep 2023 22:01:46 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c63164a2b6so9927795ad.0; Fri, 29 Sep 2023 22:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050106; x=1696654906; 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; b=Lk93wttLTNuHCCDZqSRZu5hJ6zh3eTJKxYMAetLyk/k1h/oXdJnm0fCj38edehQLsl XoA4+r8hWx+EEbFhBJkkysH94rH1vypgXKJ3g/jBhyU1TDyJLkDJuMFzLFakzLrWyLmC o26/AiZu2yqdMpvtI8+46US7syVhfZpxaf1Mv79qGeOxrF5g69Vc+r4Vbw9FVnLFqZFl Nt32QadODTj6Ur0bNdbLd/h7b56+rv7bHRGV+hl7cA1uCU/mtoKtKYnALbPoaWPmn3kI MmYUZKyU9h4verzDki9ZCfxMtcSPqTNc36UUCXQ1ldMjqf4ilfgAOpbdKm4knONhASF1 4rmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050106; x=1696654906; 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=oH9OE0TWxgoHAH6ZcW6POZxSiYPCkmArEwnHUlA64Qc=; b=dACHRVqLaENYRh8Z6MnZ9JICvB/ru8u9Xce4ISCIHoH+1Yb5nLf+ijkz51UQuZkkf4 rXvvIR9IixVQ3pYAvdrdraG5uPm5FHxib84mQzlJ+o4kDhBNWvEl1uLDeqJGr+vPN3dv ItFBUPbP2oXNbSmgqV3s4GgliILi0Ue+HqJN/Vmf8iP2VoVh3lMSw4CR7bsEEFvSFlis GFdop2QncRDYusWoaybkRZDRwqc8R6FIKcAZFgtNGL3AbA3psl/a811hUWrIXXjeJcPN X1syXbzstlrafr5Q5Ad4ya6cV6htyFE1ZHJDkPrP0s6zI9F8anRODh71UbBRwe8gWLmu 9xUg== X-Gm-Message-State: AOJu0Yx0m+wAEfLuCHMK1sGD1AjPhVcU82WKyzH6AIDrWI2S4BE6ceZU qB4/JkkTv2zqv2CtF9fYvqM= X-Received: by 2002:a17:903:41d1:b0:1c3:432f:9f69 with SMTP id u17-20020a17090341d100b001c3432f9f69mr11026355ple.23.1696050105710; Fri, 29 Sep 2023 22:01:45 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:45 -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 , David Woodhouse , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 15/29] jffs2: move jffs2_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:19 -0300 Message-Id: <20230930050033.41174-16-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778438408329610107 X-GMAIL-MSGID: 1778438408329610107 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to jffs2_xattr_handlers at runtime. Cc: David Woodhouse Cc: Richard Weinberger Cc: linux-mtd@lists.infradead.org Signed-off-by: Wedson Almeida Filho --- fs/jffs2/xattr.c | 2 +- fs/jffs2/xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/jffs2/xattr.c b/fs/jffs2/xattr.c index 3b6bdc9a49e1..00224f3a8d6e 100644 --- a/fs/jffs2/xattr.c +++ b/fs/jffs2/xattr.c @@ -920,7 +920,7 @@ struct jffs2_xattr_datum *jffs2_setup_xattr_datum(struct jffs2_sb_info *c, * do_jffs2_setxattr(inode, xprefix, xname, buffer, size, flags) * is an implementation of setxattr handler on jffs2. * -------------------------------------------------- */ -const struct xattr_handler *jffs2_xattr_handlers[] = { +const struct xattr_handler * const jffs2_xattr_handlers[] = { &jffs2_user_xattr_handler, #ifdef CONFIG_JFFS2_FS_SECURITY &jffs2_security_xattr_handler, diff --git a/fs/jffs2/xattr.h b/fs/jffs2/xattr.h index 1b5030a3349d..7e7de093ec0a 100644 --- a/fs/jffs2/xattr.h +++ b/fs/jffs2/xattr.h @@ -94,7 +94,7 @@ extern int do_jffs2_getxattr(struct inode *inode, int xprefix, const char *xname extern int do_jffs2_setxattr(struct inode *inode, int xprefix, const char *xname, const char *buffer, size_t size, int flags); -extern const struct xattr_handler *jffs2_xattr_handlers[]; +extern const struct xattr_handler * const jffs2_xattr_handlers[]; extern const struct xattr_handler jffs2_user_xattr_handler; extern const struct xattr_handler jffs2_trusted_xattr_handler; From patchwork Sat Sep 30 05:00:20 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: 146922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp344844vqb; Sat, 30 Sep 2023 05:05:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJy1kg08GMByZSPI9xqDZqgkO09drxpInNaAgS52YBPYeW2xmaLkwXg6yVdNutwAnNRCEU X-Received: by 2002:a05:6a20:7fa6:b0:14c:daa9:5e22 with SMTP id d38-20020a056a207fa600b0014cdaa95e22mr8532819pzj.45.1696075530377; Sat, 30 Sep 2023 05:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696075530; cv=none; d=google.com; s=arc-20160816; b=n7yRhUNLH83vDuoUmK26rO0GvDM2Igtj33Uvt2ZqYpA0MHbk2hFwzvUAyYcccvwdwl mDgS0B3twX6yz9/BakEIYtbUGMyRCvRQst+WAvTVigwG76wcEWy9UDIShKfZlOz5oRJH 3YpPSTb9H3fMK4lzXdyHQKW6DqiV1ltbhuKZEw0fa1tOUXr4zpXX6lo08MxbWtf4UazO gfwcbWjWsbsQarR/0CDEzi4bVR4g+9y0hZrEYf4pi5x53BRQmAWbXD2HeISqh7Kk47U+ ve8RFv8aOSp8I4jhUFvkWWDizWXx8xWh7lOtnOw2QWHarS9IB2Glin8YVZRY9zwZrjlU FAow== 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=CvbjOndp8aI/Ez6XwF4rShTXeRhZbI/GoEOOUYLU6ao=; fh=NidycG2IFYun+KyQEsQuKH+t8S2GIrMh9KoY5qJjESs=; b=x9XfF9q6Fs/NgpPOWTbDNphWXoM2MbH5vOY0PCN6jJqcSkyHB5Ptvo9eX9BqIHAhDh GtQgi2OF1jH9kC1AmdfL3j2/8JQOXG6KTVGtlol/l1/ehou4RvR4DTYYV/FB0EyDrbKA 2dPNsHXvgGpzGmLMD6yYopoa+vXsVIBeKeJmW5NKRWttWJQNE/+9DT/f/mDNyQYVX9hf RMWePVTfXHjJKaz3Z6AUFIRQvpKweLLTxueXNJA2qFt1mEc/mTEOuk+kvUQjTnVH4BW1 epPdvsHRKtIMm4oK2Pl54n89V5BJRlOUsS4PAff0EkkUDVbVEcG4XP8lB3VdeOcWLXmI XAMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OMsYJ0dj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id l20-20020a17090aec1400b00277816efefasi3404751pjy.106.2023.09.30.05.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 05:05:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OMsYJ0dj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 2E0868286E88; Fri, 29 Sep 2023 22:03:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbjI3FDI (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234080AbjI3FCR (ORCPT ); Sat, 30 Sep 2023 01:02:17 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 761D010CF; Fri, 29 Sep 2023 22:01:49 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-578d0d94986so10819003a12.2; Fri, 29 Sep 2023 22:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050109; x=1696654909; 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=CvbjOndp8aI/Ez6XwF4rShTXeRhZbI/GoEOOUYLU6ao=; b=OMsYJ0djmL8A6YolidXzOPOh9rwmQaIemhL3oQ0JqpLorfCmOQnJ23DLZau4eyNwwM Ltfs4KuAOsuoZ7s38WmCX4OEgC2Cy11Wl+ko72JFODN6sWSnVEe6FHN+ZWqqVOyKpSkw bH/1h1wOg2mjykd4O8gkYPdPf6+yRZQ+vWnY6rBrC/s3l3YOaIxAie6WqpVm4COa9rCr h5fNAeXGaW9bSpmBJPpRW9NrdeGOJR47X6U7RxbYEEWUmovI6UfmEAgcBqiX7TJwkJq/ FZiVwJAgGO8rNAxuR4xk4FQAh7uaxlrd9tWLKqB6/Q4+s4phrWJEq77JUoowa5XT98mQ Oegw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050109; x=1696654909; 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=CvbjOndp8aI/Ez6XwF4rShTXeRhZbI/GoEOOUYLU6ao=; b=kJ5K+xlSySNKh1iy+pzccpNrtPoTzRxHM8EzYFyJYubQ848Sn5567Dnzt77/kqNnuR buTWftclkl8hv9uW0/DXGm5o2cXZoUaAqrmznkaPGZIg4ifmpRaFTUWfrJAJxEvkTyjW sJaIY0LTUJFO/zAt4eDGK0/qJ3npD2+BItfk0b0vQIjPi6qsb8D6Et7UAoi4KY3WwzG0 T4hcXqNTZnjEyRAiO0mYFYUK/isFtTkifJyw+qEWbXSu4qQ/y0FbRv1hMcnAGahuzFgj 0EA/iow6rgLlq1fmogEdQfmfOK10JeSp+m2ryjicd/rxd7efoOVv8x9ZzUBZSg8sFdid tOiw== X-Gm-Message-State: AOJu0YzvrlMjx3HQTaJ9/DNw0K3/OmVXwkHNc6m3AVV8k9O6XJa/51YB CobTb8nJYyLnbUJnXCvZQc4= X-Received: by 2002:a05:6a21:4985:b0:160:7679:90 with SMTP id ax5-20020a056a21498500b0016076790090mr6093121pzc.56.1696050108746; Fri, 29 Sep 2023 22:01:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:48 -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 , Dave Kleikamp , jfs-discussion@lists.sourceforge.net Subject: [PATCH 16/29] jfs: move jfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:20 -0300 Message-Id: <20230930050033.41174-17-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778464095514010400 X-GMAIL-MSGID: 1778464095514010400 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to jfs_xattr_handlers at runtime. Cc: Dave Kleikamp Cc: jfs-discussion@lists.sourceforge.net Signed-off-by: Wedson Almeida Filho Reviewed-by: Dave Kleikamp --- fs/jfs/jfs_xattr.h | 2 +- fs/jfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_xattr.h b/fs/jfs/jfs_xattr.h index 0d33816d251d..ec67d8554d2c 100644 --- a/fs/jfs/jfs_xattr.h +++ b/fs/jfs/jfs_xattr.h @@ -46,7 +46,7 @@ extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *, extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t); extern ssize_t jfs_listxattr(struct dentry *, char *, size_t); -extern const struct xattr_handler *jfs_xattr_handlers[]; +extern const struct xattr_handler * const jfs_xattr_handlers[]; #ifdef CONFIG_JFS_SECURITY extern int jfs_init_security(tid_t, struct inode *, struct inode *, diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 931e50018f88..001c900a2b4d 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c @@ -985,7 +985,7 @@ static const struct xattr_handler jfs_trusted_xattr_handler = { .set = jfs_xattr_set, }; -const struct xattr_handler *jfs_xattr_handlers[] = { +const struct xattr_handler * const jfs_xattr_handlers[] = { &jfs_os2_xattr_handler, &jfs_user_xattr_handler, &jfs_security_xattr_handler, From patchwork Sat Sep 30 05:00:21 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: 146877 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp203269vqb; Fri, 29 Sep 2023 22:12:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiENcIJea5y/5rlTTCie5dUhO6ImN/xtpigM4a5Ap+SdOM3Vg4mYSRJ1EVhaUam5rddlRP X-Received: by 2002:a17:90a:9c08:b0:277:1bd8:abee with SMTP id h8-20020a17090a9c0800b002771bd8abeemr5698462pjp.14.1696050759710; Fri, 29 Sep 2023 22:12:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696050759; cv=none; d=google.com; s=arc-20160816; b=a8ZM+y/u70iYe+nDe4h/kwIbN+3QA7u9MJLJt+7MkyWx/y2tH3an73ZoSTxX6PjUR7 SozIhN/OFOfV27waeDymOW/OgFI4ExObY7241jmsgGSDuRNiWpZL1Tv0kJvsf9UbHOim 6LcxUwy23eABpY3upwWb56THf8eNVI2NWhhWYRy5Wt2WBWIXNDNFg4HotVOJxw9IkBFh 1vyUYwTAT0JSFJKgjd60+2MXlf0E0cACjUtkGCMKCwVtMjWEoeiweljnYfVH3HFiNtYz EiIo1G9UOYD9xjo3TPTvS7uBZxVWB6kr/CMEUsRm0O+vDko9cEX3HKGJA4zL077oZdTO zaUA== 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=UoSS5+yx7J+uWrFeSUXvh9abBFJWkLUVnx99Iw9FVh0=; fh=8vnf/z2axMBo46Vq8QwddNXYYr/UHbW67aAdq26O4ZQ=; b=T16zqiBFsIdL84Jm/a6MHtm+ed2DSIATi6dwAN2H/2dIiM+k37f0REH0HNFnG0Tp4+ OlK6GgFN7ALP5IJkZPnW8XureaPpEbnhfzeN+U4PMoBR5yO51VWpVSO+3SAwv54eHZpw 7bvqNt2Oa/XN0zIhqz/Wel069oAjl5t6F/iNeGJmhML3Qi7KECAeWik8E0Sf7vlMC1uI taZPuCPMlMd6y4rZ2RTAl78YFtkukoviUSmcioAZCJbKkqdLYFYDLB6D5PWDOcJKF17Q QiGJDj9/7MqdpCg4pvOSekdERK7TOroffEmQfOubrFESsyt7oruShNQpAi9EwKTpi0Gv +j9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ggyKUR3E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i8-20020a17090ad34800b00274c5572179si2900977pjx.2.2023.09.29.22.12.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:12:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ggyKUR3E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 554DC83B85D8; Fri, 29 Sep 2023 22:04:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234122AbjI3FDR (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233994AbjI3FCX (ORCPT ); Sat, 30 Sep 2023 01:02:23 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E041510E7; Fri, 29 Sep 2023 22:01:55 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-27747002244so9144653a91.2; Fri, 29 Sep 2023 22:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050115; x=1696654915; 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=UoSS5+yx7J+uWrFeSUXvh9abBFJWkLUVnx99Iw9FVh0=; b=ggyKUR3EXYYVlvz449UDK7Upsyy3t7my4SD+b9E9EwQZlGJUhMFRAOQ+ZDXTnKxtrT eTnjnurFZs/xvpIjV8f+nzxDbtEP0+1YauwDTsNoX7FmZsd7iv8T5Mz967gv7tsOKeKk 6FexgoxoychUKTiNiQCrY+Zu0Caz7ViMd/4Zuvdh95w46TbGqOiGNScbIcMOdA0h4Gix kKZMupl5P9w8wFfLfhF6VH1l8qdLiosv7S4NY6SoktFI03jztA5TeLGtSXeI2XlWQFyj N+RF10C/whD0vqAzUWjaSDQxeB299dbmqjk2dHV9iWnBH50jzff+GNiGejd2pkgm8Dx2 fNkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050115; x=1696654915; 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=UoSS5+yx7J+uWrFeSUXvh9abBFJWkLUVnx99Iw9FVh0=; b=H8X/69eExXoFkRAC8Bmz3Gx+ENI3lDY0zVPlpAf2GUQcswgijGmlHTpQpjhFhqVRsU x2fW9ecHEb/wKYmCg3FxtL2SDQWVdDxd3qFj3/bgdL2LXjBSOGXf3xYsqp/asKTtbKj6 upS+bzhLQSAb2jIwytk3R9jv7eNCGJqajHYDjx205wWKUI+THJFSdyx39rV4MqDGYmh9 iUncDtaY4qGTPMq90V7WWM3bInpoo1e3a1+MUe0DajBlcH37S4Tw6Rx3eu0SbWLBgsiJ 8JeMlhnse8Kz7z8ws7khtW1CCtCF68EnMJwEML8SBBye4oBJk3WkOilQlImwjJkihevl NPxg== X-Gm-Message-State: AOJu0YwDKB5Dj6NHkI45+2AzTkMh+Ap2oALBc22/OEjtpJwxNsUmn5BL UIlqOz5Wr9gpClGfl1bP6G9Gzsyf7z52lQ== X-Received: by 2002:a17:90a:e60a:b0:277:371e:fa9b with SMTP id j10-20020a17090ae60a00b00277371efa9bmr5370212pjy.24.1696050115411; Fri, 29 Sep 2023 22:01:55 -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.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:55 -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 , Greg Kroah-Hartman , Tejun Heo Subject: [PATCH 17/29] kernfs: move kernfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:21 -0300 Message-Id: <20230930050033.41174-18-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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:04:54 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778438121644299442 X-GMAIL-MSGID: 1778438121644299442 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to kernfs_xattr_handlers at runtime. Cc: Greg Kroah-Hartman Cc: Tejun Heo Signed-off-by: Wedson Almeida Filho Acked-by: Greg Kroah-Hartman --- fs/kernfs/inode.c | 2 +- fs/kernfs/kernfs-internal.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index b22b74d1a115..45a63c4e5e4e 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -434,7 +434,7 @@ static const struct xattr_handler kernfs_user_xattr_handler = { .set = kernfs_vfs_user_xattr_set, }; -const struct xattr_handler *kernfs_xattr_handlers[] = { +const struct xattr_handler * const kernfs_xattr_handlers[] = { &kernfs_trusted_xattr_handler, &kernfs_security_xattr_handler, &kernfs_user_xattr_handler, diff --git a/fs/kernfs/kernfs-internal.h b/fs/kernfs/kernfs-internal.h index a9b854cdfdb5..237f2764b941 100644 --- a/fs/kernfs/kernfs-internal.h +++ b/fs/kernfs/kernfs-internal.h @@ -127,7 +127,7 @@ extern struct kmem_cache *kernfs_node_cache, *kernfs_iattrs_cache; /* * inode.c */ -extern const struct xattr_handler *kernfs_xattr_handlers[]; +extern const struct xattr_handler * const kernfs_xattr_handlers[]; void kernfs_evict_inode(struct inode *inode); int kernfs_iop_permission(struct mnt_idmap *idmap, struct inode *inode, int mask); From patchwork Sat Sep 30 05:00:22 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: 146889 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp247650vqb; Sat, 30 Sep 2023 00:30:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEaWiLe5k3uibEz+ZT0ZRFcxTV4rSmbF5MExFzn1R2gKCYkL3xTZpLw28HiI/bFUtEM54DR X-Received: by 2002:a05:6a20:748b:b0:15e:6b3:8e10 with SMTP id p11-20020a056a20748b00b0015e06b38e10mr6868375pzd.55.1696059057932; Sat, 30 Sep 2023 00:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696059057; cv=none; d=google.com; s=arc-20160816; b=Lwn5DfXD9ruigzWYZ58uyXMGBc1r6+wnljJwSas78jDAvTmOadbh4wVwHY1T/rPopo 93ZKjuvUplZKk3gHa5iuoonyuG7u7cye2Sc4kkZUNfMQyallqCoIDbyTNlOgGyEVLgEw 3+XTaSXt88mr8jrBitsTQCEreZkcD6eTepjp2fhVlpaf5AmK6SEG93GoVOIuxgYU9oPD yl8wIaGdi4F13PZUteTKSGTrL4UO/wP/9ScRe6kt1jCWIDGdC59MIvYPWj0JgDzl1Cxk lvqwaLLR8fRogkGfpe7bt5CSPoR4dIq3NXtGKOU61fwUuL/YmY1X70s/43SIPnrg1xMs 6SJQ== 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=hkmcdMm12QbRMkcwPXJsldRA3LZpvW1XQ5QQ1oyLq3Q=; fh=jfjErUXcRwuxu7jiWefIObqSKW+j/fj7lbRaXQdsHPU=; b=DRlbvfh/BIMr1pn49AuQA0As82OYuz0SVKSh++Go+HVYkJo1lfApOPtE6rCdZnkr5B V0UCvIMp+l/aYY9ZpleBdYp3oFlcYx5443AkSvvqFmBzvb2Aj59qjUoKN2DkyzgNS4oT kJZcJG6kWAhLMTjUW6SegKOrIk3IpAYjszOkMJOSp2cCZoTFMBVzQADulAlHzo2oHPnX +wO8nAkFOeFzx+XlfXVR3UW/4tZchkuviD8d9It4JXeQBWhyDjZe/zZUAu+B/ddEdhEU +C10KGlxNLmQbkmnLfb0H7lFaK74bVCHGhrlYt2RZkCVrXhUuzIc9dsyLz5ZmpiWp9ai +qWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RxY+KqYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id rj2-20020a17090b3e8200b0026b71fdd505si3269043pjb.177.2023.09.30.00.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 00:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RxY+KqYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id B9A13831ED89; Fri, 29 Sep 2023 22:03:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234096AbjI3FDU (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234184AbjI3FCo (ORCPT ); Sat, 30 Sep 2023 01:02:44 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C9CE10FD; Fri, 29 Sep 2023 22:01:59 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-690bd8f89baso12039926b3a.2; Fri, 29 Sep 2023 22:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050118; x=1696654918; 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=hkmcdMm12QbRMkcwPXJsldRA3LZpvW1XQ5QQ1oyLq3Q=; b=RxY+KqYdSUGCZ63RUITbenHyMOEDNmO3pSOrLr1XxtI7FrWkxzte5exlMEtYRal3Ys 5BS4lf7O/WyeUdEk8CmX3TwS5eduZswvnOCcw9zlhjOWABca+VX/GEK3p62qZuIM46al wqG2PFikr1A/0Fp3kC11uqG1Unza/Bu3jDbmt90cRaJF/0oZEbp46yGzRJgd8DgZ7yHV q5VCItp+QRVRfEnxI5gQJnn7IprZWNU1iDy+v5m+zzuTjc87R6KUxOtnR1/JG5kXVhUw iKVRCmv4H2RVetzmOy0DAmOLZwaV381IaKfuSPH1AUB4Xz1UCU4m2Zvj4xZaqulLyUn6 r2Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050118; x=1696654918; 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=hkmcdMm12QbRMkcwPXJsldRA3LZpvW1XQ5QQ1oyLq3Q=; b=r/WowLRJx3/2qFwFWhHQ5V04KAzIuiuj/M3zywVNtil/OlDUS7jaKPvJ2wjAMsWcW4 W/ciccC++0+eHBV7pFZpHk33WPf9/euxX29lQL5J9U0UYPfrCs7PJURLtSH1cDUHvOnB WDj/brPdvkzPoXPEkia/Mk77B38ohjwIw/h3Ogq/XTw7I5YWBM1OQJy2/Zs9pvaLp9I9 ZyHiGgpVFuiuMHvyvK/USRb3togU1dlPRVJe6AIroaLZyEMsCsuH8SEDfc537FQ4DVhZ 4Aj8LToqNGGY2zRSyvIacLRsfOTS6P+S9qCeXt480cKGPghKOvnSzMl5CamqambMVZK2 XUYQ== X-Gm-Message-State: AOJu0Yzxg5ZebeBDSLHKhLOV8hhpLUeJGrHBTHBZlbZ0Ak1bl7tsnfpE pWik/x3whY/mpsEM3F9obgQ= X-Received: by 2002:a05:6a20:734a:b0:14d:4ab5:5e34 with SMTP id v10-20020a056a20734a00b0014d4ab55e34mr6205874pzc.51.1696050118456; Fri, 29 Sep 2023 22:01:58 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:01:58 -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 , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [PATCH 18/29] nfs: move nfs4_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:22 -0300 Message-Id: <20230930050033.41174-19-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778446822884872361 X-GMAIL-MSGID: 1778446822884872361 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to nfs4_xattr_handlers at runtime. Cc: Trond Myklebust Cc: Anna Schumaker Cc: linux-nfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/nfs/nfs.h | 2 +- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h index 5ba00610aede..0d3ce0460e35 100644 --- a/fs/nfs/nfs.h +++ b/fs/nfs/nfs.h @@ -18,7 +18,7 @@ struct nfs_subversion { const struct rpc_version *rpc_vers; /* NFS version information */ const struct nfs_rpc_ops *rpc_ops; /* NFS operations */ const struct super_operations *sops; /* NFS Super operations */ - const struct xattr_handler **xattr; /* NFS xattr handlers */ + const struct xattr_handler * const *xattr; /* NFS xattr handlers */ struct list_head list; /* List of NFS versions */ }; diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 4c9f8bd866ab..28499a0da4c3 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -315,7 +315,7 @@ extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct nfs_fh *, struct nfs_fattr *); extern int nfs4_proc_secinfo(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *); -extern const struct xattr_handler *nfs4_xattr_handlers[]; +extern const struct xattr_handler * const nfs4_xattr_handlers[]; extern int nfs4_set_rw_stateid(nfs4_stateid *stateid, const struct nfs_open_context *ctx, const struct nfs_lock_context *l_ctx, diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 832fa226b8f2..4557a14a596c 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -10740,7 +10740,7 @@ static const struct xattr_handler nfs4_xattr_nfs4_user_handler = { }; #endif -const struct xattr_handler *nfs4_xattr_handlers[] = { +const struct xattr_handler * const nfs4_xattr_handlers[] = { &nfs4_xattr_nfs4_acl_handler, #if defined(CONFIG_NFS_V4_1) &nfs4_xattr_nfs4_dacl_handler, From patchwork Sat Sep 30 05:00:23 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: 146904 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp298608vqb; Sat, 30 Sep 2023 03:07:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEN063TXM0rI2iT6FchYoRFrMvte5gzYUo10N0i4TJTgzwFqVKNyAoepwJ+qbLJfWM2Q1tv X-Received: by 2002:a05:6870:8287:b0:1dc:a055:8587 with SMTP id q7-20020a056870828700b001dca0558587mr7720529oae.6.1696068475903; Sat, 30 Sep 2023 03:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696068475; cv=none; d=google.com; s=arc-20160816; b=rLTpjkE2Gf7Ku3iAaIORefih88kxFz4wYxZIgnKyPmyyfxKCwmBn0HunHakekMD+gE 6aQJHZvbTiFI9NCBcA/PiQNtoS2ouAj06IFAn4vkoEKL/EENDP5Ftw9fBavEnPW234r0 ZvPP6wWnL8QbRdEAAg0kM+vipFYSV38n3fwp+L0bYk30xFBr1EKUq1UcrcI7ccp6XplE grb0bQUlJ4zZfIDwQryXT5HXkWbkkSTU9HzzkJ8nj+6x6p+pD42Wtvhzxh73Lx4Np0cM cG9Cye5Uxr91MsSb6G+XjnKFAIrsroMn3vn6O+PeP2xt6pfFVfjUbKEwPNv9h6l/bcP6 XP2A== 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=Wc3/lDJ0Y70q5wqO7T6IeDRSePuhtOmjFGCpqJDnCH4=; fh=hz331NCuG3bOmGEABlBXKdWALneJ3B2uH53pUjAYPPY=; b=l0D8aX48YowohlE4sMu+Z4nsG267sGqgHlT/Q7jj+1oquDW/vlACww/QnzAkNvTVgh YFpvDNPQMiSpvRQY9jWa0az6qh4nu5l3ZNJgOvN+TpelRkLbXetIL3WoWUpbgzxhyUYK ZyyJVIEz891l+HfO8+smrrZ6ZNzg9jTP1/moXf4dEehThvf4qtJ46sU/kocnqBd/qnHR UtTmsrbnOmbVCtCraHHsZS7QfJMbx7Ve0bVoNYkQE9Ke+6RYYBQ50BhTUuOjMOSeIPTp jquCwBiK+uNDTVAeY015E1yHd4DdaWhflE/3iX0Y69P6hbzKiGQzIhZDeS2Kl1SppuPE 7TmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kmjejcs6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id h11-20020a65480b000000b00584a5cd69basi1423660pgs.177.2023.09.30.03.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 03:07:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Kmjejcs6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id A5CAF8600C75; Fri, 29 Sep 2023 22:03:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234192AbjI3FDc (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234172AbjI3FC5 (ORCPT ); Sat, 30 Sep 2023 01:02:57 -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 1014F1716; Fri, 29 Sep 2023 22:02:01 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-578b4981526so9577018a12.0; Fri, 29 Sep 2023 22:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050121; x=1696654921; 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=Wc3/lDJ0Y70q5wqO7T6IeDRSePuhtOmjFGCpqJDnCH4=; b=Kmjejcs6cA9AmCbLWbwjDyo5/oq/p4ugr8dzIFKsz7B3OqCJCDkkuqvAGr5nKDo9se yXxv2j5A5Lf9K0MRJanMitul1TQSlh4rmJ/y1FQlWORMFU1iICjYW/aTsW1ey+mYNHIG 4ceorT8CgJVOQSzlJrvyuWGYCN5keizFS+o/RghJLHuTtIAMWBAJzNvEh/L85kH+aXZM Eyq1Q4+4i1fklgTkRVxGGcO6MakyUlzPHlESo5RnMHiooaLYH4z/fcdHCfzo2wQdzrK8 jcH6Q6vDN3jz89vHhALqKW2tozaUdP4jWDPRKdYyhOe/qwEvg8hzEG7RkISbwCAjq514 t5OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050121; x=1696654921; 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=Wc3/lDJ0Y70q5wqO7T6IeDRSePuhtOmjFGCpqJDnCH4=; b=iRaY03i69y0xYuDvru75+uGODn+wVhQeBmxxxXc5YAfYINqywnHlBTH+G8DhGi1+2P ioWyLte3vW+AQEHhbfl0ztBozxrk/CuEKJj7g1T2uJKJqhA9QF+PY3/VJb1xPe5xAtGJ 8kDbKZfHVMEtHpv+g/AA4tTt2CHPwtENLuwRJhhKPKL7m3erlouPFwkiR4Gob2ItAadn em1P7v+wLgWHdlNnyHpzIYaz3brVPx+WnsuV7nGf3RMP7mSH5N0Sumn+sJHaAVm3KGjW i6cNEzBAR7FwthfyVxH5aFZtcngMrGV2An0HrjUrydYtM/jd5tRWUl2GRndH/NeKKpFE ulfw== X-Gm-Message-State: AOJu0YwhKxySJNNrGz0y11QzVWLoO3tNeUh5c1YT3EOmDGWxVCDhpG9k fa04bmVo5FtHuR3zrHmp8Lc= X-Received: by 2002:a05:6a20:1451:b0:15d:e68d:a855 with SMTP id a17-20020a056a20145100b0015de68da855mr6635638pzi.29.1696050121350; Fri, 29 Sep 2023 22:02:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:01 -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 , Konstantin Komarov , ntfs3@lists.linux.dev Subject: [PATCH 19/29] ntfs3: move ntfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:23 -0300 Message-Id: <20230930050033.41174-20-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:03:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778456698068611917 X-GMAIL-MSGID: 1778456698068611917 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ntfs_xattr_handlers at runtime. Cc: Konstantin Komarov Cc: ntfs3@lists.linux.dev Signed-off-by: Wedson Almeida Filho --- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 629403ede6e5..41c1538f8e51 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -872,7 +872,7 @@ int ntfs_init_acl(struct mnt_idmap *idmap, struct inode *inode, int ntfs_acl_chmod(struct mnt_idmap *idmap, struct dentry *dentry); ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size); -extern const struct xattr_handler *ntfs_xattr_handlers[]; +extern const struct xattr_handler * const ntfs_xattr_handlers[]; int ntfs_save_wsl_perm(struct inode *inode, __le16 *ea_size); void ntfs_get_wsl_perm(struct inode *inode); diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 023f314e8950..a67ff036a251 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -1016,7 +1016,7 @@ static const struct xattr_handler ntfs_other_xattr_handler = { .list = ntfs_xattr_user_list, }; -const struct xattr_handler *ntfs_xattr_handlers[] = { +const struct xattr_handler * const ntfs_xattr_handlers[] = { &ntfs_other_xattr_handler, NULL, }; From patchwork Sat Sep 30 05:00:24 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: 146887 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp240400vqb; Sat, 30 Sep 2023 00:10:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXzDzwAFMF7jH77r8kSKBsmn895cH/KCuVJI3NcNF1sEAAocWIKKPCsVyFgw+8UyLOnMoE X-Received: by 2002:a05:6a20:5495:b0:153:a00b:dca0 with SMTP id i21-20020a056a20549500b00153a00bdca0mr6896773pzk.11.1696057806559; Sat, 30 Sep 2023 00:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696057806; cv=none; d=google.com; s=arc-20160816; b=efXaFrDI8oMEUbZdiC2F1abGXOTR3E8Dx6NlWD4fGJPoRexplXcQ1LD94x52AUNbJb QBcIFb9F1YGyHIAMhdlA/uFPm8462kpQtTXTuCMMg/3jXCLzyZbkecMMI9uhoj3HvWHv Pit3KMQ3q8sUhPnsArHcVCbN4UGc254RcCbJURcdralp84b145Atvz8KgDK6dERTzpN9 BRNVkmisWaAEIlnE2eTCC6oAC2bPtx7AKq6AR5XOe9ZewH/z4Fcj5Wd0Se7RctTUJW+1 22pSy1oflUvBPnMzolmecEGiqwbCnULywAgLMqnxoCuUDvdOuczf8o6LOw3ZveW1Wuqm FOUw== 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=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; fh=pZg0L/n76CzeI+Iax/GwQBT1mLSudd1jhViRHLd4PC0=; b=tQw1AQ8msPGbHNJQE2wGSzH/iz82JL0A7jqK8IDy69FSu9ZK868OP6ybkyvjBUr2pW K/lerMlTy/21G+b3pymbJ+Od3gaPJ+yKMP1ayH3UZRJ/Td0PbfisiLZZ85WIvVLGX3e0 vQSSgDT+j/x0GdLBACh4GKPjMS9290yJOoX19vohhYSNxvgE2xhG7hDWHbVGHbQVLjMe Di+l/0Rv2qmlOk9pj4OkEY45BbRmTjXDULlUOhkJ5ZH4YM4oS6Ez2YHFYrqvUEx4PfVz lKkghF/r9rkDydKXJGmjta59R8UzDsY8vJZ8HUafm9Bpx6r1gxRkGDYhfDbZLTokr6jn g2Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=m9y5oWQz; 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 s18-20020a17090aad9200b0026f75d932a8si2966649pjq.185.2023.09.30.00.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 00:10:06 -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=m9y5oWQz; 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 9DADC8326382; Fri, 29 Sep 2023 22:04:18 -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 S234243AbjI3FDl (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234074AbjI3FDB (ORCPT ); Sat, 30 Sep 2023 01:03:01 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E860F19A7; Fri, 29 Sep 2023 22:02:06 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c735473d1aso24030585ad.1; Fri, 29 Sep 2023 22:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050126; x=1696654926; 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=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; b=m9y5oWQza7nh/yZ20urfhCbcy1kUZ2krNB39UVylJBvU8G/oKiNgOmyUL5Ziokcr/J c/hKbNws8ir2Ar61HSJwid9KLdc0oM4Xoy0fYi7WWC4oFGZOsKKFv4CqdgoGzju+cb4P lgpmLKMFSoJ03dQm/fBz1DMi/4b5URf+aQQSxCoJ41gnnNXKVEp3ktLjI6Qxk6qMH5ZE orcMqhH/wqWedFDlJnOOTcXl9rF3HQvQGuE17hlv+2WVKbiGEBMctHZ/qHZMD2X1OgnM a5RbzawyR3JVyFLJaZxlNftYzSdZeAohsJn7kUYYd2pe7kwYrFHLGuK6aV1wvcnq6YAh hjzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050126; x=1696654926; 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=ERTq1h2JUPIQir/rEk+r3r2PZJ52vm7XhnYInCUG6b0=; b=K9PpvlduTpOqJ9OGt0CXWg6E0DKKZ4gEFfMt95DgqnhlTkxrw8k82ghYvnTNJwTEJ2 TPu6YDRfVmGvOzkRujSD1y5NU+U1iptuRi0wN2RrCmhEdXEOlLQxt+eBjfu8eZBpQv69 PVoNrVWRhD6ceimLf/mI4nXa17U7oKPp3NEl+ufpFGHFgp1qqWJO2LDla6QKKGLl9ws1 iTsXB9Yks/FoKLFSDuaM7dVKPzBtz8eQz1j0daOepNnT0bp5KOESjV//P2AzsNHIW0Jw YMhPXrh7hY+V0pYWxlQ9DTb4BY1JxS/qqto9grrKDbjBauSfkUknM13CPg6NzgLItnPQ SQyw== X-Gm-Message-State: AOJu0YxzpPOxm/p0D8O3BgCo9kGBNDn9tX7B8EoMJxUroY/8TpbmEe0Q +JPR/4KBLPkMKpCD+R4Oq18= X-Received: by 2002:a17:902:f7c6:b0:1c3:a4f2:7c92 with SMTP id h6-20020a170902f7c600b001c3a4f27c92mr4959184plw.65.1696050125757; Fri, 29 Sep 2023 22:02:05 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:05 -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 , Mark Fasheh , Joel Becker , Joseph Qi , ocfs2-devel@lists.linux.dev Subject: [PATCH 20/29] ocfs2: move ocfs2_xattr_handlers and ocfs2_xattr_handler_map to .rodata Date: Sat, 30 Sep 2023 02:00:24 -0300 Message-Id: <20230930050033.41174-21-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:04:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778445510716515223 X-GMAIL-MSGID: 1778445510716515223 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ocfs2_xattr_handlers or ocfs2_xattr_handler_map at runtime. Cc: Mark Fasheh Cc: Joel Becker Cc: Joseph Qi Cc: ocfs2-devel@lists.linux.dev Signed-off-by: Wedson Almeida Filho --- fs/ocfs2/xattr.c | 4 ++-- fs/ocfs2/xattr.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 4ac77ff6e676..1c54adac1e50 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c @@ -87,14 +87,14 @@ static struct ocfs2_xattr_def_value_root def_xv = { .xv.xr_list.l_count = cpu_to_le16(1), }; -const struct xattr_handler *ocfs2_xattr_handlers[] = { +const struct xattr_handler * const ocfs2_xattr_handlers[] = { &ocfs2_xattr_user_handler, &ocfs2_xattr_trusted_handler, &ocfs2_xattr_security_handler, NULL }; -static const struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { +static const struct xattr_handler * const ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] = &nop_posix_acl_access, [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] = &nop_posix_acl_default, diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h index 00308b57f64f..65e9aa743919 100644 --- a/fs/ocfs2/xattr.h +++ b/fs/ocfs2/xattr.h @@ -30,7 +30,7 @@ struct ocfs2_security_xattr_info { extern const struct xattr_handler ocfs2_xattr_user_handler; extern const struct xattr_handler ocfs2_xattr_trusted_handler; extern const struct xattr_handler ocfs2_xattr_security_handler; -extern const struct xattr_handler *ocfs2_xattr_handlers[]; +extern const struct xattr_handler * const ocfs2_xattr_handlers[]; ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int, From patchwork Sat Sep 30 05:00:25 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: 146926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp365744vqb; Sat, 30 Sep 2023 05:50:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9i4EWGVKyRLTP78LypM76Uj90LkqmHLYQZ1jK57iQNr5izF4eagPGDwUW/rrnAbYLND1O X-Received: by 2002:a17:90b:4c10:b0:269:851:4f00 with SMTP id na16-20020a17090b4c1000b0026908514f00mr5297749pjb.35.1696078236948; Sat, 30 Sep 2023 05:50:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696078236; cv=none; d=google.com; s=arc-20160816; b=Fqj4pjp071FjZ8D5Zj2wNWwgBqpOqVgA8/X0Jvx5RXnzb8CtTKdGCNPSgHjvs7K+h8 p7GC27VosJTC62cjQyMvsqbJjCpPLl1ubTNBcHBHdr/vL0Va2tNzKAXyPe/iSX94nurr 7kzXiI3OOd5RFattZSGoUdgNDz7LAeLZJR3eso24K53T173GfkZWL29tI3NQfoVZER1d SELyC18cS0VBUvwYRHsmynquTCG5/tX88acRTzMzpRdTlWj7+/x22yVV6cYqc7a8ML6D kZl4HBTo1TserHpVrJY2aF2d1BtU1Y9gLSUzNOZ1iVkQLIfdDLtWz1If18NWydEaDY3/ n1wg== 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=/UA+v7vVQRQxu5MLsOJ6RxWE6x/okoJ8LNf7oCvDbOY=; fh=o9ao+tpQoR2EJBfAPzmA6MlUItBaxiwiV3YDP3FS9jw=; b=oI7ZCRoc+tGMUOBXtHpzLP6gO4U/Yge1nY24S8pfK4rxbf5P7BaNSvUxPHSljtANj1 ukvzeduOBoHSc9nosaocC0CrcFkVL4/8pc+IoGQ/0yp1k1fCNFjE1E5vNqsJTTRyhbpc N4ZO4xN/IlOHTIMV6M5877DBlaBy19PC7XAJJQ9s2NgFHU9xIDcpEkCyLDxFRwdgSh4F /eFhgMijz/G6YHSs7lAI7/AhGHbYsblHaPlu4G94HFhDgImxeBoypk1bbp3mRUO5uZs0 17WbfSGer7DV8dZKbmaF5Pa2ITiYXxrPp5AHOSU780mFZuNKy9cJ5FMIQDJvJu1jFPD7 Crig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="J/Ur7VXN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id 142-20020a630294000000b00578b6e32b5dsi22988953pgc.405.2023.09.30.05.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 05:50:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="J/Ur7VXN"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 20EE882ABAA5; Fri, 29 Sep 2023 22:05:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231823AbjI3FDr (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234211AbjI3FDD (ORCPT ); Sat, 30 Sep 2023 01:03:03 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EE3F19B2; Fri, 29 Sep 2023 22:02:09 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c5ff5f858dso87314455ad.2; Fri, 29 Sep 2023 22:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050129; x=1696654929; 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=/UA+v7vVQRQxu5MLsOJ6RxWE6x/okoJ8LNf7oCvDbOY=; b=J/Ur7VXNDXSb5TMhCWT6V5Q7cX1BUXmsXlPMi4l/n3vGOR6xfm6p6t6fIGmsusncCP DRyCFL2fS4TvZecx3fDy4AjO4xuRArhrPpR7bmuELUAKaZa/nX/J6F+s/CoEjnGkf6mX Rwxb4i12JRG0Tn+/nP1ln+rxvGJU0KBeiZu7VDfxs+3WKRTmg+3/Q7GCOTvPSCLiJt0p u1K7p07n2GH6gTjzrXIVv/bXk3lli7dMDQHrxQ8giHTIq1oh+4cM45OKdaExrQgjD0wy r9LklzBAX6ivTX0xbAiHBrnotuk5Nstx7c3+Wzu5RuMoBHucpJzplVTyRuGQ+TelXKiZ yKtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050129; x=1696654929; 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=/UA+v7vVQRQxu5MLsOJ6RxWE6x/okoJ8LNf7oCvDbOY=; b=uQYArvhS1MrOy6f0eMGnADQ7lEfhXoFr2bKr16E7/oEIDcSRISGBhWDnQznejEzNFx I4bU15W4tra08XKQExNHsiScPiwBg0zXmBu9biB09ycgylal67U2V+u7WpeF4fOoPs87 FYBxqSvD9tqLeK2eZEVdTDHMJIKB5Ec8/F8TQBz4MrvU1sGZcPPN4Qf/Q9IsyfRB2ibI TkP6Q7Bw6Vy++2Nv8WMvH84Bt0lUpar+iyjZvfigChebR2VyUKPJMeu+gD0o8NpJV6bV oU5zIWgLtgvKTOw5AKmoZsf5mzaoqsEt7JLhM3SVoDxtfty0t5y9gAl+MWUAXJX7ON7X gQuQ== X-Gm-Message-State: AOJu0Yyxf2jo1ktKr2dewpgLeZe/ZseYqLBHT+BGqCtS9bI6x76shQGk IrzSQMyaLQ1YQ7bSXY1VVZg= X-Received: by 2002:a17:903:230d:b0:1c0:98fe:3677 with SMTP id d13-20020a170903230d00b001c098fe3677mr6409717plh.56.1696050128820; Fri, 29 Sep 2023 22:02:08 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:08 -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 , Mike Marshall , Martin Brandenburg , devel@lists.orangefs.org Subject: [PATCH 21/29] orangefs: move orangefs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:25 -0300 Message-Id: <20230930050033.41174-22-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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:05:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778466933338839165 X-GMAIL-MSGID: 1778466933338839165 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to orangefs_xattr_handlers at runtime. Cc: Mike Marshall Cc: Martin Brandenburg Cc: devel@lists.orangefs.org Signed-off-by: Wedson Almeida Filho --- fs/orangefs/orangefs-kernel.h | 2 +- fs/orangefs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index ce20d3443869..e211f29544e5 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h @@ -103,7 +103,7 @@ enum orangefs_vfs_op_states { #define ORANGEFS_CACHE_CREATE_FLAGS 0 #endif -extern const struct xattr_handler *orangefs_xattr_handlers[]; +extern const struct xattr_handler * const orangefs_xattr_handlers[]; extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type, bool rcu); extern int orangefs_set_acl(struct mnt_idmap *idmap, diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 68b62689a63e..74ef75586f38 100644 --- a/fs/orangefs/xattr.c +++ b/fs/orangefs/xattr.c @@ -554,7 +554,7 @@ static const struct xattr_handler orangefs_xattr_default_handler = { .set = orangefs_xattr_set_default, }; -const struct xattr_handler *orangefs_xattr_handlers[] = { +const struct xattr_handler * const orangefs_xattr_handlers[] = { &orangefs_xattr_default_handler, NULL }; From patchwork Sat Sep 30 05:00:26 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: 146938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp414710vqb; Sat, 30 Sep 2023 07:25:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoNzc6Ao4358+wEyL6a4t1FM77Wf2mc5WgwV2UP5D8FPu1qpzr2hsx37y4xr3F/RYQytHQ X-Received: by 2002:a17:902:9a44:b0:1c5:d1a2:c3e8 with SMTP id x4-20020a1709029a4400b001c5d1a2c3e8mr5886890plv.5.1696083938183; Sat, 30 Sep 2023 07:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696083938; cv=none; d=google.com; s=arc-20160816; b=CqmWTc4NtPy+9RE1ihwGGuH+hwPMdGU/wwtl7j/ofkFimhEz1kspZrg0kJnlEKs9R1 odhLwBtABNhm/NK3ftFmfmJFDE1x/IvGHay1+LO2WRWQ7pPeqk5J90yxjLuuzJxLM7rs caLRUFI23G0N32wglv2YF14CyAB3XAp/54TO19eHdXGB52CIWCiTTs1qdaNZQTfMHPQs XJH/c6qo0CX9oRdR/4dX1ZcA0DjqQRNXRKlWGHVDx/fjZ+hW1B9obTnVGqb05MaUJsS4 rldi6wLwUkP+a3Fo1cVfLHWvLcMf439wevzS0VBUK4KzeLjv2vruFL1Mde1mgHorxNJj VxbQ== 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=IBbz7qEexK/f91LFPBrdRHvTcIeI5CzCcQ9osGtM8EE=; fh=9MNgFDgUxJee83Fod3Yrze2ym3j8GoALP5G+GTl/NA8=; b=QXQovDmrJPH+YLqbo6ULgbS9S2ezmmxI1g4dH/rBdPYlDZSdFSgnqj4bhV0yTJVcvR u5889fkS2wY8nt3IVEqfxDmOPntYtiU9Q59ZxXoetX/FKyRjfPEmFWmsZFvBabktphEu vQRgzWOPjkj6K8cOrNe9Wed7xz8D5d1kCstT6nPildPE1epQX4/fc3UoB/EpbIIAc20H nXkACcWjgQlYVAOKkMGFxtL4KqDwmtV4Nm8AJVCDAeEb2exLK6TLkc+G9nuOufhCvCJa zrwzi3ekX5vx7PxUNLNzpASzibrICHO+mdgRFwr3hwEIebxqgqoE8YQYsijOnejkSDTb BCRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UMq4KiAe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id b16-20020a170903229000b001c5f6203ca8si21163998plh.556.2023.09.30.07.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 07:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UMq4KiAe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 149AA860523C; Fri, 29 Sep 2023 22:04:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234043AbjI3FEE (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234037AbjI3FDT (ORCPT ); Sat, 30 Sep 2023 01:03:19 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43D881BC9; Fri, 29 Sep 2023 22:02:12 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5859d13f73dso1084836a12.1; Fri, 29 Sep 2023 22:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050131; x=1696654931; 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=IBbz7qEexK/f91LFPBrdRHvTcIeI5CzCcQ9osGtM8EE=; b=UMq4KiAenfMRZggFur+7oToekfK53rrUmKeNu0Ghnkzk07XzBH/KYXtiKuBEWPNA+6 SjOMka6aI0mXxa9H/u7ZT5ccO+ijtLM7cXvJftVFXJTChfpsnOjKkdQr2lpI5nTRKa2v klfPbri/lScotVvZvz5jmKHKJ8V3/7yy5NBptU2GCKx1oZ1M5oAIxX7x3Hj79+4VreHP ENUpjQYP234CNQNBrH43OsoHK6EUmL24Ldho4wsqWmvvtbxKRSRVSYWMSQy04xeBbXgZ MAJ+3/Frgtrt6d1QMXJ2CScoH7Ozfpp4guc/5EFEltYMhDcYPfXiefYzHkhJcLJeJQKT FBXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050131; x=1696654931; 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=IBbz7qEexK/f91LFPBrdRHvTcIeI5CzCcQ9osGtM8EE=; b=PFxBH0kWcd/Dy+ROjmJveKCdXfNL2RYPzWC5PssZviFEGyikLK+6vZ/V3KtAvz0g+9 kv0xhZ4+Ar5+bfV2a2SOkfSxa/CQTANDvqc7MmuzcX1zAtEDV+r25DkqC92ct2biMB2u W7VbkhPy7GrIUZ8QhjT9B8bMBjYLWKT8c+SQ1fp7WiPg+uNr2WN092B0Lg6TrMJMNguM udVKx6g6B0mxcNS1ypJ1oES5qYLgYtN4otZgXC5OvW5PB2q8gid7m3yipPALOOCPCjEu q03cuER92ABsyeDYEp5ir/c61OM8Xn3esqTq5sUDuMay68MYsDxdFbcUmri0n8b940IX vIoA== X-Gm-Message-State: AOJu0YzcUxmm02EJjFdws7vgQw2CDX6oZ9W1eC54c6VCWYg6BnJzl17w JbcPRV+3ehjkOPCofUOtDXWoUlkViJT7KA== X-Received: by 2002:a17:903:456:b0:1c3:1c74:5d0a with SMTP id iw22-20020a170903045600b001c31c745d0amr5368774plb.34.1696050131398; Fri, 29 Sep 2023 22:02:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:11 -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 , reiserfs-devel@vger.kernel.org Subject: [PATCH 22/29] reiserfs: move reiserfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:26 -0300 Message-Id: <20230930050033.41174-23-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:04:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778472911226453895 X-GMAIL-MSGID: 1778472911226453895 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to reiserfs_xattr_handlers at runtime. Cc: reiserfs-devel@vger.kernel.org Signed-off-by: Wedson Almeida Filho --- fs/reiserfs/reiserfs.h | 2 +- fs/reiserfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h index 55e85256aae8..c18d0bc01725 100644 --- a/fs/reiserfs/reiserfs.h +++ b/fs/reiserfs/reiserfs.h @@ -1165,7 +1165,7 @@ static inline int bmap_would_wrap(unsigned bmap_nr) return bmap_nr > ((1LL << 16) - 1); } -extern const struct xattr_handler *reiserfs_xattr_handlers[]; +extern const struct xattr_handler * const reiserfs_xattr_handlers[]; /* * this says about version of key of all items (but stat data) the diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 651027967159..5a22a2bdaec7 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c @@ -910,7 +910,7 @@ static int create_privroot(struct dentry *dentry) { return 0; } #endif /* Actual operations that are exported to VFS-land */ -const struct xattr_handler *reiserfs_xattr_handlers[] = { +const struct xattr_handler * const reiserfs_xattr_handlers[] = { #ifdef CONFIG_REISERFS_FS_XATTR &reiserfs_xattr_user_handler, &reiserfs_xattr_trusted_handler, From patchwork Sat Sep 30 05:00:27 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: 146892 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp263793vqb; Sat, 30 Sep 2023 01:19:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3BAZMscd+BSNmmwfbGrqN0u5lXZtp4ws7FjyGG5J554SxseaK+IYDnnQtbu7DsMIwQuk0 X-Received: by 2002:a05:6808:1aa6:b0:3a7:8f94:743a with SMTP id bm38-20020a0568081aa600b003a78f94743amr5644068oib.10.1696061975444; Sat, 30 Sep 2023 01:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696061975; cv=none; d=google.com; s=arc-20160816; b=x3p7WP8mSFRwhiTuGSiZxnpqZs+sH5XIyirpNom7DQ9WYinoNxkGpW2PVYmAlKnsPN xHlxI4QClEx0IgWp937H0FPBU8qyQJES+XqB0w52q4iOg93pHmAIXjn1cjLKpyfRs1Jh dX6D7aTG5KgvOdIeasMnSNj36FVSR531tmVYMEUNx5SozWhTcIqH5bX20+uIZj/58FqF lOv+PI+gMUSSp5xLt2vlylrVbE+THZ7UvQWS2qCSDoGXFAx1QX4rdR8C38G0vGSo+842 rYYp8Udwudw1lJGsoJ2le7lqYuU21yjad3bwaHn7JvyJ0+OPTAOAuYTl5xenfHYOPjLg osEQ== 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=BE6ipvO+8ZhSNCDofbLi72/2YlhGigOFPDez07Hl8BI=; fh=A85IbJbd5uuGxPB7d8S1xsvFNkX+cL0X+cuiddAfMRw=; b=TlSX1DTk3+ASlF673xUyfCxJusGWEd0y+cC8Jh+J2Azwl/Fl9qcduDnyUtpsXscDLO Jan1nn2IcHp4/VqDf4S2f86z2idZheq4dd/LYEV6bc6u+QQNWQ9/7L/HV7PX0xsSMtQc L4447C78e1vMVaINR1qZJ3qh1n4rZiGs4alWucvis2BJjkAjXVYMGIXpUj8rZ9w6ZPJi LJSYNrir5/4uBsjf4zYOLBxKJVdhY0nEncAhb/WeB8cDotEFpq0JbXyLNe1NKcjuKlaS ONBDslAfjHJrqZ7IflxQjT1OMDR3kePlU66a+yFxnaxJHLG/Hn03bOY/9Vxmq5S++xfJ Nb0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kzPEBBCm; 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 w2-20020a637b02000000b0056da0ae25a2si22892663pgc.32.2023.09.30.01.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 01:19:35 -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=kzPEBBCm; 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 38E3E8325199; Fri, 29 Sep 2023 22:04: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 S234054AbjI3FD7 (ORCPT + 19 others); Sat, 30 Sep 2023 01:03:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234227AbjI3FDT (ORCPT ); Sat, 30 Sep 2023 01:03:19 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33DB21BE3; Fri, 29 Sep 2023 22:02:16 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-692a885f129so10729448b3a.0; Fri, 29 Sep 2023 22:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050135; x=1696654935; 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=BE6ipvO+8ZhSNCDofbLi72/2YlhGigOFPDez07Hl8BI=; b=kzPEBBCmAwadesV6kqjng19qJV8xVwOIq2DWvG51ft3Y+D2zEXTD6iNtcFlO/3A1Kb QxEeM8jcJ99LVfO+dZn99wXXdL3lsp2H1okaYqdje7kYXEmcN2KVC530r5yrkYEL4rLR BLKfSXEppxRv9/S0w87Jvq+407qtX9JUJQbgjPey/CUd5KVQXgMmtVx0sGsBHgrVMBtR kXdzbG7xC8ByLFcUddAqr4cwhFqbK43CyiShYcCVFAzohPcIxLXhowaQ/3T20lGgZ2Le Yc/PfpOjfCYFIKo1mIyZ1ZU4iKBQkp56rf/2jl1rRtr9Uk9+lSd9TtQ3M45Ks3gcbO2b Uoxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050135; x=1696654935; 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=BE6ipvO+8ZhSNCDofbLi72/2YlhGigOFPDez07Hl8BI=; b=OyC2U+oYaBTGTSWZVX59EnitgJP937YC37a30dxfDJ1yZmKg0mC97jBiPsACQBRz0G 4o0a+5DL69lljUiycIFjsO32UjXUw4BpBt/XhyxZNoh3FVmO3Q75pRDxHU3LS03PQI0n 4Vnf2HOKBBbh28eEBCVU1aKerguWj5w1zV76AmGVUYSmTu1ljLph4jXonQ9rM6wkvGrN aK1i1bVITSekNyFYS3VXbKuNX0N/Fy+v2PDOy/OpInOLRkRBcGeepy41kdGgKyh2gwcL AjC27L4fR7XC36LoXb1uoutdHDUdDS1/sNoF8eDk34AQNHZrlNbtV+W8YdjKJTPNFVXK jW7g== X-Gm-Message-State: AOJu0YzkDrthk5hQVFoKXzIF+VJJnN66oiGOK3VhFgdYDpdukbyEpR3b XeMVSPaYkC9frijOgyGIMhY= X-Received: by 2002:a05:6a20:5b14:b0:153:588c:f197 with SMTP id kl20-20020a056a205b1400b00153588cf197mr5106839pzb.35.1696050135453; Fri, 29 Sep 2023 22:02:15 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:15 -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 , Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , linux-cifs@vger.kernel.org Subject: [PATCH 23/29] smb: move cifs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:27 -0300 Message-Id: <20230930050033.41174-24-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:04:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778449881996533395 X-GMAIL-MSGID: 1778449881996533395 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to cifs_xattr_handlers at runtime. Cc: Steve French Cc: Paulo Alcantara Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Tom Talpey Cc: linux-cifs@vger.kernel.org Signed-off-by: Wedson Almeida Filho Reviewed-by: Steve French --- fs/smb/client/cifsfs.h | 2 +- fs/smb/client/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/cifsfs.h b/fs/smb/client/cifsfs.h index 15c8cc4b6680..a0472b539567 100644 --- a/fs/smb/client/cifsfs.h +++ b/fs/smb/client/cifsfs.h @@ -134,7 +134,7 @@ extern int cifs_symlink(struct mnt_idmap *idmap, struct inode *inode, struct dentry *direntry, const char *symname); #ifdef CONFIG_CIFS_XATTR -extern const struct xattr_handler *cifs_xattr_handlers[]; +extern const struct xattr_handler * const cifs_xattr_handlers[]; extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); #else # define cifs_xattr_handlers NULL diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c index 4ad5531686d8..ac199160bce6 100644 --- a/fs/smb/client/xattr.c +++ b/fs/smb/client/xattr.c @@ -478,7 +478,7 @@ static const struct xattr_handler smb3_ntsd_full_xattr_handler = { .set = cifs_xattr_set, }; -const struct xattr_handler *cifs_xattr_handlers[] = { +const struct xattr_handler * const cifs_xattr_handlers[] = { &cifs_user_xattr_handler, &cifs_os2_xattr_handler, &cifs_cifs_acl_xattr_handler, From patchwork Sat Sep 30 05:00:28 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: 146934 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp375285vqb; Sat, 30 Sep 2023 06:07:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQh6Ng3mc9YICuZ50Y8SBvuRJUngjQfcoPntumgwQoVFgaKFDyHij5fxQbmwWxHVvg/B5m X-Received: by 2002:a17:90b:fce:b0:26d:17da:5e9f with SMTP id gd14-20020a17090b0fce00b0026d17da5e9fmr5957768pjb.1.1696079244147; Sat, 30 Sep 2023 06:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696079244; cv=none; d=google.com; s=arc-20160816; b=PXzkf+WlCNB5yGAoTowJGeUtNkL/3xISTqpDtWkKNCxuogGJuxlrk6LXo0j7Jo28mR 0boQFwaeC/v12k24v7kznCOOKLOKrH/FIae9UMFGUtt0EDy0E/cQ6zvATBpVK9vD4pTb DS/rezwpkJuD4wjYuMKatYg5xl6GmyJCeBUAxRzdo7doakkDvov1Im7mE2jrlHldPphv XKDAdZ3XB1lLCPT3k/uSIQaxK+ghEa6MiJ1lZVn01O1X6Y8nRn8xeZ6QY7xxrPmgJQpE qYFv3CwpiQVI9DRZeSnttZ/dnsVDBzT/xDmjQ1vZ5el8a9JxkU3kkrMtSBtS9gsODjJT klmQ== 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=SX/rjYIK1IVXt18htg+5KG/0YnvzJQn6149rPJUtUFI=; fh=Z91GUZQ42Z8DM2LjLXsJSm9LFLCfvdSGp/HZ6eC4xUU=; b=na7yAQ2lqA9pLAIWKbg9qyMJcDN0YhcXxkVGENxhQcpsEVAhZOy5z8ZXl9m+vPoHzx O5qqhV5LTHj2Iv0RRgSeyJdfgZ3HRlHgB8MD08LSwqaoQa7TFPDB2MIHhRbPH7HKxWg1 sx3ClUii8JE73oLw/FMALkHvpZOSNe1A5qb8+AxEb6pMdRLsPX1Jkztafs2TGUjTfmTw DhJgypTgEbaFZgLQego2dS4MaSdyrzCSc22jG8cvORmjTTUyNgsXdwJ35eFPpf93CkVh xkNA3Ll3s1RHwvI5pGpiCkEibS4SFeHeSQPn/riKiXz4PcBN5s+72hTtUKEEPz9kHeKY 8I3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TeVKZ34X; 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 z19-20020a63e113000000b0057d7cff25besi20743653pgh.829.2023.09.30.06.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 06:07:24 -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=TeVKZ34X; 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 438998325EB7; Fri, 29 Sep 2023 22:04:48 -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 S234105AbjI3FEI (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234177AbjI3FDc (ORCPT ); Sat, 30 Sep 2023 01:03:32 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0870F1BE8; Fri, 29 Sep 2023 22:02:18 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c434c33ec0so114735915ad.3; Fri, 29 Sep 2023 22:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050138; x=1696654938; 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=SX/rjYIK1IVXt18htg+5KG/0YnvzJQn6149rPJUtUFI=; b=TeVKZ34XN5rX3Hx21ON03LJGgRAhkcRlmI2N8tObLN/sZzXd7tVkFKxCp/feNKnGR3 FDqDYyhf3tKepS8X5KCynb4FI+iiBz244RTrlq9bod7w94a3vJ2Oc1/1BqQHz5Fl6VUY 9VAFcwU+VcpQkTWl9rDXWdPxNiG20/pz8YvFyOgjxTF5zEEMdaCrW76+w1mFvLlA1KcU a8V2rmfGYWJxkSdKOO+vT3CoT4Ii4NxqUfpHfJzHZhXVFmxb3P2iYhAJ6MEwuhTv5tMd 7yP20zzflSp9D+b2U/ZG5BElCjkrBZWNYjrZz4an1GmsxiGl4oTRVPUuBUijTJpfvtHG hRww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050138; x=1696654938; 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=SX/rjYIK1IVXt18htg+5KG/0YnvzJQn6149rPJUtUFI=; b=oymItOY+KxmND7jSOnyI0kUZ3cLR1169zN0vzQgbR80jFKRv1mCvIKYK9ibATXqa5X Z8K10BaKfM1teKnZyhNbZ0h111QQbC11tOL2pWg0EAafncTcyFpvW25wjoDxyzAMmEJG NDbm51F7CBY0XtUkIYXVej5QLjH6T7N1254Wh7PP5t2Pla/iVjHMoe3bfSmG9icnhr1j qCgUHz0cC89rxFcpju+Tlv6J/jzHLypEWBwyBq5ZPYzbCGs3+AW3DFSNIUjuHEtgh9l/ GrmqXLoYbpvF3Ccif8VhNuAX7JFTtLLof4u4bL8kykAWJT0go8PzfxyI/OYBVIsVreRG Tv9A== X-Gm-Message-State: AOJu0YyOgIXCaaFyL2fRa02MQueSCSWipvVGFTEy8wqrE6i+T2gEZ0ET geRTavc/c8XZY9ZiWUjbxq8= X-Received: by 2002:a17:902:c255:b0:1bb:c64f:9a5e with SMTP id 21-20020a170902c25500b001bbc64f9a5emr5364333plg.5.1696050138126; Fri, 29 Sep 2023 22:02:18 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:17 -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 , Phillip Lougher Subject: [PATCH 24/29] squashfs: move squashfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:28 -0300 Message-Id: <20230930050033.41174-25-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:04:48 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778467989517573905 X-GMAIL-MSGID: 1778467989517573905 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to squashfs_xattr_handlers at runtime. Cc: Phillip Lougher Signed-off-by: Wedson Almeida Filho --- fs/squashfs/squashfs.h | 2 +- fs/squashfs/xattr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h index a6164fdf9435..5a756e6790b5 100644 --- a/fs/squashfs/squashfs.h +++ b/fs/squashfs/squashfs.h @@ -111,4 +111,4 @@ extern const struct address_space_operations squashfs_symlink_aops; extern const struct inode_operations squashfs_symlink_inode_ops; /* xattr.c */ -extern const struct xattr_handler *squashfs_xattr_handlers[]; +extern const struct xattr_handler * const squashfs_xattr_handlers[]; diff --git a/fs/squashfs/xattr.c b/fs/squashfs/xattr.c index e1e3f3dd5a06..ce6608cabd49 100644 --- a/fs/squashfs/xattr.c +++ b/fs/squashfs/xattr.c @@ -262,7 +262,7 @@ static const struct xattr_handler *squashfs_xattr_handler(int type) } } -const struct xattr_handler *squashfs_xattr_handlers[] = { +const struct xattr_handler * const squashfs_xattr_handlers[] = { &squashfs_xattr_user_handler, &squashfs_xattr_trusted_handler, &squashfs_xattr_security_handler, 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 From patchwork Sat Sep 30 05:00:30 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: 146897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp284821vqb; Sat, 30 Sep 2023 02:25:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2Wh2k9rd4yKcNhL1v55/XBZxwZ0Mm47u4tJ8aVrG9hs3lZX7pkSQWxJZpVUPZCPmHwc/+ X-Received: by 2002:a17:902:d2c3:b0:1b8:954c:1f6 with SMTP id n3-20020a170902d2c300b001b8954c01f6mr7791941plc.36.1696065950171; Sat, 30 Sep 2023 02:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696065950; cv=none; d=google.com; s=arc-20160816; b=CdUuQOAFbeqVx1unvNEV4LeU17XI9aZbnEFjTmDOmQFUKr/8IFW5l0wqbhIQGYV09V GcsxVNu7HLkalrcXq1kuC+BKvw4W6Sh/8ZZ1X6sK1Iu8D2GWaPMM15e4c9pdX7V+BhdT bouz4Kuht8KZLDf8dty3tuKhd64KwWAS5JKmyCYhUQP9gYKMirDYeKtEooo0PcWpX7Dl 7K2oL5VW0ap2Y8eCOCe4uvLixlNkNtp2criMQOB1evWNU9v1q6sxzAOaCSQ+naI6xSqA Eih7Dhne+pYGtDzxWQ7HrXbtmOiZY+G27FAhAEphJULTQHGszitwTo9YYCv8sAaUwMY9 9Orw== 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=sWwX1MjDa5FGmsQKrAkRxhx462UR+5GB5fgvAVZzAwA=; fh=/69G5QMXG6ouAniOSC1WEMRaWJCjt/ndyb8jzlvyocY=; b=uZebLfd3F1xWcatN6GL82EZwvuRTLN74+HtczHf5LRaGlajiGhNQ/4V4TdUPNqB3tI u5iWkkhPTHQx+TzpxZJkTKnKKrURNvVHMVKs+hdbwij45U1+Eal+ud/BAFdAm/ojh7qK 5cdAf8msAI5MeUaZJDIJvNHY+DxZgf0mNXLRsuTuQ3qIboMb1e+aKyBXP4Yet2jIL7Vo SPIUo4x6zowRfgDI9yFVXfu7hgd7/uO72u95jrq4XhAVm6rLKVau1KGnQi9Ac0uvZljS xnYBwO2Ne+yuGdAVBZI6DEi+T5bNdLV8C6EQtke6wPPFnhT9+zmhC2elHPEPZcKXpxIp V+UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JVnbZxN4; 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 u12-20020a170902e80c00b001b9eb5d1ea2si24813077plg.198.2023.09.30.02.25.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 02:25:50 -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=JVnbZxN4; 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 8289A82E6C09; Fri, 29 Sep 2023 22:05:24 -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 S234275AbjI3FER (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbjI3FDl (ORCPT ); Sat, 30 Sep 2023 01:03:41 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 362F1CC3; Fri, 29 Sep 2023 22:02:24 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1c724577e1fso48053185ad.0; Fri, 29 Sep 2023 22:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050144; x=1696654944; 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=sWwX1MjDa5FGmsQKrAkRxhx462UR+5GB5fgvAVZzAwA=; b=JVnbZxN4OTRqCD7cNE0PHFfiwZHl6nDh76sQjP5LQ8bvAU/TxOr0svsg8D5uZdsfIJ lI5Sek6rV44djNuSL6c54gHgb5zQsWHsssN+tqOa8+/MzOdf0d4jO0mlcJL9gB2dwj/L hq8yLtd5Y1G7Ww0t9Ni18YTxBEsk8IRMnJwhFHCXkzGAILl4X+bkm70cZGyLX6eKVHcn 7M9n1/utbQ7eFzWRexkIr3vMH5i1p7XApbYteMmrp3wedkc7RsCL+nI4uPE4mW4Uidvs QNa4uiv17c7qnnrqSCDteOSUlkXMZ4yF5r1gkSLC7A1XAOaW7TVkSZqeniKV8re9MR1z AHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050144; x=1696654944; 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=sWwX1MjDa5FGmsQKrAkRxhx462UR+5GB5fgvAVZzAwA=; b=XDVWZGskamCFow1Gfbro9Whu51lwBJRhqMQyW1KBOhGPSAEAhqQaw1nU9/RDWPzaob T1NJ/nyzwAcQ83+PUcSHbIMidvDiRSy4qlKQoebAvZoSHhnY3hiHeC+TZ/sTCjnsD4AB pi1ok7TMFLZqtFZpsf7vSnyV5Z3A/G7ekbitDZr78ByLDtO5FeP9M1tV0WvfXORirYbs 1Hr78niIttFzcn9ccRBDlJsSaLZwC9dIlZGQQeS07Yw8q6hBpMR2p6JPRSniJ2HbkdgE 46VBV3zGiyirCqRm58sJez2LWplSvrwtaXtD+hUbmkem1uKOXnLq40WSncvTflOSpdu4 1gjQ== X-Gm-Message-State: AOJu0YxIEuBe6Q/yfpYxSeXv7I57zN4bCxIWyK8t3/FJrq/uuBP4xeZv a5ZsZDzjJyUbfeqdwnhwzYJtVdsnrdeLfw== X-Received: by 2002:a17:903:25ce:b0:1c6:25c3:13d3 with SMTP id jc14-20020a17090325ce00b001c625c313d3mr5649024plb.6.1696050143991; Fri, 29 Sep 2023 22:02:23 -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.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:23 -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 , "Darrick J. Wong" , linux-xfs@vger.kernel.org Subject: [PATCH 26/29] xfs: move xfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:30 -0300 Message-Id: <20230930050033.41174-27-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:05:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778454049472337028 X-GMAIL-MSGID: 1778454049472337028 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to xfs_xattr_handlers at runtime. Cc: "Darrick J. Wong" Cc: linux-xfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_xattr.c | 2 +- fs/xfs/xfs_xattr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c index 43e5c219aaed..77418bcd6f3a 100644 --- a/fs/xfs/xfs_xattr.c +++ b/fs/xfs/xfs_xattr.c @@ -175,7 +175,7 @@ static const struct xattr_handler xfs_xattr_security_handler = { .set = xfs_xattr_set, }; -const struct xattr_handler *xfs_xattr_handlers[] = { +const struct xattr_handler * const xfs_xattr_handlers[] = { &xfs_xattr_user_handler, &xfs_xattr_trusted_handler, &xfs_xattr_security_handler, diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h index 2b09133b1b9b..cec766cad26c 100644 --- a/fs/xfs/xfs_xattr.h +++ b/fs/xfs/xfs_xattr.h @@ -8,6 +8,6 @@ int xfs_attr_change(struct xfs_da_args *args); -extern const struct xattr_handler *xfs_xattr_handlers[]; +extern const struct xattr_handler * const xfs_xattr_handlers[]; #endif /* __XFS_XATTR_H__ */ From patchwork Sat Sep 30 05:00:31 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: 146980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp572911vqb; Sat, 30 Sep 2023 13:52:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCXzz6Cmdgl9xPPZfC63oz8uHgYhYnQ9UDw1M54Eo6og2cT4wOL+2gypSPnlE64aR69DRK X-Received: by 2002:a17:90a:8903:b0:268:553f:1938 with SMTP id u3-20020a17090a890300b00268553f1938mr6699338pjn.4.1696107163079; Sat, 30 Sep 2023 13:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696107163; cv=none; d=google.com; s=arc-20160816; b=vnwfv/7ki+Vc815IWi/kCVIJXaSrQeS3J9RCPH5koD4jjExhXvOzJauOzQg1MwH1nV YKdgQuKRsteOEdSbcVG9xXL9QrBIKh+30viHNWpVI2eL5sgR2ahfSTALQUHkgd05q6V9 QNmVKfLpv8P3ieBwg2f/0WOjiOaBuWsvzTXnu4p279v5Fnlvh0wy2FJZ+sooUxdrIV/V u8/4YkoSXKXfW//ObtXvPOpNrUxQ6FjED0vei+uBxOLJbL9640+PbqKfkY7pXTHDMZ2h OXLxfOYoPANut8PUfjlX1mHC0fZz4SSISf/7RvkSoBh7kVz/uNX6u05djh5heZfyTNDF oSOQ== 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; fh=Cyy0paYSqXv7Hu83I/CfPA8OsrJkBwQIuusifjue/5U=; b=mdnddWO/g15wZr16qfI9YSMai0OZdb88te6Tgbk3gVRaLdfaEV4qkK3Hwwh7LkFojV 4ZzV+i0oCHOGMeLfJqfy2VB0ENUxIC+OVLygVoHaclMwimlA8Dy43/gRgXwChUfhu1eG lXDhoj/VxlQp688up77hEx9ZvocFQTzt3lXs78oJkEgRVaE/hAH9RkBKRVKnHUbHMGGm 1OhKdiL6/MpUZgJj3JYFylOo54GxoYAAfEHIG+NMpKsKSWqBEt+3beiOo7SC3rEnpjn1 VrKB2Do6/00biJUwsERDGUqrNYpluQ0l9drsM728fgDaKJRYSO0ALjA5KYJKpu3TsiyX U7aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjvt9rgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id nv6-20020a17090b1b4600b00277636a9e5csi4566390pjb.96.2023.09.30.13.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 13:52:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hjvt9rgd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 0A02F867F1CB; Fri, 29 Sep 2023 22:04:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234103AbjI3FEX (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234245AbjI3FDm (ORCPT ); Sat, 30 Sep 2023 01:03:42 -0400 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C55401BE; Fri, 29 Sep 2023 22:02:28 -0700 (PDT) Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-577e62e2adfso10221548a12.2; Fri, 29 Sep 2023 22:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050148; x=1696654948; 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; b=hjvt9rgdArJTKxAh3KZYRzCVF76mT/jhVvgVRswetn92DMW/ceiIkYAiA920AC3LBS 48wonSkESEV0MClwYBzrAPVRNvFZvBu7lOkQgHTWkF6UT5xuj9MGKLmVxx5NMo53TaJW 5mRxP02XwYgUYf2TAAmhDswS3V0hSmCQuEBOy0OPPAYVEJh6K5dVTC5CVeOtKwT25wvc lLsLs7XhBhNUCaH+WbDgqVxMjPPE5plxHojF9WFj7rsp3BdF1A3YkYhpQ1DTFcojQZ8y xuhd2ACHnzaxKLRpr9/+/RbYq818aDYlOYBtSx0C84m29GhNre64V3o0m7XU8HOA0DLp TCjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050148; x=1696654948; 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=9UNIhEufzQwgDPjs0KxNTWIPnnrU94TNvqQfHawN6Ek=; b=M+smeOnQmx542mX/j7E1W+jpguBI7b2vZ6v6kAllnm14L0Y6IHzlYd0LsdOFlE+VoP znf2Vzl3UWMueJYVmetCMIfvd+yK2bIWT4OblCoiod4n1mwsp/TiHPBULLjcU9C1KxGr IQyq6gAOCaMuim88rpWlwkmRXChN1DPz1U58Y4DBfnrAO3DKTu65c9MEmkjG2BoAJL20 85hJDEGXvzIem542DofSMEGwWXUSLfPR2vrK82CFqEElMMcGfzW7HjSHmn/JygqoqV9j 62IgC+ezB9r1OzbR+OrVN9LnPBCwyDC+Lqf7pAhRJEj8RDxqUU5Y6kY6Ri+UX0dhzc3c jK/g== X-Gm-Message-State: AOJu0YyUdQQH0RTIdVTe0VfkyWTVPaHp+j09t/gKfmVEI8lgw/sXnFBt DaHHgLZ6R6bwJgJtusx8n/k= X-Received: by 2002:a17:902:e881:b0:1c4:4c10:6ae3 with SMTP id w1-20020a170902e88100b001c44c106ae3mr6845902plg.23.1696050148169; Fri, 29 Sep 2023 22:02:28 -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.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:27 -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 , Miklos Szeredi , Amir Goldstein , linux-unionfs@vger.kernel.org Subject: [PATCH 27/29] overlayfs: move xattr tables to .rodata Date: Sat, 30 Sep 2023 02:00:31 -0300 Message-Id: <20230930050033.41174-28-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:04:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778497264451607165 X-GMAIL-MSGID: 1778497264451607165 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to ovl_trusted_xattr_handlers or ovl_user_xattr_handlers at runtime. Cc: Miklos Szeredi Cc: Amir Goldstein Cc: linux-unionfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho Acked-by: Amir Goldstein --- fs/overlayfs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index cc8977498c48..fe7af47be621 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -477,13 +477,13 @@ static const struct xattr_handler ovl_other_xattr_handler = { .set = ovl_other_xattr_set, }; -static const struct xattr_handler *ovl_trusted_xattr_handlers[] = { +static const struct xattr_handler * const ovl_trusted_xattr_handlers[] = { &ovl_own_trusted_xattr_handler, &ovl_other_xattr_handler, NULL }; -static const struct xattr_handler *ovl_user_xattr_handlers[] = { +static const struct xattr_handler * const ovl_user_xattr_handlers[] = { &ovl_own_user_xattr_handler, &ovl_other_xattr_handler, NULL From patchwork Sat Sep 30 05:00:32 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: 146875 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp201200vqb; Fri, 29 Sep 2023 22:06:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLoREzM7/0MKkqD8Fau6BmyO+t4usz+NynXm3YJcForS4ssMTlqqvLolrMm6KmvgQ1ZPRA X-Received: by 2002:a05:6870:b290:b0:1bb:6cca:3468 with SMTP id c16-20020a056870b29000b001bb6cca3468mr7082345oao.47.1696050366374; Fri, 29 Sep 2023 22:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696050366; cv=none; d=google.com; s=arc-20160816; b=RWdtwF1Z58EqXqZ/h8DXJKW+VSx6BEXiZl9bWQh2B8QG6c+GNTPwkTLEExSDM/6VJJ SAY+7UwdFP8Z4gSQyM9QOTbzSoC3sHUvJRbzLJ1pSgglzXW/aQwOxsi7lNwQf6MO12p6 yItsj/WiDpPg7nrws69f0/a8xsjlLO9fYmEyQrh6ReVJNfQEnRs0Ob+OFOXZvTUKRFz1 uyoUZLdpohS69sCjZ6pAXmr2wDA+nRLz/rfmd26SpvqvEyU8i/u/faXx1hMPTIb0CYsr IYhD4jRrj36e3SeP3MplVGZVt4ljLhWvyVpyV1Wo9aHTIzwwJHUSG7k6uMY6G4SESRc5 sF9w== 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=iNgBYnm3H81CL2AuZdWmOPe+pdl1B3VjJnIrmYnD2KM=; fh=1R4fGg4hjrcHzuT3UNLK44bV0c9j+tw4negsJr3ySh8=; b=SHh5hhoauxIUP8Wc+oIwPuzuuwLEY3GARCJ/6B6w1s/AKoFknRmNkYqVC3YU80gxOE dkFunJrgYEFug8vGdxjKIz47uK0NHbUZbrLR1ErdooM7zcZMsJwLGNibtoGdTPV18+BL jbUi3hH3oWzcYHO1yUwdBN/yiIFOYmqEf/qMxFDMMGQ+p4CajJxq+t7c974KnKoqccNY zgfwcp8hOvmzO6Bq26BeFNIH6e11gh705j801nJPArT0TXuVl3jVObMgSImqc3/Rr0MU FzFVNnHIS8dHDAywuXFRFMcNoTImE9zXGq2Pw/cZNSeK0r5E2ytb2UgarlmzqLZwvn9c N7Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZjSIypxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id e21-20020a656895000000b0056da0ae25a0si21727747pgt.441.2023.09.29.22.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:06:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZjSIypxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 82592828D074; Fri, 29 Sep 2023 22:05:23 -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 S234287AbjI3FEf (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234008AbjI3FDx (ORCPT ); Sat, 30 Sep 2023 01:03:53 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 088B71FD0; Fri, 29 Sep 2023 22:02:33 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5789ffc8ae0so10231870a12.0; Fri, 29 Sep 2023 22:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050152; x=1696654952; 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=iNgBYnm3H81CL2AuZdWmOPe+pdl1B3VjJnIrmYnD2KM=; b=ZjSIypxRE2W8y2ExF38WwCcprBmHUjWY845bSU6xuICaiZKMN6fjwxqIvxGX+EnUn0 tZM884r2KmCnahZZszQpwvsLMIwFrgRIFnLK2ccBIQ7NgWCMZpX6Th6aR+on0aikpcnC 1nLBLPcbVzhH9c3yB73EX9PBYyefZCATsExTqW7lYD0OsiJDs3alDykVg4KOA2MgTFcM NS6E9JRYsUPGuotNtVRxZKLuvRpEuqduNsL5mN/VApu0xI7p5ONZNGO3ADZIq6ne5bfH +EDIZv1RhNJoNWEPnu0hLDeeQb/593bcsHSTj4ZYlOHcI4+R11nQXUnML+tWG6YpEQaI Qb8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050152; x=1696654952; 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=iNgBYnm3H81CL2AuZdWmOPe+pdl1B3VjJnIrmYnD2KM=; b=ImxdMpqKQGop5/ARYaP/UCrqNFbFhaj7D8enNvtYz0OrVX4CFf80hmkW6ypWlufqDG SBUfBlOvRiH+mf0BFgOWPfSXcboXo+bKX5o4WFkxK/rRBYIhN0jmVAWH1/PluGeh2OeA uzIj5dIpqrNiwxMwiAXFC/A1NYkp2+KM+sMGit+bA29/Fq6ceiMOysbULPTGmUY79x1M oZzuVzcCYMQqP5NesC/yQvI0/aSKPu5j6crD/0gVNuzRP0wDziFhTJ6Z/mQ7uWn9VHIN Z8mTCMK94TM6yoKQcLzueWwFMoqnF1GkFzeuZwAavWXnoIerDsXZjwC7wrmI8ZqAqtxX Dwmg== X-Gm-Message-State: AOJu0Yzc+w2Fd8rD2SJsCkWdg3EnS9d019zrfNctLBmlsePXkHzXhfQg 9ltcfR7zs8s7rjC3xob/V8AQHwfxHV00Cw== X-Received: by 2002:a17:902:e80d:b0:1c5:efd1:82b6 with SMTP id u13-20020a170902e80d00b001c5efd182b6mr6762435plg.30.1696050152408; Fri, 29 Sep 2023 22:02:32 -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.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:32 -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 , Hugh Dickins , Andrew Morton , linux-mm@kvack.org Subject: [PATCH 28/29] shmem: move shmem_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:32 -0300 Message-Id: <20230930050033.41174-29-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:05:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778437708815701326 X-GMAIL-MSGID: 1778437708815701326 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to shmem_xattr_handlers at runtime. Cc: Hugh Dickins Cc: Andrew Morton Cc: linux-mm@kvack.org Signed-off-by: Wedson Almeida Filho --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index d963c747dabc..683c84d667c1 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3487,7 +3487,7 @@ static const struct xattr_handler shmem_trusted_xattr_handler = { .set = shmem_xattr_handler_set, }; -static const struct xattr_handler *shmem_xattr_handlers[] = { +static const struct xattr_handler * const shmem_xattr_handlers[] = { &shmem_security_xattr_handler, &shmem_trusted_xattr_handler, NULL From patchwork Sat Sep 30 05:00:33 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: 146914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp327218vqb; Sat, 30 Sep 2023 04:24:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIaGulfnlcURkrmIoYJnknh5Z9Yb4LXfmvtV5tHAZjR7pidwJaV63Q12xjwapDA4yCijel X-Received: by 2002:a17:90a:74cc:b0:277:4be4:7a84 with SMTP id p12-20020a17090a74cc00b002774be47a84mr10403869pjl.19.1696073087637; Sat, 30 Sep 2023 04:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696073087; cv=none; d=google.com; s=arc-20160816; b=xW0Y8K9dkl5JoiDedtbuO2m4L2CD2tWwZK7JpRMQIbwUZoHmLNOR4U6t4tcrRNU4Wp 1IYWQ8ZkHiBKTK6feMQbTI82Bb3jMRtwKdu+BfmTPwCrTeMwBFjlZ6XRde58zSU/XNZt zkjGKg5I5flMSATakYP4YVeVvTJBMuAZySKpUxyZalgRAnpb/J3zJDcb9yGDiosrKZor HwU5Ix5WgT0DKYApHk073ykd9am5y6V4p6qCM9HevTQ2nxKVEQDLU+n7h1RndNDuQFUg jqkW/hBgQP8ual0DwCEVmiXyiLGy5Sy4jA9XAxL6LSCSM/Cy/hkkOtwMv37P0nkz5ETa +ZHQ== 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=xyxiBtLOD6vKA93NS3NnjiNRx4OZIF1tJqScqvYHIAA=; fh=ghEN+YrrNwLHm6hV2E5VuHpaG5DuLiEQfJK8ZoIKwIE=; b=0hni4CK19r4Sa7O9lGZrMBOSLWQkFZRElPYo75NJnnnOf/TgfY0iikw8Pbr2BlCSro gLhSCLfQVgD/uteurWk4r1b5DJEMXr3tQ0SoZ0Fr3HRB4x1sb70rcH5xijfrzGoWMCy7 a7Hf0vANYSuWI3qAoSmyAwXUVQMiJoppccu3p8RfwbiThXKRKjrYuTf36uRxUx0d3kbh fp/jvWNhWauAhHtSCquKys/FhNaVkTn7k7GZ0yaoBitro5B8sVn54t/SNuacfbGpSA64 b5m53oV0cWvR33wwy+lMCnwyHwd0svFZVe9tnINvanPaKwF1WlFMuyDThLHqlCSSGjKQ 3ANA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VBSP56Fs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id 1-20020a631541000000b00573fa8f2827si22583660pgv.340.2023.09.30.04.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 04:24:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VBSP56Fs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id EF5DE8328FF7; Fri, 29 Sep 2023 22:04:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234228AbjI3FEi (ORCPT + 19 others); Sat, 30 Sep 2023 01:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234263AbjI3FD6 (ORCPT ); Sat, 30 Sep 2023 01:03:58 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3622FCC5; Fri, 29 Sep 2023 22:02:39 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1c60f1a2652so10356825ad.0; Fri, 29 Sep 2023 22:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696050158; x=1696654958; 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=xyxiBtLOD6vKA93NS3NnjiNRx4OZIF1tJqScqvYHIAA=; b=VBSP56FsvsX2sAOKAc6rmt7Qy/p4D5Wl28D/GnHG+/RBJvMHK2GLTOMWAe2sbSCb5y BDXmHlod7VCIlROoprvmj7/YsDPXlAcfp0CoipqLJKHLgK66xsLhbbD8/eJc3Y9R9w95 WQ9a5y6Q42b6DWiwbPslqHiTEcvnHCHjOcVIotM26cs5RhQDncVJjPKNfn7iaBU6p5TH 9N9VaAheViF9RGEwVj1LmTqLgl7KHJtsDTAEVhmNqD9vqjtAyxebjvm3otWWx3yBcOwz ek8VBiD4xTr881N5M3ojNj+Jgq2MuD7+7HOVWZ6vgcbYcYtMuzVjFe7iI3xVza3fNDhd L8Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696050158; x=1696654958; 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=xyxiBtLOD6vKA93NS3NnjiNRx4OZIF1tJqScqvYHIAA=; b=s2laeMImirhJk319JbNgiWVBY4nXkXblqRhLYosrWqNFSaH5Mn7WBhNGC9Ql+7Xp+J rNBqcq7O2OwQyO5r2DCArsd3ERh+MBBT1ZWhsJOZFdO5UPJkaJGngd0eJheyKE5sI+yq AKdRfqEZpgnarmOXGtFHeCXB9SoG79TQJ3fO535QY0DbDEPIR8PrgCI9T+XOHOcuQbNe 2w/HUpEkCWDWUTl4fIqPL6jH20eUAKkXCyngSjn9Ufdsh2CUuMi3+kvLgh/ix0zTovk1 ddqDIKaQFNpGcNLY+qZkwAAyIYCW4AdixGPkfBUz/Ch8kAoEElqw3Qe2GU0Q08nwV+Kc 5MPQ== X-Gm-Message-State: AOJu0Yyi7tVWZAwGx6ZrTnqzu5/qya7I1huvtCds9VYqOdSDThiW6zYq 9jvpsfNzkJY4zkcKeqyun+g= X-Received: by 2002:a17:902:e741:b0:1c4:1cd3:8068 with SMTP id p1-20020a170902e74100b001c41cd38068mr9737235plf.5.1696050158560; Fri, 29 Sep 2023 22:02:38 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 22:02:38 -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 , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , netdev@vger.kernel.org Subject: [PATCH 29/29] net: move sockfs_xattr_handlers to .rodata Date: Sat, 30 Sep 2023 02:00:33 -0300 Message-Id: <20230930050033.41174-30-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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 29 Sep 2023 22:04:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778461534208466714 X-GMAIL-MSGID: 1778461534208466714 From: Wedson Almeida Filho This makes it harder for accidental or malicious changes to sockfs_xattr_handlers at runtime. Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Richard Cochran Cc: netdev@vger.kernel.org Signed-off-by: Wedson Almeida Filho Acked-by: Jakub Kicinski --- include/linux/pseudo_fs.h | 2 +- net/socket.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/pseudo_fs.h b/include/linux/pseudo_fs.h index eceda1d1407a..730f77381d55 100644 --- a/include/linux/pseudo_fs.h +++ b/include/linux/pseudo_fs.h @@ -5,7 +5,7 @@ struct pseudo_fs_context { const struct super_operations *ops; - const struct xattr_handler **xattr; + const struct xattr_handler * const *xattr; const struct dentry_operations *dops; unsigned long magic; }; diff --git a/net/socket.c b/net/socket.c index 2b0e54b2405c..0a99fc22641e 100644 --- a/net/socket.c +++ b/net/socket.c @@ -400,7 +400,7 @@ static const struct xattr_handler sockfs_security_xattr_handler = { .set = sockfs_security_xattr_set, }; -static const struct xattr_handler *sockfs_xattr_handlers[] = { +static const struct xattr_handler * const sockfs_xattr_handlers[] = { &sockfs_xattr_handler, &sockfs_security_xattr_handler, NULL