From patchwork Sat Jun 24 10:30:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 696378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F76EEB64DA for ; Sat, 24 Jun 2023 10:31:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232655AbjFXKbL (ORCPT ); Sat, 24 Jun 2023 06:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232881AbjFXKbH (ORCPT ); Sat, 24 Jun 2023 06:31:07 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C71F51BC1; Sat, 24 Jun 2023 03:31:05 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1687602663; bh=Hv07IQfpUi17QmNQC9s2OoEvXVUFS7E+TFWplvGmRyw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PLpwolsw7ZlHoPEmIDUplUBmlSCa8ZaqedGFxQZIe0KHkvGBuIEYCQ8fghPvWEHzT SKEHwbl8Fn4kDf3E4tFrHvu9hHBDkBN4yeBxd0MteqcfvTu6IpSN0ofP8O6i0eeDPm ILi84B1HpjuS8Gb3Jcx1a0ZocYvInkSZ5kH1WKmI= Date: Sat, 24 Jun 2023 12:30:47 +0200 Subject: [PATCH 2/2] proc: use generic setattr() for /proc/$PID/net MIME-Version: 1.0 Message-Id: <20230624-proc-net-setattr-v1-2-73176812adee@weissschuh.net> References: <20230624-proc-net-setattr-v1-0-73176812adee@weissschuh.net> In-Reply-To: <20230624-proc-net-setattr-v1-0-73176812adee@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Zhangjin Wu , Arnd Bergmann , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687602663; l=1087; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=Hv07IQfpUi17QmNQC9s2OoEvXVUFS7E+TFWplvGmRyw=; b=sydRcATQix4hEhnx962ZvNEbCLjg3XbDnJu/cS4rm0AFbOauHU1aZOpDDZuLyUmH8xsoEiR6s ZKxXc2ZQni9DLO1vq0PQMim7IYCgXab/zowgtqGT8vwCFxon9fdZPdW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org All other files in /proc/$PID/ use proc_setattr(). Not using it allows the usage of chmod() on /proc/$PID/net, even on other processes owned by the same user. The same would probably also be true for other attributes to be changed. As this technically represents an ABI change it is not marked for stable so any unlikely regressions are caught during a full release cycle. Fixes: e9720acd728a ("[NET]: Make /proc/net a symlink on /proc/self/net (v3)") Signed-off-by: Thomas Weißschuh --- fs/proc/proc_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index a0c0419872e3..78f9e6b469c0 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c @@ -321,6 +321,7 @@ static int proc_tgid_net_getattr(struct mnt_idmap *idmap, const struct inode_operations proc_net_inode_operations = { .lookup = proc_tgid_net_lookup, .getattr = proc_tgid_net_getattr, + .setattr = proc_setattr, }; static int proc_tgid_net_readdir(struct file *file, struct dir_context *ctx)