[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1589984009.631316172@decadent.org.uk>
Date: Wed, 20 May 2020 15:14:45 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, Denis Kirjanov <kda@...ux-powerpc.org>,
"Paolo Bonzini" <pbonzini@...hat.com>,
"Andrew Honig" <ahonig@...gle.com>, "Nick Finco" <nifi@...gle.com>,
"Marios Pomonis" <pomonis@...gle.com>,
"Jim Mattson" <jmattson@...gle.com>
Subject: [PATCH 3.16 77/99] KVM: x86: Refactor picdev_write() to prevent
Spectre-v1/L1TF attacks
3.16.84-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marios Pomonis <pomonis@...gle.com>
commit 14e32321f3606e4b0970200b6e5e47ee6f1e6410 upstream.
This fixes a Spectre-v1/L1TF vulnerability in picdev_write().
It replaces index computations based on the (attacked-controlled) port
number with constants through a minor refactoring.
Fixes: 85f455f7ddbe ("KVM: Add support for in-kernel PIC emulation")
Signed-off-by: Nick Finco <nifi@...gle.com>
Signed-off-by: Marios Pomonis <pomonis@...gle.com>
Reviewed-by: Andrew Honig <ahonig@...gle.com>
Reviewed-by: Jim Mattson <jmattson@...gle.com>
Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
[bwh: Backported to 3.16: pic_{,un}lock() are called outside the switch]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -486,9 +486,11 @@ static int picdev_write(struct kvm_pic *
switch (addr) {
case 0x20:
case 0x21:
+ pic_ioport_write(&s->pics[0], addr, data);
+ break;
case 0xa0:
case 0xa1:
- pic_ioport_write(&s->pics[addr >> 7], addr, data);
+ pic_ioport_write(&s->pics[1], addr, data);
break;
case 0x4d0:
case 0x4d1:
Powered by blists - more mailing lists