1. 10 Jun, 2015 3 commits
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Shorten __audit_syscall_entry() args preparation · a92fde25
      Denys Vlasenko authored
      We use three MOVs to swap edx and ecx. We can use one XCHG
      instead.
      
      Expand the comments. It's difficult to keep track which arg#
      every register corresponds to, so spell it out.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433876051-26604-3-git-send-email-dvlasenk@redhat.com
      [ Expanded the comments some more. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a92fde25
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Explain reloading of registers after __audit_syscall_entry() · 1536bb46
      Denys Vlasenko authored
      Here it is not obvious why we load pt_regs->cx to %esi etc.
      Lets improve comments.
      
      Explain that here we combine two things: first, we reload
      registers since some of them are clobbered by the C function we
      just called; and we also convert 32-bit syscall params to 64-bit
      C ABI, because we are going to jump back to syscall dispatch
      code.
      
      Move reloading of 6th argument into the macro instead of having
      it after each of two macro invocations.
      
      No actual code changes here.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433876051-26604-2-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1536bb46
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Fix fallout from the R9 trick removal in the SYSCALL code · aee4b013
      Denys Vlasenko authored
      I put %ebp restoration code too late. Under strace, it is not
      reached and %ebp is not restored upon return to userspace.
      
      This is the fix. Run-tested.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433876051-26604-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      aee4b013
  2. 09 Jun, 2015 1 commit
  3. 08 Jun, 2015 8 commits
    • Ingo Molnar's avatar
      x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max · bace7117
      Ingo Molnar authored
      Brian Gerst noticed that I did a weird rename in the following commit:
      
         b2502b41 ("x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32")
      
      which renamed __NR_ia32_syscall_max to __NR_entry_INT80_compat_max.
      
      Now the original name was a misnomer, but the new one is a misnomer as well,
      as all the 32-bit compat syscall entry points (sysenter, syscall) share the
      system call table, not just the INT80 based one.
      
      Rename it to __NR_syscall_compat_max.
      Reported-by: default avatarBrian Gerst <brgerst@gmail.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bace7117
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Reinstate clearing of pt_regs->r8..r11 on EFAULT path · eb478544
      Denys Vlasenko authored
      I broke this recently when I changed pt_regs->r8..r11 clearing
      logic in INT 80 code path.
      
      There is a branch from SYSENTER/SYSCALL code to INT 80 code:
      if we fail to retrieve arg6, we return EFAULT. Before this
      patch, in this case we don't clear pt_regs->r8..r11.
      
      This patch fixes this. The resulting code is smaller and
      simpler.
      
      While at it, remove incorrect comment about syscall dispatching
      CALL insn: it does not use RIP-relative addressing form (the
      comment was meant to be "TODO: make this rip-relative", and
      morphed since then, dropping "TODO").
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433701470-28800-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      eb478544
    • Ingo Molnar's avatar
      x86/asm/entry/64: Clean up entry_64.S · 4d732138
      Ingo Molnar authored
      Make the 64-bit syscall entry code a bit more readable:
      
       - use consistent assembly coding style similar to the other entry_*.S files
      
       - remove old comments that are not true anymore
      
       - eliminate whitespace noise
      
       - use consistent vertical spacing
      
       - fix various comments
      
       - reorganize entry point generation tables to be more readable
      
      No code changed:
      
        # arch/x86/entry/entry_64.o:
      
         text    data     bss     dec     hex filename
        12282       0       0   12282    2ffa entry_64.o.before
        12282       0       0   12282    2ffa entry_64.o.after
      
      md5:
         cbab1f2d727a2a8a87618eeb79f391b7  entry_64.o.before.asm
         cbab1f2d727a2a8a87618eeb79f391b7  entry_64.o.after.asm
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4d732138
    • Ingo Molnar's avatar
      Merge branch 'x86/asm' into x86/core, to prepare for new patch · 9dda1658
      Ingo Molnar authored
      Collect all changes to arch/x86/entry/entry_64.S, before applying
      patch that changes most of the file.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      9dda1658
    • Ingo Molnar's avatar
      x86/asm/entry/32: Clean up entry_32.S · a49976d1
      Ingo Molnar authored
      Make the 32-bit syscall entry code a bit more readable:
      
       - use consistent assembly coding style similar to entry_64.S
      
       - remove old comments that are not true anymore
      
       - eliminate whitespace noise
      
       - use consistent vertical spacing
      
       - fix various comments
      
      No code changed:
      
        # arch/x86/entry/entry_32.o:
      
         text    data     bss     dec     hex filename
         6025       0       0    6025    1789 entry_32.o.before
         6025       0       0    6025    1789 entry_32.o.after
      
      md5:
         f3fa16b2b0dca804f052deb6b30ba6cb  entry_32.o.before.asm
         f3fa16b2b0dca804f052deb6b30ba6cb  entry_32.o.after.asm
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a49976d1
    • Ingo Molnar's avatar
      x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32 · b2502b41
      Ingo Molnar authored
      The 'system_call' entry points differ starkly between native 32-bit and 64-bit
      kernels: on 32-bit kernels it defines the INT 0x80 entry point, while on
      64-bit it's the SYSCALL entry point.
      
      This is pretty confusing when looking at generic code, and it also obscures
      the nature of the entry point at the assembly level.
      
      So unangle this by splitting the name into its two uses:
      
      	system_call (32) -> entry_INT80_32
      	system_call (64) -> entry_SYSCALL_64
      
      As per the generic naming scheme for x86 system call entry points:
      
      	entry_MNEMONIC_qualifier
      
      where 'qualifier' is one of _32, _64 or _compat.
      
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b2502b41
    • Ingo Molnar's avatar
      x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points:... · 4c8cd0c5
      Ingo Molnar authored
      x86/asm/entry: Untangle 'ia32_sysenter_target' into two entry points: entry_SYSENTER_32 and entry_SYSENTER_compat
      
      So the SYSENTER instruction is pretty quirky and it has different behavior
      depending on bitness and CPU maker.
      
      Yet we create a false sense of coherency by naming it 'ia32_sysenter_target'
      in both of the cases.
      
      Split the name into its two uses:
      
      	ia32_sysenter_target (32)    -> entry_SYSENTER_32
      	ia32_sysenter_target (64)    -> entry_SYSENTER_compat
      
      As per the generic naming scheme for x86 system call entry points:
      
      	entry_MNEMONIC_qualifier
      
      where 'qualifier' is one of _32, _64 or _compat.
      
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4c8cd0c5
    • Ingo Molnar's avatar
      x86/asm/entry: Rename compat syscall entry points · 2cd23553
      Ingo Molnar authored
      Rename the following system call entry points:
      
      	ia32_cstar_target       -> entry_SYSCALL_compat
      	ia32_syscall            -> entry_INT80_compat
      
      The generic naming scheme for x86 system call entry points is:
      
      	entry_MNEMONIC_qualifier
      
      where 'qualifier' is one of _32, _64 or _compat.
      
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2cd23553
  4. 07 Jun, 2015 7 commits
    • Borislav Petkov's avatar
      x86/uapi: Do not export <asm/msr-index.h> as part of the user API headers · b72e7464
      Borislav Petkov authored
      This header containing all MSRs and respective bit definitions
      got exported to userspace in conjunction with the big UAPI
      shuffle.
      
      But, it doesn't belong in the UAPI headers because userspace can
      do its own MSR defines and exporting them from the kernel blocks
      us from doing cleanups/renames in that header. Which is
      ridiculous - it is not kernel's job to export such a header and
      keep MSRs list and their names stable.
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1433436928-31903-19-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b72e7464
    • Ingo Molnar's avatar
      Merge branch 'x86/ras' into x86/core, to fix conflicts · c2f9b0af
      Ingo Molnar authored
      Conflicts:
      	arch/x86/include/asm/irq_vectors.h
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c2f9b0af
    • Borislav Petkov's avatar
      x86: Kill CONFIG_X86_HT · c8e56d20
      Borislav Petkov authored
      In talking to Aravind recently about making certain AMD topology
      attributes available to the MCE injection module, it seemed like
      that CONFIG_X86_HT thing is more or less superfluous. It is
      def_bool y, depends on SMP and gets enabled in the majority of
      .configs - distro and otherwise - out there.
      
      So let's kill it and make code behind it depend directly on SMP.
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Daniel Walter <dwalter@google.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Igor Mammedov <imammedo@redhat.com>
      Cc: Jacob Shin <jacob.w.shin@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1433436928-31903-18-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c8e56d20
    • Ashok Raj's avatar
      x86/mce: Handle Local MCE events · 243d657e
      Ashok Raj authored
      Add the necessary changes to do_machine_check() to be able to
      process MCEs signaled as local MCEs. Typically, only recoverable
      errors (SRAR type) will be Signaled as LMCE. The architecture
      does not restrict to only those errors, however.
      
      When errors are signaled as LMCE, there is no need for the MCE
      handler to perform rendezvous with other logical processors
      unlike earlier processors that would broadcast machine check
      errors.
      Signed-off-by: default avatarAshok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/1433436928-31903-17-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      243d657e
    • Ashok Raj's avatar
      x86/mce: Add infrastructure to support Local MCE · 88d53867
      Ashok Raj authored
      Initialize and prepare for handling LMCEs. Add a boot-time
      option to disable LMCEs.
      Signed-off-by: default avatarAshok Raj <ashok.raj@intel.com>
      [ Simplify stuff, align statements for better readability, reflow comments; kill
        unused lmce_clear(); save us an MSR write if LMCE is already enabled. ]
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/1433436928-31903-16-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      88d53867
    • Ashok Raj's avatar
      x86/mce: Add Local MCE definitions · bc12edb8
      Ashok Raj authored
      Add required definitions to support Local Machine Check
      Exceptions.
      
      Historically, machine check exceptions on Intel x86 processors
      have been broadcast to all logical processors in the system.
      Upcoming CPUs will support an opt-in mechanism to request some
      machine check exceptions be delivered to a single logical
      processor experiencing the fault.
      
      See http://www.intel.com/sdm Volume 3, System Programming Guide,
      chapter 15 for more information on MSRs and documentation on
      Local MCE.
      Signed-off-by: default avatarAshok Raj <ashok.raj@intel.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-edac <linux-edac@vger.kernel.org>
      Link: http://lkml.kernel.org/r/1433436928-31903-15-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      bc12edb8
    • Ingo Molnar's avatar
      x86/asm/entry/64/compat: Rename ia32entry.S -> entry_64_compat.S · 138bd56a
      Ingo Molnar authored
      So we now have the following system entry code related
      files, which define the following system call instruction
      and other entry paths:
      
         entry_32.S            # 32-bit binaries on 32-bit kernels
         entry_64.S            # 64-bit binaries on 64-bit kernels
         entry_64_compat.S	 # 32-bit binaries on 64-bit kernels
      
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      138bd56a
  5. 05 Jun, 2015 9 commits
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Remove unnecessary optimization in stub32_clone · 7a5a9824
      Denys Vlasenko authored
      Really swap arguments #4 and #5 in stub32_clone instead of
      "optimizing" it into a move.
      
      Yes, tls_val is currently unused. Yes, on some CPUs XCHG is a
      little bit more expensive than MOV. But a cycle or two on an
      expensive syscall like clone() is way below noise floor, and
      this optimization is simply not worth the obfuscation of logic.
      
      [ There's also ongoing work on the clone() ABI by Josh Triplett
        that will depend on this change later on. ]
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433339930-20880-2-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      7a5a9824
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Explain the stub32_clone logic · 5cdc683b
      Denys Vlasenko authored
      The reason for copying of %r8 to %rcx is quite non-obvious.
      Add a comment which explains why it is done.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433339930-20880-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5cdc683b
    • Ingo Molnar's avatar
      x86/asm/entry/32: Improve code readability · 54ad726c
      Ingo Molnar authored
      Make the 64-bit compat 32-bit syscall entry code a bit more readable:
      
       - eliminate whitespace noise
      
       - use consistent vertical spacing
      
       - use consistent assembly coding style similar to entry_64.S
      
       - fix various comments
      
      No code changed:
      
      arch/x86/entry/ia32entry.o:
      
         text	   data	    bss	    dec	    hex	filename
         1391	      0	      0	   1391	    56f	ia32entry.o.before
         1391	      0	      0	   1391	    56f	ia32entry.o.after
      
      md5:
         f28501dcc366e68b557313942c6496d6  ia32entry.o.before.asm
         f28501dcc366e68b557313942c6496d6  ia32entry.o.after.asm
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      54ad726c
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Do not use R9 in SYSCALL32 entry point · 53e9accf
      Denys Vlasenko authored
      SYSENTER and SYSCALL 32-bit entry points differ in handling of
      arg2 and arg6.
      
      SYSENTER:
       * ecx  arg2
       * ebp  user stack
       * 0(%ebp) arg6
      
      SYSCALL:
       * ebp  arg2
       * esp  user stack
       * 0(%esp) arg6
      
      Sysenter code loads 0(%ebp) to %ebp right away.
      (This destroys %ebp. It means we do not preserve it on return.
      It's not causing problems since userspace VDSO code does not
      depend on it, and SYSENTER insn can't be sanely used outside of
      VDSO).
      
      Syscall code loads 0(%ebp) to %r9. This allows to eliminate one
      MOV insn (r9 is a register where arg6 should be for 64-bit ABI),
      but on audit/ptrace code paths this requires juggling of r9 and
      ebp: (1) ptrace expects arg6 to be in pt_regs->bp;
      (2) r9 is callee-clobbered register and needs to be
      saved/restored     around calls to C functions.
      
      This patch changes syscall code to load 0(%ebp) to %ebp, making
      it more similar to sysenter code. It's a bit smaller:
      
         text    data     bss     dec     hex filename
         1407       0       0    1407     57f ia32entry.o.before
         1391       0       0    1391     56f ia32entry.o
      
      To preserve ABI compat, we restore ebp on exit.
      
      Run-tested.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433336169-18964-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      53e9accf
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Open-code LOAD_ARGS32 · 73cbf687
      Denys Vlasenko authored
      This macro is small, has only three callsites, and one of them
      is slightly different using a conditional parameter.
      
      A few saved lines aren't worth the resulting obfuscation.
      
      Generated machine code is identical.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433271842-9139-2-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      73cbf687
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Open-code CLEAR_RREGS · ef0cd5dc
      Denys Vlasenko authored
      This macro is small, has only four callsites, and one of them is
      slightly different using a conditional parameter.
      
      A few saved lines aren't worth the resulting obfuscation.
      
      Generated machine code is identical.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      [ Added comments. ]
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433271842-9139-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ef0cd5dc
    • Denys Vlasenko's avatar
      x86/asm/entry/32: Simplify the zeroing of pt_regs->r8..r11 in the int80 code path · 61b1e3e7
      Denys Vlasenko authored
      32-bit syscall entry points do not save the complete pt_regs struct,
      they leave some fields uninitialized. However, they must be
      careful to not leak uninitialized data in pt_regs->r8..r11 to
      ptrace users.
      
      CLEAR_RREGS macro is used to zero these fields out when needed.
      
      However, in the int80 code path this zeroing is unconditional.
      This patch simplifies it by storing zeroes there right away,
      when pt_regs is constructed on stack.
      
      This uses shorter instructions:
      
         text    data     bss     dec     hex filename
         1423       0       0    1423     58f ia32entry.o.before
         1407       0       0    1407     57f ia32entry.o
      
      Compile-tested.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1433266510-2938-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      61b1e3e7
    • Andy Lutomirski's avatar
      x86/asm/entry/64: Remove pointless jump to irq_return · 5ca6f70f
      Andy Lutomirski authored
      INTERRUPT_RETURN turns into a jmp instruction.  There's no need
      for extra indirection.
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: <linux-kernel@vger.kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/2f2318653dbad284a59311f13f08cea71298fd7c.1433449436.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5ca6f70f
    • Andy Lutomirski's avatar
      x86/asm/msr: Make wrmsrl_safe() a function · cf991de2
      Andy Lutomirski authored
      The wrmsrl_safe macro performs invalid shifts if the value
      argument is 32 bits.  This makes it unnecessarily awkward to
      write code that puts an unsigned long into an MSR.
      
      Convert it to a real inline function.
      
      For inspiration, see:
      
        7c74d5b7 ("x86/asm/entry/64: Fix MSR_IA32_SYSENTER_CS MSR value").
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: <linux-kernel@vger.kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      [ Applied small improvements. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      cf991de2
  6. 04 Jun, 2015 4 commits
    • Ingo Molnar's avatar
      x86/asm/entry: Move the vsyscall code to arch/x86/entry/vsyscall/ · 00398a00
      Ingo Molnar authored
      The vsyscall code is entry code too, so move it to arch/x86/entry/vsyscall/.
      
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      00398a00
    • Ingo Molnar's avatar
      x86/asm/entry: Move the arch/x86/syscalls/ definitions to arch/x86/entry/syscalls/ · 1f57d5d8
      Ingo Molnar authored
      The build time generated syscall definitions are entry code related, move
      them into the arch/x86/entry/ directory.
      
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1f57d5d8
    • Ingo Molnar's avatar
      x86/asm/entry: Move arch/x86/include/asm/calling.h to arch/x86/entry/ · d36f9479
      Ingo Molnar authored
      asm/calling.h is private to the entry code, make this more apparent
      by moving it to the new arch/x86/entry/ directory.
      
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d36f9479
    • Ingo Molnar's avatar
      x86/asm/entry: Move the 'thunk' functions to arch/x86/entry/ · e6b93f4e
      Ingo Molnar authored
      These are all calling x86 entry code functions, so move them close
      to other entry code.
      
      Change lib-y to obj-y: there's no real difference between the two
      as we don't really drop any of them during the linking stage, and
      obj-y is the more common approach for core kernel object code.
      
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e6b93f4e
  7. 03 Jun, 2015 7 commits
  8. 02 Jun, 2015 1 commit