Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-24 Thread Andy Lutomirski
On Mon, Nov 21, 2016 at 1:21 PM, Linus Torvalds wrote: > On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: >> On 11/21/16 10:00, Linus Torvalds wrote: >>> >>> I'd much rather we go back to just making the "cs" entry explicitly >>> 16-bit, and

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-24 Thread Andy Lutomirski
On Mon, Nov 21, 2016 at 1:21 PM, Linus Torvalds wrote: > On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: >> On 11/21/16 10:00, Linus Torvalds wrote: >>> >>> I'd much rather we go back to just making the "cs" entry explicitly >>> 16-bit, and have a separate padding entry, the way we used

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-23 Thread Ingo Molnar
* Andy Lutomirski wrote: > The SDM says: > > If the source operand is an immediate of size less than the operand size, a > sign-extended value is pushed on the stack. If the source operand is a > segment > register (16 bits) and the operand size is 64-bits, a zero-

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-23 Thread Ingo Molnar
* Andy Lutomirski wrote: > The SDM says: > > If the source operand is an immediate of size less than the operand size, a > sign-extended value is pushed on the stack. If the source operand is a > segment > register (16 bits) and the operand size is 64-bits, a zero- extended value is >

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-22 Thread Andy Lutomirski
On Tue, Nov 22, 2016 at 12:30 AM, Ingo Molnar wrote: > > * Linus Torvalds wrote: > >> On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: >> > >> > So I have applied your fix that addresses the worst fallout directly: >> > >> >

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-22 Thread Andy Lutomirski
On Tue, Nov 22, 2016 at 12:30 AM, Ingo Molnar wrote: > > * Linus Torvalds wrote: > >> On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: >> > >> > So I have applied your fix that addresses the worst fallout directly: >> > >> > fc0e81b2bea0 x86/traps: Ignore high word of regs->cs in >> >

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-22 Thread Ingo Molnar
* Linus Torvalds wrote: > On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: > > > > So I have applied your fix that addresses the worst fallout directly: > > > > fc0e81b2bea0 x86/traps: Ignore high word of regs->cs in > >

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-22 Thread Ingo Molnar
* Linus Torvalds wrote: > On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: > > > > So I have applied your fix that addresses the worst fallout directly: > > > > fc0e81b2bea0 x86/traps: Ignore high word of regs->cs in > > early_fixup_exception() > > > > ... but otherwise we might be

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 2:17 PM, wrote: > > Now, segment loads have always ignored the top 32 bits; it's an issue when > examined by other kinds of code. Yes. Particularly ptrace and signal information copying. Need to make sure those things don't look at (or expose) high bits

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 2:17 PM, wrote: > > Now, segment loads have always ignored the top 32 bits; it's an issue when > examined by other kinds of code. Yes. Particularly ptrace and signal information copying. Need to make sure those things don't look at (or expose) high bits that may be

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread hpa
On November 21, 2016 1:21:35 PM PST, Linus Torvalds wrote: >On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: >> On 11/21/16 10:00, Linus Torvalds wrote: >>> >>> I'd much rather we go back to just making the "cs" entry explicitly >>> 16-bit,

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread hpa
On November 21, 2016 1:21:35 PM PST, Linus Torvalds wrote: >On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: >> On 11/21/16 10:00, Linus Torvalds wrote: >>> >>> I'd much rather we go back to just making the "cs" entry explicitly >>> 16-bit, and have a separate padding entry, the way we

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: > On 11/21/16 10:00, Linus Torvalds wrote: >> >> I'd much rather we go back to just making the "cs" entry explicitly >> 16-bit, and have a separate padding entry, the way we used to long >> long ago. >> > > I would agree 100%

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 10:26 AM, H. Peter Anvin wrote: > On 11/21/16 10:00, Linus Torvalds wrote: >> >> I'd much rather we go back to just making the "cs" entry explicitly >> 16-bit, and have a separate padding entry, the way we used to long >> long ago. >> > > I would agree 100% with this. We

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread H. Peter Anvin
On 11/21/16 10:00, Linus Torvalds wrote: > > Ugh. > > I'd much rather we go back to just making the "cs" entry explicitly > 16-bit, and have a separate padding entry, the way we used to long > long ago. > I would agree 100% with this. -hpa

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread H. Peter Anvin
On 11/21/16 10:00, Linus Torvalds wrote: > > Ugh. > > I'd much rather we go back to just making the "cs" entry explicitly > 16-bit, and have a separate padding entry, the way we used to long > long ago. > I would agree 100% with this. -hpa

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 7:58 AM, H. Peter Anvin wrote: > On 11/20/16 20:54, h...@zytor.com wrote: >> >> I believe i686+ writes zero, older CPUs leave unchanged. > > I should point out that, at least from my memory, the same applies to > instructions like "movl ". I can't even

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Mon, Nov 21, 2016 at 7:58 AM, H. Peter Anvin wrote: > On 11/20/16 20:54, h...@zytor.com wrote: >> >> I believe i686+ writes zero, older CPUs leave unchanged. > > I should point out that, at least from my memory, the same applies to > instructions like "movl ". I can't even remember for sure

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: > > So I have applied your fix that addresses the worst fallout directly: > > fc0e81b2bea0 x86/traps: Ignore high word of regs->cs in > early_fixup_exception() > > ... but otherwise we might be better off zeroing out the

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread Linus Torvalds
On Sun, Nov 20, 2016 at 11:13 PM, Ingo Molnar wrote: > > So I have applied your fix that addresses the worst fallout directly: > > fc0e81b2bea0 x86/traps: Ignore high word of regs->cs in > early_fixup_exception() > > ... but otherwise we might be better off zeroing out the high bits of segment

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread H. Peter Anvin
On 11/20/16 20:54, h...@zytor.com wrote: > > I believe i686+ writes zero, older CPUs leave unchanged. > I should point out that, at least from my memory, the same applies to instructions like "movl ". I can't even remember for sure how the behavior differs between "movl ," and "movl ,"; I'd

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-21 Thread H. Peter Anvin
On 11/20/16 20:54, h...@zytor.com wrote: > > I believe i686+ writes zero, older CPUs leave unchanged. > I should point out that, at least from my memory, the same applies to instructions like "movl ". I can't even remember for sure how the behavior differs between "movl ," and "movl ,"; I'd

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-20 Thread Ingo Molnar
* Andy Lutomirski wrote: > On Sat, Nov 19, 2016 at 6:11 PM, Brian Gerst wrote: > > On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: > >> This is a question for the old-timers here, since I can't find > >> anything resembling an

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-20 Thread Ingo Molnar
* Andy Lutomirski wrote: > On Sat, Nov 19, 2016 at 6:11 PM, Brian Gerst wrote: > > On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: > >> This is a question for the old-timers here, since I can't find > >> anything resembling an answer in the SDM. > >> > >> Suppose an exception happens

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-20 Thread hpa
On November 19, 2016 5:52:57 PM PST, Andy Lutomirski wrote: >This is a question for the old-timers here, since I can't find >anything resembling an answer in the SDM. > >Suppose an exception happens (#UD in this case, but I assume it >doesn't really matter). We're not in long

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-20 Thread hpa
On November 19, 2016 5:52:57 PM PST, Andy Lutomirski wrote: >This is a question for the old-timers here, since I can't find >anything resembling an answer in the SDM. > >Suppose an exception happens (#UD in this case, but I assume it >doesn't really matter). We're not in long mode, and the IDT

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Andy Lutomirski
On Sat, Nov 19, 2016 at 6:11 PM, Brian Gerst wrote: > On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: >> This is a question for the old-timers here, since I can't find >> anything resembling an answer in the SDM. >> >> Suppose an exception happens (#UD

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Andy Lutomirski
On Sat, Nov 19, 2016 at 6:11 PM, Brian Gerst wrote: > On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: >> This is a question for the old-timers here, since I can't find >> anything resembling an answer in the SDM. >> >> Suppose an exception happens (#UD in this case, but I assume it >>

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Brian Gerst
On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: > This is a question for the old-timers here, since I can't find > anything resembling an answer in the SDM. > > Suppose an exception happens (#UD in this case, but I assume it > doesn't really matter). We're not in long

Re: What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Brian Gerst
On Sat, Nov 19, 2016 at 8:52 PM, Andy Lutomirski wrote: > This is a question for the old-timers here, since I can't find > anything resembling an answer in the SDM. > > Suppose an exception happens (#UD in this case, but I assume it > doesn't really matter). We're not in long mode, and the IDT

What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Andy Lutomirski
This is a question for the old-timers here, since I can't find anything resembling an answer in the SDM. Suppose an exception happens (#UD in this case, but I assume it doesn't really matter). We're not in long mode, and the IDT is set up to deliver to a normal 32-bit kernel code segment. We're

What exactly do 32-bit x86 exceptions push on the stack in the CS slot?

2016-11-19 Thread Andy Lutomirski
This is a question for the old-timers here, since I can't find anything resembling an answer in the SDM. Suppose an exception happens (#UD in this case, but I assume it doesn't really matter). We're not in long mode, and the IDT is set up to deliver to a normal 32-bit kernel code segment. We're