1. 21 11月, 2019 1 次提交
    • V
      s390/vdso: avoid 64-bit vdso mapping for compat tasks · 84bfa034
      Vasily Gorbik 提交于
      [ Upstream commit d1befa65823e9c6d013883b8a41d081ec338c489 ]
      
      vdso_fault used is_compat_task function (on s390 it tests "current"
      thread_info flags) to distinguish compat tasks and map 31-bit vdso
      pages. But "current" task might not correspond to mm context.
      
      When 31-bit compat inferior is executed under gdb, gdb does
      PTRACE_PEEKTEXT on vdso page, causing vdso_fault with "current" being
      64-bit gdb process. So, 31-bit inferior ends up with 64-bit vdso mapped.
      
      To avoid this problem a new compat_mm flag has been introduced into
      mm context. This flag is used in vdso_fault and vdso_mremap instead
      of is_compat_task.
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      84bfa034
  2. 06 11月, 2019 1 次提交
    • C
      s390/uaccess: avoid (false positive) compiler warnings · 12e13266
      Christian Borntraeger 提交于
      [ Upstream commit 062795fcdcb2d22822fb42644b1d76a8ad8439b3 ]
      
      Depending on inlining decisions by the compiler, __get/put_user_fn
      might become out of line. Then the compiler is no longer able to tell
      that size can only be 1,2,4 or 8 due to the check in __get/put_user
      resulting in false positives like
      
      ./arch/s390/include/asm/uaccess.h: In function ‘__put_user_fn’:
      ./arch/s390/include/asm/uaccess.h:113:9: warning: ‘rc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        113 |  return rc;
            |         ^~
      ./arch/s390/include/asm/uaccess.h: In function ‘__get_user_fn’:
      ./arch/s390/include/asm/uaccess.h:143:9: warning: ‘rc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        143 |  return rc;
            |         ^~
      
      These functions are supposed to be always inlined. Mark it as such.
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      12e13266
  3. 16 8月, 2019 1 次提交
  4. 21 7月, 2019 1 次提交
    • H
      s390: fix stfle zero padding · 02eb533e
      Heiko Carstens 提交于
      commit 4f18d869ffd056c7858f3d617c71345cf19be008 upstream.
      
      The stfle inline assembly returns the number of double words written
      (condition code 0) or the double words it would have written
      (condition code 3), if the memory array it got as parameter would have
      been large enough.
      
      The current stfle implementation assumes that the array is always
      large enough and clears those parts of the array that have not been
      written to with a subsequent memset call.
      
      If however the array is not large enough memset will get a negative
      length parameter, which means that memset clears memory until it gets
      an exception and the kernel crashes.
      
      To fix this simply limit the maximum length. Move also the inline
      assembly to an extra function to avoid clobbering of register 0, which
      might happen because of the added min_t invocation together with code
      instrumentation.
      
      The bug was introduced with commit 14375bc4 ("[S390] cleanup
      facility list handling") but was rather harmless, since it would only
      write to a rather large array. It became a potential problem with
      commit 3ab121ab ("[S390] kernel: Add z/VM LGR detection"). Since
      then it writes to an array with only four double words, while some
      machines already deliver three double words. As soon as machines have
      a facility bit within the fifth double a crash on IPL would happen.
      
      Fixes: 14375bc4 ("[S390] cleanup facility list handling")
      Cc: <stable@vger.kernel.org> # v2.6.37+
      Reviewed-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02eb533e
  5. 25 6月, 2019 2 次提交
  6. 19 6月, 2019 1 次提交
    • V
      s390/kasan: fix strncpy_from_user kasan checks · fcc1ce5b
      Vasily Gorbik 提交于
      [ Upstream commit 01eb42afb45719cb41bb32c278e068073738899d ]
      
      arch/s390/lib/uaccess.c is built without kasan instrumentation. Kasan
      checks are performed explicitly in copy_from_user/copy_to_user
      functions. But since those functions could be inlined, calls from
      files like uaccess.c with instrumentation disabled won't generate
      kasan reports. This is currently the case with strncpy_from_user
      function which was revealed by newly added kasan test. Avoid inlining of
      copy_from_user/copy_to_user when the kernel is built with kasan support
      to make sure kasan checks are fully functional.
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      fcc1ce5b
  7. 04 5月, 2019 1 次提交
  8. 24 3月, 2019 1 次提交
    • S
      KVM: Call kvm_arch_memslots_updated() before updating memslots · 23ad135a
      Sean Christopherson 提交于
      commit 152482580a1b0accb60676063a1ac57b2d12daf6 upstream.
      
      kvm_arch_memslots_updated() is at this point in time an x86-specific
      hook for handling MMIO generation wraparound.  x86 stashes 19 bits of
      the memslots generation number in its MMIO sptes in order to avoid
      full page fault walks for repeat faults on emulated MMIO addresses.
      Because only 19 bits are used, wrapping the MMIO generation number is
      possible, if unlikely.  kvm_arch_memslots_updated() alerts x86 that
      the generation has changed so that it can invalidate all MMIO sptes in
      case the effective MMIO generation has wrapped so as to avoid using a
      stale spte, e.g. a (very) old spte that was created with generation==0.
      
      Given that the purpose of kvm_arch_memslots_updated() is to prevent
      consuming stale entries, it needs to be called before the new generation
      is propagated to memslots.  Invalidating the MMIO sptes after updating
      memslots means that there is a window where a vCPU could dereference
      the new memslots generation, e.g. 0, and incorrectly reuse an old MMIO
      spte that was created with (pre-wrap) generation==0.
      
      Fixes: e59dbe09 ("KVM: Introduce kvm_arch_memslots_updated()")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NSean Christopherson <sean.j.christopherson@intel.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      23ad135a
  9. 31 1月, 2019 1 次提交
  10. 27 11月, 2018 1 次提交
    • M
      s390/mm: fix mis-accounting of pgtable_bytes · 4136161d
      Martin Schwidefsky 提交于
      [ Upstream commit e12e4044aede97974f2222eb7f0ed726a5179a32 ]
      
      In case a fork or a clone system fails in copy_process and the error
      handling does the mmput() at the bad_fork_cleanup_mm label, the
      following warning messages will appear on the console:
      
        BUG: non-zero pgtables_bytes on freeing mm: 16384
      
      The reason for that is the tricks we play with mm_inc_nr_puds() and
      mm_inc_nr_pmds() in init_new_context().
      
      A normal 64-bit process has 3 levels of page table, the p4d level and
      the pud level are folded. On process termination the free_pud_range()
      function in mm/memory.c will subtract 16KB from pgtable_bytes with a
      mm_dec_nr_puds() call, but there actually is not really a pud table.
      
      One issue with this is the fact that pgtable_bytes is usually off
      by a few kilobytes, but the more severe problem is that for a failed
      fork or clone the free_pgtables() function is not called. In this case
      there is no mm_dec_nr_puds() or mm_dec_nr_pmds() that go together with
      the mm_inc_nr_puds() and mm_inc_nr_pmds in init_new_context().
      The pgtable_bytes will be off by 16384 or 32768 bytes and we get the
      BUG message. The message itself is purely cosmetic, but annoying.
      
      To fix this override the mm_pmd_folded, mm_pud_folded and mm_p4d_folded
      function to check for the true size of the address space.
      Reported-by: NLi Wang <liwang@redhat.com>
      Tested-by: NLi Wang <liwang@redhat.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4136161d
  11. 20 9月, 2018 1 次提交
    • G
      s390/hibernate: fix error handling when suspend cpu != resume cpu · 55a5542a
      Gerald Schaefer 提交于
      The resume code checks if the resume cpu is the same as the suspend cpu.
      If not, and if it is also not possible to switch to the suspend cpu, an
      error message should be printed and the resume process should be stopped
      by loading a disabled wait psw.
      
      The current logic is broken in multiple ways, the message is never printed,
      and the disabled wait psw never loaded because the kernel panics before that:
      - sam31 and SIGP_SET_ARCHITECTURE to ESA mode is wrong, this will break
        on the first 64bit instruction in sclp_early_printk().
      - The init stack should be used, but the stack pointer is not set up correctly
        (missing aghi %r15,-STACK_FRAME_OVERHEAD).
      - __sclp_early_printk() checks the sclp_init_state. If it is not
        sclp_init_state_uninitialized, it simply returns w/o printing anything.
        In the resumed kernel however, sclp_init_state will never be uninitialized.
      
      This patch fixes those issues by removing the sam31/ESA logic, adding a
      correct init stack pointer, and also introducing sclp_early_printk_force()
      to allow using sclp_early_printk() even when sclp_init_state is not
      uninitialized.
      Reviewed-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      55a5542a
  12. 04 9月, 2018 1 次提交
  13. 20 8月, 2018 1 次提交
  14. 16 8月, 2018 2 次提交
  15. 31 7月, 2018 2 次提交
  16. 30 7月, 2018 7 次提交
  17. 19 7月, 2018 1 次提交
  18. 13 7月, 2018 1 次提交
  19. 06 7月, 2018 1 次提交
    • P
      s390/purgatory: Remove duplicate variable definitions · 287d6070
      Philipp Rudo 提交于
      Currently there are some variables in the purgatory (e.g. kernel_entry)
      which are defined twice, once in assembler- and once in c-code. The reason
      for this is that these variables are set during purgatory load, where
      sanity checks on the corresponding Elf_Sym's are made, while they are used
      in assembler-code. Thus adding a second definition in c-code is a handy
      workaround to guarantee correct Elf_Sym's are created.
      
      When the purgatory is compiled with -fcommon (default for gcc on s390) this
      is no problem because both symbols are merged by the linker. However this
      is not required by ISO C and when the purgatory is built with -fno-common
      the linker fails with errors like
      
      arch/s390/purgatory/purgatory.o:(.bss+0x18): multiple definition of `kernel_entry'
      arch/s390/purgatory/head.o:/.../arch/s390/purgatory/head.S:230: first defined here
      
      Thus remove the duplicate definitions and add the required size and type
      information to the assembler definition. Also add -fno-common to the
      command line options to prevent similar hacks in the future.
      Signed-off-by: NPhilipp Rudo <prudo@linux.ibm.com>
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      287d6070
  20. 04 7月, 2018 1 次提交
  21. 02 7月, 2018 3 次提交
  22. 25 6月, 2018 4 次提交
  23. 21 6月, 2018 4 次提交