1. 12 Apr, 2021 1 commit
    • Vasily Gorbik's avatar
      s390/entry: avoid setting up backchain in ext|io handlers · b74e409e
      Vasily Gorbik authored
      Currently when interrupt arrives to cpu while in kernel context
      INT_HANDLER macro (used for ext_int_handler and io_int_handler)
      allocates new stack frame and pt_regs on the kernel stack and
      sets up the backchain to jump over the pt_regs to the frame which has
      been interrupted. This is not ideal to two reasons:
      
      1. This hides the fact that kernel stack contains interrupt frame in it
         and hence breaks arch_stack_walk_reliable(), which needs to know that to
         guarantee "reliability" and checks that there are no pt_regs on the way.
      
      2. It breaks the backchain unwinder logic, which assumes that the next
         stack frame after an interrupt frame is reliable, while it is not.
         In some cases (when r14 contains garbage) this leads to early unwinding
         termination with an error, instead of marking frame as unreliable
         and continuing.
      
      To address that, only set backchain to 0.
      
      Fixes: 56e62a73 ("s390: convert to generic entry")
      Reviewed-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      b74e409e
  2. 07 Apr, 2021 1 commit
  3. 05 Apr, 2021 3 commits
    • Heiko Carstens's avatar
      s390/irq: fix reading of ext_params2 field from lowcore · 85012e76
      Heiko Carstens authored
      The contents of the ext_params2 field of the lowcore should just be
      copied to the pt_regs structure, not dereferenced.
      
      Fixes crashes / program check loops like this:
      
      Krnl PSW : 0404c00180000000 00000000d6d02b3c (do_ext_irq+0x74/0x170)
                 R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
      Krnl GPRS: 0000000000000000 80000000000b974e 00000000d71abee0 00000000d71abee0
                 0000000080030000 000000000000000f 0000000000000000 0000000000000000
                 0000000000000001 00000380000bf918 00000000d73ef780 00000380000bf518
                 0000000080348000 00000000d6d13350 00000000d6d02b1e 00000380000bf428
      Krnl Code: 00000000d6d02b2e: 58100080            l       %r1,128
                 00000000d6d02b32: 5010b0a4            st      %r1,164(%r11)
                #00000000d6d02b36: e31001b80104        lg      %r1,4536
                >00000000d6d02b3c: e31010000004        lg      %r1,0(%r1)
                 00000000d6d02b42: e310b0a80024        stg     %r1,168(%r11)
                 00000000d6d02b48: c01000242270        larl    %r1,00000000d7187028
                 00000000d6d02b4e: d5071000b010        clc     0(8,%r1),16(%r11)
                 00000000d6d02b54: a784001b            brc     8,00000000d6d02b8a
      Call Trace:
       [<00000000d6d02b3c>] do_ext_irq+0x74/0x170
       [<00000000d6d0ea5c>] ext_int_handler+0xc4/0xf4
       [<00000000d621d266>] die+0x106/0x188
       [<00000000d62305b8>] do_no_context+0xc8/0x100
       [<00000000d6d02790>] __do_pgm_check+0xe0/0x1f0
       [<00000000d6d0e950>] pgm_check_handler+0x118/0x160
       [<00000000d6d02b3c>] do_ext_irq+0x74/0x170
       [<00000000d6d0ea5c>] ext_int_handler+0xc4/0xf4
       [<00000000d621d266>] die+0x106/0x188
       [<00000000d62305b8>] do_no_context+0xc8/0x100
       [<00000000d6d02790>] __do_pgm_check+0xe0/0x1f0
       [<00000000d6d0e950>] pgm_check_handler+0x118/0x160
       [<00000000d6d02b3c>] do_ext_irq+0x74/0x170
       [<00000000d6d0ea5c>] ext_int_handler+0xc4/0xf4
       [<0000000000000000>] 0x0
       [<00000000d6d0e57a>] default_idle_call+0x42/0x110
       [<00000000d629856e>] do_idle+0xce/0x160
       [<00000000d62987be>] cpu_startup_entry+0x36/0x40
       [<00000000d621f2f2>] smp_start_secondary+0x82/0x88
      
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Fixes: 56e62a73 ("s390: convert to generic entry")
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      85012e76
    • Vasily Gorbik's avatar
      s390/unwind: add machine check handler stack · 08edb968
      Vasily Gorbik authored
      Fixes: b61b1595 ("s390: add stack for machine check handler")
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      08edb968
    • Alexander Gordeev's avatar
      s390/cpcmd: fix inline assembly register clobbering · 7a2f9144
      Alexander Gordeev authored
      Register variables initialized using arithmetic. That leads to
      kasan instrumentaton code corrupting the registers contents.
      Follow GCC guidlines and use temporary variables for assigning
      init values to register variables.
      
      Fixes: 94c12cc7 ("[S390] Inline assembly cleanup.")
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.htmlSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      7a2f9144
  4. 28 Mar, 2021 1 commit
  5. 25 Mar, 2021 3 commits
    • Heiko Carstens's avatar
      s390/vdso: fix initializing and updating of vdso_data · 5b43bd18
      Heiko Carstens authored
      Li Wang reported that clock_gettime(CLOCK_MONOTONIC_RAW, ...) returns
      incorrect values when time is provided via vdso instead of system call:
      
      vdso_ts_nsec = 4484351380985507, vdso_ts.tv_sec = 4484351, vdso_ts.tv_nsec = 380985507
      sys_ts_nsec  = 1446923235377, sys_ts.tv_sec  = 1446, sys_ts.tv_nsec  = 923235377
      
      Within the s390 specific vdso function __arch_get_hw_counter() reads
      tod clock steering values from the arch_data member of the passed in
      vdso_data structure.
      
      Problem is that only for the CS_HRES_COARSE vdso_data arch_data is
      initialized and gets updated. The CS_RAW specific vdso_data does not
      contain any valid tod_clock_steering information, which explains the
      different values.
      
      Fix this by initializing and updating all vdso_datas.
      Reported-by: default avatarLi Wang <liwang@redhat.com>
      Tested-by: default avatarLi Wang <liwang@redhat.com>
      Fixes: 1ba2d6c0 ("s390/vdso: simplify __arch_get_hw_counter()")
      Link: https://lore.kernel.org/linux-s390/YFnxr1ZlMIOIqjfq@osirisSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      5b43bd18
    • Heiko Carstens's avatar
      s390/vdso: fix tod_steering_delta type · b24bacd6
      Heiko Carstens authored
      The s390 specific vdso function __arch_get_hw_counter() is supposed to
      consider tod clock steering.
      
      If a tod clock steering event happens and the tod clock is set to a
      new value __arch_get_hw_counter() will not return the real tod clock
      value but slowly drift it from the old delta until the returned value
      finally matches the real tod clock value again.
      
      Unfortunately the type of tod_steering_delta unsigned while it is
      supposed to be signed. It depends on if tod_steering_delta is negative
      or positive in which direction the vdso code drifts the clock value.
      
      Worst case is now that instead of drifting the clock slowly it will
      jump into the opposite direction by a factor of two.
      
      Fix this by simply making tod_steering_delta signed.
      
      Fixes: 4bff8cb5 ("s390: convert to GENERIC_VDSO")
      Cc: <stable@vger.kernel.org> # 5.10
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      b24bacd6
    • Heiko Carstens's avatar
      s390/vdso: copy tod_steering_delta value to vdso_data page · 72bbc226
      Heiko Carstens authored
      When converting the vdso assembler code to C it was forgotten to
      actually copy the tod_steering_delta value to vdso_data page.
      
      Which in turn means that tod clock steering will not work correctly.
      
      Fix this by simply copying the value whenever it is updated.
      
      Fixes: 4bff8cb5 ("s390: convert to GENERIC_VDSO")
      Cc: <stable@vger.kernel.org> # 5.10
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      72bbc226
  6. 21 Mar, 2021 23 commits
  7. 20 Mar, 2021 7 commits
    • Thomas Gleixner's avatar
      genirq: Disable interrupts for force threaded handlers · 81e2073c
      Thomas Gleixner authored
      With interrupt force threading all device interrupt handlers are invoked
      from kernel threads. Contrary to hard interrupt context the invocation only
      disables bottom halfs, but not interrupts. This was an oversight back then
      because any code like this will have an issue:
      
      thread(irq_A)
        irq_handler(A)
          spin_lock(&foo->lock);
      
      interrupt(irq_B)
        irq_handler(B)
          spin_lock(&foo->lock);
      
      This has been triggered with networking (NAPI vs. hrtimers) and console
      drivers where printk() happens from an interrupt which interrupted the
      force threaded handler.
      
      Now people noticed and started to change the spin_lock() in the handler to
      spin_lock_irqsave() which affects performance or add IRQF_NOTHREAD to the
      interrupt request which in turn breaks RT.
      
      Fix the root cause and not the symptom and disable interrupts before
      invoking the force threaded handler which preserves the regular semantics
      and the usefulness of the interrupt force threading as a general debugging
      tool.
      
      For not RT this is not changing much, except that during the execution of
      the threaded handler interrupts are delayed until the handler
      returns. Vs. scheduling and softirq processing there is no difference.
      
      For RT kernels there is no issue.
      
      Fixes: 8d32a307 ("genirq: Provide forced interrupt threading")
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Link: https://lore.kernel.org/r/20210317143859.513307808@linutronix.de
      81e2073c
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 812da4d3
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
       "A handful of fixes for 5.12:
      
         - fix the SBI remote fence numbers for hypervisor fences, which had
           been transcribed in the wrong order in Linux. These fences are only
           used with the KVM patches applied.
      
         - fix a whole host of build warnings, these should have no functional
           change.
      
         - fix init_resources() to prevent an off-by-one error from causing an
           out-of-bounds array reference. This was manifesting during boot on
           vexriscv.
      
         - ensure the KASAN mappings are visible before proceeding to use
           them"
      
      * tag 'riscv-for-linus-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Correct SPARSEMEM configuration
        RISC-V: kasan: Declare kasan_shallow_populate() static
        riscv: Ensure page table writes are flushed when initializing KASAN vmalloc
        RISC-V: Fix out-of-bounds accesses in init_resources()
        riscv: Fix compilation error with Canaan SoC
        ftrace: Fix spelling mistake "disabed" -> "disabled"
        riscv: fix bugon.cocci warnings
        riscv: process: Fix no prototype for arch_dup_task_struct
        riscv: ftrace: Use ftrace_get_regs helper
        riscv: process: Fix no prototype for show_regs
        riscv: syscall_table: Reduce W=1 compilation warnings noise
        riscv: time: Fix no prototype for time_init
        riscv: ptrace: Fix no prototype warnings
        riscv: sbi: Fix comment of __sbi_set_timer_v01
        riscv: irq: Fix no prototype warning
        riscv: traps: Fix no prototype warnings
        RISC-V: correct enum sbi_ext_rfence_fid
      812da4d3
    • Linus Torvalds's avatar
      Merge tag '5.12-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6 · bfdc4aa9
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Five cifs/smb3 fixes - three for stable, including an important ACL
        fix and security signature fix"
      
      * tag '5.12-rc3-smb3' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: fix allocation size on newly created files
        cifs: warn and fail if trying to use rootfs without the config option
        fs/cifs/: fix misspellings using codespell tool
        cifs: Fix preauth hash corruption
        cifs: update new ACE pointer after populate_new_aces.
      bfdc4aa9
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · af97713d
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Eight fixes, all in drivers, all fairly minor either being fixes in
        error legs, memory leaks on teardown, context errors or semantic
        problems"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: mpt3sas: Do not use GFP_KERNEL in atomic context
        scsi: ufs: ufs-mediatek: Correct operator & -> &&
        scsi: sd_zbc: Update write pointer offset cache
        scsi: lpfc: Fix some error codes in debugfs
        scsi: qla2xxx: Fix broken #endif placement
        scsi: st: Fix a use after free in st_open()
        scsi: myrs: Fix a double free in myrs_cleanup()
        scsi: ibmvfc: Free channel_setup_buf during device tear down
      af97713d
    • Linus Torvalds's avatar
      Merge tag 'zonefs-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs · 1c273e10
      Linus Torvalds authored
      Pull zonefs fixes from Damien Le Moal:
      
       - fix inode write open reference count (Chao)
      
       - Fix wrong write offset for asynchronous O_APPEND writes (me)
      
       - Prevent use of sequential zone file as swap files (me)
      
      * tag 'zonefs-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs:
        zonefs: fix to update .i_wr_refcnt correctly in zonefs_open_zone()
        zonefs: Fix O_APPEND async write handling
        zonefs: prevent use of seq files as swap file
      1c273e10
    • Linus Torvalds's avatar
      Merge tag 'block-5.12-2021-03-19' of git://git.kernel.dk/linux-block · d626c692
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Just an NVMe pull request this week:
      
         - fix tag allocation for keep alive
      
         - fix a unit mismatch for the Write Zeroes limits
      
         - various TCP transport fixes (Sagi Grimberg, Elad Grupi)
      
         - fix iosqes and iocqes validation for discovery controllers (Sagi Grimberg)"
      
      * tag 'block-5.12-2021-03-19' of git://git.kernel.dk/linux-block:
        nvmet-tcp: fix kmap leak when data digest in use
        nvmet: don't check iosqes,iocqes for discovery controllers
        nvme-rdma: fix possible hang when failing to set io queues
        nvme-tcp: fix possible hang when failing to set io queues
        nvme-tcp: fix misuse of __smp_processor_id with preemption enabled
        nvme-tcp: fix a NULL deref when receiving a 0-length r2t PDU
        nvme: fix Write Zeroes limitations
        nvme: allocate the keep alive request using BLK_MQ_REQ_NOWAIT
        nvme: merge nvme_keep_alive into nvme_keep_alive_work
        nvme-fabrics: only reserve a single tag
      d626c692
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.12-2021-03-19' of git://git.kernel.dk/linux-block · 0ada2dad
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "Quieter week this time, which was both expected and desired. About
        half of the below is fixes for this release, the other half are just
        fixes in general. In detail:
      
         - Fix the freezing of IO threads, by making the freezer not send them
           fake signals. Make them freezable by default.
      
         - Like we did for personalities, move the buffer IDR to xarray. Kills
           some code and avoids a use-after-free on teardown.
      
         - SQPOLL cleanups and fixes (Pavel)
      
         - Fix linked timeout race (Pavel)
      
         - Fix potential completion post use-after-free (Pavel)
      
         - Cleanup and move internal structures outside of general kernel view
           (Stefan)
      
         - Use MSG_SIGNAL for send/recv from io_uring (Stefan)"
      
      * tag 'io_uring-5.12-2021-03-19' of git://git.kernel.dk/linux-block:
        io_uring: don't leak creds on SQO attach error
        io_uring: use typesafe pointers in io_uring_task
        io_uring: remove structures from include/linux/io_uring.h
        io_uring: imply MSG_NOSIGNAL for send[msg]()/recv[msg]() calls
        io_uring: fix sqpoll cancellation via task_work
        io_uring: add generic callback_head helpers
        io_uring: fix concurrent parking
        io_uring: halt SQO submission on ctx exit
        io_uring: replace sqd rw_semaphore with mutex
        io_uring: fix complete_post use ctx after free
        io_uring: fix ->flags races by linked timeouts
        io_uring: convert io_buffer_idr to XArray
        io_uring: allow IO worker threads to be frozen
        kernel: freezer should treat PF_IO_WORKER like PF_KTHREAD for freezing
      0ada2dad
  8. 19 Mar, 2021 1 commit
    • Johan Hovold's avatar
      x86/apic/of: Fix CPU devicetree-node lookups · dd926880
      Johan Hovold authored
      Architectures that describe the CPU topology in devicetree and do not have
      an identity mapping between physical and logical CPU ids must override the
      default implementation of arch_match_cpu_phys_id().
      
      Failing to do so breaks CPU devicetree-node lookups using of_get_cpu_node()
      and of_cpu_device_node_get() which several drivers rely on. It also causes
      the CPU struct devices exported through sysfs to point to the wrong
      devicetree nodes.
      
      On x86, CPUs are described in devicetree using their APIC ids and those
      do not generally coincide with the logical ids, even if CPU0 typically
      uses APIC id 0.
      
      Add the missing implementation of arch_match_cpu_phys_id() so that CPU-node
      lookups work also with SMP.
      
      Apart from fixing the broken sysfs devicetree-node links this likely does
      not affect current users of mainline kernels on x86.
      
      Fixes: 4e07db9c ("x86/devicetree: Use CPU description from Device Tree")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: https://lore.kernel.org/r/20210312092033.26317-1-johan@kernel.org
      dd926880