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: 13404968 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65E1217C8 for ; Sat, 30 Sep 2023 05:02:41 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IHeeeLjNU8syfWCBKCNd97N2hKxjyhO5OwBkFhe27PcOwAEtpXWD5JUYEpvqR1hQq8unpsqKQ== 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> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 X-Patchwork-Delegate: kuba@kernel.org 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