Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp13660794rwd; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7yLrRHqH8MhJlkHmeGmNg6EUrSiqFiSLNjUC3OY3gv6DiXhwcHapnsZyBPSLO8sXrntHVu X-Received: by 2002:a92:d3c7:0:b0:342:2b27:7261 with SMTP id c7-20020a92d3c7000000b003422b277261mr20613680ilh.3.1687606285327; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687606285; cv=none; d=google.com; s=arc-20160816; b=roq6tn4KHeRSZuErpRTY+GbjBRlaF6yS1Lssut6typUkMTp9W4eyg928cyIo028QPA 9My226VY1J8mxI3Oj+BBAcJuES6u3OxEN0tMIVx2SDLauzJDiDEAicBmFy6WZ5z+1x36 wPVOFIOHbhYBwZCIH9NYoGNhHpmvQ+AwNb0r+bhJqUOwCWotcZdjfyeLjcGLQvaikelw e2t/wfjPRlW0qx907+erSD1rpgh4t8JwnDSCH7UoShESbWttvQxPSEBZMKues59lvwrV U8QKmXUWuy/II8EGoZOFPCB6WDHZTCBcqat7u/Lr++7+aPLhrdFqn6FP4mllPlSjRKB6 XXng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:dkim-signature :from; bh=7kesrMtWuc7lW5uxQ6MtNAQSv1EsHW4rM9QC9mSHr6k=; fh=g5y7j50HCusOFRgKNhVWk9U9UI6WIiaHKjQ0jhBEuBM=; b=us38pOgG4YFaX81C7CtpSkNZBhWH9XYzxmmLA5CAcSps5gxvwBokNCY7Ed8PY9CT6z d9wmx6T5g5QsSf311D6sjPGWJ0X+TuQmua10Z0lPOhg2++WuMYHZqLL0dpE840zX0XgZ xMzAWhrwyf2EpqmfT1W0opSWA6nz59XudcAZKO14qCW2sRaWyr5a1eHWz5f9SHMfOcxb YNTtlhQJQqTyAp4YmWrmUAylO7yKx/XKLS4P7lYKrif0qKwYiThdIhbfadLwJ0IJGoOz 3+cktewMO36QeZs2whv311ZZwEbwUSp3A/xOGFv0NP3Gy42OyiDwGs4S19JQJtDcYFci 43CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=PLpwolsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v189-20020a6389c6000000b005428f25f67asi1275294pgd.618.2023.06.24.04.31.04; Sat, 24 Jun 2023 04:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=PLpwolsw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233110AbjFXKbP (ORCPT + 99 others); Sat, 24 Jun 2023 06:31:15 -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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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) -- 2.41.0