1. 21 Dec, 2023 4 commits
    • Linus Torvalds's avatar
      posix-timers: Get rid of [COMPAT_]SYS_NI() uses · a4aebe93
      Linus Torvalds authored
      Only the posix timer system calls use this (when the posix timer support
      is disabled, which does not actually happen in any normal case), because
      they had debug code to print out a warning about missing system calls.
      
      Get rid of that special case, and just use the standard COND_SYSCALL
      interface that creates weak system call stubs that return -ENOSYS for
      when the system call does not exist.
      
      This fixes a kCFI issue with the SYS_NI() hackery:
      
        CFI failure at int80_emulation+0x67/0xb0 (target: sys_ni_posix_timers+0x0/0x70; expected type: 0xb02b34d9)
        WARNING: CPU: 0 PID: 48 at int80_emulation+0x67/0xb0
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a4aebe93
    • Linus Torvalds's avatar
      Merge tag '6.7-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · eee7f5b4
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
      
       - two multichannel reconnect fixes, one fixing an important refcounting
         problem that can lead to umount problems
      
       - atime fix
      
       - five fixes for various potential OOB accesses, including a CVE fix,
         and two additional fixes for problems pointed out by Robert Morris's
         fuzzing investigation
      
      * tag '6.7-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: do not let cifs_chan_update_iface deallocate channels
        cifs: fix a pending undercount of srv_count
        fs: cifs: Fix atime update check
        smb: client: fix potential OOB in smb2_dump_detail()
        smb: client: fix potential OOB in cifs_dump_detail()
        smb: client: fix OOB in smbCalcSize()
        smb: client: fix OOB in SMB2_query_info_init()
        smb: client: fix OOB in cifsd when receiving compounded resps
      eee7f5b4
    • Linus Torvalds's avatar
      Merge tag 's390-6.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 1bf5c892
      Linus Torvalds authored
      Pull s390 fixes from Alexander Gordeev:
      
       - Fix virtual vs physical address confusion in Storage Class Memory
         (SCM) block device driver.
      
       - Fix saving and restoring of FPU kernel context, which could lead to
         corruption of vector registers 8-15
      
       - Update defconfigs
      
      * tag 's390-6.7-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390: update defconfigs
        s390/vx: fix save/restore of fpu kernel context
        s390/scm: fix virtual vs physical address confusion
      1bf5c892
    • Linus Torvalds's avatar
      Merge tag 'soc-fixes-6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 87c71dd6
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "There are only a handful of bugfixes this time, which feels almost too
        small, so I hope we are not missing something important.
      
         - One more mediatek dts warning fix after the previous larger set,
           this should finally result in a clean defconfig build.
      
         - TI OMAP dts fixes for a spurious hang on am335x and invalid data on
           DTA7
      
         - One DTS fix for ethernet on Oriange Pi Zero (Allwinner H616)
      
         - A regression fix for ti-sysc interconnect target module driver to
           not access registers after reset if srst_udelay quirk is needed
      
         - Reset controller driver fixes for a crash during error handling and
           a build warning"
      
      * tag 'soc-fixes-6.7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        arm64: dts: mediatek: mt8395-genio-1200-evk: add interrupt-parent for mt6360
        ARM: dts: Fix occasional boot hang for am3 usb
        reset: Fix crash when freeing non-existent optional resets
        ARM: OMAP2+: Fix null pointer dereference and memory leak in omap_soc_device_init
        ARM: dts: dra7: Fix DRA7 L3 NoC node register size
        bus: ti-sysc: Flush posted write only after srst_udelay
        reset: hisilicon: hi6220: fix Wvoid-pointer-to-enum-cast warning
        arm64: dts: allwinner: h616: update emac for Orange Pi Zero 3
      87c71dd6
  2. 20 Dec, 2023 9 commits
  3. 19 Dec, 2023 11 commits
    • Kent Overstreet's avatar
    • Kent Overstreet's avatar
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · 55cb5f43
      Linus Torvalds authored
      Pull tracing fix from Steven Rostedt:
       "While working on the ring buffer, I found one more bug with the
        timestamp code, and the fix for this removed the need for the final
        64-bit cmpxchg!
      
        The ring buffer events hold a "delta" from the previous event. If it
        is determined that the delta can not be calculated, it falls back to
        adding an absolute timestamp value. The way to know if the delta can
        be used is via two stored timestamps in the per-cpu buffer meta data:
      
         before_stamp and write_stamp
      
        The before_stamp is written by every event before it tries to allocate
        its space on the ring buffer. The write_stamp is written after it
        allocates its space and knows that nothing came in after it read the
        previous before_stamp and write_stamp and the two matched.
      
        A previous fix dd939425 ("ring-buffer: Do not try to put back
        write_stamp") removed putting back the write_stamp to match the
        before_stamp so that the next event could use the delta, but races
        were found where the two would match, but not be for of the previous
        event.
      
        It was determined to allow the event reservation to not have a valid
        write_stamp when it is finished, and this fixed a lot of races.
      
        The last use of the 64-bit timestamp cmpxchg depended on the
        write_stamp being valid after an interruption. But this is no longer
        the case, as if an event is interrupted by a softirq that writes an
        event, and that event gets interrupted by a hardirq or NMI and that
        writes an event, then the softirq could finish its reservation without
        a valid write_stamp.
      
        In the slow path of the event reservation, a delta can still be used
        if the write_stamp is valid. Instead of using a cmpxchg against the
        write stamp, the before_stamp needs to be read again to validate the
        write_stamp. The cmpxchg is not needed.
      
        This updates the slowpath to validate the write_stamp by comparing it
        to the before_stamp and removes all rb_time_cmpxchg() as there are no
        more users of that function.
      
        The removal of the 32-bit updates of rb_time_t will be done in the
        next merge window"
      
      * tag 'trace-v6.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        ring-buffer: Fix slowpath of interrupted event
      55cb5f43
    • Linus Torvalds's avatar
      Merge tag 'arc-6.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc · 9c749e61
      Linus Torvalds authored
      Pull ARC fixes from Vineet Gupta:
      
       - build error for hugetlb, sparse and smatch fixes
      
       - removal of VIPT aliasing cache code
      
      * tag 'arc-6.7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
        ARC: add hugetlb definitions
        ARC: fix smatch warning
        ARC: fix spare error
        ARC: mm: retire support for aliasing VIPT D$
        ARC: entry: move ARCompact specific bits out of entry.h
        ARC: entry: SAVE_ABI_CALLEE_REG: ISA/ABI specific helper
      9c749e61
    • Shyam Prasad N's avatar
      cifs: do not let cifs_chan_update_iface deallocate channels · 12d1e301
      Shyam Prasad N authored
      cifs_chan_update_iface is meant to check and update the server
      interface used for a channel when the existing server interface
      is no longer available.
      
      So far, this handler had the code to remove an interface entry
      even if a new candidate interface is not available. Allowing
      this leads to several corner cases to handle.
      
      This change makes the logic much simpler by not deallocating
      the current channel interface entry if a new interface is not
      found to replace it with.
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      12d1e301
    • Shyam Prasad N's avatar
      cifs: fix a pending undercount of srv_count · f30bbc38
      Shyam Prasad N authored
      The following commit reverted the changes to ref count
      the server struct while scheduling a reconnect work:
      82334252 Revert "cifs: reconnect work should have reference on server struct"
      
      However, a following change also introduced scheduling
      of reconnect work, and assumed ref counting. This change
      fixes that as well.
      
      Fixes umount problems like:
      
      [73496.157838] CPU: 5 PID: 1321389 Comm: umount Tainted: G        W  OE      6.7.0-060700rc6-generic #202312172332
      [73496.157841] Hardware name: LENOVO 20MAS08500/20MAS08500, BIOS N2CET67W (1.50 ) 12/15/2022
      [73496.157843] RIP: 0010:cifs_put_tcp_session+0x17d/0x190 [cifs]
      [73496.157906] Code: 5d 31 c0 31 d2 31 f6 31 ff c3 cc cc cc cc e8 4a 6e 14 e6 e9 f6 fe ff ff be 03 00 00 00 48 89 d7 e8 78 26 b3 e5 e9 e4 fe ff ff <0f> 0b e9 b1 fe ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90
      [73496.157908] RSP: 0018:ffffc90003bcbcb8 EFLAGS: 00010286
      [73496.157911] RAX: 00000000ffffffff RBX: ffff8885830fa800 RCX: 0000000000000000
      [73496.157913] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
      [73496.157915] RBP: ffffc90003bcbcc8 R08: 0000000000000000 R09: 0000000000000000
      [73496.157917] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      [73496.157918] R13: ffff8887d56ba800 R14: 00000000ffffffff R15: ffff8885830fa800
      [73496.157920] FS:  00007f1ff0e33800(0000) GS:ffff88887ba80000(0000) knlGS:0000000000000000
      [73496.157922] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [73496.157924] CR2: 0000115f002e2010 CR3: 00000003d1e24005 CR4: 00000000003706f0
      [73496.157926] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [73496.157928] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [73496.157929] Call Trace:
      [73496.157931]  <TASK>
      [73496.157933]  ? show_regs+0x6d/0x80
      [73496.157936]  ? __warn+0x89/0x160
      [73496.157939]  ? cifs_put_tcp_session+0x17d/0x190 [cifs]
      [73496.157976]  ? report_bug+0x17e/0x1b0
      [73496.157980]  ? handle_bug+0x51/0xa0
      [73496.157983]  ? exc_invalid_op+0x18/0x80
      [73496.157985]  ? asm_exc_invalid_op+0x1b/0x20
      [73496.157989]  ? cifs_put_tcp_session+0x17d/0x190 [cifs]
      [73496.158023]  ? cifs_put_tcp_session+0x1e/0x190 [cifs]
      [73496.158057]  __cifs_put_smb_ses+0x2b5/0x540 [cifs]
      [73496.158090]  ? tconInfoFree+0xc2/0x120 [cifs]
      [73496.158130]  cifs_put_tcon.part.0+0x108/0x2b0 [cifs]
      [73496.158173]  cifs_put_tlink+0x49/0x90 [cifs]
      [73496.158220]  cifs_umount+0x56/0xb0 [cifs]
      [73496.158258]  cifs_kill_sb+0x52/0x60 [cifs]
      [73496.158306]  deactivate_locked_super+0x32/0xc0
      [73496.158309]  deactivate_super+0x46/0x60
      [73496.158311]  cleanup_mnt+0xc3/0x170
      [73496.158314]  __cleanup_mnt+0x12/0x20
      [73496.158330]  task_work_run+0x5e/0xa0
      [73496.158333]  exit_to_user_mode_loop+0x105/0x130
      [73496.158336]  exit_to_user_mode_prepare+0xa5/0xb0
      [73496.158338]  syscall_exit_to_user_mode+0x29/0x60
      [73496.158341]  do_syscall_64+0x6c/0xf0
      [73496.158344]  ? syscall_exit_to_user_mode+0x37/0x60
      [73496.158346]  ? do_syscall_64+0x6c/0xf0
      [73496.158349]  ? exit_to_user_mode_prepare+0x30/0xb0
      [73496.158353]  ? syscall_exit_to_user_mode+0x37/0x60
      [73496.158355]  ? do_syscall_64+0x6c/0xf0
      Reported-by: default avatarRobert Morris <rtm@csail.mit.edu>
      Fixes: 705fc522 ("cifs: handle when server starts supporting multichannel")
      Signed-off-by: default avatarShyam Prasad N <sprasad@microsoft.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      f30bbc38
    • Heiko Carstens's avatar
      s390: update defconfigs · 3d940bb1
      Heiko Carstens authored
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      3d940bb1
    • Zizhi Wo's avatar
      fs: cifs: Fix atime update check · 01fe654f
      Zizhi Wo authored
      Commit 9b9c5bea ("cifs: do not return atime less than mtime") indicates
      that in cifs, if atime is less than mtime, some apps will break.
      Therefore, it introduce a function to compare this two variables in two
      places where atime is updated. If atime is less than mtime, update it to
      mtime.
      
      However, the patch was handled incorrectly, resulting in atime and mtime
      being exactly equal. A previous commit 69738cfd ("fs: cifs: Fix atime
      update check vs mtime") fixed one place and forgot to fix another. Fix it.
      
      Fixes: 9b9c5bea ("cifs: do not return atime less than mtime")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarZizhi Wo <wozizhi@huawei.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      01fe654f
    • Paulo Alcantara's avatar
      smb: client: fix potential OOB in smb2_dump_detail() · 567320c4
      Paulo Alcantara authored
      Validate SMB message with ->check_message() before calling
      ->calc_smb_size().
      
      This fixes CVE-2023-6610.
      
      Reported-by: j51569436@gmail.com
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218219
      Cc; stable@vger.kernel.org
      Signed-off-by: default avatarPaulo Alcantara <pc@manguebit.com>
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      567320c4
    • Steven Rostedt (Google)'s avatar
      ring-buffer: Fix slowpath of interrupted event · b803d7c6
      Steven Rostedt (Google) authored
      To synchronize the timestamps with the ring buffer reservation, there are
      two timestamps that are saved in the buffer meta data.
      
      1. before_stamp
      2. write_stamp
      
      When the two are equal, the write_stamp is considered valid, as in, it may
      be used to calculate the delta of the next event as the write_stamp is the
      timestamp of the previous reserved event on the buffer.
      
      This is done by the following:
      
       /*A*/	w = current position on the ring buffer
      	before = before_stamp
      	after = write_stamp
      	ts = read current timestamp
      
      	if (before != after) {
      		write_stamp is not valid, force adding an absolute
      		timestamp.
      	}
      
       /*B*/	before_stamp = ts
      
       /*C*/	write = local_add_return(event length, position on ring buffer)
      
      	if (w == write - event length) {
      		/* Nothing interrupted between A and C */
       /*E*/		write_stamp = ts;
      		delta = ts - after
      		/*
      		 * If nothing interrupted again,
      		 * before_stamp == write_stamp and write_stamp
      		 * can be used to calculate the delta for
      		 * events that come in after this one.
      		 */
      	} else {
      
      		/*
      		 * The slow path!
      		 * Was interrupted between A and C.
      		 */
      
      This is the place that there's a bug. We currently have:
      
      		after = write_stamp
      		ts = read current timestamp
      
       /*F*/		if (write == current position on the ring buffer &&
      		    after < ts && cmpxchg(write_stamp, after, ts)) {
      
      			delta = ts - after;
      
      		} else {
      			delta = 0;
      		}
      
      The assumption is that if the current position on the ring buffer hasn't
      moved between C and F, then it also was not interrupted, and that the last
      event written has a timestamp that matches the write_stamp. That is the
      write_stamp is valid.
      
      But this may not be the case:
      
      If a task context event was interrupted by softirq between B and C.
      
      And the softirq wrote an event that got interrupted by a hard irq between
      C and E.
      
      and the hard irq wrote an event (does not need to be interrupted)
      
      We have:
      
       /*B*/ before_stamp = ts of normal context
      
         ---> interrupted by softirq
      
      	/*B*/ before_stamp = ts of softirq context
      
      	  ---> interrupted by hardirq
      
      		/*B*/ before_stamp = ts of hard irq context
      		/*E*/ write_stamp = ts of hard irq context
      
      		/* matches and write_stamp valid */
      	  <----
      
      	/*E*/ write_stamp = ts of softirq context
      
      	/* No longer matches before_stamp, write_stamp is not valid! */
      
         <---
      
       w != write - length, go to slow path
      
      // Right now the order of events in the ring buffer is:
      //
      // |-- softirq event --|-- hard irq event --|-- normal context event --|
      //
      
       after = write_stamp (this is the ts of softirq)
       ts = read current timestamp
      
       if (write == current position on the ring buffer [true] &&
           after < ts [true] && cmpxchg(write_stamp, after, ts) [true]) {
      
      	delta = ts - after  [Wrong!]
      
      The delta is to be between the hard irq event and the normal context
      event, but the above logic made the delta between the softirq event and
      the normal context event, where the hard irq event is between the two. This
      will shift all the remaining event timestamps on the sub-buffer
      incorrectly.
      
      The write_stamp is only valid if it matches the before_stamp. The cmpxchg
      does nothing to help this.
      
      Instead, the following logic can be done to fix this:
      
      	before = before_stamp
      	ts = read current timestamp
      	before_stamp = ts
      
      	after = write_stamp
      
      	if (write == current position on the ring buffer &&
      	    after == before && after < ts) {
      
      		delta = ts - after
      
      	} else {
      		delta = 0;
      	}
      
      The above will only use the write_stamp if it still matches before_stamp
      and was tested to not have changed since C.
      
      As a bonus, with this logic we do not need any 64-bit cmpxchg() at all!
      
      This means the 32-bit rb_time_t workaround can finally be removed. But
      that's for a later time.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20231218175229.58ec3daf@gandalf.local.home/
      Link: https://lore.kernel.org/linux-trace-kernel/20231218230712.3a76b081@gandalf.local.home
      
      Cc: stable@vger.kernel.org
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Fixes: dd939425 ("ring-buffer: Do not try to put back write_stamp")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      b803d7c6
    • Linus Torvalds's avatar
      Merge tag 'hid-for-linus-2023121901' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 3f10e214
      Linus Torvalds authored
      Pull HID fixes from Jiri Kosina:
      
       - fix for division by zero in Nintendo driver when generic joycon is
         attached, reported and fixed by SteamOS folks (Guilherme G. Piccoli)
      
       - GCC-7 build fix (which is a good cleanup anyway) for Nintendo driver
         (Ryan McClelland)
      
      * tag 'hid-for-linus-2023121901' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: nintendo: Prevent divide-by-zero on code
        HID: nintendo: fix initializer element is not constant error
      3f10e214
  4. 18 Dec, 2023 16 commits