1. 09 Jun, 2015 1 commit
  2. 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
  3. 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
  4. 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
  5. 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
  6. 03 Jun, 2015 7 commits
  7. 02 Jun, 2015 4 commits
    • Jan Beulich's avatar
      x86/asm/entry/64: Fold identical code paths · 2f63b9db
      Jan Beulich authored
      retint_kernel doesn't require %rcx to be pointing to thread info
      (anymore?), and the code on the two alternative paths is - not
      really surprisingly - identical.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Andy Lutomirski <luto@kernel.org>
      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/556C664F020000780007FB64@mail.emea.novell.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2f63b9db
    • Jan Beulich's avatar
      x86/asm/entry/64: Use negative immediates for stack adjustments · 2bf557ea
      Jan Beulich authored
      Doing so allows adjustments by 128 bytes (occurring for
      REMOVE_PT_GPREGS_FROM_STACK 8 uses) to be expressed with a
      single byte immediate.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      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/556C660F020000780007FB60@mail.emea.novell.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2bf557ea
    • Ingo Molnar's avatar
      x86/debug: Remove perpetually broken, unmaintainable dwarf annotations · 131484c8
      Ingo Molnar authored
      So the dwarf2 annotations in low level assembly code have
      become an increasing hindrance: unreadable, messy macros
      mixed into some of the most security sensitive code paths
      of the Linux kernel.
      
      These debug info annotations don't even buy the upstream
      kernel anything: dwarf driven stack unwinding has caused
      problems in the past so it's out of tree, and the upstream
      kernel only uses the much more robust framepointers based
      stack unwinding method.
      
      In addition to that there's a steady, slow bitrot going
      on with these annotations, requiring frequent fixups.
      There's no tooling and no functionality upstream that
      keeps it correct.
      
      So burn down the sick forest, allowing new, healthier growth:
      
         27 files changed, 350 insertions(+), 1101 deletions(-)
      
      Someone who has the willingness and time to do this
      properly can attempt to reintroduce dwarf debuginfo in x86
      assembly code plus dwarf unwinding from first principles,
      with the following conditions:
      
       - it should be maximally readable, and maximally low-key to
         'ordinary' code reading and maintenance.
      
       - find a build time method to insert dwarf annotations
         automatically in the most common cases, for pop/push
         instructions that manipulate the stack pointer. This could
         be done for example via a preprocessing step that just
         looks for common patterns - plus special annotations for
         the few cases where we want to depart from the default.
         We have hundreds of CFI annotations, so automating most of
         that makes sense.
      
       - it should come with build tooling checks that ensure that
         CFI annotations are sensible. We've seen such efforts from
         the framepointer side, and there's no reason it couldn't be
         done on the dwarf side.
      
      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: Frédéric Weisbecker <fweisbec@gmail.com
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jan Beulich <JBeulich@suse.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.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>
      131484c8
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · c46a024e
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Various VTI tunnel (mark handling, PMTU) bug fixes from Alexander
          Duyck and Steffen Klassert.
      
       2) Revert ethtool PHY query change, it wasn't correct.  The PHY address
          selected by the driver running the PHY to MAC connection decides
          what PHY address GET ethtool operations return information from.
      
       3) Fix handling of sequence number bits for encryption IV generation in
          ESP driver, from Herbert Xu.
      
       4) UDP can return -EAGAIN when we hit a bad checksum on receive, even
          when there are other packets in the receive queue which is wrong.
          Just respect the error returned from the generic socket recv
          datagram helper.  From Eric Dumazet.
      
       5) Fix BNA driver firmware loading on big-endian systems, from Ivan
          Vecera.
      
       6) Fix regression in that we were inheriting the congestion control of
          the listening socket for new connections, the intended behavior
          always was to use the default in this case.  From Neal Cardwell.
      
       7) Fix NULL deref in brcmfmac driver, from Arend van Spriel.
      
       8) OTP parsing fix in iwlwifi from Liad Kaufman.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
        vti6: Add pmtu handling to vti6_xmit.
        Revert "net: core: 'ethtool' issue with querying phy settings"
        bnx2x: Move statistics implementation into semaphores
        xen: netback: read hotplug script once at start of day.
        xen: netback: fix printf format string warning
        Revert "netfilter: ensure number of counters is >0 in do_replace()"
        net: dsa: Properly propagate errors from dsa_switch_setup_one
        tcp: fix child sockets to use system default congestion control if not set
        udp: fix behavior of wrong checksums
        sfc: free multiple Rx buffers when required
        bna: fix soft lock-up during firmware initialization failure
        bna: remove unreasonable iocpf timer start
        bna: fix firmware loading on big-endian machines
        bridge: fix br_multicast_query_expired() bug
        via-rhine: Resigning as maintainer
        brcmfmac: avoid null pointer access when brcmf_msgbuf_get_pktid() fails
        mac80211: Fix mac80211.h docbook comments
        iwlwifi: nvm: fix otp parsing in 8000 hw family
        iwlwifi: pcie: fix tracking of cmd_in_flight
        ip_vti/ip6_vti: Preserve skb->mark after rcv_cb call
        ...
      c46a024e