Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3701216ybv; Mon, 10 Feb 2020 04:59:38 -0800 (PST) X-Google-Smtp-Source: APXvYqx0OHkAoNphIGJKGLzi6Q/1RFl/lOFJ1tSH619clqT+QBkAkTVIex0Kev8oGL2a1XGj+Rxj X-Received: by 2002:a9d:67c9:: with SMTP id c9mr968293otn.67.1581339578812; Mon, 10 Feb 2020 04:59:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339578; cv=none; d=google.com; s=arc-20160816; b=S3hEP2XKFHQYT0Hv4UZ/ZNfAiSmh8Zs/WTqe5wWgUv9Eh9bHjnd6fIOkTnEWSMcxXq nwmx/4oZgaUPIg7PA4AdxT6UW4JmZF/8MMzQKV65rLGnwPqz31vgjdJmdcZO4qQhUek0 YAn23p29fb30SV1LcMwMsIJZA1fUf+tgRoNbzUAM4t5/NuGaNR7IFpAvQLcQNoM+5o6j q5deY9oz6dqd6l7NXiMQlQ+BHHaPNA71vBt+U2iSEGePufK4SruaAngSEP7RulfSIBdK q69IJxX/QZv9k3pVOEf07ZJw0Kw6Qrr0m7UopU6fTkIHrc5gwWXETLmUg4XOaayOx8cp Wrbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=i6ik9XWmycttO6WH0XxU+kTM5hDsIZc/dI+1VBsuqCc=; b=hoCtfYEmyjkmJO77Iclm5jwU1LUHBqYrM7pMh0Sd4x7CgZfBoBNI2KZ6VdYHqQQFfp Nw//Qrr7hh6u+PCTe2e6LnWnVShBtteOmIgliua0mXma6LEiuxOgWrb5GDfUk23x3R3Z Gg9FJE4L3jF3GLRJjAUCK1rFBksfJxxTa5ag8JisHGRp085aHiobeOval9Oil1iLj++4 b/GFyRvn2rwzwo9X2BFGF6bsBtAZNSpobCuQ0agOz9G5Xg5Fp4KB+NDJCcwOsRV4g4bK 9QENpee4K6Qf9oQK4nIAXtS+KbNL+bWxr2GeWdXdVXVksQ0el5nYosIWjfJdJhKoK4cU XgTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="DG/Zq7fm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si223456ots.317.2020.02.10.04.59.26; Mon, 10 Feb 2020 04:59:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="DG/Zq7fm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730359AbgBJM7Y (ORCPT + 99 others); Mon, 10 Feb 2020 07:59:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:42770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729911AbgBJMlK (ORCPT ); Mon, 10 Feb 2020 07:41:10 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA3682080C; Mon, 10 Feb 2020 12:41:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338469; bh=8os6H8DtanvHEZ70BPe9K7lodrlmiL+KbSO2NIDQA0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DG/Zq7fmZnpQYBCmeBALwAXvRbqsysKOZH5IPc0wMin6eErY4gP9/hikpZk2gglIW K6pYR41OzyfqQP42gFaT/MU6uRP9qx+0woHfql8lkKRK+RHM+wk+yG0KvIvJGD4mHJ Jd4sakxDrQ9v0bmgXiZoCiQz9+XPTsDOy/7qgvFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Finco , Marios Pomonis , Andrew Honig , Jim Mattson , Paolo Bonzini Subject: [PATCH 5.5 233/367] KVM: x86: Protect ioapic_write_indirect() from Spectre-v1/L1TF attacks Date: Mon, 10 Feb 2020 04:32:26 -0800 Message-Id: <20200210122445.722731428@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marios Pomonis commit 670564559ca35b439c8d8861fc399451ddf95137 upstream. This fixes a Spectre-v1/L1TF vulnerability in ioapic_write_indirect(). This function contains index computations based on the (attacker-controlled) IOREGSEL register. This patch depends on patch "KVM: x86: Protect ioapic_read_indirect() from Spectre-v1/L1TF attacks". Fixes: 70f93dae32ac ("KVM: Use temporary variable to shorten lines.") Signed-off-by: Nick Finco Signed-off-by: Marios Pomonis Reviewed-by: Andrew Honig Cc: stable@vger.kernel.org Reviewed-by: Jim Mattson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/ioapic.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c @@ -292,6 +292,7 @@ static void ioapic_write_indirect(struct if (index >= IOAPIC_NUM_PINS) return; + index = array_index_nospec(index, IOAPIC_NUM_PINS); e = &ioapic->redirtbl[index]; mask_before = e->fields.mask; /* Preserve read-only fields */