All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
	Brian Gerst <brgerst@gmail.com>, Andi Kleen <andi@firstfloor.org>,
	Andy Lutomirski <luto@kernel.org>
Subject: [PATCH 0/8] x86: A round of x86 segmentation improvements
Date: Tue, 26 Apr 2016 12:23:23 -0700	[thread overview]
Message-ID: <cover.1461698311.git.luto@kernel.org> (raw)

Hi all-

This is preparation for enabling FSGSBASE and fixing FS/GS switching
better than my last attempt.

It cleans up the code, fixes two more holes in X86_BUG_NULL_SEG
handling (loadsegment(fs, val) and load_gs_index(val) failure
handling), and makes set_thread_area behave in a well-defined
manner.

With these patches applied, modify_ldt should be the last remaining
way for a user thread to get its cached descriptors out of sync with
memory, except in the 64-bit FS/GS < 3 case.  I'll fix modify_ldt as
well, but those patches will come later.

I'm sending these now because they seem to be good improvements on
their own and it'll help avoid a monster patch series down the road.

Tested on x86_32 with and without lazy GS and on x86_64.

Andy Lutomirski (8):
  x86/asm: Stop depending on ptrace.h in alternative.h
  x86/asm: Make asm/alternative.h safe from assembly
  x86/segments/64: When loadsegment(fs, ...) fails, clear the base
  x86/segments/64: When load_gs_index fails, clear the base
  x86/arch_prctl/64: Remove FSBASE/GSBASE < 4G optimization
  x86/asm/64: Rename thread_struct's fs and gs to fsbase and gsbase
  x86/tls: Synchronize segment registers in set_thread_area
  selftests/x86/ldt_gdt: Test set_thread_area deletion of an active
    segment

 arch/x86/entry/entry_64.S             |   6 +
 arch/x86/include/asm/alternative.h    |  35 +----
 arch/x86/include/asm/elf.h            |   6 +-
 arch/x86/include/asm/kgdb.h           |   2 +
 arch/x86/include/asm/processor.h      |  11 +-
 arch/x86/include/asm/segment.h        |  49 +++++--
 arch/x86/include/asm/setup.h          |   1 +
 arch/x86/include/asm/text-patching.h  |  40 ++++++
 arch/x86/kernel/alternative.c         |   1 +
 arch/x86/kernel/cpu/common.c          |   2 +-
 arch/x86/kernel/jump_label.c          |   1 +
 arch/x86/kernel/kgdb.c                |   1 +
 arch/x86/kernel/kprobes/core.c        |   1 +
 arch/x86/kernel/kprobes/opt.c         |   1 +
 arch/x86/kernel/module.c              |   1 +
 arch/x86/kernel/process_64.c          |  97 ++++---------
 arch/x86/kernel/ptrace.c              |  48 ++-----
 arch/x86/kernel/tls.c                 |  42 ++++++
 arch/x86/kernel/traps.c               |   1 +
 arch/x86/kvm/svm.c                    |   2 +-
 arch/x86/mm/extable.c                 |  10 ++
 tools/testing/selftests/x86/ldt_gdt.c | 250 ++++++++++++++++++++++++++++++++++
 22 files changed, 446 insertions(+), 162 deletions(-)
 create mode 100644 arch/x86/include/asm/text-patching.h

-- 
2.5.5

             reply	other threads:[~2016-04-26 19:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26 19:23 Andy Lutomirski [this message]
2016-04-26 19:23 ` [PATCH 1/8] x86/asm: Stop depending on ptrace.h in alternative.h Andy Lutomirski
2016-04-29 10:48   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 2/8] x86/asm: Make asm/alternative.h safe from assembly Andy Lutomirski
2016-04-29 10:49   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 3/8] x86/segments/64: When loadsegment(fs, ...) fails, clear the base Andy Lutomirski
2016-04-29 10:49   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 4/8] x86/segments/64: When load_gs_index " Andy Lutomirski
2016-04-29 10:49   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 5/8] x86/arch_prctl/64: Remove FSBASE/GSBASE < 4G optimization Andy Lutomirski
2016-04-26 20:50   ` Andi Kleen
2016-04-26 22:33     ` Andy Lutomirski
2016-04-29 10:50   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 6/8] x86/asm/64: Rename thread_struct's fs and gs to fsbase and gsbase Andy Lutomirski
2016-04-29 10:50   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 7/8] x86/tls: Synchronize segment registers in set_thread_area Andy Lutomirski
2016-04-29 10:51   ` [tip:x86/asm] x86/tls: Synchronize segment registers in set_thread_area() tip-bot for Andy Lutomirski
2016-04-26 19:23 ` [PATCH 8/8] selftests/x86/ldt_gdt: Test set_thread_area deletion of an active segment Andy Lutomirski
2016-04-29 10:51   ` [tip:x86/asm] selftests/x86/ldt_gdt: Test set_thread_area() " tip-bot for Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1461698311.git.luto@kernel.org \
    --to=luto@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.