Commit 333c515d1896 ("vhost-net: allow configuring extended features") added VHOST_SET_FEATURES_ARRAY. The ioctl reads the number of feature words from user space, copies the words it supports, and then reads every remaining word, one at a time, to check that it is zero. That loop has no upper bound and no scheduling point. A caller can pass a count of U64_MAX and a pointer into a large zero-filled mapping. The ioctl then stays in the kernel for as long as the mapping is readable, and a fatal signal is not handled until it ends. On a v6.18 debug kernel booted with preempt=none, two such calls from a non-root user, each on a 4 GiB mapping, froze a 2-CPU VM for 56 s with soft lockup reports. The check is not needed: the extra words can only hold features that this kernel does not know about, and they are never stored. Drop the loop and ignore them. A nonzero extra word is now ignored instead of failing with EOPNOTSUPP. Unsupported bits in the words the kernel knows still fail with EOPNOTSUPP. Fixes: 333c515d1896 ("vhost-net: allow configuring extended features") Cc: stable@vger.kernel.org # v6.17+ Suggested-by: Michael S. Tsirkin Signed-off-by: Hengyu Liang --- Changes in v2: - Drop the loop instead of rejecting counts above one page (Michael). - v1: https://lore.kernel.org/r/20261122120919.1718445-1-hengyul@cs.unc.edu I found this while comparing the behavior of different kernel versions. I used an LLM to analyze the problem and to draft the patch and this message, and I analyzed the result myself. Tested on the vhost tree at 44293796526f with KASAN and lockdep. With a count of U64_MAX on a 1 GiB zero-filled mapping, the ioctl now returns at once (before: EFAULT after 27.4 s), and a SIGKILL sent during the call no longer waits for the walk. Counts of 0, 2, 3, 512 and 514 with zero words succeed as before. Unsupported bits in the first two words still give EOPNOTSUPP. A nonzero third word now succeeds instead of giving EOPNOTSUPP. VHOST_GET_FEATURES_ARRAY is unchanged. drivers/vhost/net.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 631855064b3d..f6b59def4a21 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1802,18 +1802,6 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, if (copy_from_user(all_features, argp, copied * sizeof(u64))) return -EFAULT; - /* - * Any feature specified by user-space above - * VIRTIO_FEATURES_BITS is not supported by definition. - */ - for (i = copied; i < count; ++i) { - if (copy_from_user(&features, featurep + 1 + i, - sizeof(features))) - return -EFAULT; - if (features) - return -EOPNOTSUPP; - } - for (i = 0; i < VIRTIO_FEATURES_U64S; i++) if (all_features[i] & ~vhost_net_features[i]) return -EOPNOTSUPP; base-commit: 44293796526f4343639f87b2acc53811c78b5d54 -- 2.53.0