The following changes since commit 7e57714cd0ad2d5bb90e50b5096a0e671dec1ef3:
Linux 5.17-rc6 (2022-02-27 14:36:33 -0800)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git tags/for_linus
for you to fetch changes up to 3dd7d135e75cb37c8501ba02977332a2a487dd39:
tools/virtio: handle fallout from folio work (2022-03-06 06:06:50 -0500)
----------------------------------------------------------------
virtio: last minute fixes
Some fixes that took a while to get ready. Not regressions,
but they look safe and seem to be worth to have.
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
----------------------------------------------------------------
Anirudh Rayabharam (1):
vhost: fix hung thread due to erroneous iotlb entries
Michael S. Tsirkin (6):
virtio: unexport virtio_finalize_features
virtio: acknowledge all features before access
virtio: document virtio_reset_device
virtio_console: break out of buf poll on remove
virtio: drop default for virtio-mem
tools/virtio: handle fallout from folio work
Si-Wei Liu (3):
vdpa: factor out vdpa_set_features_unlocked for vdpa internal use
vdpa/mlx5: should verify CTRL_VQ feature exists for MQ
vdpa/mlx5: add validation for VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET command
Stefano Garzarella (2):
vhost: remove avail_event arg from vhost_update_avail_event()
tools/virtio: fix virtio_test execution
Xie Yongji (3):
vduse: Fix returning wrong type in vduse_domain_alloc_iova()
virtio-blk: Don't use MAX_DISCARD_SEGMENTS if max_discard_seg is zero
virtio-blk: Remove BUG_ON() in virtio_queue_rq()
Zhang Min (1):
vdpa: fix use-after-free on vp_vdpa_remove
drivers/block/virtio_blk.c | 20 ++++++-------
drivers/char/virtio_console.c | 7 +++++
drivers/vdpa/mlx5/net/mlx5_vnet.c | 34 ++++++++++++++++++++--
drivers/vdpa/vdpa.c | 2 +-
drivers/vdpa/vdpa_user/iova_domain.c | 2 +-
drivers/vdpa/virtio_pci/vp_vdpa.c | 2 +-
drivers/vhost/iotlb.c | 11 +++++++
drivers/vhost/vdpa.c | 2 +-
drivers/vhost/vhost.c | 9 ++++--
drivers/virtio/Kconfig | 1 -
drivers/virtio/virtio.c | 56 ++++++++++++++++++++++++------------
drivers/virtio/virtio_vdpa.c | 2 +-
include/linux/vdpa.h | 18 ++++++++----
include/linux/virtio.h | 1 -
include/linux/virtio_config.h | 3 +-
tools/virtio/linux/mm_types.h | 3 ++
tools/virtio/virtio_test.c | 1 +
17 files changed, 127 insertions(+), 47 deletions(-)
create mode 100644 tools/virtio/linux/mm_types.h
Commit 4e6292114c74 ("x86/paravirt: Add new features for paravirt
patching") changed the order in which altinstructions and paravirt
instructions are patched at boot time. However, no analogous change was
made in module_finalize, where we apply altinstructions and
parainstructions during module load.
As a result, any code that generates "stacked up" altinstructions and
parainstructions (i.e. local_irq_save/restore) will produce different
results when used in built-in kernel code vs. kernel modules. This also
makes it possible to inadvertently replace altinstructions in the booted
kernel with their parainstruction counterparts when using
livepatch/kpatch.
To fix this, re-order the processing in module_finalize, so that we do
things in this order:
1. apply_paravirt
2. apply_retpolines
3. apply_alternatives
4. alternatives_smp_module_add
This is the same ordering that is used at boot time in
alternative_instructions.
Fixes: 4e6292114c74 ("x86/paravirt: Add new features for paravirt patching")
Signed-off-by: Alex Thorlton <alex.thorlton(a)oracle.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky(a)oracle.com>
Cc: Thomas Gleixner <tglx(a)linutronix.de>
Cc: Ingo Molnar <mingo(a)redhat.com>
Cc: Borislav Petkov <bp(a)alien8.de>
Cc: Dave Hansen <dave.hansen(a)linux.intel.com>
Cc: "H. Peter Anvin" <hpa(a)zytor.com>
Cc: Andrew Morton <akpm(a)linux-foundation.org>
Cc: Peter Zijlstra <peterz(a)infradead.org>
Cc: Josh Poimboeuf <jpoimboe(a)redhat.com>
Cc: Kefeng Wang <wangkefeng.wang(a)huawei.com>
Cc: x86(a)kernel.org
Cc: linux-kernel(a)vger.kernel.org
Cc: stable(a)vger.kernel.org # 5.13+
---
arch/x86/kernel/module.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
index 95fa745e310a5..4edc9c87ad0bc 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -273,6 +273,10 @@ int module_finalize(const Elf_Ehdr *hdr,
retpolines = s;
}
+ if (para) {
+ void *pseg = (void *)para->sh_addr;
+ apply_paravirt(pseg, pseg + para->sh_size);
+ }
if (retpolines) {
void *rseg = (void *)retpolines->sh_addr;
apply_retpolines(rseg, rseg + retpolines->sh_size);
@@ -290,11 +294,6 @@ int module_finalize(const Elf_Ehdr *hdr,
tseg, tseg + text->sh_size);
}
- if (para) {
- void *pseg = (void *)para->sh_addr;
- apply_paravirt(pseg, pseg + para->sh_size);
- }
-
/* make jump label nops */
jump_label_apply_nops(me);
--
2.33.1