Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp297695pxb; Thu, 27 Jan 2022 22:25:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyo0z3qOiFw2aBEzibgxSYhlp2xgni5R7aYfMtPrAhFwZutfkS171UfEVzujGQjojO0bzTi X-Received: by 2002:aa7:c346:: with SMTP id j6mr6701707edr.368.1643351131396; Thu, 27 Jan 2022 22:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643351131; cv=none; d=google.com; s=arc-20160816; b=xKNe/+Qgfk1sKm63LrD1EIlkDTCOaqxq3jCkLN2m4LwQXT3Zui1Ysmwap+ghdxo5xk fbAh6ZGrsRMjtMf4vZSeDyi8m9owh6oXT3A772LwJxQsrO9/8YwVkng6neQZ+mEOlQC2 Iqdg4eHuygwVDZZepHPWyz398VfeVRddEuEWgaVKKw+9SwIupey1LIhGwJcLODJaSU7W 8Ugrba5ZIxiay+e7KAzaEacsxKfEz0c2sx+bfZwtTRqKk0oExTQYKtFFnESXq+P5FgaQ sWSKWC7VWioF3NglxDl/9wSBvGY6Rlg7mYio1LUrTHVkJ6oMH2DL3z2CVYX1t/nhPWKo k77A== 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=/5yz10nLPgMlrkWVAwaUxDSGwjhQp8dD2oPAz5UmbOk=; b=OO9YZa8GTdl995QWZRPGy1uQooNhRgOsd2lKPO8dXfCfOQ1PMZVnEHi2xFwHd1UndD 3hvb8Omz2ryWm7MUbRFDFgGSOxYZDbJsYQyIi/7cTtdSqttcrCx1xjZaCvFUl9PlqOi3 R7vqh98Jm87C68xjitxiQSC98C9sQthdvQ1t6NR+UfzjZ3aU+qpoaYR3FFi/FdH1WQe6 n1RmYhnJ4DzUsKcZBmxRM74xTg5CgNxYLxHFpLePYeaE+iVRFxwaFwMXllnp5QxgwEcU 6pAHEH6cs9rVVHMx72I99HIW7jfCfmYMiN1SDtMEQKi/v/gChva9oY+IUBby5xduMN4N t9HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IVS9CIB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do9si2467228ejc.968.2022.01.27.22.25.06; Thu, 27 Jan 2022 22:25:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IVS9CIB8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242595AbiA0Ooh (ORCPT + 99 others); Thu, 27 Jan 2022 09:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242575AbiA0Ood (ORCPT ); Thu, 27 Jan 2022 09:44:33 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5752DC061714 for ; Thu, 27 Jan 2022 06:44:33 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id ah7so6379595ejc.4 for ; Thu, 27 Jan 2022 06:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/5yz10nLPgMlrkWVAwaUxDSGwjhQp8dD2oPAz5UmbOk=; b=IVS9CIB8/AivDcBztvuLvEwbz3QXtRhgtoDxXiXszgbHxkHrkg504y8Qxnch10IXj0 Op7gy4ZNShKuq90npTDHa82csurg5mNzU8+DzZdfZgGryFslgttHFaJrv2dZZajBRDeZ ioI0TvPi6HK9Gy5zoXbxa9C4xM6mxFS7OUjo9z/cP+QTMiYVrUtV2hB+My9mrnGtrpKF YJWOPIg3XhTx9BxNjTnQ974KvB+TCscni385gPCl8NrZQVcaDWoYkpoxfhapO/k36r1a vHEsYJbh47W2kmvJhFQBVD5+I14Cch1VYuMUrTk7zpIub+ZjYuwTM4VdrBu/yIwge9ez ZJZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5yz10nLPgMlrkWVAwaUxDSGwjhQp8dD2oPAz5UmbOk=; b=I7bvgpgweTqb6a1SCZudD9E5j9n1y0G2yC9mYjd033I/0wx1HVNtIEO4J1dPtz1dlu llNj6cJFc/WSGEwwE9xVcEnVx6nz8ws46rSC7/B/6fVqQWY59YcGUYGe12F0u7Iskvjt mTebRgfQCIHVtlnaUvHTCT/iuOWqp6mhZwhIJjvTjUWpvFR8hYJYTKkQgJJ6WCxpJRUw ZuU5yFPCxLB1YXiqOSQr+sxWc+jlVzMabpK8hIeS3VKgvchYF1monb5erMsjfZ2h7nqg tbVfYBi/4Q2Elus2rCHAwVaAunJPGGb+Hl5LT2bQT/DvZ2tXbx56hg16mG9qwT3uclye VqhQ== X-Gm-Message-State: AOAM532QTfpxtwFR1g0mQ96RCT+28oVbqbaO48qWx4Wxi/2E/tmk9dvo MKotFRs+txQIklaOc+76sXCuhR8TLJsaBC18Tnw= X-Received: by 2002:a17:907:e9e:: with SMTP id ho30mr3084101ejc.648.1643294671950; Thu, 27 Jan 2022 06:44:31 -0800 (PST) Received: from localhost.localdomain (dhcp-077-250-038-153.chello.nl. [77.250.38.153]) by smtp.googlemail.com with ESMTPSA id lo15sm8746533ejb.28.2022.01.27.06.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 06:44:31 -0800 (PST) From: Jakob Koschel To: linux-kernel@vger.kernel.org Cc: Brian Johannesmeyer , Cristiano Giuffrida , "Gustavo A. R. Silva" , "Bos, H.J." , Thomas Gleixner , Jakob Koschel , Greg Kroah-Hartman , Jiri Slaby , "Maciej W. Rozycki" , "Ahmed S. Darwish" , Sebastian Andrzej Siewior Subject: [PATCH 2/2] vt_ioctl: add array_index_nospec to VT_ACTIVATE Date: Thu, 27 Jan 2022 15:44:05 +0100 Message-Id: <20220127144406.3589293-2-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127144406.3589293-1-jakobkoschel@gmail.com> References: <20220127144406.3589293-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org in vt_setactivate an almost identical code path has been patched with array_index_nospec. In the VT_ACTIVATE path the user input is from a system call argument instead of a usercopy. For consistency both code paths should have the same mitigations applied. Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU Amsterdam. Co-developed-by: Brian Johannesmeyer Signed-off-by: Brian Johannesmeyer Signed-off-by: Jakob Koschel --- drivers/tty/vt/vt_ioctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index e0714a9c9fd7..58013698635f 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -845,6 +845,7 @@ int vt_ioctl(struct tty_struct *tty, return -ENXIO; arg--; + arg = array_index_nospec(arg, MAX_NR_CONSOLES); console_lock(); ret = vc_allocate(arg); console_unlock(); -- 2.25.1