1. 02 8月, 2018 3 次提交
    • K
      x86/boot/compressed/64: Validate trampoline placement against E820 · 1b3a6264
      Kirill A. Shutemov 提交于
      There were two report of boot failure cased by trampoline placed into
      a reserved memory region. It can happen on machines that don't report
      EBDA correctly.
      
      Fix the problem by re-validating the found address against the E820 table.
      If the address is in a reserved area, find the next usable region below the
      initial address.
      
      Fixes: 3548e131 ("x86/boot/compressed/64: Find a place for 32-bit trampoline")
      Reported-by: NDmitry Malkin <d.malkin@real-time-systems.com>
      Reported-by: Nyouling 257 <youling257@gmail.com>
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Link: https://lkml.kernel.org/r/20180801133225.38121-1-kirill.shutemov@linux.intel.com
      1b3a6264
    • L
      mm: do not initialize TLB stack vma's with vma_init() · 8b11ec1b
      Linus Torvalds 提交于
      Commit 2c4541e2 ("mm: use vma_init() to initialize VMAs on stack and
      data segments") tried to initialize various left-over ad-hoc vma's
      "properly", but actually made things worse for the temporary vma's used
      for TLB flushing.
      
      vma_init() doesn't actually initialize all of the vma, just a few
      fields, so doing something like
      
         -       struct vm_area_struct vma = { .vm_mm = tlb->mm, };
         +       struct vm_area_struct vma;
         +
         +       vma_init(&vma, tlb->mm);
      
      was actually very bad: instead of having a nicely initialized vma with
      every field but "vm_mm" zeroed, you'd have an entirely uninitialized vma
      with only a couple of fields initialized.  And they weren't even fields
      that the code in question mostly cared about.
      
      The flush_tlb_range() function takes a "struct vma" rather than a
      "struct mm_struct", because a few architectures actually care about what
      kind of range it is - being able to only do an ITLB flush if it's a
      range that doesn't have data accesses enabled, for example.  And all the
      normal users already have the vma for doing the range invalidation.
      
      But a few people want to call flush_tlb_range() with a range they just
      made up, so they also end up using a made-up vma.  x86 just has a
      special "flush_tlb_mm_range()" function for this, but other
      architectures (arm and ia64) do the "use fake vma" thing instead, and
      thus got caught up in the vma_init() changes.
      
      At the same time, the TLB flushing code really doesn't care about most
      other fields in the vma, so vma_init() is just unnecessary and
      pointless.
      
      This fixes things by having an explicit "this is just an initializer for
      the TLB flush" initializer macro, which is used by the arm/arm64/ia64
      people who mis-use this interface with just a dummy vma.
      
      Fixes: 2c4541e2 ("mm: use vma_init() to initialize VMAs on stack and data segments")
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Hugh Dickins <hughd@google.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8b11ec1b
    • L
      ia64: mark special ia64 memory areas anonymous · ebad825c
      Linus Torvalds 提交于
      Commit bfd40eaf ("mm: fix vma_is_anonymous() false-positives") made
      newly allocated vma's have a dummy vm_ops field so that they wouldn't be
      mistaken for anonymous mappings, and if you wanted an anonymous vma you
      had to explicitly say so by calling "vma_set_anonymous()" on it.
      
      However, it missed the two special vmas that ia64 processes have: the
      register backing store and the NaT page.  So they wouldn't actually act
      like anonymous ranges, and page faults on them caused a SIGBUS rather
      than the creation of a new anon page in them.
      
      That obviously will make any ia64 binary very unhappy indeed, and the
      boot fails early.
      
      Fixes: bfd40eaf ("mm: fix vma_is_anonymous() false-positives")
      Reported-by: NTony Luck <tony.luck@intel.com>
      Cc: Kirill Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ebad825c
  2. 01 8月, 2018 2 次提交
    • F
      powerpc/64s/radix: Fix missing global invalidations when removing copro · cca19f0b
      Frederic Barrat 提交于
      With the optimizations for TLB invalidation from commit 0cef77c7
      ("powerpc/64s/radix: flush remote CPUs out of single-threaded
      mm_cpumask"), the scope of a TLBI (global vs. local) can now be
      influenced by the value of the 'copros' counter of the memory context.
      
      When calling mm_context_remove_copro(), the 'copros' counter is
      decremented first before flushing. It may have the unintended side
      effect of sending local TLBIs when we explicitly need global
      invalidations in this case. Thus breaking any nMMU user in a bad and
      unpredictable way.
      
      Fix it by flushing first, before updating the 'copros' counter, so
      that invalidations will be global.
      
      Fixes: 0cef77c7 ("powerpc/64s/radix: flush remote CPUs out of single-threaded mm_cpumask")
      Signed-off-by: NFrederic Barrat <fbarrat@linux.ibm.com>
      Reviewed-by: NNicholas Piggin <npiggin@gmail.com>
      Tested-by: NVaibhav Jain <vaibhav@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      cca19f0b
    • H
      PCI: Fix is_added/is_busmaster race condition · 44bda4b7
      Hari Vyas 提交于
      When a PCI device is detected, pdev->is_added is set to 1 and proc and
      sysfs entries are created.
      
      When the device is removed, pdev->is_added is checked for one and then
      device is detached with clearing of proc and sys entries and at end,
      pdev->is_added is set to 0.
      
      is_added and is_busmaster are bit fields in pci_dev structure sharing same
      memory location.
      
      A strange issue was observed with multiple removal and rescan of a PCIe
      NVMe device using sysfs commands where is_added flag was observed as zero
      instead of one while removing device and proc,sys entries are not cleared.
      This causes issue in later device addition with warning message
      "proc_dir_entry" already registered.
      
      Debugging revealed a race condition between the PCI core setting the
      is_added bit in pci_bus_add_device() and the NVMe driver reset work-queue
      setting the is_busmaster bit in pci_set_master().  As these fields are not
      handled atomically, that clears the is_added bit.
      
      Move the is_added bit to a separate private flag variable and use atomic
      functions to set and retrieve the device addition state.  This avoids the
      race because is_added no longer shares a memory location with is_busmaster.
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=200283Signed-off-by: NHari Vyas <hari.vyas@broadcom.com>
      Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NLukas Wunner <lukas@wunner.de>
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      44bda4b7
  3. 31 7月, 2018 11 次提交
    • A
      crypto/arm64: aes-ce-gcm - add missing kernel_neon_begin/end pair · c7513c2a
      Ard Biesheuvel 提交于
      Calling pmull_gcm_encrypt_block() requires kernel_neon_begin() and
      kernel_neon_end() to be used since the routine touches the NEON
      register file. Add the missing calls.
      
      Also, since NEON register contents are not preserved outside of
      a kernel mode NEON region, pass the key schedule array again.
      
      Fixes: 7c50136a ("crypto: arm64/aes-ghash - yield NEON after every ...")
      Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      c7513c2a
    • K
      perf/x86/intel/uncore: Fix hardcoded index of Broadwell extra PCI devices · 156c8b58
      Kan Liang 提交于
      Masayoshi Mizuma reported that a warning message is shown while a CPU is
      hot-removed on Broadwell servers:
      
        WARNING: CPU: 126 PID: 6 at arch/x86/events/intel/uncore.c:988
        uncore_pci_remove+0x10b/0x150
        Call Trace:
         pci_device_remove+0x42/0xd0
         device_release_driver_internal+0x148/0x220
         pci_stop_bus_device+0x76/0xa0
         pci_stop_root_bus+0x44/0x60
         acpi_pci_root_remove+0x1f/0x80
         acpi_bus_trim+0x57/0x90
         acpi_bus_trim+0x2e/0x90
         acpi_device_hotplug+0x2bc/0x4b0
         acpi_hotplug_work_fn+0x1a/0x30
         process_one_work+0x174/0x3a0
         worker_thread+0x4c/0x3d0
         kthread+0xf8/0x130
      
      This bug was introduced by:
      
        commit 15a3e845 ("perf/x86/intel/uncore: Fix SBOX support for Broadwell CPUs")
      
      The index of "QPI Port 2 filter" was hardcode to 2, but this conflicts with the
      index of "PCU.3" which is "HSWEP_PCI_PCU_3", which equals to 2 as well.
      
      To fix the conflict, the hardcoded index needs to be cleaned up:
      
       - introduce a new enumerator "BDX_PCI_QPI_PORT2_FILTER" for "QPI Port 2
         filter" on Broadwell,
       - increase UNCORE_EXTRA_PCI_DEV_MAX by one,
       - clean up the hardcoded index.
      Debugged-by: NMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Suggested-by: NIngo Molnar <mingo@kernel.org>
      Reported-by: NMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Tested-by: NMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
      Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: msys.mizuma@gmail.com
      Cc: stable@vger.kernel.org
      Fixes: 15a3e845 ("perf/x86/intel/uncore: Fix SBOX support for Broadwell CPUs")
      Link: http://lkml.kernel.org/r/1532953688-15008-1-git-send-email-kan.liang@linux.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      156c8b58
    • T
      sparc: use asm-generic version of msi.h · 12be1036
      Thomas Petazzoni 提交于
      This is necessary to be able to include <linux/msi.h> when
      CONFIG_GENERIC_MSI_IRQ_DOMAIN is enabled. Without this, a build with
      CONFIG_GENERIC_MSI_IRQ_DOMAIN fails with:
      
         In file included from drivers//ata/ahci.c:45:0:
      >> include/linux/msi.h:226:10: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
                   msi_alloc_info_t *arg);
                   ^~~~~~~~~~~~~~~~
                   sg_alloc_fn
         include/linux/msi.h:230:9: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
                  msi_alloc_info_t *arg);
                  ^~~~~~~~~~~~~~~~
                  sg_alloc_fn
         include/linux/msi.h:239:12: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
                     msi_alloc_info_t *arg);
                     ^~~~~~~~~~~~~~~~
                     sg_alloc_fn
         include/linux/msi.h:240:22: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
           void  (*msi_finish)(msi_alloc_info_t *arg, int retval);
                               ^~~~~~~~~~~~~~~~
                               sg_alloc_fn
         include/linux/msi.h:241:20: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
           void  (*set_desc)(msi_alloc_info_t *arg,
                             ^~~~~~~~~~~~~~~~
                             sg_alloc_fn
         include/linux/msi.h:316:18: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
                 int nvec, msi_alloc_info_t *args);
                           ^~~~~~~~~~~~~~~~
                           sg_alloc_fn
         include/linux/msi.h:318:29: error: unknown type name 'msi_alloc_info_t'; did you mean 'sg_alloc_fn'?
                  int virq, int nvec, msi_alloc_info_t *args);
                                      ^~~~~~~~~~~~~~~~
                                      sg_alloc_fn
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      12be1036
    • T
      sparc: move MSI related definitions to where they are used · f0afc6b1
      Thomas Petazzoni 提交于
      The definitions in arch/sparc/include/asm/msi.h are only used in
      arch/sparc/mm/srmmu.c, so it makes sense to have them in the C file
      directly.
      
      In addition, having a custom arch/sparc/include/asm/msi.h prevents
      from using the asm-generic version of this header, which is necessary
      to be able to include <linux/msi.h> when CONFIG_GENERIC_MSI_IRQ_DOMAIN
      is enabled.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f0afc6b1
    • S
      sparc/time: Add missing __init to init_tick_ops() · 6f57ed68
      Steven Rostedt (VMware) 提交于
      Code that was added to force gcc not to inline any function that isn't
      explicitly declared as inline uncovered that init_tick_ops() isn't
      marked as "__init". It is only called by __init functions and more
      importantly it too calls an __init function which would require it to be
      __init as well.
      
      Link: http://lkml.kernel.org/r/201806060444.hdHcKOBy%fengguang.wu@intel.comReported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f57ed68
    • R
      arc: fix type warnings in arc/mm/cache.c · ec837d62
      Randy Dunlap 提交于
      Fix type warnings in arch/arc/mm/cache.c.
      
      ../arch/arc/mm/cache.c: In function 'flush_anon_page':
      ../arch/arc/mm/cache.c:1062:55: warning: passing argument 2 of '__flush_dcache_page' makes integer from pointer without a cast [-Wint-conversion]
        __flush_dcache_page((phys_addr_t)page_address(page), page_address(page));
                                                             ^~~~~~~~~~~~~~~~~~
      ../arch/arc/mm/cache.c:1013:59: note: expected 'long unsigned int' but argument is of type 'void *'
       void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr)
                                                   ~~~~~~~~~~~~~~^~~~~
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Elad Kanfi <eladkan@mellanox.com>
      Cc: Leon Romanovsky <leonro@mellanox.com>
      Cc: Ofer Levi <oferle@mellanox.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      ec837d62
    • R
      arc: fix build errors in arc/include/asm/delay.h · 2423665e
      Randy Dunlap 提交于
      Fix build errors in arch/arc/'s delay.h:
      - add "extern unsigned long loops_per_jiffy;"
      - add <asm-generic/types.h> for "u64"
      
      In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:
      ../arch/arc/include/asm/delay.h: In function '__udelay':
      ../arch/arc/include/asm/delay.h:61:12: error: 'u64' undeclared (first use in this function)
        loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
                  ^~~
      
      In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:
      ../arch/arc/include/asm/delay.h: In function '__udelay':
      ../arch/arc/include/asm/delay.h:63:37: error: 'loops_per_jiffy' undeclared (first use in this function)
        loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
                                           ^~~~~~~~~~~~~~~
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Elad Kanfi <eladkan@mellanox.com>
      Cc: Leon Romanovsky <leonro@mellanox.com>
      Cc: Ofer Levi <oferle@mellanox.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      2423665e
    • R
      arc: [plat-eznps] fix printk warning in arc/plat-eznps/mtm.c · 9e2ea405
      Randy Dunlap 提交于
      Fix printk format warning in arch/arc/plat-eznps/mtm.c:
      
      In file included from ../include/linux/printk.h:7,
                       from ../include/linux/kernel.h:14,
                       from ../include/linux/list.h:9,
                       from ../include/linux/smp.h:12,
                       from ../arch/arc/plat-eznps/mtm.c:17:
      ../arch/arc/plat-eznps/mtm.c: In function 'set_mtm_hs_ctr':
      ../include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
       #define KERN_SOH "\001"  /* ASCII Start Of Header */
                        ^~~~~~
      ../include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
       #define KERN_ERR KERN_SOH "3" /* error conditions */
                        ^~~~~~~~
      ../include/linux/printk.h:308:9: note: in expansion of macro 'KERN_ERR'
        printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
               ^~~~~~~~
      ../arch/arc/plat-eznps/mtm.c:166:3: note: in expansion of macro 'pr_err'
         pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
         ^~~~~~
      ../arch/arc/plat-eznps/mtm.c:166:40: note: format string is defined here
         pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
                                             ~^
                                             %ld
      The hs_ctr variable can just be int instead of long, so also change
      kstrtol() to kstrtoint() and leave the format string as %d.
      
      Also add 2 header files since they are used in mtm.c and we prefer
      not to depend on accidental/indirect #includes.
      
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Ofer Levi <oferle@mellanox.com>
      Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      9e2ea405
    • R
      arc: [plat-eznps] fix data type errors in platform headers · b1f32ce1
      Randy Dunlap 提交于
      Add <linux/types.h> to fix build errors.
      Both ctop.h and <soc/nps/common.h> use u32 types and cause many
      errors.
      
      Examples:
      ../include/soc/nps/common.h:71:4: error: unknown type name 'u32'
          u32 __reserved:20, cluster:4, core:4, thread:4;
      ../include/soc/nps/common.h:76:3: error: unknown type name 'u32'
         u32 value;
      ../include/soc/nps/common.h:124:4: error: unknown type name 'u32'
          u32 base:8, cl_x:4, cl_y:4,
      ../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
         u32 value;
      
      ../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'
          u32 gen:1, gdis:1, clk_gate_dis:1, asb:1,
      ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32'
         u32 value;
      ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32'
          u32 csa:22, dmsid:6, __reserved:3, cs:1;
      ../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
         u32 value;
      
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Ofer Levi <oferle@mellanox.com>
      Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      b1f32ce1
    • O
      ARC: [plat-eznps] Add missing struct nps_host_reg_aux_dpc · 05b466bf
      Ofer Levi 提交于
      Fixing compilation issue caused by missing struct nps_host_reg_aux_dpc
      definition.
      
      Fixes: 3f9cd874 ("ARC: [plat-eznps] avoid toggling of DPC register")
      Reported-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NOfer Levi <oferle@mellanox.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      05b466bf
    • E
      ARC: add SMP_CACHE_BYTES value validate · 386177da
      Eugeniy Paltsev 提交于
      Check that SMP_CACHE_BYTES (and hence ARCH_DMA_MINALIGN) is larger
      or equal to any cache line length by comparing it with values
      previously read from ARC cache BCR registers.
      Signed-off-by: NEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      386177da
  4. 30 7月, 2018 1 次提交
    • V
      ARM: 8781/1: Fix Thumb-2 syscall return for binutils 2.29+ · afc9f65e
      Vincent Whitchurch 提交于
      When building the kernel as Thumb-2 with binutils 2.29 or newer, if the
      assembler has seen the .type directive (via ENDPROC()) for a symbol, it
      automatically handles the setting of the lowest bit when the symbol is
      used with ADR.  The badr macro on the other hand handles this lowest bit
      manually.  This leads to a jump to a wrong address in the wrong state
      in the syscall return path:
      
       Internal error: Oops - undefined instruction: 0 [#2] SMP THUMB2
       Modules linked in:
       CPU: 0 PID: 652 Comm: modprobe Tainted: G      D           4.18.0-rc3+ #8
       PC is at ret_fast_syscall+0x4/0x62
       LR is at sys_brk+0x109/0x128
       pc : [<80101004>]    lr : [<801c8a35>]    psr: 60000013
       Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
       Control: 50c5387d  Table: 9e82006a  DAC: 00000051
       Process modprobe (pid: 652, stack limit = 0x(ptrval))
      
       80101000 <ret_fast_syscall>:
       80101000:       b672            cpsid   i
       80101002:       f8d9 2008       ldr.w   r2, [r9, #8]
       80101006:       f1b2 4ffe       cmp.w   r2, #2130706432 ; 0x7f000000
      
       80101184 <local_restart>:
       80101184:       f8d9 a000       ldr.w   sl, [r9]
       80101188:       e92d 0030       stmdb   sp!, {r4, r5}
       8010118c:       f01a 0ff0       tst.w   sl, #240        ; 0xf0
       80101190:       d117            bne.n   801011c2 <__sys_trace>
       80101192:       46ba            mov     sl, r7
       80101194:       f5ba 7fc8       cmp.w   sl, #400        ; 0x190
       80101198:       bf28            it      cs
       8010119a:       f04f 0a00       movcs.w sl, #0
       8010119e:       f3af 8014       nop.w   {20}
       801011a2:       f2af 1ea2       subw    lr, pc, #418    ; 0x1a2
      
      To fix this, add a new symbol name which doesn't have ENDPROC used on it
      and use that with badr.  We can't remove the badr usage since that would
      would cause breakage with older binutils.
      Signed-off-by: NVincent Whitchurch <vincent.whitchurch@axis.com>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      afc9f65e
  5. 28 7月, 2018 3 次提交
    • E
      ARC: dma [non-IOC] setup SMP_CACHE_BYTES and cache_line_size · eb277739
      Eugeniy Paltsev 提交于
      As for today we don't setup SMP_CACHE_BYTES and cache_line_size for
      ARC, so they are set to L1_CACHE_BYTES by default. L1 line length
      (L1_CACHE_BYTES) might be easily smaller than L2 line (which is
      usually the case BTW). This breaks code.
      
      For example this breaks ethernet infrastructure on HSDK/AXS103 boards
      with IOC disabled, involving manual cache flushes
      Functions which alloc and manage sk_buff packet data area rely on
      SMP_CACHE_BYTES define. In the result we can share last L2 cache
      line in sk_buff linear packet data area between DMA buffer and
      some useful data in other structure. So we can lose this data when
      we invalidate DMA buffer.
      
         sk_buff linear packet data area
                      |
                      |
                      |         skb->end        skb->tail
                      V            |                |
                                   V                V
      ----------------------------------------------.
            packet data            | <tail padding> |  <useful data in other struct>
      ----------------------------------------------.
      
      ---------------------.--------------------------------------------------.
           SLC line        |             SLC (L2 cache) line (128B)           |
      ---------------------.--------------------------------------------------.
              ^                                     ^
              |                                     |
           These cache lines will be invalidated when we invalidate skb
           linear packet data area before DMA transaction starting.
      
      This leads to issues painful to debug as it reproduces only if
      (sk_buff->end - sk_buff->tail) < SLC_LINE_SIZE and
      if we have some useful data right after sk_buff->end.
      
      Fix that by hardcode SMP_CACHE_BYTES to max line length we may have.
      Signed-off-by: NEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      eb277739
    • E
      ARC: dma [non IOC]: fix arc_dma_sync_single_for_(device|cpu) · 4c612add
      Eugeniy Paltsev 提交于
      ARC backend for dma_sync_single_for_(device|cpu) was broken as it was
      not honoring the @dir argument and simply forcing it based on the call:
       - arc_dma_sync_single_for_device(dir) assumed DMA_TO_DEVICE (cache wback)
       - arc_dma_sync_single_for_cpu(dir) assumed DMA_FROM_DEVICE (cache inv)
      
      This is not true given the DMA API programming model and has been
      discussed here [1] in some detail.
      
      Interestingly while the deficiency has been there forever, it only started
      showing up after 4.17 dma common ops rework, commit a8eb92d0
      ("arc: fix arc_dma_{map,unmap}_page") which wired up these calls under the
      more commonly used dma_map_page API triggering the issue.
      
      [1]: https://lkml.org/lkml/2018/5/18/979
      Fixes: commit a8eb92d0 ("arc: fix arc_dma_{map,unmap}_page")
      Cc: stable@kernel.org # v4.17+
      Signed-off-by: NEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: NVineet Gupta <vgupta@synopsys.com>
      [vgupta: reworked changelog]
      4c612add
    • R
      Revert "MIPS: BCM47XX: Enable 74K Core ExternalSync for PCIe erratum" · d5ea019f
      Rafał Miłecki 提交于
      This reverts commit 2a027b47 ("MIPS: BCM47XX: Enable 74K Core
      ExternalSync for PCIe erratum").
      
      Enabling ExternalSync caused a regression for BCM4718A1 (used e.g. in
      Netgear E3000 and ASUS RT-N16): it simply hangs during PCIe
      initialization. It's likely that BCM4717A1 is also affected.
      
      I didn't notice that earlier as the only BCM47XX devices with PCIe I
      own are:
      1) BCM4706 with 2 x 14e4:4331
      2) BCM4706 with 14e4:4360 and 14e4:4331
      it appears that BCM4706 is unaffected.
      
      While BCM5300X-ES300-RDS.pdf seems to document that erratum and its
      workarounds (according to quotes provided by Tokunori) it seems not even
      Broadcom follows them.
      
      According to the provided info Broadcom should define CONF7_ES in their
      SDK's mipsinc.h and implement workaround in the si_mips_init(). Checking
      both didn't reveal such code. It *could* mean Broadcom also had some
      problems with the given workaround.
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Reported-by: NMichael Marley <michael@michaelmarley.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20032/
      URL: https://bugs.openwrt.org/index.php?do=details&task_id=1688
      Cc: Tokunori Ikegami <ikegami@allied-telesis.co.jp>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      d5ea019f
  6. 27 7月, 2018 2 次提交
  7. 26 7月, 2018 1 次提交
  8. 25 7月, 2018 5 次提交
    • J
      arm64: fix vmemmap BUILD_BUG_ON() triggering on !vmemmap setups · 7b0eb6b4
      Johannes Weiner 提交于
      Arnd reports the following arm64 randconfig build error with the PSI
      patches that add another page flag:
      
        /git/arm-soc/arch/arm64/mm/init.c: In function 'mem_init':
        /git/arm-soc/include/linux/compiler.h:357:38: error: call to
        '__compiletime_assert_618' declared with attribute error: BUILD_BUG_ON
        failed: sizeof(struct page) > (1 << STRUCT_PAGE_MAX_SHIFT)
      
      The additional page flag causes other information stored in
      page->flags to get bumped into their own struct page member:
      
        #if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <=
        BITS_PER_LONG - NR_PAGEFLAGS
        #define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT
        #else
        #define LAST_CPUPID_WIDTH 0
        #endif
      
        #if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0
        #define LAST_CPUPID_NOT_IN_PAGE_FLAGS
        #endif
      
      which in turn causes the struct page size to exceed the size set in
      STRUCT_PAGE_MAX_SHIFT. This value is an an estimate used to size the
      VMEMMAP page array according to address space and struct page size.
      
      However, the check is performed - and triggers here - on a !VMEMMAP
      config, which consumes an additional 22 page bits for the sparse
      section id. When VMEMMAP is enabled, those bits are returned, cpupid
      doesn't need its own member, and the page passes the VMEMMAP check.
      
      Restrict that check to the situation it was meant to check: that we
      are sizing the VMEMMAP page array correctly.
      
      Says Arnd:
      
          Further experiments show that the build error already existed before,
          but was only triggered with larger values of CONFIG_NR_CPU and/or
          CONFIG_NODES_SHIFT that might be used in actual configurations but
          not in randconfig builds.
      
          With longer CPU and node masks, I could recreate the problem with
          kernels as old as linux-4.7 when arm64 NUMA support got added.
      Reported-by: NArnd Bergmann <arnd@arndb.de>
      Tested-by: NArnd Bergmann <arnd@arndb.de>
      Cc: stable@vger.kernel.org
      Fixes: 1a2db300 ("arm64, numa: Add NUMA support for arm64 platforms.")
      Fixes: 3e1907d5 ("arm64: mm: move vmemmap region right below the linear region")
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      7b0eb6b4
    • D
      arm64: Check for errata before evaluating cpu features · dc0e3658
      Dirk Mueller 提交于
      Since commit d3aec8a2 ("arm64: capabilities: Restrict KPTI
      detection to boot-time CPUs") we rely on errata flags being already
      populated during feature enumeration. The order of errata and
      features was flipped as part of commit ed478b3f ("arm64:
      capabilities: Group handling of features and errata workarounds").
      
      Return to the orginal order of errata and feature evaluation to
      ensure errata flags are present during feature evaluation.
      
      Fixes: ed478b3f ("arm64: capabilities: Group handling of
          features and errata workarounds")
      CC: Suzuki K Poulose <suzuki.poulose@arm.com>
      CC: Marc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NDirk Mueller <dmueller@suse.com>
      Reviewed-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      dc0e3658
    • K
      x86/boot: Fix if_changed build flip/flop bug · 92a47286
      Kees Cook 提交于
      Dirk Gouders reported that two consecutive "make" invocations on an
      already compiled tree will show alternating behaviors:
      
      $ make
        CALL    scripts/checksyscalls.sh
        DESCEND  objtool
        CHK     include/generated/compile.h
        DATAREL arch/x86/boot/compressed/vmlinux
      Kernel: arch/x86/boot/bzImage is ready  (#48)
        Building modules, stage 2.
        MODPOST 165 modules
      
      $ make
        CALL    scripts/checksyscalls.sh
        DESCEND  objtool
        CHK     include/generated/compile.h
        LD      arch/x86/boot/compressed/vmlinux
        ZOFFSET arch/x86/boot/zoffset.h
        AS      arch/x86/boot/header.o
        LD      arch/x86/boot/setup.elf
        OBJCOPY arch/x86/boot/setup.bin
        OBJCOPY arch/x86/boot/vmlinux.bin
        BUILD   arch/x86/boot/bzImage
      Setup is 15644 bytes (padded to 15872 bytes).
      System is 6663 kB
      CRC 3eb90f40
      Kernel: arch/x86/boot/bzImage is ready  (#48)
        Building modules, stage 2.
        MODPOST 165 modules
      
      He bisected it back to:
      
          commit 98f78525 ("x86/boot: Refuse to build with data relocations")
      
      The root cause was the use of the "if_changed" kbuild function multiple
      times for the same target. It was designed to only be used once per
      target, otherwise it will effectively always trigger, flipping back and
      forth between the two commands getting recorded by "if_changed". Instead,
      this patch merges the two commands into a single function to get stable
      build artifacts (i.e. .vmlinux.cmd), and a single build behavior.
      Bisected-and-Reported-by: NDirk Gouders <dirk@gouders.net>
      Fix-Suggested-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.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/20180724230827.GA37823@beastSigned-off-by: NIngo Molnar <mingo@kernel.org>
      92a47286
    • P
      perf/x86/intel: Fix unwind errors from PEBS entries (mk-II) · 6cbc304f
      Peter Zijlstra 提交于
      Vince reported the perf_fuzzer giving various unwinder warnings and
      Josh reported:
      
      > Deja vu.  Most of these are related to perf PEBS, similar to the
      > following issue:
      >
      >   b8000586 ("perf/x86/intel: Cure bogus unwind from PEBS entries")
      >
      > This is basically the ORC version of that.  setup_pebs_sample_data() is
      > assembling a franken-pt_regs which ORC isn't happy about.  RIP is
      > inconsistent with some of the other registers (like RSP and RBP).
      
      And where the previous unwinder only needed BP,SP ORC also requires
      IP. But we cannot spoof IP because then the sample will get displaced,
      entirely negating the point of PEBS.
      
      So cure the whole thing differently by doing the unwind early; this
      does however require a means to communicate we did the unwind early.
      We (ab)use an unused sample_type bit for this, which we set on events
      that fill out the data->callchain before the normal
      perf_prepare_sample().
      Debugged-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Reported-by: NVince Weaver <vincent.weaver@maine.edu>
      Tested-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Tested-by: NPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      6cbc304f
    • W
      locking/pvqspinlock/x86: Use LOCK_PREFIX in __pv_queued_spin_unlock() assembly code · c0dc373a
      Waiman Long 提交于
      The LOCK_PREFIX macro should be used in the __raw_callee_save___pv_queued_spin_unlock()
      assembly code, so that the lock prefix can be patched out on UP systems.
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1531858560-21547-1-git-send-email-longman@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c0dc373a
  9. 24 7月, 2018 4 次提交
    • A
      x86/entry/64: Remove %ebx handling from error_entry/exit · b3681dd5
      Andy Lutomirski 提交于
      error_entry and error_exit communicate the user vs. kernel status of
      the frame using %ebx.  This is unnecessary -- the information is in
      regs->cs.  Just use regs->cs.
      
      This makes error_entry simpler and makes error_exit more robust.
      
      It also fixes a nasty bug.  Before all the Spectre nonsense, the
      xen_failsafe_callback entry point returned like this:
      
              ALLOC_PT_GPREGS_ON_STACK
              SAVE_C_REGS
              SAVE_EXTRA_REGS
              ENCODE_FRAME_POINTER
              jmp     error_exit
      
      And it did not go through error_entry.  This was bogus: RBX
      contained garbage, and error_exit expected a flag in RBX.
      
      Fortunately, it generally contained *nonzero* garbage, so the
      correct code path was used.  As part of the Spectre fixes, code was
      added to clear RBX to mitigate certain speculation attacks.  Now,
      depending on kernel configuration, RBX got zeroed and, when running
      some Wine workloads, the kernel crashes.  This was introduced by:
      
          commit 3ac6d8c7 ("x86/entry/64: Clear registers for exceptions/interrupts, to reduce speculation attack surface")
      
      With this patch applied, RBX is no longer needed as a flag, and the
      problem goes away.
      
      I suspect that malicious userspace could use this bug to crash the
      kernel even without the offending patch applied, though.
      
      [ Historical note: I wrote this patch as a cleanup before I was aware
        of the bug it fixed. ]
      
      [ Note to stable maintainers: this should probably get applied to all
        kernels.  If you're nervous about that, a more conservative fix to
        add xorl %ebx,%ebx; incl %ebx before the jump to error_exit should
        also fix the problem. ]
      Reported-and-tested-by: NM. Vefa Bicakci <m.v.b@runbox.com>
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      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: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: stable@vger.kernel.org
      Cc: xen-devel@lists.xenproject.org
      Fixes: 3ac6d8c7 ("x86/entry/64: Clear registers for exceptions/interrupts, to reduce speculation attack surface")
      Link: http://lkml.kernel.org/r/b5010a090d3586b2d6e06c7ad3ec5542d1241c45.1532282627.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      b3681dd5
    • L
      x86/apic: Future-proof the TSC_DEADLINE quirk for SKX · d9e6dbcf
      Len Brown 提交于
      All SKX with stepping higher than 4 support the TSC_DEADLINE,
      no matter the microcode version.
      
      Without this patch, upcoming SKX steppings will not be able to use
      their TSC_DEADLINE timer.
      Signed-off-by: NLen Brown <len.brown@intel.com>
      Cc: <stable@kernel.org> # v4.14+
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 616dd587 ("x86/apic: Update TSC_DEADLINE quirk with additional SKX stepping")
      Link: http://lkml.kernel.org/r/d0c7129e509660be9ec6b233284b8d42d90659e8.1532207856.git.len.brown@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      d9e6dbcf
    • T
      perf/x86/amd/ibs: Don't access non-started event · d2753e6b
      Thomas Gleixner 提交于
      Paul Menzel reported the following bug:
      
      > Enabling the undefined behavior sanitizer and building GNU/Linux 4.18-rc5+
      > (with some unrelated commits) with GCC 8.1.0 from Debian Sid/unstable, the
      > warning below is shown.
      >
      > > [    2.111913]
      > > ================================================================================
      > > [    2.111917] UBSAN: Undefined behaviour in arch/x86/events/amd/ibs.c:582:24
      > > [    2.111919] member access within null pointer of type 'struct perf_event'
      > > [    2.111926] CPU: 0 PID: 144 Comm: udevadm Not tainted 4.18.0-rc5-00316-g4864b68cedf2 #104
      > > [    2.111928] Hardware name: ASROCK E350M1/E350M1, BIOS TIMELESS 01/01/1970
      > > [    2.111930] Call Trace:
      > > [    2.111943]  dump_stack+0x55/0x89
      > > [    2.111949]  ubsan_epilogue+0xb/0x33
      > > [    2.111953]  handle_null_ptr_deref+0x7f/0x90
      > > [    2.111958]  __ubsan_handle_type_mismatch_v1+0x55/0x60
      > > [    2.111964]  perf_ibs_handle_irq+0x596/0x620
      
      The code dereferences event before checking the STARTED bit. Patch
      below should cure the issue.
      
      The warning should not trigger, if I analyzed the thing correctly.
      (And Paul's testing confirms this.)
      Reported-by: NPaul Menzel <pmenzel@molgen.mpg.de>
      Tested-by: NPaul Menzel <pmenzel@molgen.mpg.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul Menzel <pmenzel+linux-x86@molgen.mpg.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1807200958390.1580@nanos.tec.linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      d2753e6b
    • M
      s390: disable gcc plugins · 2fba3573
      Martin Schwidefsky 提交于
      The s390 build currently fails with the latent entropy plugin:
      
      arch/s390/kernel/als.o: In function `verify_facilities':
      als.c:(.init.text+0x24): undefined reference to `latent_entropy'
      als.c:(.init.text+0xae): undefined reference to `latent_entropy'
      make[3]: *** [arch/s390/boot/compressed/vmlinux] Error 1
      make[2]: *** [arch/s390/boot/compressed/vmlinux] Error 2
      make[1]: *** [bzImage] Error 2
      
      This will be fixed with the early boot rework from Vasily, which
      is planned for the 4.19 merge window.
      
      For 4.18 the simplest solution is to disable the gcc plugins and
      reenable them after the early boot rework is upstream.
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      2fba3573
  10. 23 7月, 2018 1 次提交
  11. 22 7月, 2018 3 次提交
  12. 21 7月, 2018 2 次提交
  13. 20 7月, 2018 2 次提交