Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-09 Thread Thomas Gleixner
On Sun, 7 Jul 2019, Thomas Gleixner wrote: > On Fri, 5 Jul 2019, Paolo Bonzini wrote: > > On 05/07/19 22:25, Thomas Gleixner wrote: > > > The more interesting question is whether this is all relevant. If I > > > understood the issue correctly then this is mitigated by proper interrupt > > >

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-07 Thread Thomas Gleixner
On Fri, 5 Jul 2019, Paolo Bonzini wrote: > On 05/07/19 22:25, Thomas Gleixner wrote: > > The more interesting question is whether this is all relevant. If I > > understood the issue correctly then this is mitigated by proper interrupt > > remapping. > > Yes, and for Linux we're good I think.

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-07 Thread Thomas Gleixner
On Fri, 5 Jul 2019, Andy Lutomirski wrote: > On Fri, Jul 5, 2019 at 1:36 PM Thomas Gleixner wrote: > > No. We can map the APIC into the user space visible page tables for PTI > > without compromising the PTI isolation and it can be read very early on > > before SWAPGS. All you need is a register

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andrew Cooper
On 05/07/2019 21:49, Paolo Bonzini wrote: > On 05/07/19 22:25, Thomas Gleixner wrote: >> In practice, this makes Linux vulnerable to CVE-2011-1898 / XSA-3, which >> I'm disappointed to see wasn't shared with other software vendors at the >> time. > Oh, that brings back memories. At the time I was

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Paolo Bonzini
On 05/07/19 22:25, Thomas Gleixner wrote: > In practice, this makes Linux vulnerable to CVE-2011-1898 / XSA-3, which > I'm disappointed to see wasn't shared with other software vendors at the > time. Oh, that brings back memories. At the time I was working on Xen, so I remember that CVE. IIRC

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andrew Cooper
On 05/07/2019 20:19, Nadav Amit wrote: >> On Jul 5, 2019, at 8:47 AM, Andrew Cooper wrote: >> >> On 04/07/2019 16:51, Thomas Gleixner wrote: >>> 2) The loop termination logic is interesting at best. >>> >>> If the machine has no TSC or cpu_khz is not known yet it tries 1 >>> million

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andy Lutomirski
On Fri, Jul 5, 2019 at 1:36 PM Thomas Gleixner wrote: > > On Fri, 5 Jul 2019, Andy Lutomirski wrote: > > On Fri, Jul 5, 2019 at 8:47 AM Andrew Cooper > > wrote: > > > Because TPR is 0, an incoming IPI can trigger #AC, #CP, #VC or #SX > > > without an error code on the stack, which results in a

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andy Lutomirski
On Fri, Jul 5, 2019 at 1:25 PM Thomas Gleixner wrote: > > Andrew, > > > > > These can be addressed by setting TPR to 0x10, which will inhibit > > Right, that's easy and obvious. > This boots: diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 177aa8ef2afa..5257c40bde6c

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Thomas Gleixner
On Fri, 5 Jul 2019, Andy Lutomirski wrote: > On Fri, Jul 5, 2019 at 8:47 AM Andrew Cooper > wrote: > > Because TPR is 0, an incoming IPI can trigger #AC, #CP, #VC or #SX > > without an error code on the stack, which results in a corrupt pt_regs > > in the exception handler, and a stack underflow

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Thomas Gleixner
Andrew, On Fri, 5 Jul 2019, Andrew Cooper wrote: > On 04/07/2019 16:51, Thomas Gleixner wrote: > > 2) The loop termination logic is interesting at best. > > > > If the machine has no TSC or cpu_khz is not known yet it tries 1 > > million times to ack stale IRR/ISR bits. What? > > > >

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andrew Cooper
On 05/07/2019 20:06, Andy Lutomirski wrote: > On Fri, Jul 5, 2019 at 8:47 AM Andrew Cooper > wrote: >> On 04/07/2019 16:51, Thomas Gleixner wrote: >>> 2) The loop termination logic is interesting at best. >>> >>> If the machine has no TSC or cpu_khz is not known yet it tries 1 >>>

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Nadav Amit
> On Jul 5, 2019, at 8:47 AM, Andrew Cooper wrote: > > On 04/07/2019 16:51, Thomas Gleixner wrote: >> 2) The loop termination logic is interesting at best. >> >> If the machine has no TSC or cpu_khz is not known yet it tries 1 >> million times to ack stale IRR/ISR bits. What? >> >>

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andy Lutomirski
On Fri, Jul 5, 2019 at 8:47 AM Andrew Cooper wrote: > > On 04/07/2019 16:51, Thomas Gleixner wrote: > > 2) The loop termination logic is interesting at best. > > > > If the machine has no TSC or cpu_khz is not known yet it tries 1 > > million times to ack stale IRR/ISR bits. What? > >

Re: [patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-05 Thread Andrew Cooper
On 04/07/2019 16:51, Thomas Gleixner wrote: > 2) The loop termination logic is interesting at best. > > If the machine has no TSC or cpu_khz is not known yet it tries 1 > million times to ack stale IRR/ISR bits. What? > > With TSC it uses the TSC to calculate the loop termination.

[patch V2 04/25] x86/apic: Make apic_pending_intr_clear() more robust

2019-07-04 Thread Thomas Gleixner
In course of developing shorthand based IPI support issues with the function which tries to clear eventually pending ISR bits in the local APIC were observed. 1) O-day testing triggered the WARN_ON() in apic_pending_intr_clear(). This warning is emitted when the function fails to clear