4.19.274-rc1 review
Greg Kroah-Hartman
maintainerPATCH 1/11 wifi: rtl8xxxu: gen2: Turn on the rate control
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 791082ec0ab843e0be07c8ce3678e4c2afd2e33d ]
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 edd5747aa12e ("wifi: rtl8xxxu: Fix skb misuse in TX queue selection").
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2 -6
@@ -4375,12 +4375,9 @@ void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv,void rtl8xxxu_gen2_report_connect (struct rtl8xxxu_priv *priv,u8 macid,bool connect) { -#ifdef RTL8XXXU_GEN2_REPORT_CONNECT /* -* Barry Day reports this causes issues with 8192eu and 8723bu -* devices reconnecting. The reason for this is unclear, but -* until it is better understood, leave the code in place but -* disabled, so it is not lost. +* The firmware turns on the rate control when it knows it's +* connected to a network. */ struct h2c_cmd h2c;
@@ -4393,7 +4390,6 @@ void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, h2c.media_status_rpt.parm &= ~BIT (0 );rtl8xxxu_gen2_h2c_cmd (priv, &h2c,sizeof (h2c.media_status_rpt)); -#endif }void rtl8xxxu_gen1_init_aggregation (struct rtl8xxxu_priv *priv)
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 10/11 wifi: mwifiex: Add missing compatible string for SD8787
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 36dd7a4c6226133b0b7aa92b8e604e688d958d0c upstream.
Commit e3fffc1f0b47 ("devicetree: document new marvell-8xxx and pwrseq-sd8787 options") documented a compatible string for SD8787 in the devicetree bindings, but neglected to add it to the mwifiex driver.
--- drivers/net/wireless/marvell/mwifiex/sdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/marvell/mwifiex/sdio.c +1 -0
@@ -58,6 +58,7 @@ static struct memory_type_mapping mem_ty };static const struct of_device_id mwifiex_sdio_of_match_table[] = { + { .compatible ="marvell,sd8787" }, { .compatible ="marvell,sd8897" }, { .compatible ="marvell,sd8997" }, { }
Greg Kroah-Hartman
maintainerPATCH 11/11 ext4: Fix function prototype mismatch for ext4_feat_ktype
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit 118901ad1f25d2334255b3d50512fa20591531cd upstream.
With clang's kernel control flow integrity (kCFI, CONFIG_CFI_CLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed.
ext4_feat_ktype was setting the "release" handler to "kfree", which doesn't have a matching function prototype. Add a simple wrapper with the correct prototype.
This was found as a result of Clang's new -Wcast-function-type-strict flag, which is more sensitive than the simpler -Wcast-function-type, which only checks for type width mismatches.
Note that this code is only reached when ext4 is a loadable module and it is being unloaded:
CFI failure at kobject_put+0xbb/0x1b0 (target: kfree+0x0/0x180; expected type: 0x7c4aa698)
...
RIP: 0010:kobject_put+0xbb/0x1b0 ... Call Trace: <TASK> ext4_exit_sysfs+0x14/0x60 [ext4] cleanup_module+0x67/0xedb [ext4]
--- fs/ext4/sysfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ext4/sysfs.c +6 -1
@@ -349,6 +349,11 @@ static void ext4_sb_release(struct kobjecomplete (&sbi->s_kobj_unregister); } +static void ext4_feat_release (struct kobject *kobj) +{ +kfree (kobj); +} +static const struct sysfs_ops ext4_attr_ops = { .show = ext4_attr_show, .store = ext4_attr_store,
@@ -363,7 +368,7 @@ static struct kobj_type ext4_sb_ktype =static struct kobj_type ext4_feat_ktype = { .default_attrs = ext4_feat_attrs, .sysfs_ops = &ext4_attr_ops, - .release = (void (*)(struct kobject *))kfree, + .release = ext4_feat_release, };static struct kobject *ext4_root;
Greg Kroah-Hartman
maintainerPATCH 2/11 powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G
In reply to Greg Kroah-HartmanFrom: Sean Anderson <[email protected]>
[ Upstream commit 36926a7d70c2d462fca1ed85bfee000d17fd8662 ]
On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC dtsi fragments, and mark the QMAN ports as 10G.
--- .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++ .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi new file +44 -0
@@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later +/* + * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset 0x400000 ] + * + * Copyright 2022 Sean Anderson <[email protected]> + * Copyright 2012 - 2015 Freescale Semiconductor Inc. + */ + +fman@400000 { + fman0_rx_0x08: port@88000 { + cell-index = <0x8>; + compatible = "fsl,fman-v3-port-rx"; + reg = <0x88000 0x1000>; + fsl,fman-10g-port; + }; + + fman0_tx_0x28: port@a8000 { + cell-index = <0x28>; + compatible = "fsl,fman-v3-port-tx"; + reg = <0xa8000 0x1000>; + fsl,fman-10g-port; + }; + + ethernet@e0000 { + cell-index = <0>; + compatible = "fsl,fman-memac"; + reg = <0xe0000 0x1000>; + fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; + ptp-timer = <&ptp_timer0>; + pcsphy-handle = <&pcsphy0>; + }; + + mdio@e1000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; + reg = <0xe1000 0x1000>; + fsl,erratum-a011043; /* must ignore read errors */ + + pcsphy0: ethernet-phy@0 { + reg = <0x0>; + }; + }; +};
arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi new file +44 -0
44 lines not on this page · raw message
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +2 -2
@@ -631,8 +631,8 @@ /include/ "qoriq-bman1.dtsi" /include/ "qoriq-fman3-0.dtsi" -/include/ "qoriq-fman3-0-1g-0.dtsi" -/include/ "qoriq-fman3-0-1g-1.dtsi" +/include/ "qoriq-fman3-0-10g-2.dtsi" +/include/ "qoriq-fman3-0-10g-3.dtsi" /include/ "qoriq-fman3-0-1g-2.dtsi" /include/ "qoriq-fman3-0-1g-3.dtsi" /include/ "qoriq-fman3-0-1g-4.dtsi"
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 3/11 random: always mix cycle counter in add_latent_entropy()
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit d7bf7f3b813e3755226bcb5114ad2ac477514ebf ]
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.
--- include/linux/random.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/random.h +3 -3
@@ -19,14 +19,14 @@ void add_input_randomness(unsigned int type, unsigned int code, void add_interrupt_randomness(int irq) __latent_entropy;void add_hwgenerator_randomness (const void *buf,size_t len,size_t entropy); -#if defined(LATENT_ENTROPY_PLUGIN ) && !defined(__CHECKER__)static inline void add_latent_entropy (void ) { +#if defined(LATENT_ENTROPY_PLUGIN ) && !defined(__CHECKER__)add_device_randomness ((const void *)&latent_entropy,sizeof (latent_entropy)); -}#else -static inline void add_latent_entropy (void ) { } +add_device_randomness (NULL ,0 );#endif +}void get_random_bytes (void *buf,size_t len);size_t __must_check get_random_bytes_arch (void *buf,size_t len);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 4/11 can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit f006229135b7debf4037adb1eb93e358559593db ]
Debian's gcc-13 [1] throws the following error inkvaser_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.
--- .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +24 -9
@@ -518,6 +518,7 @@ static int kvaser_usb_hydra_send_simple_cmd(struct kvaser_usb *dev, u8 cmd_no, int channel) {struct kvaser_cmd *cmd; +size_t cmd_len;int err; cmd =kcalloc (1 ,sizeof (struct kvaser_cmd ),GFP_KERNEL );
@@ -525,6 +526,7 @@ static int kvaser_usb_hydra_send_simple_cmd(struct kvaser_usb *dev,return -ENOMEM ; cmd->header.cmd_no = cmd_no; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);if (channel <0 ) {kvaser_usb_hydra_set_cmd_dest_he (cmd,KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL );
@@ -541,7 +543,7 @@ static int kvaser_usb_hydra_send_simple_cmd(struct kvaser_usb *dev,kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);if (err) goto end;
@@ -557,6 +559,7 @@ kvaser_usb_hydra_send_simple_cmd_async(struct kvaser_usb_net_priv *priv, {struct kvaser_cmd *cmd;struct kvaser_usb *dev = priv->dev; +size_t cmd_len;int err; cmd =kcalloc (1 ,sizeof (struct kvaser_cmd ),GFP_ATOMIC );
@@ -564,14 +567,14 @@ kvaser_usb_hydra_send_simple_cmd_async(struct kvaser_usb_net_priv *priv,return -ENOMEM ; cmd->header.cmd_no = cmd_no; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);kvaser_usb_hydra_set_cmd_dest_he (cmd, dev->card_data.hydra.channel_to_he[priv->channel]);kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd_async (priv, cmd, -kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd_async (priv, cmd, cmd_len);if (err)kfree (cmd);
@@ -715,6 +718,7 @@ static int kvaser_usb_hydra_get_single_capability(struct kvaser_usb *dev, {struct kvaser_usb_dev_card_data *card_data = &dev->card_data;struct kvaser_cmd *cmd; +size_t cmd_len;u32 value =0 ;u32 mask =0 ;u16 cap_cmd_res;
@@ -726,13 +730,14 @@ static int kvaser_usb_hydra_get_single_capability(struct kvaser_usb *dev,return -ENOMEM ; cmd->header.cmd_no =CMD_GET_CAPABILITIES_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd); cmd->cap_req.cap_cmd =cpu_to_le16 (cap_cmd_req);kvaser_usb_hydra_set_cmd_dest_he (cmd, card_data->hydra.sysdbg_he);kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);if (err) goto end;
@@ -1555,6 +1560,7 @@ static int kvaser_usb_hydra_get_busparams(struct kvaser_usb_net_priv *priv,struct kvaser_usb *dev = priv->dev;struct kvaser_usb_net_hydra_priv *hydra = priv->sub_priv;struct kvaser_cmd *cmd; +size_t cmd_len;int err;if (!hydra)
@@ -1565,6 +1571,7 @@ static int kvaser_usb_hydra_get_busparams(struct kvaser_usb_net_priv *priv,return -ENOMEM ; cmd->header.cmd_no =CMD_GET_BUSPARAMS_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);kvaser_usb_hydra_set_cmd_dest_he (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); kvaser_usb_hydra_set_cmd_transid
@@ -1574,7 +1581,7 @@ static int kvaser_usb_hydra_get_busparams(struct kvaser_usb_net_priv *priv,reinit_completion (&priv->get_busparams_comp); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);if (err)return err;
@@ -1601,6 +1608,7 @@ static int kvaser_usb_hydra_set_bittiming(const struct net_device *netdev,struct kvaser_cmd *cmd;struct kvaser_usb_net_priv *priv =netdev_priv (netdev);struct kvaser_usb *dev = priv->dev; +size_t cmd_len;int err; cmd =kcalloc (1 ,sizeof (struct kvaser_cmd ),GFP_KERNEL );
@@ -1608,6 +1616,7 @@ static int kvaser_usb_hydra_set_bittiming(const struct net_device *netdev,return -ENOMEM ; cmd->header.cmd_no =CMD_SET_BUSPARAMS_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);memcpy (&cmd->set_busparams_req.busparams_nominal, busparams,sizeof (cmd->set_busparams_req.busparams_nominal));
@@ -1616,7 +1625,7 @@ static int kvaser_usb_hydra_set_bittiming(const struct net_device *netdev,kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);kfree (cmd);
@@ -1629,6 +1638,7 @@ static int kvaser_usb_hydra_set_data_bittiming(const struct net_device *netdev,struct kvaser_cmd *cmd;struct kvaser_usb_net_priv *priv =netdev_priv (netdev);struct kvaser_usb *dev = priv->dev; +size_t cmd_len;int err; cmd =kcalloc (1 ,sizeof (struct kvaser_cmd ),GFP_KERNEL );
@@ -1636,6 +1646,7 @@ static int kvaser_usb_hydra_set_data_bittiming(const struct net_device *netdev,return -ENOMEM ; cmd->header.cmd_no =CMD_SET_BUSPARAMS_FD_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);memcpy (&cmd->set_busparams_req.busparams_data, busparams,sizeof (cmd->set_busparams_req.busparams_data));
@@ -1653,7 +1664,7 @@ static int kvaser_usb_hydra_set_data_bittiming(const struct net_device *netdev,kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);kfree (cmd);
@@ -1781,6 +1792,7 @@ static int kvaser_usb_hydra_get_software_info(struct kvaser_usb *dev)static int kvaser_usb_hydra_get_software_details (struct kvaser_usb *dev) {struct kvaser_cmd *cmd; +size_t cmd_len;int err;u32 flags;struct kvaser_usb_dev_card_data *card_data = &dev->card_data;
@@ -1790,6 +1802,7 @@ static int kvaser_usb_hydra_get_software_details(struct kvaser_usb *dev)return -ENOMEM ; cmd->header.cmd_no =CMD_GET_SOFTWARE_DETAILS_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd); cmd->sw_detail_req.use_ext_cmd =1 ;kvaser_usb_hydra_set_cmd_dest_he (cmd,KVASER_USB_HYDRA_HE_ADDRESS_ILLEGAL );
@@ -1797,7 +1810,7 @@ static int kvaser_usb_hydra_get_software_details(struct kvaser_usb *dev)kvaser_usb_hydra_set_cmd_transid (cmd,kvaser_usb_hydra_get_next_transid (dev)); - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);if (err) goto end;
@@ -1913,6 +1926,7 @@ static int kvaser_usb_hydra_set_opt_mode(const struct kvaser_usb_net_priv *priv) {struct kvaser_usb *dev = priv->dev;struct kvaser_cmd *cmd; +size_t cmd_len;int err; if ((priv->can.ctrlmode &
@@ -1928,6 +1942,7 @@ static int kvaser_usb_hydra_set_opt_mode(const struct kvaser_usb_net_priv *priv)return -ENOMEM ; cmd->header.cmd_no =CMD_SET_DRIVERMODE_REQ ; + cmd_len =kvaser_usb_hydra_cmd_size (cmd);kvaser_usb_hydra_set_cmd_dest_he (cmd, dev->card_data.hydra.channel_to_he[priv->channel]); kvaser_usb_hydra_set_cmd_transid
@@ -1937,7 +1952,7 @@ static int kvaser_usb_hydra_set_opt_mode(const struct kvaser_usb_net_priv *priv)else cmd->set_ctrlmode.mode =KVASER_USB_HYDRA_CTRLMODE_NORMAL ; - err =kvaser_usb_send_cmd (dev, cmd,kvaser_usb_hydra_cmd_size (cmd)); + err =kvaser_usb_send_cmd (dev, cmd, cmd_len);kfree (cmd);return err;
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 5/11 powerpc: dts: t208x: Disable 10G on MAC1 and MAC2
In reply to Greg Kroah-HartmanFrom: Sean Anderson <[email protected]>
[ Upstream commit 8d8bee13ae9e316443c6666286360126a19c8d94 ]
There aren't enough resources to run these ports at 10G speeds. Disable 10G for these ports, reverting to the previous speed.
--- arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +16 -0
@@ -681,3 +681,19 @@ interrupts = <16 2 1 9>; }; }; + +&fman0_rx_0x08 { + /delete-property/ fsl,fman-10g-port; +}; + +&fman0_tx_0x28 { + /delete-property/ fsl,fman-10g-port; +}; + +&fman0_rx_0x09 { + /delete-property/ fsl,fman-10g-port; +}; + +&fman0_tx_0x29 { + /delete-property/ fsl,fman-10g-port; +};
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 6/11 alarmtimer: Prevent starvation by small intervals and SIG_IGN
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit d125d1349abeb46945dc5e98f7824bf688266f13 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 58229a189942 ("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 ff86bf0c65f1 ("alarmtimer: Rate limit periodic intervals") already, but that fix got lost in a later rework.
--- kernel/time/alarmtimer.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-)
kernel/time/alarmtimer.c +29 -4
@@ -476,11 +476,35 @@ u64 alarm_forward(struct alarm *alarm, k }EXPORT_SYMBOL_GPL (alarm_forward); -u64 alarm_forward_now (struct alarm *alarm,ktime_t interval) +static u64 __alarm_forward_now (struct alarm *alarm,ktime_t interval,bool throttle) {struct alarm_base *base = &alarm_bases[alarm->type]; +ktime_t now = base->gettime (); + +if (IS_ENABLED (CONFIG_HIGH_RES_TIMERS ) && throttle) { +/* +* Same issue as with posix_timer_fn(). Timers which are +* periodic but the signal is ignored can starve the system +* with a very small interval. The real fix which was +* promised in the context of posix_timer_fn() never +* materialized, but someone should really work on it. +* +* To prevent DOS fake @now to be 1 jiffie out which keeps +* the overrun accounting correct but creates an +* inconsistency vs. timer_gettime(2). +*/ +ktime_t kj =NSEC_PER_SEC /HZ ; + +if (interval < kj) + now =ktime_add (now, kj); + } + +return alarm_forward (alarm, now, interval); +} -return alarm_forward (alarm, base->gettime (), interval); +u64 alarm_forward_now (struct alarm *alarm,ktime_t interval) +{ +return __alarm_forward_now (alarm, interval, false); }EXPORT_SYMBOL_GPL (alarm_forward_now);
@@ -554,9 +578,10 @@ static enum alarmtimer_restart alarm_hanif (posix_timer_event (ptr, si_private) && ptr->it_interval) {/* * Handle ignored signals and rearm the timer. This will go -* away once we handle ignored signals proper. +* away once we handle ignored signals proper. Ensure that +* small intervals cannot starve the system. */ - ptr->it_overrun +=alarm_forward_now (alarm, ptr->it_interval); + ptr->it_overrun +=__alarm_forward_now (alarm, ptr->it_interval, true); ++ptr->it_requeue_pending; ptr->it_active =1 ; result =ALARMTIMER_RESTART ;
Greg Kroah-Hartman
maintainerPATCH 7/11 drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
commit 4a61648af68f5ba4884f0e3b494ee1cabc4b6620 upstream.
If intel_gvt_dma_map_guest_page failed, it will call ppgtt_invalidate_spt, which will finally free the spt. But the caller function ppgtt_populate_spt_by_guest_entry does not notice that, it will free spt again in its error path.
Fix this by canceling the mapping of DMA address and freeing sub_spt. Besides, leave the handle of spt destroy to caller function instead of callee function when error occurs.
--- drivers/gpu/drm/i915/gvt/gtt.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gvt/gtt.c +13 -4
@@ -1155,10 +1155,8 @@ static int split_2MB_gtt_entry(struct infor_each_shadow_entry (sub_spt, &sub_se, sub_index) { ret =intel_gvt_hypervisor_dma_map_guest_page (vgpu, start_gfn + sub_index,PAGE_SIZE , &dma_addr); -if (ret) { -ppgtt_invalidate_spt (spt); -return ret; - } +if (ret) + goto err; sub_se.val64 = se->val64;/* Copy the PAT field from PDE. */
@@ -1177,6 +1175,17 @@ static int split_2MB_gtt_entry(struct in ops->set_pfn (se, sub_spt->shadow_page.mfn);ppgtt_set_shadow_entry (spt, se, index);return 0 ; +err: +/* Cancel the existing addess mappings of DMA addr. */ +for_each_present_shadow_entry (sub_spt, &sub_se, sub_index) { +gvt_vdbg_mm ("invalidate 4K entry\n" ); +ppgtt_invalidate_pte (sub_spt, &sub_se); + } +/* Release the new allocated spt. */ +trace_spt_change (sub_spt->vgpu->id,"release" , sub_spt, + sub_spt->guest_page.gfn, sub_spt->shadow_page.type); +ppgtt_free_spt (sub_spt); +return ret; } static int split_64KB_gtt_entry(struct intel_vgpu *vgpu,
Greg Kroah-Hartman
maintainerPATCH 8/11 mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 8b5cb7e41d9d77ffca036b0239177de123394a55 upstream.
Syzbot hit NULL deref in rhashtable_free_and_destroy(). The problem was in mesh_paths and mpp_paths being NULL.
mesh_pathtbl_init() could fail in case of memory allocation failure, but nobody cared, since ieee80211_mesh_init_sdata() returns void. It led to leaving 2 pointers as NULL. Syzbot has found null deref on exit path, but it could happen anywhere else, because code assumes these pointers are valid.
Since all ieee80211_*_setup_sdata functions are void and do not fail, let's embedd mesh_paths and mpp_paths into parent struct to avoid adding error handling on higher levels and follow the pattern of others setup_sdata functions
--- net/mac80211/ieee80211_i.h | 24 ++++++++++- net/mac80211/mesh.h | 22 ---------- net/mac80211/mesh_pathtbl.c | 91 +++++++++++++++----------------------------- 3 files changed, 55 insertions(+), 82 deletions(-)
net/mac80211/ieee80211_i.h +22 -2
@@ -627,6 +627,26 @@ struct mesh_csa_settings {struct cfg80211_csa_settings settings; }; +/** +* struct mesh_table +* +* @known_gates: list of known mesh gates and their mpaths by the station. The +* gate's mpath may or may not be resolved and active. +* @gates_lock: protects updates to known_gates +* @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr +* @walk_head: linked list containing all mesh_path objects +* @walk_lock: lock protecting walk_head +* @entries: number of entries in the table +*/ +struct mesh_table { +struct hlist_head known_gates; +spinlock_t gates_lock; +struct rhashtable rhead; +struct hlist_head walk_head; +spinlock_t walk_lock; +atomic_t entries;/* Up to MAX_MESH_NEIGHBOURS */ +}; +struct ieee80211_if_mesh {struct timer_list housekeeping_timer;struct timer_list mesh_path_timer;
@@ -701,8 +721,8 @@ struct ieee80211_if_mesh {/* offset from skb->data while building IE */ int meshconf_offset; -struct mesh_table *mesh_paths; -struct mesh_table *mpp_paths;/* Store paths for MPP&MAP */ +struct mesh_table mesh_paths; +struct mesh_table mpp_paths;/* Store paths for MPP&MAP */ int mesh_paths_generation;int mpp_paths_generation; };
net/mac80211/mesh.h +1 -21
@@ -128,26 +128,6 @@ struct mesh_path {bool is_gate; }; -/** -* struct mesh_table -* -* @known_gates: list of known mesh gates and their mpaths by the station. The -* gate's mpath may or may not be resolved and active. -* @gates_lock: protects updates to known_gates -* @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr -* @walk_head: linked list containging all mesh_path objects -* @walk_lock: lock protecting walk_head -* @entries: number of entries in the table -*/ -struct mesh_table { -struct hlist_head known_gates; -spinlock_t gates_lock; -struct rhashtable rhead; -struct hlist_head walk_head; -spinlock_t walk_lock; -atomic_t entries;/* Up to MAX_MESH_NEIGHBOURS */ -}; -/* Recent multicast cache */ /* RMC_BUCKETS must be a power of 2, maximum 256 */ #define RMC_BUCKETS 256
@@ -300,7 +280,7 @@ int mesh_path_error_tx(struct ieee80211_void mesh_path_assign_nexthop (struct mesh_path *mpath,struct sta_info *sta);void mesh_path_flush_pending (struct mesh_path *mpath);void mesh_path_tx_pending (struct mesh_path *mpath); -int mesh_pathtbl_init (struct ieee80211_sub_if_data *sdata); +void mesh_pathtbl_init (struct ieee80211_sub_if_data *sdata);void mesh_pathtbl_unregister (struct ieee80211_sub_if_data *sdata);int mesh_path_del (struct ieee80211_sub_if_data *sdata,const u8 *addr);void mesh_path_timer (struct timer_list *t);
net/mac80211/mesh_pathtbl.c +32 -59
196 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 9/11 uaccess: Add speculation barrier to copy_from_user()
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
commit 74e19ef0ff8061ef55957c3abd71614ef0f42f47 upstream.
The results of "access_ok()" can be mis-speculated. The result is that you can end speculatively:
if (access_ok(from, size)) // Right here
even for bad from/size combinations. On first glance, it would be ideal to just add a speculation barrier to "access_ok()" so that its results can never be mis-speculated.
But there are lots of system calls just doing access_ok() via "copy_to_user()" and friends (example: fstat() and friends). Those are generally not problematic because they do not _consume_ data from userspace other than the pointer. They are also very quick and common system calls that should not be needlessly slowed down.
"copy_from_user()" on the other hand uses a user-controller pointer and is frequently followed up with code that might affect caches. Take something like this:
if (!copy_from_user(&kernelvar, uptr, size)) do_something_with(kernelvar);
If userspace passes in an evil 'uptr' that *actually* points to a kernel addresses, and then do_something_with() has cache (or other) side-effects, it could allow userspace to infer kernel data values.
Add a barrier to the common copy_from_user() code to prevent mis-speculated values which happen after the copy.
Also add a stub for architectures that do not define barrier_nospec(). This makes the macro usable in generic code.
Since the barrier is now usable in generic code, the x86 #ifdef in the BPF code can also go away.
--- include/linux/nospec.h | 4 ++++ kernel/bpf/core.c | 2 -- lib/usercopy.c | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-)
include/linux/nospec.h +4 -0
@@ -9,6 +9,10 @@struct task_struct ; +#ifndef barrier_nospec +# define barrier_nospec () do { } while (0) +#endif +/** * array_index_mask_nospec() - generate a ~0 mask when index < size, 0 otherwise * @index: array element index
kernel/bpf/core.c +0 -2
@@ -1373,9 +1373,7 @@ out:* reuse preexisting logic from Spectre v1 mitigation that * happens to produce the required code on x86 for v4 as well. */ -#ifdef CONFIG_X86 barrier_nospec (); -#endif CONT ;#define LDST (SIZEOP ,SIZE ) \ STX_MEM_##SIZEOP: \
lib/usercopy.c +7 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/uaccess.h> +#include <linux/nospec.h> /* out-of-line parts */
@@ -9,6 +10,12 @@ unsigned long _copy_from_user(void *to,unsigned long res = n;might_fault ();if (likely (access_ok (VERIFY_READ , from, n))) { +/* +* Ensure that bad access_ok() speculation will not +* lead to nasty side effects *after* the copy is +* finished: +*/ +barrier_nospec ();kasan_check_write (to, n); res =raw_copy_from_user (to, from, n); }
Greg Kroah-Hartman
maintainercover 4.19.274-rc1 review
This is the start of the stable review cycle for the 4.19.274 release. There are 11 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 25 Feb 2023 13:04:16 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.274-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.274-rc1
Kees Cook <[email protected]>
ext4: Fix function prototype mismatch for ext4_feat_ktype
Lukas Wunner <[email protected]>
wifi: mwifiex: Add missing compatible string for SD8787
Dave Hansen <[email protected]>
uaccess: Add speculation barrier to copy_from_user()
Pavel Skripkin <[email protected]>
mac80211: mesh: embedd mesh_paths and mpp_paths into ieee80211_if_mesh
Zheng Wang <[email protected]>
drm/i915/gvt: fix double free bug in split_2MB_gtt_entry
Thomas Gleixner <[email protected]>
alarmtimer: Prevent starvation by small intervals and SIG_IGN
Sean Anderson <[email protected]>
powerpc: dts: t208x: Disable 10G on MAC1 and MAC2
Marc Kleine-Budde <[email protected]>
can: kvaser_usb: hydra: help gcc-13 to figure out cmd_len
Jason A. Donenfeld <[email protected]>
random: always mix cycle counter in add_latent_entropy()
Sean Anderson <[email protected]>
powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G
Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: gen2: Turn on the rate control
-------------
Diffstat:
Makefile | 4 +- arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++ arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++ arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 20 ++++- drivers/gpu/drm/i915/gvt/gtt.c | 17 ++++- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 33 +++++--- drivers/net/wireless/marvell/mwifiex/sdio.c | 1 + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 +- fs/ext4/sysfs.c | 7 +- include/linux/nospec.h | 4 + include/linux/random.h | 6 +- kernel/bpf/core.c | 2 - kernel/time/alarmtimer.c | 33 +++++++- lib/usercopy.c | 7 ++ net/mac80211/ieee80211_i.h | 24 +++++- net/mac80211/mesh.h | 22 +----- net/mac80211/mesh_pathtbl.c | 89 ++++++++-------------- 17 files changed, 251 insertions(+), 114 deletions(-)