1. 08 Oct, 2018 11 commits
    • Ingo Molnar's avatar
      x86/fsgsbase/64: Clean up various details · ec3a9418
      Ingo Molnar authored
      So:
      
       - use 'extern' consistently for APIs
      
       - fix weird header guard
      
       - clarify code comments
      
       - reorder APIs by type
      
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/1537312139-5580-2-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ec3a9418
    • Ingo Molnar's avatar
      x86/segments: Introduce the 'CPUNODE' naming to better document the segment limit CPU/node NR trick · 22245bdf
      Ingo Molnar authored
      We have a special segment descriptor entry in the GDT, whose sole purpose is to
      encode the CPU and node numbers in its limit (size) field. There are user-space
      instructions that allow the reading of the limit field, which gives us a really
      fast way to read the CPU and node IDs from the vDSO for example.
      
      But the naming of related functionality does not make this clear, at all:
      
      	VDSO_CPU_SIZE
      	VDSO_CPU_MASK
      	__CPU_NUMBER_SEG
      	GDT_ENTRY_CPU_NUMBER
      	vdso_encode_cpu_node
      	vdso_read_cpu_node
      
      There's a number of problems:
      
       - The 'VDSO_CPU_SIZE' doesn't really make it clear that these are number
         of bits, nor does it make it clear which 'CPU' this refers to, i.e.
         that this is about a GDT entry whose limit encodes the CPU and node number.
      
       - Furthermore, the 'CPU_NUMBER' naming is actively misleading as well,
         because the segment limit encodes not just the CPU number but the
         node ID as well ...
      
      So use a better nomenclature all around: name everything related to this trick
      as 'CPUNODE', to make it clear that this is something special, and add
      _BITS to make it clear that these are number of bits, and propagate this to
      every affected name:
      
      	VDSO_CPU_SIZE         =>  VDSO_CPUNODE_BITS
      	VDSO_CPU_MASK         =>  VDSO_CPUNODE_MASK
      	__CPU_NUMBER_SEG      =>  __CPUNODE_SEG
      	GDT_ENTRY_CPU_NUMBER  =>  GDT_ENTRY_CPUNODE
      	vdso_encode_cpu_node  =>  vdso_encode_cpunode
      	vdso_read_cpu_node    =>  vdso_read_cpunode
      
      This, beyond being less confusing, also makes it easier to grep for all related
      functionality:
      
        $ git grep -i cpunode arch/x86
      
      Also, while at it, fix "return is not a function" style sloppiness in vdso_encode_cpunode().
      
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Chang S. Bae <chang.seok.bae@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/1537312139-5580-2-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      22245bdf
    • Chang S. Bae's avatar
      x86/vdso: Initialize the CPU/node NR segment descriptor earlier · b2e2ba57
      Chang S. Bae authored
      Currently the CPU/node NR segment descriptor (GDT_ENTRY_CPU_NUMBER) is
      initialized relatively late during CPU init, from the vCPU code, which
      has a number of disadvantages, such as hotplug CPU notifiers and SMP
      cross-calls.
      
      Instead just initialize it much earlier, directly in cpu_init().
      
      This reduces complexity and increases robustness.
      
      [ mingo: Wrote new changelog. ]
      Suggested-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Suggested-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1537312139-5580-9-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b2e2ba57
    • Chang S. Bae's avatar
      x86/vdso: Introduce helper functions for CPU and node number · ffebbaed
      Chang S. Bae authored
      Clean up the CPU/node number related code a bit, to make it more apparent
      how we are encoding/extracting the CPU and node fields from the
      segment limit.
      
      No change in functionality intended.
      
      [ mingo: Wrote new changelog. ]
      Suggested-by: default avatarAndy Lutomirski <luto@kernel.org>
      Suggested-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Link: http://lkml.kernel.org/r/1537312139-5580-8-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ffebbaed
    • Chang S. Bae's avatar
      x86/segments/64: Rename the GDT PER_CPU entry to CPU_NUMBER · c4755613
      Chang S. Bae authored
      The old 'per CPU' naming was misleading: 64-bit kernels don't use this
      GDT entry for per CPU data, but to store the CPU (and node) ID.
      
      [ mingo: Wrote new changelog. ]
      Suggested-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Link: http://lkml.kernel.org/r/1537312139-5580-7-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c4755613
    • Chang S. Bae's avatar
      x86/fsgsbase/64: Factor out FS/GS segment loading from __switch_to() · f4550b52
      Chang S. Bae authored
      Instead of open coding the calls to load_seg_legacy(), introduce
      x86_fsgsbase_load() to load FS/GS segments.
      
      This makes it more explicit that this is part of FSGSBASE functionality,
      and the new helper can be updated when FSGSBASE instructions are enabled.
      
      [ mingo: Wrote new changelog. ]
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarAndy Lutomirski <luto@kernel.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Link: http://lkml.kernel.org/r/1537312139-5580-6-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f4550b52
    • Chang S. Bae's avatar
      x86/fsgsbase/64: Convert the ELF core dump code to the new FSGSBASE helpers · 824eea38
      Chang S. Bae authored
      Replace open-coded rdmsr()'s with their <asm/fsgsbase.h> API
      counterparts.
      
      No change in functionality intended.
      
      [ mingo: Wrote new changelog. ]
      
      Based-on-code-from: Andy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Reviewed-by: default avatarAndi Kleen <ak@linux.intel.com>
      Reviewed-by: default avatarAndy Lutomirski <luto@kernel.org>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Link: http://lkml.kernel.org/r/1537312139-5580-5-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      824eea38
    • Chang S. Bae's avatar
      x86/fsgsbase/64: Make ptrace use the new FS/GS base helpers · e696c231
      Chang S. Bae authored
      Use the new FS/GS base helper functions in <asm/fsgsbase.h> in the platform
      specific ptrace implementation of the following APIs:
      
        PTRACE_ARCH_PRCTL,
        PTRACE_SETREG,
        PTRACE_GETREG,
        etc.
      
      The fsgsbase code is more abstracted out this way and the FS/GS-update
      mechanism will be easier to change this way.
      
      [ mingo: Wrote new changelog. ]
      
      Based-on-code-from: Andy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.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: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1537312139-5580-4-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e696c231
    • Chang S. Bae's avatar
      x86/fsgsbase/64: Introduce FS/GS base helper functions · b1378a56
      Chang S. Bae authored
      Introduce FS/GS base access functionality via <asm/fsgsbase.h>,
      not yet used by anything directly.
      
      Factor out task_seg_base() from x86/ptrace.c and rename it to
      x86_fsgsbase_read_task() to make it part of the new helpers.
      
      This will allow us to enhance FSGSBASE support and eventually enable
      the FSBASE/GSBASE instructions.
      
      An "inactive" GS base refers to a base saved at kernel entry
      and being part of an inactive, non-running/stopped user-task.
      (The typical ptrace model.)
      
      Here are the new functions:
      
        x86_fsbase_read_task()
        x86_gsbase_read_task()
        x86_fsbase_write_task()
        x86_gsbase_write_task()
        x86_fsbase_read_cpu()
        x86_fsbase_write_cpu()
        x86_gsbase_read_cpu_inactive()
        x86_gsbase_write_cpu_inactive()
      
      As an advantage of the unified namespace we can now see all FS/GSBASE
      API use in the kernel via the following 'git grep' pattern:
      
        $ git grep x86_.*sbase
      
      [ mingo: Wrote new changelog. ]
      
      Based-on-code-from: Andy Lutomirski <luto@kernel.org>
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.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: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1537312139-5580-3-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b1378a56
    • Andy Lutomirski's avatar
      x86/fsgsbase/64: Fix ptrace() to read the FS/GS base accurately · 07e1d88a
      Andy Lutomirski authored
      On 64-bit kernels ptrace can read the FS/GS base using the register access
      APIs (PTRACE_PEEKUSER, etc.) or PTRACE_ARCH_PRCTL.
      
      Make both of these mechanisms return the actual FS/GS base.
      
      This will improve debuggability by providing the correct information
      to ptracer such as GDB.
      
      [ chang: Rebased and revised patch description. ]
      [ mingo: Revised the changelog some more. ]
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarChang S. Bae <chang.seok.bae@intel.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Markus T Metzger <markus.t.metzger@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1537312139-5580-2-git-send-email-chang.seok.bae@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      07e1d88a
    • Ingo Molnar's avatar
      edfbeecd
  2. 07 Oct, 2018 6 commits
  3. 06 Oct, 2018 1 commit
    • Greg Kroah-Hartman's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · c1d84a1b
      Greg Kroah-Hartman authored
      Dave writes:
        "Networking fixes:
      
        1) Fix truncation of 32-bit right shift in bpf, from Jann Horn.
      
        2) Fix memory leak in wireless wext compat, from Stefan Seyfried.
      
        3) Use after free in cfg80211's reg_process_hint(), from Yu Zhao.
      
        4) Need to cancel pending work when unbinding in smsc75xx otherwise
           we oops, also from Yu Zhao.
      
        5) Don't allow enslaving a team device to itself, from Ido Schimmel.
      
        6) Fix backwards compat with older userspace for rtnetlink FDB dumps.
           From Mauricio Faria.
      
        7) Add validation of tc policy netlink attributes, from David Ahern.
      
        8) Fix RCU locking in rawv6_send_hdrinc(), from Wei Wang."
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
        net: mvpp2: Extract the correct ethtype from the skb for tx csum offload
        ipv6: take rcu lock in rawv6_send_hdrinc()
        net: sched: Add policy validation for tc attributes
        rtnetlink: fix rtnl_fdb_dump() for ndmsg header
        yam: fix a missing-check bug
        net: bpfilter: Fix type cast and pointer warnings
        net: cxgb3_main: fix a missing-check bug
        bpf: 32-bit RSH verification must truncate input before the ALU op
        net: phy: phylink: fix SFP interface autodetection
        be2net: don't flip hw_features when VXLANs are added/deleted
        net/packet: fix packet drop as of virtio gso
        net: dsa: b53: Keep CPU port as tagged in all VLANs
        openvswitch: load NAT helper
        bnxt_en: get the reduced max_irqs by the ones used by RDMA
        bnxt_en: free hwrm resources, if driver probe fails.
        bnxt_en: Fix enables field in HWRM_QUEUE_COS2BW_CFG request
        bnxt_en: Fix VNIC reservations on the PF.
        team: Forbid enslaving team device to itself
        net/usb: cancel pending work when unbinding smsc75xx
        mlxsw: spectrum: Delete RIF when VLAN device is removed
        ...
      c1d84a1b
  4. 05 Oct, 2018 22 commits