summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch')
-rw-r--r--meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch
new file mode 100644
index 0000000000..bb659d5563
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-close_on_exec-pass-files_struct-instead-of-fdtab.patch
@@ -0,0 +1,79 @@
+From c8adc20d19d853527a29411a03e114efdeff5f59 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 27 May 2024 10:49:45 -0400
+Subject: [PATCH] fix: close_on_exec(): pass files_struct instead of fdtable
+ (v6.10)
+
+See upstream commit:
+
+ commit f60d374d2cc88034385265d193a38e3f4a4b430c
+ Author: Al Viro <viro@zeniv.linux.org.uk>
+ Date: Thu Jan 4 21:35:38 2024 -0500
+
+ close_on_exec(): pass files_struct instead of fdtable
+
+ both callers are happier that way...
+
+Upstream-Status: Backport [c8adc20d fix: close_on_exec(): pass files_struct instead of fdtable (v6.10)]
+
+Change-Id: I8cdabb073c2090842b27b74954d86cb486c43b3e
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ include/wrapper/fdtable.h | 14 ++++++++++++++
+ src/lttng-statedump-impl.c | 3 +--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+Index: lttng-modules-2.13.13/include/wrapper/fdtable.h
+===================================================================
+--- lttng-modules-2.13.13.orig/include/wrapper/fdtable.h
++++ lttng-modules-2.13.13/include/wrapper/fdtable.h
+@@ -69,20 +69,18 @@ int lttng_iterate_fd(struct files_struct
+
+ #endif
+
+-#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
+-
+-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
++#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
++static inline
++bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
+ {
+- return close_on_exec(fd, fdt);
++ return close_on_exec(fd, files);
+ }
+-
+ #else
+-
+-static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
++static inline
++bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
+ {
+- return FD_ISSET(fd, fdt->close_on_exec);
++ return close_on_exec(fd, files_fdtable(files));
+ }
+-
+ #endif
+
+ #endif /* _LTTNG_WRAPPER_FDTABLE_H */
+Index: lttng-modules-2.13.13/src/lttng-statedump-impl.c
+===================================================================
+--- lttng-modules-2.13.13.orig/src/lttng-statedump-impl.c
++++ lttng-modules-2.13.13/src/lttng-statedump-impl.c
+@@ -44,7 +44,6 @@
+ #include <wrapper/tracepoint.h>
+ #include <wrapper/genhd.h>
+ #include <wrapper/file.h>
+-#include <wrapper/fdtable.h>
+ #include <wrapper/sched.h>
+
+ #ifdef CONFIG_LTTNG_HAS_LIST_IRQ
+@@ -451,7 +450,7 @@ int lttng_dump_one_fd(const void *p, str
+ * the lock is taken, but we are not aware whether this is
+ * guaranteed or not, so play safe.
+ */
+- if (fd < fdt->max_fds && lttng_close_on_exec(fd, fdt))
++ if (fd < fdt->max_fds && lttng_close_on_exec(fd, ctx->files))
+ flags |= O_CLOEXEC;
+ if (IS_ERR(s)) {
+ struct dentry *dentry = file->f_path.dentry;