-
debian/patches/0001-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
-
debian/patches/0002-fix-don-t-allow-userspace-copy-to-read-kernel-memory.patch
-
--- 2.12.2-1/debian/patches/0005-fix-tracepoint-Optimize-using-static_call-v5.10.patch 1970-01-01 00:00:00.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/0005-fix-tracepoint-Optimize-using-static_call-v5.10.patch 2020-11-26 11:07:33.000000000 +0000
@@ -0,0 +1,194 @@
+From 0c0558337a4483b907fb02a9819d360536f61798 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 26 Oct 2020 17:09:05 -0400
+Subject: [PATCH 5/6] fix: tracepoint: Optimize using static_call() (v5.10)
+
+See upstream commit :
+
+ commit d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
+ Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
+ Date: Tue Aug 18 15:57:52 2020 +0200
+
+ tracepoint: Optimize using static_call()
+
+ Currently the tracepoint site will iterate a vector and issue indirect
+ calls to however many handlers are registered (ie. the vector is
+ long).
+
+ Using static_call() it is possible to optimize this for the common
+ case of only having a single handler registered. In this case the
+ static_call() can directly call this handler. Otherwise, if the vector
+ is longer than 1, call a function that iterates the whole vector like
+ the current code.
+
+Change-Id: I739dd84d62cc1a821b8bd8acff74fa29aa25d22f
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ lttng-statedump-impl.c | 80 +++++++++++++++++++++++++++++++--------
+ probes/lttng.c | 7 +++-
+ tests/probes/lttng-test.c | 7 +++-
+ wrapper/tracepoint.h | 8 ++++
+ 4 files changed, 84 insertions(+), 18 deletions(-)
+
+diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
+index a6fa71a5..67ecd33c 100644
+--- a/lttng-statedump-impl.c
++++ b/lttng-statedump-impl.c
+@@ -55,26 +55,76 @@
+ #define LTTNG_INSTRUMENTATION
+ #include <instrumentation/events/lttng-module/lttng-statedump.h>
+
+-DEFINE_TRACE(lttng_statedump_block_device);
+-DEFINE_TRACE(lttng_statedump_end);
+-DEFINE_TRACE(lttng_statedump_interrupt);
+-DEFINE_TRACE(lttng_statedump_file_descriptor);
+-DEFINE_TRACE(lttng_statedump_start);
+-DEFINE_TRACE(lttng_statedump_process_state);
+-DEFINE_TRACE(lttng_statedump_process_pid_ns);
++LTTNG_DEFINE_TRACE(lttng_statedump_block_device,
++ TP_PROTO(struct lttng_session *session,
++ dev_t dev, const char *diskname),
++ TP_ARGS(session, dev, diskname));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_end,
++ TP_PROTO(struct lttng_session *session),
++ TP_ARGS(session));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_interrupt,
++ TP_PROTO(struct lttng_session *session,
++ unsigned int irq, const char *chip_name,
++ struct irqaction *action),
++ TP_ARGS(session, irq, chip_name, action));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_file_descriptor,
++ TP_PROTO(struct lttng_session *session,
++ struct files_struct *files,
++ int fd, const char *filename,
++ unsigned int flags, fmode_t fmode),
++ TP_ARGS(session, files, fd, filename, flags, fmode));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_start,
++ TP_PROTO(struct lttng_session *session),
++ TP_ARGS(session));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_process_state,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ int type, int mode, int submode, int status,
++ struct files_struct *files),
++ TP_ARGS(session, p, type, mode, submode, status, files));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_process_pid_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct pid_namespace *pid_ns),
++ TP_ARGS(session, p, pid_ns));
++
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
+-DEFINE_TRACE(lttng_statedump_process_cgroup_ns);
++LTTNG_DEFINE_TRACE(lttng_statedump_process_cgroup_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct cgroup_namespace *cgroup_ns),
++ TP_ARGS(session, p, cgroup_ns));
+ #endif
+-DEFINE_TRACE(lttng_statedump_process_ipc_ns);
++
++LTTNG_DEFINE_TRACE(lttng_statedump_process_ipc_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct ipc_namespace *ipc_ns),
++ TP_ARGS(session, p, ipc_ns));
++
+ #ifndef LTTNG_MNT_NS_MISSING_HEADER
+-DEFINE_TRACE(lttng_statedump_process_mnt_ns);
++LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct mnt_namespace *mnt_ns),
++ TP_ARGS(session, p, mnt_ns));
+ #endif
+-DEFINE_TRACE(lttng_statedump_process_net_ns);
+-DEFINE_TRACE(lttng_statedump_process_user_ns);
+-DEFINE_TRACE(lttng_statedump_process_uts_ns);
+-DEFINE_TRACE(lttng_statedump_network_interface);
++
++LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
++ TP_PROTO(struct lttng_session *session,
++ struct net_device *dev, struct in_ifaddr *ifa),
++ TP_ARGS(session, dev, ifa));
++
+ #ifdef LTTNG_HAVE_STATEDUMP_CPU_TOPOLOGY
+-DEFINE_TRACE(lttng_statedump_cpu_topology);
++LTTNG_DEFINE_TRACE(lttng_statedump_cpu_topology,
++ TP_PROTO(struct lttng_session *session, struct cpuinfo_x86 *c),
++ TP_ARGS(session, c));
+ #endif
+
+ struct lttng_fd_ctx {
+diff --git a/probes/lttng.c b/probes/lttng.c
+index 05bc1388..7ddaa69f 100644
+--- a/probes/lttng.c
++++ b/probes/lttng.c
+@@ -8,7 +8,7 @@
+ */
+
+ #include <linux/module.h>
+-#include <linux/tracepoint.h>
++#include <wrapper/tracepoint.h>
+ #include <linux/uaccess.h>
+ #include <linux/gfp.h>
+ #include <linux/fs.h>
+@@ -32,7 +32,10 @@
+ #define LTTNG_LOGGER_COUNT_MAX 1024
+ #define LTTNG_LOGGER_FILE "lttng-logger"
+
+-DEFINE_TRACE(lttng_logger);
++LTTNG_DEFINE_TRACE(lttng_logger,
++ PARAMS(const char __user *text, size_t len),
++ PARAMS(text, len)
++);
+
+ static struct proc_dir_entry *lttng_logger_dentry;
+
+diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c
+index b450e7d7..a4fa0645 100644
+--- a/tests/probes/lttng-test.c
++++ b/tests/probes/lttng-test.c
+@@ -25,7 +25,12 @@
+ #define LTTNG_INSTRUMENTATION
+ #include <instrumentation/events/lttng-module/lttng-test.h>
+
+-DEFINE_TRACE(lttng_test_filter_event);
++LTTNG_DEFINE_TRACE(lttng_test_filter_event,
++ PARAMS(int anint, int netint, long *values,
++ char *text, size_t textlen,
++ char *etext, uint32_t * net_values),
++ PARAMS(anint, netint, values, text, textlen, etext, net_values)
++);
+
+ #define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event"
+
+diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h
+index c4ba0123..bc19d8c1 100644
+--- a/wrapper/tracepoint.h
++++ b/wrapper/tracepoint.h
+@@ -14,6 +14,14 @@
+ #include <linux/tracepoint.h>
+ #include <linux/module.h>
+
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
++#define LTTNG_DEFINE_TRACE(name, proto, args) \
++ DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
++#else
++#define LTTNG_DEFINE_TRACE(name, proto, args) \
++ DEFINE_TRACE(name)
++#endif
++
+ #ifndef HAVE_KABI_2635_TRACEPOINT
+
+ #define kabi_2635_tracepoint_probe_register tracepoint_probe_register
+--
+2.29.2
+
-
--- 2.12.2-1/debian/patches/fix-writeback-queue-io-prototype-with-kernel-5.8.patch 1970-01-01 00:00:00.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/fix-writeback-queue-io-prototype-with-kernel-5.8.patch 2020-09-16 14:26:51.000000000 +0000
@@ -0,0 +1,142 @@
+Index: lttng-modules-2.12.2/instrumentation/events/lttng-module/writeback.h
+===================================================================
+--- lttng-modules-2.12.2.orig/instrumentation/events/lttng-module/writeback.h
++++ lttng-modules-2.12.2/instrumentation/events/lttng-module/writeback.h
+@@ -370,107 +370,53 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_
+ #endif
+ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
++ LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
++ LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
++ LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
++ LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
++ LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
++ LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++ TP_PROTO(struct bdi_writeback *wb,
++ struct wb_writeback_work *work,
++ unsigned long dirtied_before,
++ int moved),
++ TP_ARGS(wb, work, dirtied_before, moved),
++ TP_FIELDS(
++ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++ ctf_integer(unsigned long, older, dirtied_before)
++ ctf_integer(int, moved, moved)
++ )
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+ TP_PROTO(struct bdi_writeback *wb,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ struct wb_writeback_work *work,
+-#else
+- unsigned long *older_than_this,
+-#endif
+ int moved),
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ TP_ARGS(wb, work, moved),
+-#else
++ TP_FIELDS(
++ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++ ctf_integer(int, moved, moved)
++ )
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++ TP_PROTO(struct bdi_writeback *wb,
++ unsigned long *older_than_this,
++ int moved),
+ TP_ARGS(wb, older_than_this, moved),
+-#endif
+ TP_FIELDS(
+ ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+-#else
+ ctf_integer(unsigned long, older,
+ older_than_this ? *older_than_this : 0)
+ ctf_integer(long, age,
+ older_than_this ?
+ (jiffies - *older_than_this) * 1000 / HZ
+ : -1)
+-#endif
+ ctf_integer(int, moved, moved)
+ )
+ )
+-
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
+-LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+-
+- writeback_global_dirty_state,
+-
+- TP_PROTO(unsigned long background_thresh,
+- unsigned long dirty_thresh
+- ),
+-
+- TP_ARGS(background_thresh,
+- dirty_thresh
+- ),
+-
+- TP_FIELDS(
+- ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
+- ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
+- ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
+- ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
+- ctf_integer(unsigned long, background_thresh, background_thresh)
+- ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
+- ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+- )
+-)
+-#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+-LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+-
+- writeback_global_dirty_state,
+-
+- TP_PROTO(unsigned long background_thresh,
+- unsigned long dirty_thresh
+- ),
+-
+- TP_ARGS(background_thresh,
+- dirty_thresh
+- ),
+-
+- TP_FIELDS(
+- ctf_integer(unsigned long, nr_dirty, global_node_page_state(NR_FILE_DIRTY))
+- ctf_integer(unsigned long, nr_writeback, global_node_page_state(NR_WRITEBACK))
+- ctf_integer(unsigned long, nr_unstable, global_node_page_state(NR_UNSTABLE_NFS))
+- ctf_integer(unsigned long, nr_dirtied, global_node_page_state(NR_DIRTIED))
+- ctf_integer(unsigned long, nr_written, global_node_page_state(NR_WRITTEN))
+- ctf_integer(unsigned long, background_thresh, background_thresh)
+- ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
+- ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+- )
+-)
+-#else
+-LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+-
+- writeback_global_dirty_state,
+-
+- TP_PROTO(unsigned long background_thresh,
+- unsigned long dirty_thresh
+- ),
+-
+- TP_ARGS(background_thresh,
+- dirty_thresh
+- ),
+-
+- TP_FIELDS(
+- ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY))
+- ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK))
+- ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS))
+- ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED))
+- ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN))
+- ctf_integer(unsigned long, background_thresh, background_thresh)
+- ctf_integer(unsigned long, dirty_thresh, dirty_thresh)
+- ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+- )
+-)
+-#endif
+ #endif
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
-
--- 2.12.2-1/debian/patches/series 2020-08-05 17:51:20.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/series 2020-11-26 11:07:33.000000000 +0000
@@ -1 +1,8 @@
fix-linux-rt-4.9-sched.patch
+fix-writeback-queue-io-prototype-with-kernel-5.8.patch
+0001-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
+0002-fix-don-t-allow-userspace-copy-to-read-kernel-memory.patch
+0003-fix-Use-kernel_read-to-read-from-procfs.patch
+0004-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch
+0005-fix-tracepoint-Optimize-using-static_call-v5.10.patch
+0006-fix-statedump-undefined-symbols-caused-by-incorrect-.patch
-
--- 2.12.2-1/debian/patches/0006-fix-statedump-undefined-symbols-caused-by-incorrect-.patch 1970-01-01 00:00:00.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/0006-fix-statedump-undefined-symbols-caused-by-incorrect-.patch 2020-11-26 11:07:33.000000000 +0000
@@ -0,0 +1,53 @@
+From 49dc48631f5b5a0184cc39c990bd9ac5bc17e23d Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he@windriver.com>
+Date: Mon, 23 Nov 2020 18:14:25 +0800
+Subject: [PATCH 6/6] fix: statedump: undefined symbols caused by incorrect
+ patch backport
+
+bb346792c2cb ("fix: tracepoint: Optimize using static_call() (v5.10)")
+misses three definitions and causes the following build failures.
+
+ERROR: "__tracepoint_lttng_statedump_process_net_ns" [lttng-statedump.ko] undefined!
+ERROR: "__tracepoint_lttng_statedump_process_user_ns" [lttng-statedump.ko] undefined!
+ERROR: "__tracepoint_lttng_statedump_process_uts_ns" [lttng-statedump.ko] undefined!
+
+Fixes: #1290
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ lttng-statedump-impl.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
+index 67ecd33c..cf803a73 100644
+--- a/lttng-statedump-impl.c
++++ b/lttng-statedump-impl.c
+@@ -116,6 +116,24 @@ LTTNG_DEFINE_TRACE(lttng_statedump_process_mnt_ns,
+ TP_ARGS(session, p, mnt_ns));
+ #endif
+
++LTTNG_DEFINE_TRACE(lttng_statedump_process_net_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct net *net_ns),
++ TP_ARGS(session, p, net_ns));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_process_user_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct user_namespace *user_ns),
++ TP_ARGS(session, p, user_ns));
++
++LTTNG_DEFINE_TRACE(lttng_statedump_process_uts_ns,
++ TP_PROTO(struct lttng_session *session,
++ struct task_struct *p,
++ struct uts_namespace *uts_ns),
++ TP_ARGS(session, p, uts_ns));
++
+ LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
+ TP_PROTO(struct lttng_session *session,
+ struct net_device *dev, struct in_ifaddr *ifa),
+--
+2.29.2
+
-
--- 2.12.2-1/debian/patches/0004-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch 1970-01-01 00:00:00.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/0004-fix-objtool-Rename-frame.h-objtool.h-v5.10.patch 2020-11-26 11:07:33.000000000 +0000
@@ -0,0 +1,86 @@
+From bf0790fca02b5d82c54b75c23a97535fc88f9fc2 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 26 Oct 2020 13:41:02 -0400
+Subject: [PATCH 4/6] fix: objtool: Rename frame.h -> objtool.h (v5.10)
+
+See upstream commit :
+
+ commit 00089c048eb4a8250325efb32a2724fd0da68cce
+ Author: Julien Thierry <jthierry@redhat.com>
+ Date: Fri Sep 4 16:30:25 2020 +0100
+
+ objtool: Rename frame.h -> objtool.h
+
+ Header frame.h is getting more code annotations to help objtool analyze
+ object files.
+
+ Rename the file to objtool.h.
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: Ic2283161bebcbf1e33b72805eb4d2628f4ae3e89
+---
+ lttng-filter-interpreter.c | 2 +-
+ wrapper/{frame.h => objtool.h} | 19 ++++++++++++-------
+ 2 files changed, 13 insertions(+), 8 deletions(-)
+ rename wrapper/{frame.h => objtool.h} (50%)
+
+diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c
+index 21169f01..5d572437 100644
+--- a/lttng-filter-interpreter.c
++++ b/lttng-filter-interpreter.c
+@@ -8,7 +8,7 @@
+ */
+
+ #include <wrapper/uaccess.h>
+-#include <wrapper/frame.h>
++#include <wrapper/objtool.h>
+ #include <wrapper/types.h>
+ #include <linux/swab.h>
+
+diff --git a/wrapper/frame.h b/wrapper/objtool.h
+similarity index 50%
+rename from wrapper/frame.h
+rename to wrapper/objtool.h
+index 6e6dc811..3b997cae 100644
+--- a/wrapper/frame.h
++++ b/wrapper/objtool.h
+@@ -1,18 +1,23 @@
+-/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
++/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+- * wrapper/frame.h
++ * wrapper/objtool.h
+ *
+ * Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+-#ifndef _LTTNG_WRAPPER_FRAME_H
+-#define _LTTNG_WRAPPER_FRAME_H
++#ifndef _LTTNG_WRAPPER_OBJTOOL_H
++#define _LTTNG_WRAPPER_OBJTOOL_H
+
+ #include <linux/version.h>
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
+-
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
++#include <linux/objtool.h>
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
+ #include <linux/frame.h>
++#endif
++
++
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
+
+ #define LTTNG_STACK_FRAME_NON_STANDARD(func) \
+ STACK_FRAME_NON_STANDARD(func)
+@@ -23,4 +28,4 @@
+
+ #endif
+
+-#endif /* _LTTNG_WRAPPER_FRAME_H */
++#endif /* _LTTNG_WRAPPER_OBJTOOL_H */
+--
+2.29.2
+
-
--- 2.12.2-1/debian/patches/0003-fix-Use-kernel_read-to-read-from-procfs.patch 1970-01-01 00:00:00.000000000 +0000
+++ 2.12.2-1ubuntu2/debian/patches/0003-fix-Use-kernel_read-to-read-from-procfs.patch 2020-11-26 11:07:33.000000000 +0000
@@ -0,0 +1,54 @@
+From 2535981df8fd48ebf8a6994692b937e6374c0d95 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Thu, 24 Sep 2020 15:38:35 -0400
+Subject: [PATCH 3/6] fix: Use 'kernel_read' to read from procfs
+
+Use the 'kernel_read' helper to read files in procfs, it's present in
+the kernel since the 2.6 series and does the right thing on kernels that
+require the set_fs dance and newer one which don't.
+
+Change-Id: I1a53fda379e0bb9acc79331626925bbdba63d727
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ wrapper/random.c | 12 +-----------
+ 1 file changed, 1 insertion(+), 11 deletions(-)
+
+diff --git a/wrapper/random.c b/wrapper/random.c
+index eb41769c..d7e53cd1 100644
+--- a/wrapper/random.c
++++ b/wrapper/random.c
+@@ -28,21 +28,12 @@ int wrapper_get_bootid(char *bootid)
+ struct file *file;
+ int ret;
+ ssize_t len;
+- mm_segment_t old_fs;
+
+ file = filp_open("/proc/sys/kernel/random/boot_id", O_RDONLY, 0);
+ if (IS_ERR(file))
+ return PTR_ERR(file);
+
+- old_fs = get_fs();
+- set_fs(KERNEL_DS);
+-
+- if (!file->f_op || !file->f_op->read) {
+- ret = -EINVAL;
+- goto end;
+- }
+-
+- len = file->f_op->read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos);
++ len = kernel_read(file, bootid, BOOT_ID_LEN - 1, &file->f_pos);
+ if (len != BOOT_ID_LEN - 1) {
+ ret = -EINVAL;
+ goto end;
+@@ -51,7 +42,6 @@ int wrapper_get_bootid(char *bootid)
+ bootid[BOOT_ID_LEN - 1] = '\0';
+ ret = 0;
+ end:
+- set_fs(old_fs);
+ filp_close(file, current->files);
+ return ret;
+ }
+--
+2.29.2
+