Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5960073pxb; Mon, 14 Feb 2022 11:44:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrWoMK2dyvqENrwyl5ZMCj3jPremYl1P9jELIokyOv+WSQPfEYLi3xpfO/vPHPzxBEAhar X-Received: by 2002:a63:8349:: with SMTP id h70mr481877pge.345.1644867872098; Mon, 14 Feb 2022 11:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644867872; cv=none; d=google.com; s=arc-20160816; b=1Bz7U/xBYEeblDhEdaj35E0wrjP8KyvPDBfWyQzNfZdg2amnKqiqeoFyWldGh5QktA CkFcQS3VqotJX94h3w0e+CcbMgHdXDC5ZbBi1DtBsXJdKnsHUSP3jcMuxo5IZ/WdXIKd 7uVI5P2Dm5sDqyVKeuByjo7YHMXif6AaaD4fgob1FGI9hc93AWCksQBqkCWNtpkkHO5g PnLWOSsHeEgVXuDo2XAU+3VXBt5R5uGMPZD7EAzfFlMFdZY/cNFOnD+GQ28g1/2dXbAw Sfv+OCUxXWtSf2ZscbvjOoYtZKaWbKjkaJsyesh09C+gLduRh8Sb/x+E/Ez9oaTYixxS h5UA== 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=V4P7mrVb6tvjQWNeIKFfHb/IURYC480kLdrEYCNoqIc=; b=JslZYGrw7w8D406eY/a3qgrDS+/5WJiVzZZLBNlcMGNFZSOqhdd3sOBuxKjbgUkZpc iBMyZX4Qko4LAkJENjRntTxDzYKKopFBnNLvWqZbUvNoPtn2AvJ3yH92kU0asXuYXpGj 4qlkcnnEBubyB/K7Vr6R9VenMaZE/0JdKaBsNTkS3pX38CBn4/teAUkB+6EBEvnV8qFY QsDGvHU59kfFJot1h6BZNr8Ohqz8NuMd5Hn1VBcbfNoij6Vf2K8P7qv5g9Bjne70OdBi u7l8kswLohCZdt6/ENR9V9E59V2tlNO6BNxNhQay2WoENHO2fctrf+fAhQwHH3sBONNb Oe2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=R3eVUy8y; 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 y23si35203318pfa.375.2022.02.14.11.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:44:32 -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=R3eVUy8y; 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 538BBB1AB7; Mon, 14 Feb 2022 11:29:30 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344223AbiBNJ4B (ORCPT + 99 others); Mon, 14 Feb 2022 04:56:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344306AbiBNJvl (ORCPT ); Mon, 14 Feb 2022 04:51:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DED694B1; Mon, 14 Feb 2022 01:42:45 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D711E6120B; Mon, 14 Feb 2022 09:42:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4F1CC340E9; Mon, 14 Feb 2022 09:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831764; bh=IFK8yREHeBdWrhNcSpfKJd0kZcJEtrINbBXrpWbv/kA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R3eVUy8yPLA9OMXXLOFFBqXCM56+R0hqxi7W7QxUaOalDd3htFfiS60OGXl/f7BJZ Nx4ZecAzpqDF/8CJC/nUNPehBGlpXqB4LOkhMph3c3AsYFAp3MonMTQq+MtjA59Xim svmTCz5uyesI1CZUK2M+Js4kihH+FLJ50F5rE1Ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Johannesmeyer , Jakob Koschel Subject: [PATCH 5.10 088/116] vt_ioctl: add array_index_nospec to VT_ACTIVATE Date: Mon, 14 Feb 2022 10:26:27 +0100 Message-Id: <20220214092501.803818348@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@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 @@ -945,6 +945,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();