kni:fix build with Linux 6.3/6.5

remove unused patch intruduced by"fix build with GCC 12"

(cherry picked from commit ed3c390d8025d3d75813e30be22b26bf0fb6861c)
This commit is contained in:
jiangheng12 2023-07-15 15:34:07 +08:00 committed by openeuler-sync-bot
parent d01d8c6a0d
commit 6aa9087b57
4 changed files with 112 additions and 55 deletions

View File

@ -1,54 +0,0 @@
From 0490d69d58d9d75c37e780966c837a062658f528 Mon Sep 17 00:00:00 2001
From: Rahul Bhansali <rbhansali@marvell.com>
Date: Tue, 11 Jan 2022 18:20:05 +0530
Subject: [PATCH] examples/l3fwd: fix buffer overflow in Tx
This patch fixes the stack buffer overflow error reported
from AddressSanitizer.
Function send_packetsx4() tries to access out of bound data
from rte_mbuf and fill it into TX buffer even in the case
where no pending packets (len = 0).
Performance impact:- No
ASAN error report:-
==819==ERROR: AddressSanitizer: stack-buffer-overflow on address
0xffffe2c0dcf0 at pc 0x0000005e791c bp 0xffffe2c0d7e0 sp 0xffffe2c0d800
READ of size 8 at 0xffffe2c0dcf0 thread T0
#0 0x5e7918 in send_packetsx4 ../examples/l3fwd/l3fwd_common.h:251
#1 0x5e7918 in send_packets_multi ../examples/l3fwd/l3fwd_neon.h:226
Fixes: 96ff445371e0 ("examples/l3fwd: reorganise and optimize LPM code path")
Cc: stable@dpdk.org
Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
examples/l3fwd/l3fwd_common.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h
index cbaab79f5b..8e4c27218f 100644
--- a/examples/l3fwd/l3fwd_common.h
+++ b/examples/l3fwd/l3fwd_common.h
@@ -236,6 +236,9 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[],
/* copy rest of the packets into the TX buffer. */
len = num - n;
+ if (len == 0)
+ goto exit;
+
j = 0;
switch (len % FWDSTEP) {
while (j < len) {
@@ -258,6 +261,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[],
}
}
+exit:
qconf->tx_mbufs[port].len = len;
}
--
2.23.0

View File

@ -0,0 +1,52 @@
From 5f34cc454df420b9b2da8deb949fb76cba058b87 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit@amd.com>
Date: Fri, 14 Apr 2023 16:25:22 +0100
Subject: [PATCH] kni: fix build with Linux 6.3
KNI calls `get_user_pages_remote()` API which is using `FOLL_TOUCH`
flag, but `FOLL_TOUCH` is no more in public headers since v6.3,
causing a build error.
`FOLL_*` defines in Linux kernel first moved to another header [1],
later some of them moved to memory subsystem internal header [2] for 6.3
`get_user_pages_remote()` already sets `FOLL_TOUCH` internally,
no need to set this flag externally anyway, moving flag from the call
altogether.
[1]
Commit b5054174ac7c ("mm: move FOLL_* defs to mm_types.h")
[2]
Commit 2c2241081f7d ("mm/gup: move private gup FOLL_ flags to internal.h")
Fixes: e73831dc6c26 ("kni: support userspace VA")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
kernel/linux/kni/kni_dev.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index a2c6d9fc1a..21bfb6890e 100644
--- a/kernel/linux/kni/kni_dev.h
+++ b/kernel/linux/kni/kni_dev.h
@@ -105,11 +105,9 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk,
/* Read one page struct info */
#ifdef HAVE_TSK_IN_GUP
- ret = get_user_pages_remote(tsk, tsk->mm, iova, 1,
- FOLL_TOUCH, &page, NULL, NULL);
+ ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, 0, &page, NULL, NULL);
#else
- ret = get_user_pages_remote(tsk->mm, iova, 1,
- FOLL_TOUCH, &page, NULL, NULL);
+ ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL, NULL);
#endif
if (ret < 0)
return 0;
--
2.23.0

View File

@ -0,0 +1,53 @@
From dd33d53b9a032d7376aa04a28a1235338e1fd78f Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit@amd.com>
Date: Tue, 11 Jul 2023 11:09:41 +0100
Subject: [PATCH] kni: fix build with Linux 6.5
The get_user_pages_remote() API has been modified in Linux kernel v6.5
[1], "struct vm_area_struct **vmas" parameter removed from the API.
To fix KNI build with Linux kernel v6.5, version check added around the
get_user_pages_remote() API.
[1]
ca5e863233e8 ("mm/gup: remove vmas parameter from get_user_pages_remote()")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
kernel/linux/kni/compat.h | 4 ++++
kernel/linux/kni/kni_dev.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
index 7aa6cd9fca..8beb670465 100644
--- a/kernel/linux/kni/compat.h
+++ b/kernel/linux/kni/compat.h
@@ -149,3 +149,7 @@
#if KERNEL_VERSION(5, 18, 0) > LINUX_VERSION_CODE
#define HAVE_NETIF_RX_NI
#endif
+
+#if KERNEL_VERSION(6, 5, 0) > LINUX_VERSION_CODE
+#define HAVE_VMA_IN_GUP
+#endif
diff --git a/kernel/linux/kni/kni_dev.h b/kernel/linux/kni/kni_dev.h
index 21bfb6890e..975379825b 100644
--- a/kernel/linux/kni/kni_dev.h
+++ b/kernel/linux/kni/kni_dev.h
@@ -107,7 +107,11 @@ static inline phys_addr_t iova_to_phys(struct task_struct *tsk,
#ifdef HAVE_TSK_IN_GUP
ret = get_user_pages_remote(tsk, tsk->mm, iova, 1, 0, &page, NULL, NULL);
#else
+ #ifdef HAVE_VMA_IN_GUP
ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL, NULL);
+ #else
+ ret = get_user_pages_remote(tsk->mm, iova, 1, 0, &page, NULL);
+ #endif
#endif
if (ret < 0)
return 0;
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 21.11
Release: 53
Release: 54
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 21.11
@ -369,6 +369,8 @@ Patch6339: 0339-examples-cmdline-fix-build-with-GCC-12.patch
Patch6340: 0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch
Patch6341: 0341-pdump-fix-build-with-GCC-12.patch
Patch6342: 0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch
Patch6343: 0343-kni-fix-build-with-Linux-6.3.patch
Patch6344: 0344-kni-fix-build-with-Linux-6.5.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -514,6 +516,10 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
/usr/sbin/depmod
%changelog
* Sat Jul 15 2023 jiangheng <jiangheng14@huawei.com> - 21.11-54
- kni: fix build with Linux 6.3/6.5
- remove unused patch intruduced by "fix build with GCC 12"
* Wed Jul 12 2023 jiangheng <jiangheng14@huawei.com> - 21.11-53
- fix build with GCC 12