Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5942983pxb; Mon, 14 Feb 2022 11:17:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUxX3JxOkx4cbFEqve+fibdsVenIH9rcYUKBNY7w9R/yOD9ne5/tmlDMfRVzV8+T58L6RY X-Received: by 2002:a17:902:d486:: with SMTP id c6mr234844plg.9.1644866220945; Mon, 14 Feb 2022 11:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644866220; cv=none; d=google.com; s=arc-20160816; b=xOUJwENyqFR+FrzCMciV3m3Z9eLMQuJ410T5ms/JVHxQwjTpUl3GCu24XFnP8ra4jF rdhXp3KHmje/t/+zaZM/qFFbBYiVPmYssW+4X7fwOjM0UYOq441YCCxIw5mLXXwaLY0w RHf3hiphkI6F9mt6ABcJLijpWC9OIvLTQwKxapKV5CM3gnylsPmNiSqINQ8sKqmskC1S AqEMWo+GH+DA5zePHgUAYDMxuy2ycZXmpEC2Ky4/iX+yTEysz8pcbi6idaVikYJp2XN+ nSVt30RaZlMaSCTnLLZACBy4Swf2obKH65I1In6tVZyLltCSjPNNxU/0feYAB9RWERMp odAQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W1sLBAXTvkOmsWOCApv0nH87FKSVICfm69XpM5FWbQU=; b=pO7HnZRcXisHTrLpy+eLj6If4P+7yLSPNGfxTOpXw2bBcfw/NOjTCvm20kDQ8fcyfq kqCJ1+g39dOJE/hgnsjZFRr/fxFs6+adAMYXKpAMahSiFVYqQrYtIBKhQ0QAJzYcxoXB +nSiNuMasMvTxUaFL/4NRFCLXjPSM7LVojDibMq2yauo27BHKQp9AEahXFQmbig6fsUW jn1UMhVI92LmBaDPrMw7n4jimPJGFObi+5oA8Kb37NAf51bjoME+RIR7qJDKTs59sjY/ nWBlqKoKjEA7obBQQ3EiLA1LMkoyQmBBmmDgv0/n4XOq8Z34r6iP6ETppyDhGo/agERG g/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NkpYz9Rv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q13si4346458plg.141.2022.02.14.11.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:17:00 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=NkpYz9Rv; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8E0026AA48; Mon, 14 Feb 2022 11:09:06 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344038AbiBNKDU (ORCPT + 99 others); Mon, 14 Feb 2022 05:03:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344287AbiBNJ7A (ORCPT ); Mon, 14 Feb 2022 04:59:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77FFC6AA73; Mon, 14 Feb 2022 01:35:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 375F0B80DCC; Mon, 14 Feb 2022 09:34:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FE35C340E9; Mon, 14 Feb 2022 09:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831289; bh=M/5dKUxzJXnKgyxX5TYZlhdq53UpEzROZzEaWXAB0Dc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkpYz9RvJj8gBzuRo9PNpLb4sg/6dd6FzIJyh8fUFpqPShMUFf1eu2Xmsjx4LaY4U GbnXYvd02vpn7Gi/EWoY1kjdzvsbu+TSCLgy1ko7IikozDn5+A5LQa5a84tgD4NNQU YUHhs3BShazVOt8TtI1BVFg97fN0GLiD3KM+JViQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Johannesmeyer , Jakob Koschel Subject: [PATCH 4.19 35/49] vt_ioctl: add array_index_nospec to VT_ACTIVATE Date: Mon, 14 Feb 2022 10:26:01 +0100 Message-Id: <20220214092449.447743582@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092448.285381753@linuxfoundation.org> References: <20220214092448.285381753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Jakob Koschel commit 28cb138f559f8c1a1395f5564f86b8bbee83631b upstream. 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 Link: https://lore.kernel.org/r/20220127144406.3589293-2-jakobkoschel@gmail.com Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/tty/vt/vt_ioctl.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -691,6 +691,7 @@ int vt_ioctl(struct tty_struct *tty, ret = -ENXIO; else { arg--; + arg = array_index_nospec(arg, MAX_NR_CONSOLES); console_lock(); ret = vc_allocate(arg); console_unlock();