From: Sasha Levin Date: Wed, 15 Feb 2023 16:33:45 +0000 (-0500) Subject: Fixes for 5.4 X-Git-Tag: v4.14.306~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2cb228ebec8d41bf0010419ba2187a7563510c32;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.4 Signed-off-by: Sasha Levin --- diff --git a/queue-5.4/asoc-cs42l56-fix-dt-probe.patch b/queue-5.4/asoc-cs42l56-fix-dt-probe.patch new file mode 100644 index 00000000000..bc275c07524 --- /dev/null +++ b/queue-5.4/asoc-cs42l56-fix-dt-probe.patch @@ -0,0 +1,56 @@ +From e2c609acc23ecde6bc7b3057ec6c2204ed9fde36 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Jan 2023 17:21:24 +0100 +Subject: ASoC: cs42l56: fix DT probe + +From: Arnd Bergmann + +[ Upstream commit e18c6da62edc780e4f4f3c9ce07bdacd69505182 ] + +While looking through legacy platform data users, I noticed that +the DT probing never uses data from the DT properties, as the +platform_data structure gets overwritten directly after it +is initialized. + +There have never been any boards defining the platform_data in +the mainline kernel either, so this driver so far only worked +with patched kernels or with the default values. + +For the benefit of possible downstream users, fix the DT probe +by no longer overwriting the data. + +Signed-off-by: Arnd Bergmann +Acked-by: Charles Keepax +Link: https://lore.kernel.org/r/20230126162203.2986339-1-arnd@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/codecs/cs42l56.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c +index 8be7d83f0ce9a..732405587c5a4 100644 +--- a/sound/soc/codecs/cs42l56.c ++++ b/sound/soc/codecs/cs42l56.c +@@ -1192,18 +1192,12 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client, + if (pdata) { + cs42l56->pdata = *pdata; + } else { +- pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata), +- GFP_KERNEL); +- if (!pdata) +- return -ENOMEM; +- + if (i2c_client->dev.of_node) { + ret = cs42l56_handle_of_data(i2c_client, + &cs42l56->pdata); + if (ret != 0) + return ret; + } +- cs42l56->pdata = *pdata; + } + + if (cs42l56->pdata.gpio_nreset) { +-- +2.39.0 + diff --git a/queue-5.4/net-rose-fix-to-not-accept-on-connected-socket.patch b/queue-5.4/net-rose-fix-to-not-accept-on-connected-socket.patch new file mode 100644 index 00000000000..86cf686ce72 --- /dev/null +++ b/queue-5.4/net-rose-fix-to-not-accept-on-connected-socket.patch @@ -0,0 +1,63 @@ +From 6010dccf612518ffda7c6563f114ae2bad6219d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Jan 2023 02:59:44 -0800 +Subject: net/rose: Fix to not accept on connected socket + +From: Hyunwoo Kim + +[ Upstream commit 14caefcf9837a2be765a566005ad82cd0d2a429f ] + +If you call listen() and accept() on an already connect()ed +rose socket, accept() can successfully connect. +This is because when the peer socket sends data to sendmsg, +the skb with its own sk stored in the connected socket's +sk->sk_receive_queue is connected, and rose_accept() dequeues +the skb waiting in the sk->sk_receive_queue. + +This creates a child socket with the sk of the parent +rose socket, which can cause confusion. + +Fix rose_listen() to return -EINVAL if the socket has +already been successfully connected, and add lock_sock +to prevent this issue. + +Signed-off-by: Hyunwoo Kim +Reviewed-by: Kuniyuki Iwashima +Link: https://lore.kernel.org/r/20230125105944.GA133314@ubuntu +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/rose/af_rose.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c +index 95dda29058a0e..6fb158172ddc2 100644 +--- a/net/rose/af_rose.c ++++ b/net/rose/af_rose.c +@@ -465,6 +465,12 @@ static int rose_listen(struct socket *sock, int backlog) + { + struct sock *sk = sock->sk; + ++ lock_sock(sk); ++ if (sock->state != SS_UNCONNECTED) { ++ release_sock(sk); ++ return -EINVAL; ++ } ++ + if (sk->sk_state != TCP_LISTEN) { + struct rose_sock *rose = rose_sk(sk); + +@@ -474,8 +480,10 @@ static int rose_listen(struct socket *sock, int backlog) + memset(rose->dest_digis, 0, AX25_ADDR_LEN * ROSE_MAX_DIGIS); + sk->sk_max_ack_backlog = backlog; + sk->sk_state = TCP_LISTEN; ++ release_sock(sk); + return 0; + } ++ release_sock(sk); + + return -EOPNOTSUPP; + } +-- +2.39.0 + diff --git a/queue-5.4/net-sched-sch-bounds-check-priority.patch b/queue-5.4/net-sched-sch-bounds-check-priority.patch new file mode 100644 index 00000000000..02f901b4c23 --- /dev/null +++ b/queue-5.4/net-sched-sch-bounds-check-priority.patch @@ -0,0 +1,57 @@ +From f621e2b296a163f27018d0157092e69d68940185 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Jan 2023 14:40:37 -0800 +Subject: net: sched: sch: Bounds check priority + +From: Kees Cook + +[ Upstream commit de5ca4c3852f896cacac2bf259597aab5e17d9e3 ] + +Nothing was explicitly bounds checking the priority index used to access +clpriop[]. WARN and bail out early if it's pathological. Seen with GCC 13: + +../net/sched/sch_htb.c: In function 'htb_activate_prios': +../net/sched/sch_htb.c:437:44: warning: array subscript [0, 31] is outside array bounds of 'struct htb_prio[8]' [-Warray-bounds=] + 437 | if (p->inner.clprio[prio].feed.rb_node) + | ~~~~~~~~~~~~~~~^~~~~~ +../net/sched/sch_htb.c:131:41: note: while referencing 'clprio' + 131 | struct htb_prio clprio[TC_HTB_NUMPRIO]; + | ^~~~~~ + +Cc: Jamal Hadi Salim +Cc: Cong Wang +Cc: Jiri Pirko +Cc: "David S. Miller" +Cc: Eric Dumazet +Cc: Jakub Kicinski +Cc: Paolo Abeni +Cc: netdev@vger.kernel.org +Signed-off-by: Kees Cook +Reviewed-by: Simon Horman +Reviewed-by: Cong Wang +Link: https://lore.kernel.org/r/20230127224036.never.561-kees@kernel.org +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/sched/sch_htb.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c +index 8184c87da8bec..e635713cb41dd 100644 +--- a/net/sched/sch_htb.c ++++ b/net/sched/sch_htb.c +@@ -405,7 +405,10 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl) + while (cl->cmode == HTB_MAY_BORROW && p && mask) { + m = mask; + while (m) { +- int prio = ffz(~m); ++ unsigned int prio = ffz(~m); ++ ++ if (WARN_ON_ONCE(prio > ARRAY_SIZE(p->inner.clprio))) ++ break; + m &= ~(1 << prio); + + if (p->inner.clprio[prio].feed.rb_node) +-- +2.39.0 + diff --git a/queue-5.4/net-stmmac-do-not-stop-rx_clk-in-rx-lpi-state-for-qc.patch b/queue-5.4/net-stmmac-do-not-stop-rx_clk-in-rx-lpi-state-for-qc.patch new file mode 100644 index 00000000000..fd7d70830f9 --- /dev/null +++ b/queue-5.4/net-stmmac-do-not-stop-rx_clk-in-rx-lpi-state-for-qc.patch @@ -0,0 +1,67 @@ +From d797b079554af2cc4a488e16f79ba503eb7dd1f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Jan 2023 00:35:39 +0300 +Subject: net: stmmac: do not stop RX_CLK in Rx LPI state for qcs404 SoC + +From: Andrey Konovalov + +[ Upstream commit 54aa39a513dbf2164ca462a19f04519b2407a224 ] + +Currently in phy_init_eee() the driver unconditionally configures the PHY +to stop RX_CLK after entering Rx LPI state. This causes an LPI interrupt +storm on my qcs404-base board. + +Change the PHY initialization so that for "qcom,qcs404-ethqos" compatible +device RX_CLK continues to run even in Rx LPI state. + +Signed-off-by: Andrey Konovalov +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 ++ + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- + include/linux/stmmac.h | 1 + + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +index bfc4a92f1d92b..78be62ecc9a9a 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +@@ -505,6 +505,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) + plat_dat->has_gmac4 = 1; + plat_dat->pmt = 1; + plat_dat->tso_en = of_property_read_bool(np, "snps,tso"); ++ if (of_device_is_compatible(np, "qcom,qcs404-ethqos")) ++ plat_dat->rx_clk_runs_in_lpi = 1; + + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); + if (ret) +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 3079e52546663..6a3b0f76d9729 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -932,7 +932,8 @@ static void stmmac_mac_link_up(struct phylink_config *config, + + stmmac_mac_set(priv, priv->ioaddr, true); + if (phy && priv->dma_cap.eee) { +- priv->eee_active = phy_init_eee(phy, 1) >= 0; ++ priv->eee_active = ++ phy_init_eee(phy, !priv->plat->rx_clk_runs_in_lpi) >= 0; + priv->eee_enabled = stmmac_eee_init(priv); + stmmac_set_eee_pls(priv, priv->hw, true); + } +diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h +index 0b35747c9837a..88b107e20fc7c 100644 +--- a/include/linux/stmmac.h ++++ b/include/linux/stmmac.h +@@ -178,6 +178,7 @@ struct plat_stmmacenet_data { + int rss_en; + int mac_port_sel_speed; + bool en_tx_lpi_clockgating; ++ bool rx_clk_runs_in_lpi; + int has_xgmac; + bool sph_disable; + }; +-- +2.39.0 + diff --git a/queue-5.4/nvme-fc-fix-a-missing-queue-put-in-nvmet_fc_ls_creat.patch b/queue-5.4/nvme-fc-fix-a-missing-queue-put-in-nvmet_fc_ls_creat.patch new file mode 100644 index 00000000000..0ad69ccdbef --- /dev/null +++ b/queue-5.4/nvme-fc-fix-a-missing-queue-put-in-nvmet_fc_ls_creat.patch @@ -0,0 +1,41 @@ +From 1b66a9becb4b95b8cdc27bab8c9fc283d4b120e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Jan 2023 14:37:28 +0200 +Subject: nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association + +From: Amit Engel + +[ Upstream commit 0cab4404874f2de52617de8400c844891c6ea1ce ] + +As part of nvmet_fc_ls_create_association there is a case where +nvmet_fc_alloc_target_queue fails right after a new association with an +admin queue is created. In this case, no one releases the get taken in +nvmet_fc_alloc_target_assoc. This fix is adding the missing put. + +Signed-off-by: Amit Engel +Reviewed-by: James Smart +Signed-off-by: Christoph Hellwig +Signed-off-by: Sasha Levin +--- + drivers/nvme/target/fc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c +index 9b07e8c7689ab..f74fc6481731d 100644 +--- a/drivers/nvme/target/fc.c ++++ b/drivers/nvme/target/fc.c +@@ -1362,8 +1362,10 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport, + else { + queue = nvmet_fc_alloc_target_queue(iod->assoc, 0, + be16_to_cpu(rqst->assoc_cmd.sqsize)); +- if (!queue) ++ if (!queue) { + ret = VERR_QUEUE_ALLOC_FAIL; ++ nvmet_fc_tgt_a_put(iod->assoc); ++ } + } + } + +-- +2.39.0 + diff --git a/queue-5.4/s390-decompressor-specify-__decompress-buf-len-to-av.patch b/queue-5.4/s390-decompressor-specify-__decompress-buf-len-to-av.patch new file mode 100644 index 00000000000..1cc184e7b97 --- /dev/null +++ b/queue-5.4/s390-decompressor-specify-__decompress-buf-len-to-av.patch @@ -0,0 +1,47 @@ +From a587cab6fe1210b0af97da276f2eb9f189a8f569 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 29 Jan 2023 23:47:23 +0100 +Subject: s390/decompressor: specify __decompress() buf len to avoid overflow + +From: Vasily Gorbik + +[ Upstream commit 7ab41c2c08a32132ba8c14624910e2fe8ce4ba4b ] + +Historically calls to __decompress() didn't specify "out_len" parameter +on many architectures including s390, expecting that no writes beyond +uncompressed kernel image are performed. This has changed since commit +2aa14b1ab2c4 ("zstd: import usptream v1.5.2") which includes zstd library +commit 6a7ede3dfccb ("Reduce size of dctx by reutilizing dst buffer +(#2751)"). Now zstd decompression code might store literal buffer in +the unwritten portion of the destination buffer. Since "out_len" is +not set, it is considered to be unlimited and hence free to use for +optimization needs. On s390 this might corrupt initrd or ipl report +which are often placed right after the decompressor buffer. Luckily the +size of uncompressed kernel image is already known to the decompressor, +so to avoid the problem simply specify it in the "out_len" parameter. + +Link: https://github.com/facebook/zstd/commit/6a7ede3dfccb +Signed-off-by: Vasily Gorbik +Tested-by: Alexander Egorenkov +Link: https://lore.kernel.org/r/patch-1.thread-41c676.git-41c676c2d153.your-ad-here.call-01675030179-ext-9637@work.hours +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/boot/compressed/decompressor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/s390/boot/compressed/decompressor.c b/arch/s390/boot/compressed/decompressor.c +index 45046630c56ac..c42ab33bd4524 100644 +--- a/arch/s390/boot/compressed/decompressor.c ++++ b/arch/s390/boot/compressed/decompressor.c +@@ -80,6 +80,6 @@ void *decompress_kernel(void) + void *output = (void *)decompress_offset; + + __decompress(_compressed_start, _compressed_end - _compressed_start, +- NULL, NULL, output, 0, NULL, error); ++ NULL, NULL, output, vmlinux.image_size, NULL, error); + return output; + } +-- +2.39.0 + diff --git a/queue-5.4/selftests-bpf-verify-copy_register_state-preserves-p.patch b/queue-5.4/selftests-bpf-verify-copy_register_state-preserves-p.patch new file mode 100644 index 00000000000..40f9359258c --- /dev/null +++ b/queue-5.4/selftests-bpf-verify-copy_register_state-preserves-p.patch @@ -0,0 +1,68 @@ +From 43a4a416bcda8498d13f6bd281df2a369784b2b4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Jan 2023 16:22:14 +0200 +Subject: selftests/bpf: Verify copy_register_state() preserves parent/live + fields + +From: Eduard Zingerman + +[ Upstream commit b9fa9bc839291020b362ab5392e5f18ba79657ac ] + +A testcase to check that verifier.c:copy_register_state() preserves +register parentage chain and livness information. + +Signed-off-by: Eduard Zingerman +Link: https://lore.kernel.org/r/20230106142214.1040390-3-eddyz87@gmail.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + .../selftests/bpf/verifier/search_pruning.c | 36 +++++++++++++++++++ + 1 file changed, 36 insertions(+) + +diff --git a/tools/testing/selftests/bpf/verifier/search_pruning.c b/tools/testing/selftests/bpf/verifier/search_pruning.c +index 7e50cb80873a5..7e36078f8f482 100644 +--- a/tools/testing/selftests/bpf/verifier/search_pruning.c ++++ b/tools/testing/selftests/bpf/verifier/search_pruning.c +@@ -154,3 +154,39 @@ + .result_unpriv = ACCEPT, + .insn_processed = 15, + }, ++/* The test performs a conditional 64-bit write to a stack location ++ * fp[-8], this is followed by an unconditional 8-bit write to fp[-8], ++ * then data is read from fp[-8]. This sequence is unsafe. ++ * ++ * The test would be mistakenly marked as safe w/o dst register parent ++ * preservation in verifier.c:copy_register_state() function. ++ * ++ * Note the usage of BPF_F_TEST_STATE_FREQ to force creation of the ++ * checkpoint state after conditional 64-bit assignment. ++ */ ++{ ++ "write tracking and register parent chain bug", ++ .insns = { ++ /* r6 = ktime_get_ns() */ ++ BPF_EMIT_CALL(BPF_FUNC_ktime_get_ns), ++ BPF_MOV64_REG(BPF_REG_6, BPF_REG_0), ++ /* r0 = ktime_get_ns() */ ++ BPF_EMIT_CALL(BPF_FUNC_ktime_get_ns), ++ /* if r0 > r6 goto +1 */ ++ BPF_JMP_REG(BPF_JGT, BPF_REG_0, BPF_REG_6, 1), ++ /* *(u64 *)(r10 - 8) = 0xdeadbeef */ ++ BPF_ST_MEM(BPF_DW, BPF_REG_FP, -8, 0xdeadbeef), ++ /* r1 = 42 */ ++ BPF_MOV64_IMM(BPF_REG_1, 42), ++ /* *(u8 *)(r10 - 8) = r1 */ ++ BPF_STX_MEM(BPF_B, BPF_REG_FP, BPF_REG_1, -8), ++ /* r2 = *(u64 *)(r10 - 8) */ ++ BPF_LDX_MEM(BPF_DW, BPF_REG_2, BPF_REG_FP, -8), ++ /* exit(0) */ ++ BPF_MOV64_IMM(BPF_REG_0, 0), ++ BPF_EXIT_INSN(), ++ }, ++ .flags = BPF_F_TEST_STATE_FREQ, ++ .errstr = "invalid read from stack off -8+1 size 8", ++ .result = REJECT, ++}, +-- +2.39.0 + diff --git a/queue-5.4/series b/queue-5.4/series index bb837c216d2..5b44cb63f9f 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -88,3 +88,11 @@ arm64-dts-meson-axg-make-mmc-host-controller-interrupts-level-sensitive.patch nvme-pci-move-enumeration-by-class-to-be-last-in-the-table.patch bpf-always-return-target-ifindex-in-bpf_fib_lookup.patch migrate-hugetlb-check-for-hugetlb-shared-pmd-in-node-migration.patch +selftests-bpf-verify-copy_register_state-preserves-p.patch +asoc-cs42l56-fix-dt-probe.patch +tools-virtio-fix-the-vringh-test-for-virtio-ring-cha.patch +net-rose-fix-to-not-accept-on-connected-socket.patch +net-stmmac-do-not-stop-rx_clk-in-rx-lpi-state-for-qc.patch +net-sched-sch-bounds-check-priority.patch +s390-decompressor-specify-__decompress-buf-len-to-av.patch +nvme-fc-fix-a-missing-queue-put-in-nvmet_fc_ls_creat.patch diff --git a/queue-5.4/tools-virtio-fix-the-vringh-test-for-virtio-ring-cha.patch b/queue-5.4/tools-virtio-fix-the-vringh-test-for-virtio-ring-cha.patch new file mode 100644 index 00000000000..5b080501f24 --- /dev/null +++ b/queue-5.4/tools-virtio-fix-the-vringh-test-for-virtio-ring-cha.patch @@ -0,0 +1,148 @@ +From 8bc7a96534d4183c164aac68c8e33c9de1d5b987 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Jan 2023 12:43:10 +0900 +Subject: tools/virtio: fix the vringh test for virtio ring changes + +From: Shunsuke Mie + +[ Upstream commit 3f7b75abf41cc4143aa295f62acbb060a012868d ] + +Fix the build caused by missing kmsan_handle_dma() and is_power_of_2() that +are used in drivers/virtio/virtio_ring.c. + +Signed-off-by: Shunsuke Mie +Message-Id: <20230110034310.779744-1-mie@igel.co.jp> +Signed-off-by: Michael S. Tsirkin +Signed-off-by: Sasha Levin +--- + tools/virtio/linux/bug.h | 8 +++----- + tools/virtio/linux/build_bug.h | 7 +++++++ + tools/virtio/linux/cpumask.h | 7 +++++++ + tools/virtio/linux/gfp.h | 7 +++++++ + tools/virtio/linux/kernel.h | 1 + + tools/virtio/linux/kmsan.h | 12 ++++++++++++ + tools/virtio/linux/scatterlist.h | 1 + + tools/virtio/linux/topology.h | 7 +++++++ + 8 files changed, 45 insertions(+), 5 deletions(-) + create mode 100644 tools/virtio/linux/build_bug.h + create mode 100644 tools/virtio/linux/cpumask.h + create mode 100644 tools/virtio/linux/gfp.h + create mode 100644 tools/virtio/linux/kmsan.h + create mode 100644 tools/virtio/linux/topology.h + +diff --git a/tools/virtio/linux/bug.h b/tools/virtio/linux/bug.h +index b14c2c3b6b857..74aef964f5099 100644 +--- a/tools/virtio/linux/bug.h ++++ b/tools/virtio/linux/bug.h +@@ -1,11 +1,9 @@ + /* SPDX-License-Identifier: GPL-2.0 */ +-#ifndef BUG_H +-#define BUG_H ++#ifndef _LINUX_BUG_H ++#define _LINUX_BUG_H + + #define BUG_ON(__BUG_ON_cond) assert(!(__BUG_ON_cond)) + +-#define BUILD_BUG_ON(x) +- + #define BUG() abort() + +-#endif /* BUG_H */ ++#endif /* _LINUX_BUG_H */ +diff --git a/tools/virtio/linux/build_bug.h b/tools/virtio/linux/build_bug.h +new file mode 100644 +index 0000000000000..cdbb75e28a604 +--- /dev/null ++++ b/tools/virtio/linux/build_bug.h +@@ -0,0 +1,7 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _LINUX_BUILD_BUG_H ++#define _LINUX_BUILD_BUG_H ++ ++#define BUILD_BUG_ON(x) ++ ++#endif /* _LINUX_BUILD_BUG_H */ +diff --git a/tools/virtio/linux/cpumask.h b/tools/virtio/linux/cpumask.h +new file mode 100644 +index 0000000000000..307da69d6b26c +--- /dev/null ++++ b/tools/virtio/linux/cpumask.h +@@ -0,0 +1,7 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _LINUX_CPUMASK_H ++#define _LINUX_CPUMASK_H ++ ++#include ++ ++#endif /* _LINUX_CPUMASK_H */ +diff --git a/tools/virtio/linux/gfp.h b/tools/virtio/linux/gfp.h +new file mode 100644 +index 0000000000000..43d146f236f14 +--- /dev/null ++++ b/tools/virtio/linux/gfp.h +@@ -0,0 +1,7 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __LINUX_GFP_H ++#define __LINUX_GFP_H ++ ++#include ++ ++#endif +diff --git a/tools/virtio/linux/kernel.h b/tools/virtio/linux/kernel.h +index 6683b4a70b059..3325cdf229410 100644 +--- a/tools/virtio/linux/kernel.h ++++ b/tools/virtio/linux/kernel.h +@@ -10,6 +10,7 @@ + #include + + #include ++#include + #include + #include + #include +diff --git a/tools/virtio/linux/kmsan.h b/tools/virtio/linux/kmsan.h +new file mode 100644 +index 0000000000000..272b5aa285d5a +--- /dev/null ++++ b/tools/virtio/linux/kmsan.h +@@ -0,0 +1,12 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _LINUX_KMSAN_H ++#define _LINUX_KMSAN_H ++ ++#include ++ ++inline void kmsan_handle_dma(struct page *page, size_t offset, size_t size, ++ enum dma_data_direction dir) ++{ ++} ++ ++#endif /* _LINUX_KMSAN_H */ +diff --git a/tools/virtio/linux/scatterlist.h b/tools/virtio/linux/scatterlist.h +index 369ee308b6686..74d9e1825748e 100644 +--- a/tools/virtio/linux/scatterlist.h ++++ b/tools/virtio/linux/scatterlist.h +@@ -2,6 +2,7 @@ + #ifndef SCATTERLIST_H + #define SCATTERLIST_H + #include ++#include + + struct scatterlist { + unsigned long page_link; +diff --git a/tools/virtio/linux/topology.h b/tools/virtio/linux/topology.h +new file mode 100644 +index 0000000000000..910794afb993a +--- /dev/null ++++ b/tools/virtio/linux/topology.h +@@ -0,0 +1,7 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef _LINUX_TOPOLOGY_H ++#define _LINUX_TOPOLOGY_H ++ ++#include ++ ++#endif /* _LINUX_TOPOLOGY_H */ +-- +2.39.0 +