commit:     fce45a24e00bf2192e0c8bfa3c80b4dad33c201b
Author:     Nick Sarnie <sarnex <AT> gentoo <DOT> org>
AuthorDate: Mon May 24 22:43:25 2021 +0000
Commit:     Nick Sarnie <sarnex <AT> gentoo <DOT> org>
CommitDate: Mon May 24 22:44:39 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fce45a24

app-emulation/vendor-reset: Add patch

Closes: https://bugs.gentoo.org/791877
Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Nick Sarnie <sarnex <AT> gentoo.org>

 .../vendor-reset/files/Fix-5.11-build.patch        | 52 ++++++++++++++++++++++
 .../vendor-reset/vendor-reset-0.1.0.ebuild         |  2 +
 2 files changed, 54 insertions(+)

diff --git a/app-emulation/vendor-reset/files/Fix-5.11-build.patch 
b/app-emulation/vendor-reset/files/Fix-5.11-build.patch
new file mode 100644
index 00000000000..845ea08afc5
--- /dev/null
+++ b/app-emulation/vendor-reset/files/Fix-5.11-build.patch
@@ -0,0 +1,52 @@
+From 225a49a40941e350899e456366265cf82b87ad25 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?T=C3=A9rence=20Clastres?= <[email protected]>
+Date: Sun, 31 Jan 2021 20:22:00 +0100
+Subject: [PATCH] [core] add support for linux 5.11
+
+This approach maintains compatibility with previous kernel versions.
+
+Thanks to @justinkb for finding the commit that broke it 
(torvalds/linux@d19ad07).
+---
+ dkms.conf    | 2 +-
+ src/ftrace.c | 8 ++++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/dkms.conf b/dkms.conf
+index 396abd3..09fbcf0 100644
+--- a/dkms.conf
++++ b/dkms.conf
+@@ -1,5 +1,5 @@
+ PACKAGE_NAME="vendor-reset"
+-PACKAGE_VERSION="0.1.0"
++PACKAGE_VERSION="0.1.1"
+ BUILT_MODULE_NAME[0]="${PACKAGE_NAME}"
+ MAKE[0]="make KDIR=${kernel_source_dir}"
+ CLEAN="make KDIR=${kernel_source_dir} clean"
+diff --git a/src/ftrace.c b/src/ftrace.c
+index 80bb4aa..7eed223 100644
+--- a/src/ftrace.c
++++ b/src/ftrace.c
+@@ -22,6 +22,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
+ #include <linux/ftrace.h>
+ #include <linux/kprobes.h>
+ #include <linux/pci.h>
++#include <linux/version.h>
+ 
+ #include "ftrace.h"
+ 
+@@ -48,8 +49,15 @@ static int resolve_hook_address(struct ftrace_hook *hook)
+   return 0;
+ }
+ 
++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
+ static void notrace fh_trace_thunk(unsigned long ip, unsigned long parent_ip, 
struct ftrace_ops *ops, struct pt_regs *regs)
+ {
++#else
++static void notrace fh_trace_thunk(unsigned long ip, unsigned long parent_ip, 
struct ftrace_ops *ops, struct ftrace_regs *fregs)
++{
++  struct pt_regs *regs;
++  regs = ftrace_get_regs(fregs);
++#endif
+   struct ftrace_hook *hook = to_ftrace_hook(ops);
+ 
+   if (!within_module(parent_ip, THIS_MODULE))

diff --git a/app-emulation/vendor-reset/vendor-reset-0.1.0.ebuild 
b/app-emulation/vendor-reset/vendor-reset-0.1.0.ebuild
index c772c455876..192727933e8 100644
--- a/app-emulation/vendor-reset/vendor-reset-0.1.0.ebuild
+++ b/app-emulation/vendor-reset/vendor-reset-0.1.0.ebuild
@@ -22,6 +22,8 @@ SLOT="0"
 DEPEND=""
 RDEPEND="${DEPEND}"
 
+PATCHES=( "${FILESDIR}/Fix-5.11-build.patch" )
+
 pkg_setup() {
        local CONFIG_CHECK="FTRACE KPROBES PCI_QUIRKS KALLSYMS FUNCTION_TRACER"
        linux-mod_pkg_setup

Reply via email to