All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] x86: modify_ldt improvement, test, and config option
@ 2015-07-22 19:23 Andy Lutomirski
  2015-07-22 19:23 ` [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous Andy Lutomirski
                   ` (5 more replies)
  0 siblings, 6 replies; 38+ messages in thread
From: Andy Lutomirski @ 2015-07-22 19:23 UTC (permalink / raw)
  To: Peter Zijlstra, Steven Rostedt
  Cc: security@kernel.org, X86 ML, Borislav Petkov, Sasha Levin,
	linux-kernel, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	Andrew Cooper, Jan Beulich, xen-devel, Andy Lutomirski

Here's v3.  It fixes the "dazed and confused" issue, I hope.  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.

Xen people, can you take a look at this?

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 (3):
  x86/ldt: Make modify_ldt synchronous
  x86/ldt: Make modify_ldt optional
  selftests/x86, x86/ldt: Add a selftest for modify_ldt

 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                 | 258 ++++++++++--------
 arch/x86/kernel/process_64.c          |   6 +-
 arch/x86/kernel/step.c                |   8 +-
 arch/x86/power/cpu.c                  |   3 +-
 kernel/sys_ni.c                       |   1 +
 tools/testing/selftests/x86/Makefile  |   2 +-
 tools/testing/selftests/x86/ldt_gdt.c | 492 ++++++++++++++++++++++++++++++++++
 14 files changed, 747 insertions(+), 151 deletions(-)
 create mode 100644 tools/testing/selftests/x86/ldt_gdt.c

-- 
2.4.3


^ permalink raw reply	[flat|nested] 38+ messages in thread
* [PATCH v3 0/3] x86: modify_ldt improvement, test, and config option
@ 2015-07-22 19:23 Andy Lutomirski
  0 siblings, 0 replies; 38+ messages in thread
From: Andy Lutomirski @ 2015-07-22 19:23 UTC (permalink / raw)
  To: Peter Zijlstra, Steven Rostedt
  Cc: security@kernel.org, Andy Lutomirski, Andrew Cooper, X86 ML,
	linux-kernel, xen-devel, Borislav Petkov, Jan Beulich,
	Sasha Levin, Boris Ostrovsky

Here's v3.  It fixes the "dazed and confused" issue, I hope.  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.

Xen people, can you take a look at this?

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 (3):
  x86/ldt: Make modify_ldt synchronous
  x86/ldt: Make modify_ldt optional
  selftests/x86, x86/ldt: Add a selftest for modify_ldt

 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                 | 258 ++++++++++--------
 arch/x86/kernel/process_64.c          |   6 +-
 arch/x86/kernel/step.c                |   8 +-
 arch/x86/power/cpu.c                  |   3 +-
 kernel/sys_ni.c                       |   1 +
 tools/testing/selftests/x86/Makefile  |   2 +-
 tools/testing/selftests/x86/ldt_gdt.c | 492 ++++++++++++++++++++++++++++++++++
 14 files changed, 747 insertions(+), 151 deletions(-)
 create mode 100644 tools/testing/selftests/x86/ldt_gdt.c

-- 
2.4.3

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2015-07-25  8:37 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 19:23 [PATCH v3 0/3] x86: modify_ldt improvement, test, and config option Andy Lutomirski
2015-07-22 19:23 ` [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous Andy Lutomirski
2015-07-22 19:23 ` Andy Lutomirski
2015-07-22 22:20   ` Boris Ostrovsky
2015-07-22 22:20   ` Boris Ostrovsky
2015-07-25  4:13     ` Boris Ostrovsky
2015-07-25  4:13     ` Boris Ostrovsky
2015-07-25  4:58       ` Andy Lutomirski
2015-07-25  4:58       ` Andy Lutomirski
2015-07-24  6:37   ` Borislav Petkov
2015-07-24  6:37   ` Borislav Petkov
2015-07-24 15:29   ` Borislav Petkov
2015-07-25  4:52     ` Andy Lutomirski
2015-07-25  4:52     ` Andy Lutomirski
2015-07-25  8:37       ` Borislav Petkov
2015-07-25  8:37       ` Borislav Petkov
2015-07-24 15:29   ` Borislav Petkov
2015-07-22 19:23 ` [PATCH v3 2/3] x86/ldt: Make modify_ldt optional Andy Lutomirski
2015-07-22 19:23 ` Andy Lutomirski
2015-07-23  7:13   ` Jan Beulich
2015-07-23  7:13   ` Jan Beulich
2015-07-23 10:24   ` Willy Tarreau
2015-07-23 23:36     ` Kees Cook
2015-07-23 23:36     ` Kees Cook
2015-07-23 23:40       ` Andy Lutomirski
2015-07-23 23:40       ` Andy Lutomirski
2015-07-23 23:58         ` Willy Tarreau
2015-07-23 23:58         ` Willy Tarreau
2015-07-24  0:09           ` Kees Cook
2015-07-24  7:24             ` Willy Tarreau
2015-07-24  7:48               ` Willy Tarreau
2015-07-24  7:48               ` Willy Tarreau
2015-07-24  7:24             ` Willy Tarreau
2015-07-24  0:09           ` Kees Cook
2015-07-23 10:24   ` Willy Tarreau
2015-07-22 19:23 ` [PATCH v3 3/3] selftests/x86, x86/ldt: Add a selftest for modify_ldt Andy Lutomirski
2015-07-22 19:23 ` Andy Lutomirski
  -- strict thread matches above, loose matches on Subject: below --
2015-07-22 19:23 [PATCH v3 0/3] x86: modify_ldt improvement, test, and config option Andy Lutomirski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.