Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-31 Thread Boris Ostrovsky

On 07/31/2015 04:43 AM, Borislav Petkov wrote:

Hey Boris,

On Thu, Jul 30, 2015 at 01:18:20PM -0400, Boris Ostrovsky wrote:

Only V5, no extra changes.

Including running the ldt_gdt test?

Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

so which tests are you running exactly and where can I get them? Andy's
repo?


tools/testing/selftests/x86/ldt_gdt.c, which is patch 3/4 in Andy's series.

-boris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-31 Thread Borislav Petkov
Hey Boris,

On Thu, Jul 30, 2015 at 01:18:20PM -0400, Boris Ostrovsky wrote:
> >>Only V5, no extra changes.
> >Including running the ldt_gdt test?
> 
> Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

so which tests are you running exactly and where can I get them? Andy's
repo?

Thanks.

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-31 Thread Boris Ostrovsky

On 07/31/2015 04:43 AM, Borislav Petkov wrote:

Hey Boris,

On Thu, Jul 30, 2015 at 01:18:20PM -0400, Boris Ostrovsky wrote:

Only V5, no extra changes.

Including running the ldt_gdt test?

Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

so which tests are you running exactly and where can I get them? Andy's
repo?


tools/testing/selftests/x86/ldt_gdt.c, which is patch 3/4 in Andy's series.

-boris
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-31 Thread Borislav Petkov
Hey Boris,

On Thu, Jul 30, 2015 at 01:18:20PM -0400, Boris Ostrovsky wrote:
 Only V5, no extra changes.
 Including running the ldt_gdt test?
 
 Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

so which tests are you running exactly and where can I get them? Andy's
repo?

Thanks.

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/30/2015 01:06 PM, Andrew Cooper wrote:

On 30/07/15 17:31, Boris Ostrovsky wrote:

On 07/30/2015 12:12 PM, Andrew Cooper wrote:

On 30/07/15 17:05, Borislav Petkov wrote:

On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:

As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky 

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?


I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?


Only V5, no extra changes.

Including running the ldt_gdt test?


Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

Still, user-visible behavior changes.




And perhaps dropping aliases in xen_alloc_ldt() may be sufficient
since with that done we will only have one mapping so a subsequent
fault will have "correct" cr2 provided by the hypervisor (from your
earlier email it sounded that hypervisor may have been providing
incorrect cr2 if alias exists)

They are sufficient to fix the first of the two bugs, but the free side
still has no protection against a missing l2, unless I am missing
something in the rest of the series?


Without aliases a subsequent fault *will* fill correct l2, won't it?

-boris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Andrew Cooper
On 30/07/15 17:31, Boris Ostrovsky wrote:
> On 07/30/2015 12:12 PM, Andrew Cooper wrote:
>> On 30/07/15 17:05, Borislav Petkov wrote:
>>> On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
 As far as Xen guests are concerned,

 Tested-by: Boris Ostrovsky 
>>> Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
>>> debugging on the v4 thread? Or does that need more fixing?
>>>
>> I was going to say... This v5 pre-dates figuring out what was wrong with
>> 32bit Xen.  v5 1/4 is still susceptible.
>>
>> Boris: does your Tested-by cover v5 + proposed fix?
>>
>
> Only V5, no extra changes.

Including running the ldt_gdt test?

>
> And perhaps dropping aliases in xen_alloc_ldt() may be sufficient
> since with that done we will only have one mapping so a subsequent
> fault will have "correct" cr2 provided by the hypervisor (from your
> earlier email it sounded that hypervisor may have been providing
> incorrect cr2 if alias exists)

They are sufficient to fix the first of the two bugs, but the free side
still has no protection against a missing l2, unless I am missing
something in the rest of the series?

~Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/30/2015 12:12 PM, Andrew Cooper wrote:

On 30/07/15 17:05, Borislav Petkov wrote:

On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:

As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky 

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?


I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?



Only V5, no extra changes.

And perhaps dropping aliases in xen_alloc_ldt() may be sufficient since 
with that done we will only have one mapping so a subsequent fault will 
have "correct" cr2 provided by the hypervisor (from your earlier email 
it sounded that hypervisor may have been providing incorrect cr2 if 
alias exists)


-boris
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Andrew Cooper
On 30/07/15 17:05, Borislav Petkov wrote:
> On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
>> As far as Xen guests are concerned,
>>
>> Tested-by: Boris Ostrovsky 
> Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
> debugging on the v4 thread? Or does that need more fixing?
>

I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?

~Andrew
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Borislav Petkov
On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
> As far as Xen guests are concerned,
> 
> Tested-by: Boris Ostrovsky 

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/28/2015 01:29 AM, Andy Lutomirski wrote:

This is intended for x86/urgent.  Sorry for taking so long, but it
seemed nice to avoid breaking Xen.

This fixes the "dazed and confused" issue which was exposed by the
CVE-2015-5157 fix.  It's also probably a good general attack surface
reduction, and it replaces some scary code with IMO less scary code.

Also, servers and embedded systems should probably turn off modify_ldt.
This makes that possible.

Boris, could I get a Tested-by, assuming this works for you?


As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky 

But ldt_gdt_32 test segfaults on 64-bit kernels. Baremetal and virt. I 
thought it worked for me before but can't reproduce this with older 
patches. Does it work for you?



-boris




Willy and Kees: I left the config option alone.  The -tiny people will
like it, and we can always add a sysctl of some sort later.

Changes from v4:
  - Fix Xen even better (patch 1 is new).
  - Reorder the patches to make a little more sense.

Changes from v3:
  - Hopefully fixed Xen.
  - Fixed 32-bit test case on 32-bit native kernel.
  - Fix bogus vumnap for some LDT sizes.
  - Strengthen test case to check all LDT sizes (catches bogus vunmap).
  - Lots of cleanups, mostly from Borislav.
  - Simplify IPI code using on_each_cpu_mask.

Changes from v2:
  - Allocate ldt_struct and the LDT entries separately.  This should fix Xen.
  - Stop using write_ldt_entry, since I'm pretty sure it's unnecessary now
that we no longer mutate an in-use LDT.  (Xen people, can you check?)

Changes from v1:
  - The config option is new.
  - The test case is new.
  - Fixed a missing allocation failure check.
  - Fixed a use-after-free on fork().

Andy Lutomirski (4):
   x86/xen: Unmap aliases in xen_alloc_ldt and xen_free_ldt
   x86/ldt: Make modify_ldt synchronous
   selftests/x86, x86/ldt: Add a selftest for modify_ldt
   x86/ldt: Make modify_ldt optional

  arch/x86/Kconfig  |  17 ++
  arch/x86/include/asm/desc.h   |  15 -
  arch/x86/include/asm/mmu.h|   5 +-
  arch/x86/include/asm/mmu_context.h|  68 -
  arch/x86/kernel/Makefile  |   3 +-
  arch/x86/kernel/cpu/common.c  |   4 +-
  arch/x86/kernel/cpu/perf_event.c  |  16 +-
  arch/x86/kernel/ldt.c | 262 +
  arch/x86/kernel/process_64.c  |   6 +-
  arch/x86/kernel/step.c|   8 +-
  arch/x86/power/cpu.c  |   3 +-
  arch/x86/xen/enlighten.c  |  12 +
  kernel/sys_ni.c   |   1 +
  tools/testing/selftests/x86/Makefile  |   2 +-
  tools/testing/selftests/x86/ldt_gdt.c | 520 ++
  15 files changed, 787 insertions(+), 155 deletions(-)
  create mode 100644 tools/testing/selftests/x86/ldt_gdt.c



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Andrew Cooper
On 30/07/15 17:31, Boris Ostrovsky wrote:
 On 07/30/2015 12:12 PM, Andrew Cooper wrote:
 On 30/07/15 17:05, Borislav Petkov wrote:
 On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
 As far as Xen guests are concerned,

 Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com
 Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
 debugging on the v4 thread? Or does that need more fixing?

 I was going to say... This v5 pre-dates figuring out what was wrong with
 32bit Xen.  v5 1/4 is still susceptible.

 Boris: does your Tested-by cover v5 + proposed fix?


 Only V5, no extra changes.

Including running the ldt_gdt test?


 And perhaps dropping aliases in xen_alloc_ldt() may be sufficient
 since with that done we will only have one mapping so a subsequent
 fault will have correct cr2 provided by the hypervisor (from your
 earlier email it sounded that hypervisor may have been providing
 incorrect cr2 if alias exists)

They are sufficient to fix the first of the two bugs, but the free side
still has no protection against a missing l2, unless I am missing
something in the rest of the series?

~Andrew
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Borislav Petkov
On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
 As far as Xen guests are concerned,
 
 Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?

-- 
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Andrew Cooper
On 30/07/15 17:05, Borislav Petkov wrote:
 On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:
 As far as Xen guests are concerned,

 Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com
 Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
 debugging on the v4 thread? Or does that need more fixing?


I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?

~Andrew
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/28/2015 01:29 AM, Andy Lutomirski wrote:

This is intended for x86/urgent.  Sorry for taking so long, but it
seemed nice to avoid breaking Xen.

This fixes the dazed and confused issue which was exposed by the
CVE-2015-5157 fix.  It's also probably a good general attack surface
reduction, and it replaces some scary code with IMO less scary code.

Also, servers and embedded systems should probably turn off modify_ldt.
This makes that possible.

Boris, could I get a Tested-by, assuming this works for you?


As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com

But ldt_gdt_32 test segfaults on 64-bit kernels. Baremetal and virt. I 
thought it worked for me before but can't reproduce this with older 
patches. Does it work for you?



-boris




Willy and Kees: I left the config option alone.  The -tiny people will
like it, and we can always add a sysctl of some sort later.

Changes from v4:
  - Fix Xen even better (patch 1 is new).
  - Reorder the patches to make a little more sense.

Changes from v3:
  - Hopefully fixed Xen.
  - Fixed 32-bit test case on 32-bit native kernel.
  - Fix bogus vumnap for some LDT sizes.
  - Strengthen test case to check all LDT sizes (catches bogus vunmap).
  - Lots of cleanups, mostly from Borislav.
  - Simplify IPI code using on_each_cpu_mask.

Changes from v2:
  - Allocate ldt_struct and the LDT entries separately.  This should fix Xen.
  - Stop using write_ldt_entry, since I'm pretty sure it's unnecessary now
that we no longer mutate an in-use LDT.  (Xen people, can you check?)

Changes from v1:
  - The config option is new.
  - The test case is new.
  - Fixed a missing allocation failure check.
  - Fixed a use-after-free on fork().

Andy Lutomirski (4):
   x86/xen: Unmap aliases in xen_alloc_ldt and xen_free_ldt
   x86/ldt: Make modify_ldt synchronous
   selftests/x86, x86/ldt: Add a selftest for modify_ldt
   x86/ldt: Make modify_ldt optional

  arch/x86/Kconfig  |  17 ++
  arch/x86/include/asm/desc.h   |  15 -
  arch/x86/include/asm/mmu.h|   5 +-
  arch/x86/include/asm/mmu_context.h|  68 -
  arch/x86/kernel/Makefile  |   3 +-
  arch/x86/kernel/cpu/common.c  |   4 +-
  arch/x86/kernel/cpu/perf_event.c  |  16 +-
  arch/x86/kernel/ldt.c | 262 +
  arch/x86/kernel/process_64.c  |   6 +-
  arch/x86/kernel/step.c|   8 +-
  arch/x86/power/cpu.c  |   3 +-
  arch/x86/xen/enlighten.c  |  12 +
  kernel/sys_ni.c   |   1 +
  tools/testing/selftests/x86/Makefile  |   2 +-
  tools/testing/selftests/x86/ldt_gdt.c | 520 ++
  15 files changed, 787 insertions(+), 155 deletions(-)
  create mode 100644 tools/testing/selftests/x86/ldt_gdt.c



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/30/2015 12:12 PM, Andrew Cooper wrote:

On 30/07/15 17:05, Borislav Petkov wrote:

On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:

As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?


I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?



Only V5, no extra changes.

And perhaps dropping aliases in xen_alloc_ldt() may be sufficient since 
with that done we will only have one mapping so a subsequent fault will 
have correct cr2 provided by the hypervisor (from your earlier email 
it sounded that hypervisor may have been providing incorrect cr2 if 
alias exists)


-boris
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-30 Thread Boris Ostrovsky

On 07/30/2015 01:06 PM, Andrew Cooper wrote:

On 30/07/15 17:31, Boris Ostrovsky wrote:

On 07/30/2015 12:12 PM, Andrew Cooper wrote:

On 30/07/15 17:05, Borislav Petkov wrote:

On Thu, Jul 30, 2015 at 11:53:34AM -0400, Boris Ostrovsky wrote:

As far as Xen guests are concerned,

Tested-by: Boris Ostrovsky boris.ostrov...@oracle.com

Does that mean, this patch 1/4 fixes the 32bit issue you guys are still
debugging on the v4 thread? Or does that need more fixing?


I was going to say... This v5 pre-dates figuring out what was wrong with
32bit Xen.  v5 1/4 is still susceptible.

Boris: does your Tested-by cover v5 + proposed fix?


Only V5, no extra changes.

Including running the ldt_gdt test?


Yes, except that 32-on-64 doesn't work, but that's not Xen-specific.

Still, user-visible behavior changes.




And perhaps dropping aliases in xen_alloc_ldt() may be sufficient
since with that done we will only have one mapping so a subsequent
fault will have correct cr2 provided by the hypervisor (from your
earlier email it sounded that hypervisor may have been providing
incorrect cr2 if alias exists)

They are sufficient to fix the first of the two bugs, but the free side
still has no protection against a missing l2, unless I am missing
something in the rest of the series?


Without aliases a subsequent fault *will* fill correct l2, won't it?

-boris
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-27 Thread Andy Lutomirski
This is intended for x86/urgent.  Sorry for taking so long, but it
seemed nice to avoid breaking Xen.

This fixes the "dazed and confused" issue which was exposed by the
CVE-2015-5157 fix.  It's also probably a good general attack surface
reduction, and it replaces some scary code with IMO less scary code.

Also, servers and embedded systems should probably turn off modify_ldt.
This makes that possible.

Boris, could I get a Tested-by, assuming this works for you?

Willy and Kees: I left the config option alone.  The -tiny people will
like it, and we can always add a sysctl of some sort later.

Changes from v4:
 - Fix Xen even better (patch 1 is new).
 - Reorder the patches to make a little more sense.

Changes from v3:
 - Hopefully fixed Xen.
 - Fixed 32-bit test case on 32-bit native kernel.
 - Fix bogus vumnap for some LDT sizes.
 - Strengthen test case to check all LDT sizes (catches bogus vunmap).
 - Lots of cleanups, mostly from Borislav.
 - Simplify IPI code using on_each_cpu_mask.

Changes from v2:
 - Allocate ldt_struct and the LDT entries separately.  This should fix Xen.
 - Stop using write_ldt_entry, since I'm pretty sure it's unnecessary now
   that we no longer mutate an in-use LDT.  (Xen people, can you check?)

Changes from v1:
 - The config option is new.
 - The test case is new.
 - Fixed a missing allocation failure check.
 - Fixed a use-after-free on fork().

Andy Lutomirski (4):
  x86/xen: Unmap aliases in xen_alloc_ldt and xen_free_ldt
  x86/ldt: Make modify_ldt synchronous
  selftests/x86, x86/ldt: Add a selftest for modify_ldt
  x86/ldt: Make modify_ldt optional

 arch/x86/Kconfig  |  17 ++
 arch/x86/include/asm/desc.h   |  15 -
 arch/x86/include/asm/mmu.h|   5 +-
 arch/x86/include/asm/mmu_context.h|  68 -
 arch/x86/kernel/Makefile  |   3 +-
 arch/x86/kernel/cpu/common.c  |   4 +-
 arch/x86/kernel/cpu/perf_event.c  |  16 +-
 arch/x86/kernel/ldt.c | 262 +
 arch/x86/kernel/process_64.c  |   6 +-
 arch/x86/kernel/step.c|   8 +-
 arch/x86/power/cpu.c  |   3 +-
 arch/x86/xen/enlighten.c  |  12 +
 kernel/sys_ni.c   |   1 +
 tools/testing/selftests/x86/Makefile  |   2 +-
 tools/testing/selftests/x86/ldt_gdt.c | 520 ++
 15 files changed, 787 insertions(+), 155 deletions(-)
 create mode 100644 tools/testing/selftests/x86/ldt_gdt.c

-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 0/4] x86: modify_ldt improvement, test, and config option

2015-07-27 Thread Andy Lutomirski
This is intended for x86/urgent.  Sorry for taking so long, but it
seemed nice to avoid breaking Xen.

This fixes the dazed and confused issue which was exposed by the
CVE-2015-5157 fix.  It's also probably a good general attack surface
reduction, and it replaces some scary code with IMO less scary code.

Also, servers and embedded systems should probably turn off modify_ldt.
This makes that possible.

Boris, could I get a Tested-by, assuming this works for you?

Willy and Kees: I left the config option alone.  The -tiny people will
like it, and we can always add a sysctl of some sort later.

Changes from v4:
 - Fix Xen even better (patch 1 is new).
 - Reorder the patches to make a little more sense.

Changes from v3:
 - Hopefully fixed Xen.
 - Fixed 32-bit test case on 32-bit native kernel.
 - Fix bogus vumnap for some LDT sizes.
 - Strengthen test case to check all LDT sizes (catches bogus vunmap).
 - Lots of cleanups, mostly from Borislav.
 - Simplify IPI code using on_each_cpu_mask.

Changes from v2:
 - Allocate ldt_struct and the LDT entries separately.  This should fix Xen.
 - Stop using write_ldt_entry, since I'm pretty sure it's unnecessary now
   that we no longer mutate an in-use LDT.  (Xen people, can you check?)

Changes from v1:
 - The config option is new.
 - The test case is new.
 - Fixed a missing allocation failure check.
 - Fixed a use-after-free on fork().

Andy Lutomirski (4):
  x86/xen: Unmap aliases in xen_alloc_ldt and xen_free_ldt
  x86/ldt: Make modify_ldt synchronous
  selftests/x86, x86/ldt: Add a selftest for modify_ldt
  x86/ldt: Make modify_ldt optional

 arch/x86/Kconfig  |  17 ++
 arch/x86/include/asm/desc.h   |  15 -
 arch/x86/include/asm/mmu.h|   5 +-
 arch/x86/include/asm/mmu_context.h|  68 -
 arch/x86/kernel/Makefile  |   3 +-
 arch/x86/kernel/cpu/common.c  |   4 +-
 arch/x86/kernel/cpu/perf_event.c  |  16 +-
 arch/x86/kernel/ldt.c | 262 +
 arch/x86/kernel/process_64.c  |   6 +-
 arch/x86/kernel/step.c|   8 +-
 arch/x86/power/cpu.c  |   3 +-
 arch/x86/xen/enlighten.c  |  12 +
 kernel/sys_ni.c   |   1 +
 tools/testing/selftests/x86/Makefile  |   2 +-
 tools/testing/selftests/x86/ldt_gdt.c | 520 ++
 15 files changed, 787 insertions(+), 155 deletions(-)
 create mode 100644 tools/testing/selftests/x86/ldt_gdt.c

-- 
2.4.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/