Skip to content
  1. Feb 25, 2023
    • Thomas Gleixner's avatar
      alarmtimer: Prevent starvation by small intervals and SIG_IGN · d6a30007
      Thomas Gleixner authored
      commit d125d134 upstream.
      
      syzbot reported a RCU stall which is caused by setting up an alarmtimer
      with a very small interval and ignoring the signal. The reproducer arms the
      alarm timer with a relative expiry of 8ns and an interval of 9ns. Not a
      problem per se, but that's an issue when the signal is ignored because then
      the timer is immediately rearmed because there is no way to delay that
      rearming to the signal delivery path.  See posix_timer_fn() and commit
      58229a18 ("posix-timers: Prevent softirq starvation by small intervals
      and SIG_IGN") for details.
      
      The reproducer does not set SIG_IGN explicitely, but it sets up the timers
      signal with SIGCONT. That has the same effect as explicitely setting
      SIG_IGN for a signal as SIGCONT is ignored if there is no handler set and
      the task is not ptraced.
      
      The log clearly shows that:
      
         [pid  5102] --- SIGCONT {si_signo=SIGCONT, si_code=SI_TIMER, si_timerid=0, si_overrun=316014, si_int=0, si_ptr=NULL} ---
      
      It works because the tasks are traced and therefore the signal is queued so
      the tracer can see it, which delays the restart of the timer to the signal
      delivery path. But then the tracer is killed:
      
         [pid  5087] kill(-5102, SIGKILL <unfinished ...>
         ...
         ./strace-static-x86_64: Process 5107 detached
      
      and after it's gone the stall can be observed:
      
         syzkaller login: [   79.439102][    C0] hrtimer: interrupt took 68471 ns
         [  184.460538][    C1] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
         ...
         [  184.658237][    C1] rcu: Stack dump where RCU GP kthread last ran:
         [  184.664574][    C1] Sending NMI from CPU 1 to CPUs 0:
         [  184.669821][    C0] NMI backtrace for cpu 0
         [  184.669831][    C0] CPU: 0 PID: 5108 Comm: syz-executor192 Not tainted 6.2.0-rc6-next-20230203-syzkaller #0
         ...
         [  184.670036][    C0] Call Trace:
         [  184.670041][    C0]  <IRQ>
         [  184.670045][    C0]  alarmtimer_fired+0x327/0x670
      
      posix_timer_fn() prevents that by checking whether the interval for
      timers which have the signal ignored is smaller than a jiffie and
      artifically delay it by shifting the next expiry out by a jiffie. That's
      accurate vs. the overrun accounting, but slightly inaccurate
      vs. timer_gettimer(2).
      
      The comment in that function says what needs to be done and there was a fix
      available for the regular userspace induced SIG_IGN mechanism, but that did
      not work due to the implicit ignore for SIGCONT and similar signals. This
      needs to be worked on, but for now the only available workaround is to do
      exactly what posix_timer_fn() does:
      
      Increase the interval of self-rearming timers, which have their signal
      ignored, to at least a jiffie.
      
      Interestingly this has been fixed before via commit ff86bf0c
      
      
      ("alarmtimer: Rate limit periodic intervals") already, but that fix got
      lost in a later rework.
      
      Reported-by: default avatar <syzbot+b9564ba6e8e00694511b@syzkaller.appspotmail.com>
      Fixes: f2c45807
      
       ("alarmtimer: Switch over to generic set/get/rearm routine")
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarJohn Stultz <jstultz@google.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/87k00q1no2.ffs@tglx
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6a30007
    • Sean Anderson's avatar
      powerpc: dts: t208x: Disable 10G on MAC1 and MAC2 · 63ad0ad1
      Sean Anderson authored
      [ Upstream commit 8d8bee13 ]
      
      There aren't enough resources to run these ports at 10G speeds. Disable
      10G for these ports, reverting to the previous speed.
      
      Fixes: 36926a7d
      
       ("powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G")
      Reported-by: default avatarCamelia Alexandra Groza <camelia.groza@nxp.com>
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Reviewed-by: default avatarCamelia Groza <camelia.groza@nxp.com>
      Tested-by: default avatarCamelia Groza <camelia.groza@nxp.com>
      Link: https://lore.kernel.org/r/20221216172937.2960054-1-sean.anderson@seco.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      63ad0ad1
    • Marc Kleine-Budde's avatar
      can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len · a8144445
      Marc Kleine-Budde authored
      [ Upstream commit f0062291 ]
      
      Debian's gcc-13 [1] throws the following error in
      kvaser_usb_hydra_cmd_size():
      
      [1] gcc version 13.0.0 20221214 (experimental) [master r13-4693-g512098a3316] (Debian 13-20221214-1)
      
      | drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c:502:65: error:
      | array subscript ‘struct kvaser_cmd_ext[0]’ is partly outside array
      | bounds of ‘unsigned char[32]’ [-Werror=array-bounds=]
      |   502 |                 ret = le16_to_cpu(((struct kvaser_cmd_ext *)cmd)->len);
      
      kvaser_usb_hydra_cmd_size() returns the size of given command. It
      depends on the command number (cmd->header.cmd_no). For extended
      commands (cmd->header.cmd_no == CMD_EXTENDED) the above shown code is
      executed.
      
      Help gcc to recognize that this code path is not taken in all cases,
      by calling kvaser_usb_hydra_cmd_size() directly after assigning the
      command number.
      
      Fixes: aec5fb22
      
       ("can: kvaser_usb: Add support for Kvaser USB hydra family")
      Cc: Jimmy Assarsson <extja@kvaser.com>
      Cc: Anssi Hannula <anssi.hannula@bitwise.fi>
      Link: https://lore.kernel.org/all/20221219110104.1073881-1-mkl@pengutronix.de
      Tested-by: default avatarJimmy Assarsson <extja@kvaser.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a8144445
    • Jason A. Donenfeld's avatar
      random: always mix cycle counter in add_latent_entropy() · e4935368
      Jason A. Donenfeld authored
      [ Upstream commit d7bf7f3b ]
      
      add_latent_entropy() is called every time a process forks, in
      kernel_clone(). This in turn calls add_device_randomness() using the
      latent entropy global state. add_device_randomness() does two things:
      
         2) Mixes into the input pool the latent entropy argument passed; and
         1) Mixes in a cycle counter, a sort of measurement of when the event
            took place, the high precision bits of which are presumably
            difficult to predict.
      
      (2) is impossible without CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y. But (1) is
      always possible. However, currently CONFIG_GCC_PLUGIN_LATENT_ENTROPY=n
      disables both (1) and (2), instead of just (2).
      
      This commit causes the CONFIG_GCC_PLUGIN_LATENT_ENTROPY=n case to still
      do (1) by passing NULL (len 0) to add_device_randomness() when add_latent_
      entropy() is called.
      
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: PaX Team <pageexec@freemail.hu>
      Cc: Emese Revfy <re.emese@gmail.com>
      Fixes: 38addce8
      
       ("gcc-plugins: Add latent_entropy plugin")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e4935368
    • Sean Anderson's avatar
      powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G · c30e4cc3
      Sean Anderson authored
      [ Upstream commit 36926a7d ]
      
      On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC dtsi
      fragments, and mark the QMAN ports as 10G.
      
      Fixes: da414bb9
      
       ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)")
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c30e4cc3
    • Bitterblue Smith's avatar
      wifi: rtl8xxxu: gen2: Turn on the rate control · c5afca5d
      Bitterblue Smith authored
      [ Upstream commit 791082ec ]
      
      Re-enable the function rtl8xxxu_gen2_report_connect.
      
      It informs the firmware when connecting to a network. This makes the
      firmware enable the rate control, which makes the upload faster.
      
      It also informs the firmware when disconnecting from a network. In the
      past this made reconnecting impossible because it was sending the
      auth on queue 0x7 (TXDESC_QUEUE_VO) instead of queue 0x12
      (TXDESC_QUEUE_MGNT):
      
      wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 1/3)
      wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 2/3)
      wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 3/3)
      wlp0s20f0u3: authentication with 90:55:de:__:__:__ timed out
      
      Probably the firmware disables the unnecessary TX queues when it
      knows it's disconnected.
      
      However, this was fixed in commit edd5747a ("wifi: rtl8xxxu: Fix
      skb misuse in TX queue selection").
      
      Fixes: c59f13bb
      
       ("rtl8xxxu: Work around issue with 8192eu and 8723bu devices not reconnecting")
      Signed-off-by: default avatarBitterblue Smith <rtl8821cerfe2@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/43200afc-0c65-ee72-48f8-231edd1df493@gmail.com
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5afca5d
  2. Feb 22, 2023