fix: close_on_exec(): pass files_struct instead of fdtable (v6.10)
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 27 May 2024 14:49:45 +0000 (10:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 May 2024 15:50:52 +0000 (11:50 -0400)
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...

Change-Id: I8cdabb073c2090842b27b74954d86cb486c43b3e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/wrapper/fdtable.h
src/lttng-statedump-impl.c

index 46fc3f33dddef766d7dfea8e71f7a8711b956b74..d81b4f0b4c8404107e41f42b0862209ed7827daf 100644 (file)
@@ -41,4 +41,18 @@ struct file *lttng_lookup_fdget_rcu(unsigned int fd)
 }
 #endif
 
+#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, files);
+}
+#else
+static inline
+bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
+{
+       return close_on_exec(fd, files_fdtable(files));
+}
+#endif
+
 #endif /* _LTTNG_WRAPPER_FDTABLE_H */
index a0e97e1ca5a53a0f5975f31aa46bbccc2cff1b34..e06649e701a03dbd9673ddc132db6dd155e4725a 100644 (file)
@@ -42,7 +42,6 @@
 #include <wrapper/fdtable.h>
 #include <wrapper/tracepoint.h>
 #include <wrapper/blkdev.h>
-#include <wrapper/fdtable.h>
 #include <wrapper/sched.h>
 
 /* Define the tracepoints, but do not build the probes */
@@ -445,7 +444,7 @@ int lttng_dump_one_fd(const void *p, struct file *file, unsigned int fd)
         * the lock is taken, but we are not aware whether this is
         * guaranteed or not, so play safe.
         */
-       if (fd < fdt->max_fds && 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;
This page took 0.027547 seconds and 4 git commands to generate.