1. 05 Jan, 2018 1 commit
    • Max Filippov's avatar
      xtensa: fix futex_atomic_cmpxchg_inatomic · ca474809
      Max Filippov authored
      Return 0 if the operation was successful, not the userspace memory
      value. Check that userspace value equals passed oldval, not itself.
      Don't update *uval if the value wasn't read from userspace memory.
      
      This fixes process hang due to infinite loop in futex_lock_pi.
      It also fixes a bunch of glibc tests nptl/tst-mutexpi*.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      ca474809
  2. 02 Jan, 2018 1 commit
    • Arnd Bergmann's avatar
      xtensa: shut up gcc-8 warnings · 32bb954d
      Arnd Bergmann authored
      Many uses of strncpy() on xtensa causes  a warning like
      
      arch/xtensa/include/asm/string.h:56:42: warning: array subscript is above array bounds [-Warray-bounds]
         : "0" (__dest), "1" (__src), "r" (__src+__n)
      
      This avoids the warning by turning the pointer arithmetic into an
      integer operation that does not get checked the same way.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      32bb954d
  3. 17 Dec, 2017 11 commits
    • Max Filippov's avatar
      xtensa: print kernel sections info in mem_init · fed566ca
      Max Filippov authored
      Output virtual addresses and sizes occupied by the main kernel sections:
      .text, .rodata, .data, .init and .bss.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      fed566ca
    • Max Filippov's avatar
      xtensa: use generic strncpy_from_user with KASAN · 57358ba9
      Max Filippov authored
      This enables KASAN check of the destination buffer.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      57358ba9
    • Max Filippov's avatar
      xtensa: use __memset in __xtensa_clear_user · e0baa014
      Max Filippov authored
      memset on xtensa is capable of accessing user memory, but KASAN checks
      if memset function is actually used for that and reports it as an error:
      
       ==================================================================
       BUG: KASAN: user-memory-access in padzero+0x4d/0x58
       Write of size 519 at addr 0049ddf9 by task init/1
      
       Call Trace:
        [<b0189978>] kasan_report+0x160/0x238
        [<b0188818>] check_memory_region+0xf8/0x100
        [<b018891c>] memset+0x20/0x34
        [<b0238b71>] padzero+0x4d/0x58
       ==================================================================
      
      Use __memset in __xtensa_clear_user to avoid that.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      e0baa014
    • Max Filippov's avatar
      xtensa: add support for KASAN · c633544a
      Max Filippov authored
      Cover kernel addresses above 0x90000000 by the shadow map. Enable
      HAVE_ARCH_KASAN when MMU is enabled. Provide kasan_early_init that fills
      shadow map with writable copies of kasan_zero_page. Call
      kasan_early_init right after mmu initialization in the setup_arch.
      Provide kasan_init that allocates proper shadow map pages from the
      memblock and puts these pages into the shadow map for addresses from
      VMALLOC area to the end of KSEG. Call kasan_init right after memblock
      initialization. Don't use KASAN for the boot code, MMU and KASAN
      initialization and page fault handler. Make kernel stack size 4 times
      larger when KASAN is enabled to avoid stack overflows.
      GCC 7.3, 8 or newer is required to build the xtensa kernel with KASAN.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      c633544a
    • Max Filippov's avatar
      xtensa: move fixmap and kmap just above the KSEG · 1af1e8a3
      Max Filippov authored
      The virtual address space between the page table and the VMALLOC region
      is big enough to host KASAN shadow map and there's enough space between
      the VMALLOC area and KSEG for the fixmap and kmap.
      Move fixmap and kmap to the gap between VMALLOC area and KSEG, just
      above the KSEG. Reorder entries in the kernel memory layout printing
      code. Drop duplicate PGTABLE_START definition, use
      XCHAL_PAGE_TABLE_VADDR instead.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      1af1e8a3
    • Max Filippov's avatar
      xtensa: don't clear swapper_pg_dir in paging_init · d4e337fe
      Max Filippov authored
      swapper_pg_dir is located in the .bss, so it's zero-initialized anyway.
      With KASAN enabled paging_init will be called after KASAN
      initialization, it must not erase page directory entries set up for
      KASAN shadow map.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      d4e337fe
    • Max Filippov's avatar
      xtensa: extract init_kio · c2edb35a
      Max Filippov authored
      KIO region placement may be specified in the device tree, that's why
      it's initialized with the rest of MMU after the early_init_devtree. In
      order to support KASAN the MMU must be initialized earlier.
      Separate KIO initialization from the rest of MMU initialization.
      Reinitialize KIO if its location is specified in the device tree.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      c2edb35a
    • Max Filippov's avatar
      xtensa: implement early_trap_init · 501c26e8
      Max Filippov authored
      Paging on xtensa architecture requires functioning exception handling
      because hardware cannot transparently access page tables that are not
      currently mapped by TLB. Exception handling is set up late in the
      initialization process, but working paging is needed for KASAN.
      
      Provide early_trap_init that sets up minimal exception handling
      sufficient for KASAN to work.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      501c26e8
    • Max Filippov's avatar
      xtensa: clean up exception handling structure · f21a79ca
      Max Filippov authored
      Instead of using flat array of longs use normal C structure and generate
      EXC_TABLE_* constants in the asm-offsets.c
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      f21a79ca
    • Max Filippov's avatar
      xtensa: clean up custom-controlled debug output · c130d3be
      Max Filippov authored
      Replace #ifdef'fed/commented out debug printk statements with pr_debug.
      Replace printk statements with pr_* equivalents.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      c130d3be
    • Max Filippov's avatar
      xtensa: enable stack protector · 40d1a07b
      Max Filippov authored
      The implementation is adopted from the ARM arch. GCC 7.3, 8 or newer is
      required for building the xtensa kernel with SSP.
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      40d1a07b
  4. 11 Dec, 2017 1 commit
  5. 10 Dec, 2017 7 commits
  6. 12 Nov, 2017 3 commits
    • Linus Torvalds's avatar
      Linux 4.14 · bebc6082
      Linus Torvalds authored
      bebc6082
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 152bbb43
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of small fixes:
      
         - make KGDB work again which got broken by the conversion of WARN()
           to #UD. The WARN fixup needs to run before the notifier callchain,
           otherwise KGDB tries to handle it and crashes.
      
         - disable KASAN in the ORC unwinder to prevent false positive KASAN
           warnings
      
         - prevent default mapping above 47bit when 5 level page tables are
           enabled
      
         - make the delay calibration optimization work correctly, which had
           the conditionals the wrong way around and was operating on data
           which was not yet updated.
      
         - remove the bogus X86_TRAP_BP trap init from the default IDT init
           table, which broke 32bit int3 handling by overwriting the correct
           int3 setup.
      
         - replace this_cpu* with boot_cpu_data access in the preemptible
           oprofile init code"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/debug: Handle warnings before the notifier chain, to fix KGDB crash
        x86/mm: Fix ELF_ET_DYN_BASE for 5-level paging
        x86/idt: Remove X86_TRAP_BP initialization in idt_setup_traps()
        x86/oprofile/ppro: Do not use __this_cpu*() in preemptible context
        x86/unwind: Disable KASAN checking in the ORC unwinder
        x86/smpboot: Make optimization of delay calibration work correctly
      152bbb43
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 69581c74
      Linus Torvalds authored
      Pull perf tool fixes from Thomas Gleixner:
       "A small set of fixes for perf tool:
      
         - synchronize the i915 drm header to avoid the 'out of date' warning
      
         - make sure that perf trace cleans up its temporary files on exit
      
         - unbreak the build with newer flex versions
      
         - add missing braces in the eBPF parsing rules"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        tooling/headers: Sync the tools/include/uapi/drm/i915_drm.h UAPI header
        perf trace: Call machine__exit() at exit
        perf tools: Fix eBPF event specification parsing
        perf tools: Add "reject" option for parse-events.l
      69581c74
  7. 11 Nov, 2017 8 commits
  8. 10 Nov, 2017 8 commits