]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
bb659d5563a00e2b59687a40202ef69d206e22dc
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From c8adc20d19d853527a29411a03e114efdeff5f59 Mon Sep 17 00:00:00 2001
2 From: Michael Jeanson <mjeanson@efficios.com>
3 Date: Mon, 27 May 2024 10:49:45 -0400
4 Subject: [PATCH] fix: close_on_exec(): pass files_struct instead of fdtable
5 (v6.10)
6
7 See upstream commit:
8
9 commit f60d374d2cc88034385265d193a38e3f4a4b430c
10 Author: Al Viro <viro@zeniv.linux.org.uk>
11 Date: Thu Jan 4 21:35:38 2024 -0500
12
13 close_on_exec(): pass files_struct instead of fdtable
14
15 both callers are happier that way...
16
17 Upstream-Status: Backport [c8adc20d fix: close_on_exec(): pass files_struct instead of fdtable (v6.10)]
18
19 Change-Id: I8cdabb073c2090842b27b74954d86cb486c43b3e
20 Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
21 Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
22 ---
23 include/wrapper/fdtable.h | 14 ++++++++++++++
24 src/lttng-statedump-impl.c | 3 +--
25 2 files changed, 15 insertions(+), 2 deletions(-)
26
27 Index: lttng-modules-2.13.13/include/wrapper/fdtable.h
28 ===================================================================
29 --- lttng-modules-2.13.13.orig/include/wrapper/fdtable.h
30 +++ lttng-modules-2.13.13/include/wrapper/fdtable.h
31 @@ -69,20 +69,18 @@ int lttng_iterate_fd(struct files_struct
32
33 #endif
34
35 -#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,4,0))
36 -
37 -static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
38 +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,10,0))
39 +static inline
40 +bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
41 {
42 - return close_on_exec(fd, fdt);
43 + return close_on_exec(fd, files);
44 }
45 -
46 #else
47 -
48 -static inline bool lttng_close_on_exec(int fd, const struct fdtable *fdt)
49 +static inline
50 +bool lttng_close_on_exec(unsigned int fd, const struct files_struct *files)
51 {
52 - return FD_ISSET(fd, fdt->close_on_exec);
53 + return close_on_exec(fd, files_fdtable(files));
54 }
55 -
56 #endif
57
58 #endif /* _LTTNG_WRAPPER_FDTABLE_H */
59 Index: lttng-modules-2.13.13/src/lttng-statedump-impl.c
60 ===================================================================
61 --- lttng-modules-2.13.13.orig/src/lttng-statedump-impl.c
62 +++ lttng-modules-2.13.13/src/lttng-statedump-impl.c
63 @@ -44,7 +44,6 @@
64 #include <wrapper/tracepoint.h>
65 #include <wrapper/genhd.h>
66 #include <wrapper/file.h>
67 -#include <wrapper/fdtable.h>
68 #include <wrapper/sched.h>
69
70 #ifdef CONFIG_LTTNG_HAS_LIST_IRQ
71 @@ -451,7 +450,7 @@ int lttng_dump_one_fd(const void *p, str
72 * the lock is taken, but we are not aware whether this is
73 * guaranteed or not, so play safe.
74 */
75 - if (fd < fdt->max_fds && lttng_close_on_exec(fd, fdt))
76 + if (fd < fdt->max_fds && lttng_close_on_exec(fd, ctx->files))
77 flags |= O_CLOEXEC;
78 if (IS_ERR(s)) {
79 struct dentry *dentry = file->f_path.dentry;