diff options
Diffstat (limited to 'meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-introduce-vma-vm_flags-wrapper-functions-v6.3.patch')
-rw-r--r-- | meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-introduce-vma-vm_flags-wrapper-functions-v6.3.patch | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-introduce-vma-vm_flags-wrapper-functions-v6.3.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-introduce-vma-vm_flags-wrapper-functions-v6.3.patch new file mode 100644 index 0000000000..976eecc3ab --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-fix-mm-introduce-vma-vm_flags-wrapper-functions-v6.3.patch | |||
@@ -0,0 +1,82 @@ | |||
1 | From 939200ef160c95c8a9d71fd80c99f42a1de0a9f0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Michael Jeanson <mjeanson@efficios.com> | ||
3 | Date: Tue, 7 Mar 2023 11:41:14 -0500 | ||
4 | Subject: [PATCH 1/4] fix: mm: introduce vma->vm_flags wrapper functions (v6.3) | ||
5 | |||
6 | See upstream commit : | ||
7 | |||
8 | commit bc292ab00f6c7a661a8a605c714e8a148f629ef6 | ||
9 | Author: Suren Baghdasaryan <surenb@google.com> | ||
10 | Date: Thu Jan 26 11:37:47 2023 -0800 | ||
11 | |||
12 | mm: introduce vma->vm_flags wrapper functions | ||
13 | |||
14 | vm_flags are among VMA attributes which affect decisions like VMA merging | ||
15 | and splitting. Therefore all vm_flags modifications are performed after | ||
16 | taking exclusive mmap_lock to prevent vm_flags updates racing with such | ||
17 | operations. Introduce modifier functions for vm_flags to be used whenever | ||
18 | flags are updated. This way we can better check and control correct | ||
19 | locking behavior during these updates. | ||
20 | |||
21 | Upstream-Status: Backport | ||
22 | |||
23 | Change-Id: I2cf662420d9d7748e5e310d3ea4bac98ba7d7f94 | ||
24 | Signed-off-by: Michael Jeanson <mjeanson@efficios.com> | ||
25 | Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | ||
26 | --- | ||
27 | include/wrapper/mm.h | 16 ++++++++++++++++ | ||
28 | src/lib/ringbuffer/ring_buffer_mmap.c | 4 +++- | ||
29 | 2 files changed, 19 insertions(+), 1 deletion(-) | ||
30 | |||
31 | diff --git a/include/wrapper/mm.h b/include/wrapper/mm.h | ||
32 | index d3bdda66..61ac8127 100644 | ||
33 | --- a/include/wrapper/mm.h | ||
34 | +++ b/include/wrapper/mm.h | ||
35 | @@ -13,6 +13,22 @@ | ||
36 | |||
37 | #include <lttng/kernel-version.h> | ||
38 | |||
39 | +#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(6,3,0)) | ||
40 | +static inline | ||
41 | +void wrapper_vm_flags_set(struct vm_area_struct *vma, | ||
42 | + vm_flags_t flags) | ||
43 | +{ | ||
44 | + vm_flags_set(vma, flags); | ||
45 | +} | ||
46 | +#else | ||
47 | +static inline | ||
48 | +void wrapper_vm_flags_set(struct vm_area_struct *vma, | ||
49 | + vm_flags_t flags) | ||
50 | +{ | ||
51 | + vma->vm_flags |= flags; | ||
52 | +} | ||
53 | +#endif | ||
54 | + | ||
55 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0) \ | ||
56 | || LTTNG_UBUNTU_KERNEL_RANGE(4,4,25,44, 4,5,0,0)) | ||
57 | |||
58 | diff --git a/src/lib/ringbuffer/ring_buffer_mmap.c b/src/lib/ringbuffer/ring_buffer_mmap.c | ||
59 | index 25e2d8d5..d24b76a3 100644 | ||
60 | --- a/src/lib/ringbuffer/ring_buffer_mmap.c | ||
61 | +++ b/src/lib/ringbuffer/ring_buffer_mmap.c | ||
62 | @@ -17,6 +17,8 @@ | ||
63 | #include <ringbuffer/frontend.h> | ||
64 | #include <ringbuffer/vfs.h> | ||
65 | |||
66 | +#include <wrapper/mm.h> | ||
67 | + | ||
68 | /* | ||
69 | * fault() vm_op implementation for ring buffer file mapping. | ||
70 | */ | ||
71 | @@ -113,7 +115,7 @@ static int lib_ring_buffer_mmap_buf(struct lttng_kernel_ring_buffer *buf, | ||
72 | return -EINVAL; | ||
73 | |||
74 | vma->vm_ops = &lib_ring_buffer_mmap_ops; | ||
75 | - vma->vm_flags |= VM_DONTEXPAND; | ||
76 | + wrapper_vm_flags_set(vma, VM_DONTEXPAND); | ||
77 | vma->vm_private_data = buf; | ||
78 | |||
79 | return 0; | ||
80 | -- | ||
81 | 2.34.1 | ||
82 | |||