Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2547965rdb; Sun, 3 Dec 2023 23:53:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IEv/7/uQn3tOgDJ7C1vA81rqb+HJtHGrWQP7bYLejD+QbUkQTIOqGmy5Hd9D2dLe2Jyw6+i X-Received: by 2002:a05:6358:9144:b0:170:17eb:1e0 with SMTP id r4-20020a056358914400b0017017eb01e0mr1232929rwr.35.1701676405109; Sun, 03 Dec 2023 23:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676405; cv=none; d=google.com; s=arc-20160816; b=dNWIlMK0w+9dOGzk09DTgQm+W+RrVrA6hdAvqhUsUWDal+2eKo23gXjvYZsxo+oNPV UKXwXZDiOI3NkWmkmlMrLG5STQ5/0GCeS8Js8T8MraeN+Zgcw9kyRRwqbUYFHUyFjWLS dYQAiKEr9o816M3naOcQS6gWT6vAp88qTT8ZFj27gdgVxkrmshqptOVA+dnJVfMcXr/F CcEWWtOim9VM8GVNf8ccfpGRUdq3x4r/hp2o1VpH9pB2/iKKavg5Bj9ie7O+PK+9iGkK MVt1SbC3alggnhhxzOO45gc99f4QA2yV5XxMN3zlu4JqPrfvvmBtPB3rRynRJ4hBg1ah uUag== 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:from :dkim-signature; bh=yg1xUtdhyvShGMZD0/81D2pKniHPKLXSYCeXpTleGJI=; fh=1v5zqbO9sIGUc9bsdyhYE0zxdK1knZz2xnJYWUWMFKo=; b=MGWkTnhak3cn2nrq+vhLU3qGJtcYEqNJnObdipTRMvpmCOYWPoFQZ0JwqPNO7B53ME tJ7ZnmhHygHhe7FIJJ+ui0dal+Fxra+O+OB+S4+SBo4gFO2GMDJamolFRrxNzsR8t5HY Y/kgO4pjA5cuGiRL0HhcYDah4/NZdtUrE9Vu1ao7gbPrlUe7wPW/KpB/X1dqTl3Gq/ae uNT2PH7hwUCWi2pku7QuI8SAI/zobi5bLlFJJdiqG/StcWZxt65sU1tMkbSOl8tbWYHK ySEnmFoEfrqWRYVDvMvOK5JXPRqWvRElOgHBVBSwrp5iVkz/mBX9LKKYPmXb62r83FJh WRRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=ci3b+tBl; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k63-20020a632442000000b005bdfe7528c9si3739286pgk.726.2023.12.03.23.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:53:25 -0800 (PST) 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=@weissschuh.net header.s=mail header.b=ci3b+tBl; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BD85E809ABF6; Sun, 3 Dec 2023 23:53:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343510AbjLDHxG (ORCPT + 99 others); Mon, 4 Dec 2023 02:53:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234772AbjLDHwq (ORCPT ); Mon, 4 Dec 2023 02:52:46 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A430FF; Sun, 3 Dec 2023 23:52:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1701676352; bh=IxovWkSQa7nkG31gg70HY4PZ86eNzdXLGZdnYvGdlOk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ci3b+tBlQJ2I4Tnz6Uq8xCRvClO69u71LCh7Jwtj+5JsnWUJoaWhvTg3js+PuZNVW tirBQ8o0jdqrYvHi8MAckWJ8O/mudw3ffSFWracoTmFkEf2CtxM9hp7OXWuLsgmKJf 8DARgLvu9Mjh2qEXOkDlubwYy0CivYcuPoJ8UMQo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 04 Dec 2023 08:52:21 +0100 Subject: [PATCH v2 08/18] stackleak: don't modify ctl_table argument MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20231204-const-sysctl-v2-8-7a5060b11447@weissschuh.net> References: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> In-Reply-To: <20231204-const-sysctl-v2-0-7a5060b11447@weissschuh.net> To: Kees Cook , "Gustavo A. R. Silva" , Luis Chamberlain , Iurii Zaikin , Greg Kroah-Hartman , Joel Granados Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701676350; l=1076; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IxovWkSQa7nkG31gg70HY4PZ86eNzdXLGZdnYvGdlOk=; b=qMyrGJ0w/4+XhOWDiE66KEjMCj0gweurC/6oQwk/Krqtt1DIpUqZeI5jGJHKrmVOFeGke54pt YQi71Ea3sghBwYXo0q8Kz3ZhIgB+zOH6G6jdpErT6vSnyCISy0KxjSU 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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]); Sun, 03 Dec 2023 23:53:24 -0800 (PST) In a future commit the proc_handlers will change to "const struct ctl_table". As a preparation for that adapt the logic to work with a temporary variable, similar to how it is done in other parts of the kernel. Signed-off-by: Thomas Weißschuh --- kernel/stackleak.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/stackleak.c b/kernel/stackleak.c index 34c9d81eea94..b292e5ca0b7d 100644 --- a/kernel/stackleak.c +++ b/kernel/stackleak.c @@ -27,10 +27,11 @@ static int stack_erasing_sysctl(struct ctl_table *table, int write, int ret = 0; int state = !static_branch_unlikely(&stack_erasing_bypass); int prev_state = state; + struct ctl_table tmp = *table; - table->data = &state; - table->maxlen = sizeof(int); - ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); + tmp.data = &state; + tmp.maxlen = sizeof(int); + ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); state = !!state; if (ret || !write || state == prev_state) return ret; -- 2.43.0