1. 23 May, 2020 3 commits
    • Linus Torvalds's avatar
      Merge tag 's390-5.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 9bca7c40
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - Add missing R_390_JMP_SLOT relocation type in KASLR code.
      
       - Fix set_huge_pte_at for empty ptes issue which has been uncovered
         with arch page table helper tests.
      
       - Correct initrd location for kdump kernel.
      
       - Fix s390_mmio_read/write with MIO in PCI code.
      
      * tag 's390-5.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/kaslr: add support for R_390_JMP_SLOT relocation type
        s390/mm: fix set_huge_pte_at() for empty ptes
        s390/kexec_file: fix initrd location for kdump kernel
        s390/pci: Fix s390_mmio_read/write with MIO
      9bca7c40
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · e644645a
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Three minor fixes, two in drivers, one to fix a hang after reset with
        iSCSI, and one to avoid a spurious log message; and the final core one
        to correct a suspend/resume miscount with quiesced devices"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: target: Put lun_ref at end of tmr processing
        scsi: pm: Balance pm_only counter of request queue during system resume
        scsi: qla2xxx: Do not log message when reading port speed via sysfs
      e644645a
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-05-23' of git://anongit.freedesktop.org/drm/drm · a24deb9d
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Things seemed to have quieten down, though no i915 pull (I even gave
        them an extra 12 hours in case they were late).
      
        The amdgpu floating point fix is probably the largest, but it just
        moves some code around to it doesn't do fpu stuff outside the fpu
        boundaries. Otherwise it's just a couple of vmwgfx fixes (maintainer
        change) and two etnaviv fixes.
      
        vmwgfx:
         - change maintainers
         - fix redundant assignment
         - fix parameter name
         - fix return value
      
        etnaviv:
         - memory leak fix when userspace passes a invalid softpin address
         - off-by-one crashing the kernel in the perfmon domain iteration when
           the GPU core has both 2D and 3D capabilities
      
        amdgpu:
         - DP fix
         - Floating point fix
         - Fix cursor stutter issue"
      
      * tag 'drm-fixes-2020-05-23' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: Defer cursor lock until after VUPDATE
        drm/amd/display: Remove dml_common_def file
        drm/amd/display: DP training to set properly SCRAMBLING_DISABLE
        drm/edid: Add Oculus Rift S to non-desktop list
        drm/etnaviv: Fix a leak in submit_pin_objects()
        drm/etnaviv: fix perfmon domain interation
        drm/vmwgfx: Return true in function vmw_fence_obj_signaled()
        drm/vmwgfx: remove redundant assignment to variable ret
        drm/vmwgfx: Fix parameter name in vmw_bo_init
        drm/vmwgfx: update MAINTAINERS entry
      a24deb9d
  2. 22 May, 2020 9 commits
  3. 21 May, 2020 12 commits
    • Linus Torvalds's avatar
      Merge tag 'apparmor-pr-2020-05-21' of... · 051143e1
      Linus Torvalds authored
      Merge tag 'apparmor-pr-2020-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor
      
      Pull apparmor bug fixes from John Johansen:
      
       - Fix use-after-free in aa_audit_rule_init
      
       - Fix refcnt leak in policy_update
      
       - Fix potential label refcnt leak in aa_change_profile
      
      * tag 'apparmor-pr-2020-05-21' of git://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor:
        apparmor: Fix use-after-free in aa_audit_rule_init
        apparmor: Fix aa_label refcnt leak in policy_update
        apparmor: fix potential label refcnt leak in aa_change_profile
      051143e1
    • Namjae Jeon's avatar
      exfat: add the dummy mount options to be backward compatible with staging/exfat · 907fa893
      Namjae Jeon authored
      As Ubuntu and Fedora release new version used kernel version equal to or
      higher than v5.4, They started to support kernel exfat filesystem.
      
      Linus reported a mount error with new version of exfat on Fedora:
      
              exfat: Unknown parameter 'namecase'
      
      This is because there is a difference in mount option between old
      staging/exfat and new exfat.  And utf8, debug, and codepage options as
      well as namecase have been removed from new exfat.
      
      This patch add the dummy mount options as deprecated option to be
      backward compatible with old one.
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Eric Sandeen <sandeen@sandeen.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      907fa893
    • Navid Emamdoost's avatar
      apparmor: Fix use-after-free in aa_audit_rule_init · c54d481d
      Navid Emamdoost authored
      In the implementation of aa_audit_rule_init(), when aa_label_parse()
      fails the allocated memory for rule is released using
      aa_audit_rule_free(). But after this release, the return statement
      tries to access the label field of the rule which results in
      use-after-free. Before releasing the rule, copy errNo and return it
      after release.
      
      Fixes: 52e8c380 ("apparmor: Fix memory leak of rule on error exit path")
      Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      c54d481d
    • Xiyu Yang's avatar
      apparmor: Fix aa_label refcnt leak in policy_update · c6b39f07
      Xiyu Yang authored
      policy_update() invokes begin_current_label_crit_section(), which
      returns a reference of the updated aa_label object to "label" with
      increased refcount.
      
      When policy_update() returns, "label" becomes invalid, so the refcount
      should be decreased to keep refcount balanced.
      
      The reference counting issue happens in one exception handling path of
      policy_update(). When aa_may_manage_policy() returns not NULL, the
      refcnt increased by begin_current_label_crit_section() is not decreased,
      causing a refcnt leak.
      
      Fix this issue by jumping to "end_section" label when
      aa_may_manage_policy() returns not NULL.
      
      Fixes: 5ac8c355 ("apparmor: allow introspecting the loaded policy pre internal transform")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      c6b39f07
    • Xiyu Yang's avatar
      apparmor: fix potential label refcnt leak in aa_change_profile · a0b845ff
      Xiyu Yang authored
      aa_change_profile() invokes aa_get_current_label(), which returns
      a reference of the current task's label.
      
      According to the comment of aa_get_current_label(), the returned
      reference must be put with aa_put_label().
      However, when the original object pointed by "label" becomes
      unreachable because aa_change_profile() returns or a new object
      is assigned to "label", reference count increased by
      aa_get_current_label() is not decreased, causing a refcnt leak.
      
      Fix this by calling aa_put_label() before aa_change_profile() return
      and dropping unnecessary aa_get_current_label().
      
      Fixes: 9fcf78cc ("apparmor: update domain transitions that are subsets of confinement at nnp")
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
      a0b845ff
    • Palmer Dabbelt's avatar
      RISC-V: gp_in_global needs register keyword · 8356c379
      Palmer Dabbelt authored
      The Intel kernel build robot recently pointed out that I missed the
      register keyword on this one when I refactored the code to remove local
      register variables (which aren't supported by LLVM).  GCC's manual
      indicates that global register variables must have the register keyword,
      As far as I can tell lacking the register keyword causes GCC to ignore
      the __asm__ and treat this as a regular variable, but I'm not sure how
      that didn't show up as some sort of failure.
      
      Fixes: 52e7c52d ("RISC-V: Stop relying on GCC's register allocator's hueristics")
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      8356c379
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · d2f8825a
      Linus Torvalds authored
      Pull virtio fixes from Michael Tsirkin:
       "Fix a couple of build warnings"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vhost: missing __user tags
        vdpasim: remove unused variable 'ret'
      d2f8825a
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-5.7-rc7' of git://git.infradead.org/users/vkoul/slave-dma · cedd54f7
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "Some driver fixes:
      
         - dmatest restoration of defaults
      
         - tegra210-adma probe handling fix
      
         - k3-udma flags fixed for slave_sg and memcpy
      
         - list fix for zynqmp_dma
      
         - idxd interrupt completion fix
      
         - lock fix for owl"
      
      * tag 'dmaengine-fix-5.7-rc7' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
        dmaengine: ti: k3-udma: Fix TR mode flags for slave_sg and memcpy
        dmaengine: zynqmp_dma: Move list_del inside zynqmp_dma_free_descriptor.
        dmaengine: dmatest: Restore default for channel
        dmaengine: idxd: fix interrupt completion after unmasking
        dmaengine: owl: Use correct lock in owl_dma_get_pchan()
      cedd54f7
    • Linus Torvalds's avatar
      Merge tag 'fiemap-regression-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 57f1b0cf
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Fix regression in ext4's FIEMAP handling introduced in v5.7-rc1"
      
      * tag 'fiemap-regression-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fix fiemap size checks for bitmap files
        ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
      57f1b0cf
    • Chaitanya Kulkarni's avatar
      null_blk: don't allow discard for zoned mode · 1592cd15
      Chaitanya Kulkarni authored
      Zoned block device specification do not define the behavior of
      discard/trim command as this command is generally replaced by the reset
      write pointer (zone reset) command. Emulate this in null_blk by making
      zoned and discard options mutually exclusive.
      Suggested-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
      Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      1592cd15
    • Chaitanya Kulkarni's avatar
      null_blk: return error for invalid zone size · e2748325
      Chaitanya Kulkarni authored
      In null_init_zone_dev() check if the zone size is larger than device
      capacity, return error if needed.
      
      This also fixes the following oops :-
      
      null_blk: changed the number of conventional zones to 4294967295
      BUG: kernel NULL pointer dereference, address: 0000000000000010
      PGD 7d76c5067 P4D 7d76c5067 PUD 7d240c067 PMD 0
      Oops: 0002 [#1] SMP NOPTI
      CPU: 4 PID: 5508 Comm: nullbtests.sh Tainted: G OE 5.7.0-rc4lblk-fnext0
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e4
      RIP: 0010:null_init_zoned_dev+0x17a/0x27f [null_blk]
      RSP: 0018:ffffc90007007e00 EFLAGS: 00010246
      RAX: 0000000000000020 RBX: ffff8887fb3f3c00 RCX: 0000000000000007
      RDX: 0000000000000000 RSI: ffff8887ca09d688 RDI: ffff888810fea510
      RBP: 0000000000000010 R08: ffff8887ca09d688 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff8887c26e8000
      R13: ffffffffa05e9390 R14: 0000000000000000 R15: 0000000000000001
      FS:  00007fcb5256f740(0000) GS:ffff888810e00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000010 CR3: 000000081e8fe000 CR4: 00000000003406e0
      Call Trace:
       null_add_dev+0x534/0x71b [null_blk]
       nullb_device_power_store.cold.41+0x8/0x2e [null_blk]
       configfs_write_file+0xe6/0x150
       vfs_write+0xba/0x1e0
       ksys_write+0x5f/0xe0
       do_syscall_64+0x60/0x250
       entry_SYSCALL_64_after_hwframe+0x49/0xb3
      RIP: 0033:0x7fcb51c71840
      Signed-off-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      e2748325
    • Michael Ellerman's avatar
      powerpc/64s: Disable STRICT_KERNEL_RWX · 8659a0e0
      Michael Ellerman authored
      Several strange crashes have been eventually traced back to
      STRICT_KERNEL_RWX and its interaction with code patching.
      
      Various paths in our ftrace, kprobes and other patching code need to
      be hardened against patching failures, otherwise we can end up running
      with partially/incorrectly patched ftrace paths, kprobes or jump
      labels, which can then cause strange crashes.
      
      Although fixes for those are in development, they're not -rc material.
      
      There also seem to be problems with the underlying strict RWX logic,
      which needs further debugging.
      
      So for now disable STRICT_KERNEL_RWX on 64-bit to prevent people from
      enabling the option and tripping over the bugs.
      
      Fixes: 1e0fc9d1 ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs")
      Cc: stable@vger.kernel.org # v4.13+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20200520133605.972649-1-mpe@ellerman.id.au
      8659a0e0
  4. 20 May, 2020 16 commits
    • Kefeng Wang's avatar
      riscv: Fix print_vm_layout build error if NOMMU · 8fa3cdff
      Kefeng Wang authored
      arch/riscv/mm/init.c: In function ‘print_vm_layout’:
      arch/riscv/mm/init.c:68:37: error: ‘FIXADDR_START’ undeclared (first use in this function);
      arch/riscv/mm/init.c:69:20: error: ‘FIXADDR_TOP’ undeclared
      arch/riscv/mm/init.c:70:37: error: ‘PCI_IO_START’ undeclared
      arch/riscv/mm/init.c:71:20: error: ‘PCI_IO_END’ undeclared
      arch/riscv/mm/init.c:72:38: error: ‘VMEMMAP_START’ undeclared
      arch/riscv/mm/init.c:73:20: error: ‘VMEMMAP_END’ undeclared (first use in this function);
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      8fa3cdff
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Defer cursor lock until after VUPDATE · 31ecebee
      Nicholas Kazlauskas authored
      [Why]
      We dropped the delay after changed the cursor functions locking the
      entire pipe to locking just the CURSOR registers to fix page flip
      stuttering - this introduced cursor stuttering instead, and an underflow
      issue.
      
      The cursor update can be delayed indefinitely if the cursor update
      repeatedly happens right around VUPDATE.
      
      The underflow issue can happen if we do a viewport update on a pipe
      on the same frame where a cursor update happens around VUPDATE - the
      old cursor registers are retained which can be in an invalid position.
      
      This can cause a pipe hang and indefinite underflow.
      
      [How]
      The complex, ideal solution to the problem would be a software
      triple buffering mechanism from the DM layer to program only one cursor
      update per frame just before VUPDATE.
      
      The simple workaround until we have that infrastructure in place is
      this change - bring back the delay until VUPDATE before locking, but
      with some corrections to the calculations.
      
      This didn't work for all timings before because the calculation for
      VUPDATE was wrong - it was using the offset from VSTARTUP instead and
      didn't correctly handle the case where VUPDATE could be in the back
      porch.
      
      Add a new hardware sequencer function to use the existing helper to
      calculate the real VUPDATE start and VUPDATE end - VUPDATE can last
      multiple lines after all.
      
      Change the udelay to incorporate the width of VUPDATE as well.
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
      Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      31ecebee
    • Rodrigo Siqueira's avatar
      drm/amd/display: Remove dml_common_def file · 5aa82e35
      Rodrigo Siqueira authored
      During the rework for removing the FPU issues, I found the following
      warning:
      
       [..] dml_common_defs.o: warning: objtool: dml_round()+0x9: FPU
            instruction outside of kernel_fpu_{begin,end}()
      
      This file has a single function that does not need to be in a specific
      file. This commit drop dml_common_defs file, and move dml_round function
      to dml_inline_defs.
      
      CC: Christian König <christian.koenig@amd.com>
      CC: Alexander Deucher <Alexander.Deucher@amd.com>
      CC: Peter Zijlstra <peterz@infradead.org>
      CC: Tony Cheng <tony.cheng@amd.com>
      CC: Harry Wentland <hwentlan@amd.com>
      Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Reviewed-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
      Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5aa82e35
    • Vladimir Stempen's avatar
      drm/amd/display: DP training to set properly SCRAMBLING_DISABLE · b6ef55cc
      Vladimir Stempen authored
      [Why]
      DP training sequence to set SCRAMBLING_DISABLE bit properly based on
      training pattern - per DP Spec.
      
      [How]
      Update dpcd_pattern.v1_4.SCRAMBLING_DISABLE with 1 for TPS1, TPS2, TPS3,
      but not for TPS4.
      Signed-off-by: default avatarVladimir Stempen <vladimir.stempen@amd.com>
      Reviewed-by: default avatarWenjing Liu <Wenjing.Liu@amd.com>
      Acked-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      b6ef55cc
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · b85051e7
      Linus Torvalds authored
      Pull MTD fixes from Richard Weinberger:
      
       - Fix a PM regression in brcmnand driver
      
       - Propagate ECC information correctly on SPI-NAND
      
       - Make sure no MTD name is used multiple time in nvmem
      
      * tag 'fixes-for-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd:rawnand: brcmnand: Fix PM resume crash
        mtd: Fix mtd not registered due to nvmem name collision
        mtd: spinand: Propagate ECC information to the MTD structure
      b85051e7
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · fea371e2
      Linus Torvalds authored
      Pull UBI and UBIFS fixes from Richard Weinberger:
      
       - Correctly set next cursor for detailed_erase_block_info debugfs file
      
       - Don't use crypto_shash_descsize() for digest size in UBIFS
      
       - Remove broken lazytime support from UBIFS
      
      * tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
        ubifs: fix wrong use of crypto_shash_descsize()
        ubifs: remove broken lazytime support
      fea371e2
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml · d303402c
      Linus Torvalds authored
      Pull UML fixes from Richard Weinberger:
      
       - Two missing includes which caused build issues on recent systems
      
       - Correctly set TRANS_GRE_LEN in our vector network driver
      
      * tag 'for-linus-5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
        um: Fix typo in vector driver transport option definition
        um: syscall.c: include <asm/unistd.h>
        um: Fix xor.h include
      d303402c
    • Linus Torvalds's avatar
      Merge tag 'pm-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 2ea1940b
      Linus Torvalds authored
      Pull power management fix from Rafael Wysocki:
       "This makes a recently introduced suspend-to-idle wakeup issue on Dell
        XPS13 9360 go away"
      
      * tag 'pm-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: EC: PM: Avoid flushing EC work when EC GPE is inactive
      2ea1940b
    • Linus Torvalds's avatar
      Merge tag 'ovl-fixes-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs · 8e2b7f63
      Linus Torvalds authored
      Pull overlayfs fixes from Miklos Szeredi:
       "Fix two bugs introduced in this cycle and one introduced in v5.5"
      
      * tag 'ovl-fixes-5.7-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
        ovl: potential crash in ovl_fid_to_fh()
        ovl: clear ATTR_OPEN from attr->ia_valid
        ovl: clear ATTR_FILE from attr->ia_valid
      8e2b7f63
    • Tetsuo Handa's avatar
      pipe: Fix pipe_full() test in opipe_prep(). · 566d1362
      Tetsuo Handa authored
      syzbot is reporting that splice()ing from non-empty read side to
      already-full write side causes unkillable task, for opipe_prep() is by
      error not inverting pipe_full() test.
      
        CPU: 0 PID: 9460 Comm: syz-executor.5 Not tainted 5.6.0-rc3-next-20200228-syzkaller #0
        Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
        RIP: 0010:rol32 include/linux/bitops.h:105 [inline]
        RIP: 0010:iterate_chain_key kernel/locking/lockdep.c:369 [inline]
        RIP: 0010:__lock_acquire+0x6a3/0x5270 kernel/locking/lockdep.c:4178
        Call Trace:
           lock_acquire+0x197/0x420 kernel/locking/lockdep.c:4720
           __mutex_lock_common kernel/locking/mutex.c:956 [inline]
           __mutex_lock+0x156/0x13c0 kernel/locking/mutex.c:1103
           pipe_lock_nested fs/pipe.c:66 [inline]
           pipe_double_lock+0x1a0/0x1e0 fs/pipe.c:104
           splice_pipe_to_pipe fs/splice.c:1562 [inline]
           do_splice+0x35f/0x1520 fs/splice.c:1141
           __do_sys_splice fs/splice.c:1447 [inline]
           __se_sys_splice fs/splice.c:1427 [inline]
           __x64_sys_splice+0x2b5/0x320 fs/splice.c:1427
           do_syscall_64+0xf6/0x790 arch/x86/entry/common.c:295
           entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Reported-by: syzbot+b48daca8639150bc5e73@syzkaller.appspotmail.com
      Link: https://syzkaller.appspot.com/bug?id=9386d051e11e09973d5a4cf79af5e8cedf79386d
      Fixes: 8cefc107 ("pipe: Use head and tail pointers for the ring, not cursor and length")
      Cc: stable@vger.kernel.org # 5.5+
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      566d1362
    • Xiaoguang Wang's avatar
      io_uring: reset -EBUSY error when io sq thread is waken up · d4ae271d
      Xiaoguang Wang authored
      In io_sq_thread(), currently if we get an -EBUSY error and go to sleep,
      we will won't clear it again, which will result in io_sq_thread() will
      never have a chance to submit sqes again. Below test program test.c
      can reveal this bug:
      
      int main(int argc, char *argv[])
      {
              struct io_uring ring;
              int i, fd, ret;
              struct io_uring_sqe *sqe;
              struct io_uring_cqe *cqe;
              struct iovec *iovecs;
              void *buf;
              struct io_uring_params p;
      
              if (argc < 2) {
                      printf("%s: file\n", argv[0]);
                      return 1;
              }
      
              memset(&p, 0, sizeof(p));
              p.flags = IORING_SETUP_SQPOLL;
              ret = io_uring_queue_init_params(4, &ring, &p);
              if (ret < 0) {
                      fprintf(stderr, "queue_init: %s\n", strerror(-ret));
                      return 1;
              }
      
              fd = open(argv[1], O_RDONLY | O_DIRECT);
              if (fd < 0) {
                      perror("open");
                      return 1;
              }
      
              iovecs = calloc(10, sizeof(struct iovec));
              for (i = 0; i < 10; i++) {
                      if (posix_memalign(&buf, 4096, 4096))
                              return 1;
                      iovecs[i].iov_base = buf;
                      iovecs[i].iov_len = 4096;
              }
      
              ret = io_uring_register_files(&ring, &fd, 1);
              if (ret < 0) {
                      fprintf(stderr, "%s: register %d\n", __FUNCTION__, ret);
                      return ret;
              }
      
              for (i = 0; i < 10; i++) {
                      sqe = io_uring_get_sqe(&ring);
                      if (!sqe)
                              break;
      
                      io_uring_prep_readv(sqe, 0, &iovecs[i], 1, 0);
                      sqe->flags |= IOSQE_FIXED_FILE;
      
                      ret = io_uring_submit(&ring);
                      sleep(1);
                      printf("submit %d\n", i);
              }
      
              for (i = 0; i < 10; i++) {
                      io_uring_wait_cqe(&ring, &cqe);
                      printf("receive: %d\n", i);
                      if (cqe->res != 4096) {
                              fprintf(stderr, "ret=%d, wanted 4096\n", cqe->res);
                              ret = 1;
                      }
                      io_uring_cqe_seen(&ring, cqe);
              }
      
              close(fd);
              io_uring_queue_exit(&ring);
              return 0;
      }
      sudo ./test testfile
      above command will hang on the tenth request, to fix this bug, when io
      sq_thread is waken up, we reset the variable 'ret' to be zero.
      Suggested-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      d4ae271d
    • Christophe Leroy's avatar
      Revert "powerpc/32s: reorder Linux PTE bits to better match Hash PTE bits." · 40bb0e90
      Christophe Leroy authored
      This reverts commit 697ece78.
      
      The implementation of SWAP on powerpc requires page protection
      bits to not be one of the least significant PTE bits.
      
      Until the SWAP implementation is changed and this requirement voids,
      we have to keep at least _PAGE_RW outside of the 3 last bits.
      
      For now, revert to previous PTE bits order. A further rework
      may come later.
      
      Fixes: 697ece78 ("powerpc/32s: reorder Linux PTE bits to better match Hash PTE bits.")
      Reported-by: default avatarRui Salvaterra <rsalvaterra@gmail.com>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/b34706f8de87f84d135abb5f3ede6b6f16fb1f41.1589969799.git.christophe.leroy@csgroup.eu
      40bb0e90
    • Keno Fischer's avatar
      arm64: Fix PTRACE_SYSEMU semantics · 1cf6022b
      Keno Fischer authored
      Quoth the man page:
      ```
             If the tracee was restarted by PTRACE_SYSCALL or PTRACE_SYSEMU, the
             tracee enters syscall-enter-stop just prior to entering any system
             call (which will not be executed if the restart was using
             PTRACE_SYSEMU, regardless of any change made to registers at this
             point or how the tracee is restarted after this stop).
      ```
      
      The parenthetical comment is currently true on x86 and powerpc,
      but not currently true on arm64. arm64 re-checks the _TIF_SYSCALL_EMU
      flag after the syscall entry ptrace stop. However, at this point,
      it reflects which method was used to re-start the syscall
      at the entry stop, rather than the method that was used to reach it.
      Fix that by recording the original flag before performing the ptrace
      stop, bringing the behavior in line with documentation and x86/powerpc.
      
      Fixes: f086f674 ("arm64: ptrace: add support for syscall emulation")
      Cc: <stable@vger.kernel.org> # 5.3.x-
      Signed-off-by: default avatarKeno Fischer <keno@juliacomputing.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Tested-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Tested-by: default avatarBin Lu <Bin.Lu@arm.com>
      [catalin.marinas@arm.com: moved 'flags' bit masking]
      [catalin.marinas@arm.com: changed 'flags' type to unsigned long]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      1cf6022b
    • Gerald Schaefer's avatar
      s390/kaslr: add support for R_390_JMP_SLOT relocation type · 4c1cbcbd
      Gerald Schaefer authored
      With certain kernel configurations, the R_390_JMP_SLOT relocation type
      might be generated, which is not expected by the KASLR relocation code,
      and the kernel stops with the message "Unknown relocation type".
      
      This was found with a zfcpdump kernel config, where CONFIG_MODULES=n
      and CONFIG_VFIO=n. In that case, symbol_get() is used on undefined
      __weak symbols in virt/kvm/vfio.c, which results in the generation
      of R_390_JMP_SLOT relocation types.
      
      Fix this by handling R_390_JMP_SLOT similar to R_390_GLOB_DAT.
      
      Fixes: 805bc0bc ("s390/kernel: build a relocatable kernel")
      Cc: <stable@vger.kernel.org> # v5.2+
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Reviewed-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      4c1cbcbd
    • Gerald Schaefer's avatar
      s390/mm: fix set_huge_pte_at() for empty ptes · ac8372f3
      Gerald Schaefer authored
      On s390, the layout of normal and large ptes (i.e. pmds/puds) differs.
      Therefore, set_huge_pte_at() does a conversion from a normal pte to
      the corresponding large pmd/pud. So, when converting an empty pte, this
      should result in an empty pmd/pud, which would return true for
      pmd/pud_none().
      
      However, after conversion we also mark the pmd/pud as large, and
      therefore present. For empty ptes, this will result in an empty pmd/pud
      that is also marked as large, and pmd/pud_none() would not return true.
      
      There is currently no issue with this behaviour, as set_huge_pte_at()
      does not seem to be called for empty ptes. It would be valid though, so
      let's fix this by not marking empty ptes as large in set_huge_pte_at().
      
      This was found by testing a patch from from Anshuman Khandual, which is
      currently discussed on LKML ("mm/debug: Add more arch page table helper
      tests").
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      ac8372f3
    • Jens Axboe's avatar
      io_uring: don't add non-IO requests to iopoll pending list · b532576e
      Jens Axboe authored
      We normally disable any commands that aren't specifically poll commands
      for a ring that is setup for polling, but we do allow buffer provide and
      remove commands to support buffer selection for polled IO. Once a
      request is issued, we add it to the poll list to poll for completion. But
      we should not do that for non-IO commands, as those request complete
      inline immediately and aren't pollable. If we do, we can leave requests
      on the iopoll list after they are freed.
      
      Fixes: ddf0322d ("io_uring: add IORING_OP_PROVIDE_BUFFERS")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b532576e