diff -Nru lttng-modules-2.10.8/debian/changelog lttng-modules-2.10.8/debian/changelog --- lttng-modules-2.10.8/debian/changelog 2019-05-31 23:13:39.000000000 +0200 +++ lttng-modules-2.10.8/debian/changelog 2020-05-19 16:55:01.000000000 +0200 @@ -1,3 +1,15 @@ +lttng-modules (2.10.8-1ubuntu3) eoan; urgency=medium + + * Fix vmalloc_sync_all() removal (LP: #1874521). Changes from upstream lttng + repo (1-4) with additional Ubuntu fixup (5). + - d/p/compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch + - d/p/compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch + - d/p/compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch + - d/p/compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch + - d/p/compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch + + -- Stefan Bader Tue, 19 May 2020 16:55:01 +0200 + lttng-modules (2.10.8-1ubuntu2) eoan; urgency=medium * Fix dkms build with Linux 5.1/5.2 (LP: #1830048) diff -Nru lttng-modules-2.10.8/debian/patches/compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch lttng-modules-2.10.8/debian/patches/compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch --- lttng-modules-2.10.8/debian/patches/compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch 1970-01-01 01:00:00.000000000 +0100 +++ lttng-modules-2.10.8/debian/patches/compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch 2020-05-19 16:53:11.000000000 +0200 @@ -0,0 +1,598 @@ +From 263b6c88138c3354d63dba3c70a965de94becd22 Mon Sep 17 00:00:00 2001 +From: Mathieu Desnoyers +Date: Tue, 5 May 2020 13:38:31 -0400 +Subject: [PATCH] Update for kernel 5.7: use vmalloc_sync_mappings on kernels + >= 5.7 + +Signed-off-by: Mathieu Desnoyers +(backported from commit 263b6c88138c3354d63dba3c70a965de94becd22 lttng) +Signed-off-by: Stefan Bader +--- + lib/ringbuffer/ring_buffer_backend.c | 4 +-- + lttng-abi.c | 4 +-- + lttng-context-callstack.c | 2 +- + lttng-context-cgroup-ns.c | 2 +- + lttng-context-cpu-id.c | 2 +- + lttng-context-egid.c | 2 +- + lttng-context-euid.c | 2 +- + lttng-context-gid.c | 2 +- + lttng-context-hostname.c | 2 +- + lttng-context-interruptible.c | 2 +- + lttng-context-ipc-ns.c | 2 +- + lttng-context-migratable.c | 2 +- + lttng-context-mnt-ns.c | 2 +- + lttng-context-need-reschedule.c | 2 +- + lttng-context-net-ns.c | 2 +- + lttng-context-nice.c | 2 +- + lttng-context-perf-counters.c | 2 +- + lttng-context-pid-ns.c | 2 +- + lttng-context-pid.c | 2 +- + lttng-context-ppid.c | 2 +- + lttng-context-preemptible.c | 2 +- + lttng-context-prio.c | 2 +- + lttng-context-procname.c | 2 +- + lttng-context-sgid.c | 2 +- + lttng-context-suid.c | 2 +- + lttng-context-tid.c | 2 +- + lttng-context-uid.c | 2 +- + lttng-context-user-ns.c | 2 +- + lttng-context-uts-ns.c | 2 +- + lttng-context-vegid.c | 2 +- + lttng-context-veuid.c | 2 +- + lttng-context-vgid.c | 2 +- + lttng-context-vpid.c | 2 +- + lttng-context-vppid.c | 2 +- + lttng-context-vsgid.c | 2 +- + lttng-context-vsuid.c | 2 +- + lttng-context-vtid.c | 2 +- + lttng-context-vuid.c | 2 +- + lttng-context.c | 2 +- + lttng-events.c | 10 +++--- + lttng-ring-buffer-client.h | 4 +-- + lttng-ring-buffer-metadata-client.h | 4 +-- + lttng-syscalls.c | 2 +- + probes/lttng-kprobes.c | 2 +- + probes/lttng-kretprobes.c | 2 +- + probes/lttng-tracepoint-event-impl.h | 4 +-- + probes/lttng-uprobes.c | 2 +- + probes/lttng.c | 2 +- + tests/probes/lttng-test.c | 2 +- + wrapper/vmalloc.h | 49 ++++++++++++++++++++++++++-- + 50 files changed, 104 insertions(+), 61 deletions(-) + +Index: lttng-modules-2.10.8/lib/ringbuffer/ring_buffer_backend.c +=================================================================== +--- lttng-modules-2.10.8.orig/lib/ringbuffer/ring_buffer_backend.c ++++ lttng-modules-2.10.8/lib/ringbuffer/ring_buffer_backend.c +@@ -30,7 +30,7 @@ + #include + + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + #include +@@ -169,7 +169,7 @@ int lib_ring_buffer_backend_allocate(con + * If kmalloc ever uses vmalloc underneath, make sure the buffer pages + * will not fault. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + wrapper_clear_current_oom_origin(); + vfree(pages); + return 0; +Index: lttng-modules-2.10.8/lttng-abi.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-abi.c ++++ lttng-modules-2.10.8/lttng-abi.c +@@ -44,7 +44,7 @@ + #include + #include + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + #include +@@ -1726,7 +1726,7 @@ int __init lttng_abi_init(void) + { + int ret = 0; + +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + lttng_clock_ref(); + + ret = lttng_tp_mempool_init(); +Index: lttng-modules-2.10.8/lttng-context-cpu-id.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-cpu-id.c ++++ lttng-modules-2.10.8/lttng-context-cpu-id.c +@@ -81,7 +81,7 @@ int lttng_add_cpu_id_to_ctx(struct lttng + field->record = cpu_id_record; + field->get_value = cpu_id_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_cpu_id_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-hostname.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-hostname.c ++++ lttng-modules-2.10.8/lttng-context-hostname.c +@@ -114,7 +114,7 @@ int lttng_add_hostname_to_ctx(struct ltt + field->record = hostname_record; + field->get_value = hostname_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_hostname_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-interruptible.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-interruptible.c ++++ lttng-modules-2.10.8/lttng-context-interruptible.c +@@ -88,7 +88,7 @@ int lttng_add_interruptible_to_ctx(struc + field->record = interruptible_record; + field->get_value = interruptible_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_interruptible_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-migratable.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-migratable.c ++++ lttng-modules-2.10.8/lttng-context-migratable.c +@@ -81,7 +81,7 @@ int lttng_add_migratable_to_ctx(struct l + field->record = migratable_record; + field->get_value = migratable_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_migratable_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-need-reschedule.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-need-reschedule.c ++++ lttng-modules-2.10.8/lttng-context-need-reschedule.c +@@ -81,7 +81,7 @@ int lttng_add_need_reschedule_to_ctx(str + field->record = need_reschedule_record; + field->get_value = need_reschedule_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_need_reschedule_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-nice.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-nice.c ++++ lttng-modules-2.10.8/lttng-context-nice.c +@@ -81,7 +81,7 @@ int lttng_add_nice_to_ctx(struct lttng_c + field->record = nice_record; + field->get_value = nice_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_nice_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-perf-counters.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-perf-counters.c ++++ lttng-modules-2.10.8/lttng-context-perf-counters.c +@@ -334,7 +334,7 @@ int lttng_add_perf_counter_to_ctx(uint32 + field->u.perf_counter = perf_field; + lttng_context_update(*ctx); + +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) +Index: lttng-modules-2.10.8/lttng-context-pid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-pid.c ++++ lttng-modules-2.10.8/lttng-context-pid.c +@@ -81,7 +81,7 @@ int lttng_add_pid_to_ctx(struct lttng_ct + field->record = pid_record; + field->get_value = pid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_pid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-ppid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-ppid.c ++++ lttng-modules-2.10.8/lttng-context-ppid.c +@@ -103,7 +103,7 @@ int lttng_add_ppid_to_ctx(struct lttng_c + field->record = ppid_record; + field->get_value = ppid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-preemptible.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-preemptible.c ++++ lttng-modules-2.10.8/lttng-context-preemptible.c +@@ -99,7 +99,7 @@ int lttng_add_preemptible_to_ctx(struct + field->record = preemptible_record; + field->get_value = preemptible_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_preemptible_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-prio.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-prio.c ++++ lttng-modules-2.10.8/lttng-context-prio.c +@@ -102,7 +102,7 @@ int lttng_add_prio_to_ctx(struct lttng_c + field->record = prio_record; + field->get_value = prio_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_prio_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-procname.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-procname.c ++++ lttng-modules-2.10.8/lttng-context-procname.c +@@ -85,7 +85,7 @@ int lttng_add_procname_to_ctx(struct ltt + field->record = procname_record; + field->get_value = procname_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_procname_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-tid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-tid.c ++++ lttng-modules-2.10.8/lttng-context-tid.c +@@ -84,7 +84,7 @@ int lttng_add_tid_to_ctx(struct lttng_ct + field->record = tid_record; + field->get_value = tid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_tid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-vpid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-vpid.c ++++ lttng-modules-2.10.8/lttng-context-vpid.c +@@ -96,7 +96,7 @@ int lttng_add_vpid_to_ctx(struct lttng_c + field->record = vpid_record; + field->get_value = vpid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_vpid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-vppid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-vppid.c ++++ lttng-modules-2.10.8/lttng-context-vppid.c +@@ -125,7 +125,7 @@ int lttng_add_vppid_to_ctx(struct lttng_ + field->record = vppid_record; + field->get_value = vppid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context-vtid.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context-vtid.c ++++ lttng-modules-2.10.8/lttng-context-vtid.c +@@ -96,7 +96,7 @@ int lttng_add_vtid_to_ctx(struct lttng_c + field->record = vtid_record; + field->get_value = vtid_get_value; + lttng_context_update(*ctx); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + EXPORT_SYMBOL_GPL(lttng_add_vtid_to_ctx); +Index: lttng-modules-2.10.8/lttng-context.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-context.c ++++ lttng-modules-2.10.8/lttng-context.c +@@ -24,7 +24,7 @@ + #include + #include + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + +Index: lttng-modules-2.10.8/lttng-events.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-events.c ++++ lttng-modules-2.10.8/lttng-events.c +@@ -42,7 +42,7 @@ + #include + + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + #include +@@ -2619,9 +2619,9 @@ end: + * Registers a transport which can be used as output to extract the data out of + * LTTng. The module calling this registration function must ensure that no + * trap-inducing code will be executed by the transport functions. E.g. +- * vmalloc_sync_all() must be called between a vmalloc and the moment the memory ++ * vmalloc_sync_mappings() must be called between a vmalloc and the moment the memory + * is made visible to the transport function. This registration acts as a +- * vmalloc_sync_all. Therefore, only if the module allocates virtual memory ++ * vmalloc_sync_mappings. Therefore, only if the module allocates virtual memory + * after its registration must it synchronize the TLBs. + */ + void lttng_transport_register(struct lttng_transport *transport) +@@ -2629,9 +2629,9 @@ void lttng_transport_register(struct ltt + /* + * Make sure no page fault can be triggered by the module about to be + * registered. We deal with this here so we don't have to call +- * vmalloc_sync_all() in each module's init. ++ * vmalloc_sync_mappings() in each module's init. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + + mutex_lock(&sessions_mutex); + list_add_tail(&transport->node, <tng_transport_list); +Index: lttng-modules-2.10.8/lttng-ring-buffer-client.h +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-ring-buffer-client.h ++++ lttng-modules-2.10.8/lttng-ring-buffer-client.h +@@ -23,7 +23,7 @@ + #include + #include + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + #include +@@ -744,7 +744,7 @@ static int __init lttng_ring_buffer_clie + * This vmalloc sync all also takes care of the lib ring buffer + * vmalloc'd module pages when it is built as a module into LTTng. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + lttng_transport_register(<tng_relay_transport); + return 0; + } +Index: lttng-modules-2.10.8/lttng-ring-buffer-metadata-client.h +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-ring-buffer-metadata-client.h ++++ lttng-modules-2.10.8/lttng-ring-buffer-metadata-client.h +@@ -22,7 +22,7 @@ + + #include + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + +@@ -439,7 +439,7 @@ static int __init lttng_ring_buffer_clie + * This vmalloc sync all also takes care of the lib ring buffer + * vmalloc'd module pages when it is built as a module into LTTng. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + lttng_transport_register(<tng_relay_transport); + return 0; + } +Index: lttng-modules-2.10.8/lttng-syscalls.c +=================================================================== +--- lttng-modules-2.10.8.orig/lttng-syscalls.c ++++ lttng-modules-2.10.8/lttng-syscalls.c +@@ -761,7 +761,7 @@ int lttng_syscalls_register(struct lttng + struct lttng_kernel_event ev; + int ret; + +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + + if (!chan->sc_table) { + /* create syscall table mapping syscall to events */ +Index: lttng-modules-2.10.8/probes/lttng-kprobes.c +=================================================================== +--- lttng-modules-2.10.8.orig/probes/lttng-kprobes.c ++++ lttng-modules-2.10.8/probes/lttng-kprobes.c +@@ -144,7 +144,7 @@ int lttng_kprobes_register(const char *n + * Well.. kprobes itself puts the page fault handler on the blacklist, + * but we can never be too careful. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + + ret = register_kprobe(&event->u.kprobe.kp); + if (ret) +Index: lttng-modules-2.10.8/probes/lttng-kretprobes.c +=================================================================== +--- lttng-modules-2.10.8.orig/probes/lttng-kretprobes.c ++++ lttng-modules-2.10.8/probes/lttng-kretprobes.c +@@ -233,7 +233,7 @@ int lttng_kretprobes_register(const char + * Well.. kprobes itself puts the page fault handler on the blacklist, + * but we can never be too careful. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + + ret = register_kretprobe(<tng_krp->krp); + if (ret) +Index: lttng-modules-2.10.8/probes/lttng-tracepoint-event-impl.h +=================================================================== +--- lttng-modules-2.10.8.orig/probes/lttng-tracepoint-event-impl.h ++++ lttng-modules-2.10.8/probes/lttng-tracepoint-event-impl.h +@@ -28,7 +28,7 @@ + #include + #include + #include +-#include /* for wrapper_vmalloc_sync_all() */ ++#include /* for wrapper_vmalloc_sync_mappings() */ + #include + #include + #include +@@ -1365,7 +1365,7 @@ static __used struct lttng_probe_desc TP + #ifndef TP_MODULE_NOINIT + static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void) + { +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return lttng_probe_register(&TP_ID(__probe_desc___, TRACE_SYSTEM)); + } + +Index: lttng-modules-2.10.8/probes/lttng.c +=================================================================== +--- lttng-modules-2.10.8.orig/probes/lttng.c ++++ lttng-modules-2.10.8/probes/lttng.c +@@ -109,7 +109,7 @@ int __init lttng_logger_init(void) + { + int ret = 0; + +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + lttng_logger_dentry = proc_create_data(LTTNG_LOGGER_FILE, + S_IRUGO | S_IWUGO, NULL, + <tng_logger_operations, NULL); +Index: lttng-modules-2.10.8/tests/probes/lttng-test.c +=================================================================== +--- lttng-modules-2.10.8.orig/tests/probes/lttng-test.c ++++ lttng-modules-2.10.8/tests/probes/lttng-test.c +@@ -100,7 +100,7 @@ int __init lttng_test_init(void) + int ret = 0; + + (void) wrapper_lttng_fixup_sig(THIS_MODULE); +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + lttng_test_filter_event_dentry = + proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE, + S_IRUGO | S_IWUGO, NULL, +Index: lttng-modules-2.10.8/wrapper/vmalloc.h +=================================================================== +--- lttng-modules-2.10.8.orig/wrapper/vmalloc.h ++++ lttng-modules-2.10.8/wrapper/vmalloc.h +@@ -34,8 +34,35 @@ + #include + #include + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) ++ + static inline +-void wrapper_vmalloc_sync_all(void) ++void wrapper_vmalloc_sync_mappings(void) ++{ ++ void (*vmalloc_sync_mappings_sym)(void); ++ ++ vmalloc_sync_mappings_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_mappings"); ++ if (vmalloc_sync_mappings_sym) { ++ vmalloc_sync_mappings_sym(); ++ } else { ++#ifdef CONFIG_X86 ++ /* ++ * Only x86 needs vmalloc_sync_mappings to make sure LTTng does not ++ * trigger recursive page faults. ++ */ ++ printk_once(KERN_WARNING "LTTng: vmalloc_sync_mappings symbol lookup failed.\n"); ++ printk_once(KERN_WARNING "Page fault handler and NMI tracing might trigger faults.\n"); ++#endif ++ } ++} ++ ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++ ++/* ++ * Map vmalloc_sync_mappings to vmalloc_sync_all() on kernels before 5.7. ++ */ ++static inline ++void wrapper_vmalloc_sync_mappings(void) + { + void (*vmalloc_sync_all_sym)(void); + +@@ -53,13 +80,29 @@ void wrapper_vmalloc_sync_all(void) + #endif + } + } ++ ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++ + #else + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) ++ ++static inline ++void wrapper_vmalloc_sync_mappings(void) ++{ ++ return vmalloc_sync_mappings(); ++} ++ ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++ + static inline +-void wrapper_vmalloc_sync_all(void) ++void wrapper_vmalloc_sync_mappings(void) + { + return vmalloc_sync_all(); + } ++ ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++ + #endif + + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)) +@@ -74,7 +117,7 @@ void *lttng_kvmalloc_node(unsigned long + * Make sure we don't trigger recursive page faults in the + * tracing fast path. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + } + return ret; + } +Index: lttng-modules-2.10.8/probes/lttng-ftrace.c +=================================================================== +--- lttng-modules-2.10.8.orig/probes/lttng-ftrace.c ++++ lttng-modules-2.10.8/probes/lttng-ftrace.c +@@ -190,7 +190,7 @@ int lttng_ftrace_register(const char *na + goto name_error; + + /* Ensure the memory we just allocated don't trigger page faults */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + + ret = wrapper_register_ftrace_function_probe(event->u.ftrace.symbol_name, + <tng_ftrace_ops, event); +@@ -226,7 +226,7 @@ EXPORT_SYMBOL_GPL(lttng_ftrace_destroy_p + + int lttng_ftrace_init(void) + { +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + return 0; + } + module_init(lttng_ftrace_init) diff -Nru lttng-modules-2.10.8/debian/patches/compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch lttng-modules-2.10.8/debian/patches/compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch --- lttng-modules-2.10.8/debian/patches/compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch 1970-01-01 01:00:00.000000000 +0100 +++ lttng-modules-2.10.8/debian/patches/compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch 2020-05-19 16:53:23.000000000 +0200 @@ -0,0 +1,27 @@ +From f3e4ba5d199a809b8dcdf9718aae651734e1b20e Mon Sep 17 00:00:00 2001 +From: Michael Jeanson +Date: Wed, 6 May 2020 11:03:32 -0400 +Subject: [PATCH] Fix: missing wrapper rename to wrapper_vmalloc_sync_mappings + +Signed-off-by: Michael Jeanson +Signed-off-by: Mathieu Desnoyers +Change-Id: Idf7082a980c5a604bfef5c69906678b5083a9bbf +(cherry picked from commit f3e4ba5d199a809b8dcdf9718aae651734e1b20e lttng) +Signed-off-by: Stefan Bader +--- + wrapper/vmalloc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: lttng-modules-2.10.8/wrapper/vmalloc.h +=================================================================== +--- lttng-modules-2.10.8.orig/wrapper/vmalloc.h ++++ lttng-modules-2.10.8/wrapper/vmalloc.h +@@ -229,7 +229,7 @@ void *lttng_kvmalloc_node(unsigned long + * Make sure we don't trigger recursive page faults in the + * tracing fast path. + */ +- wrapper_vmalloc_sync_all(); ++ wrapper_vmalloc_sync_mappings(); + } + return ret; + } diff -Nru lttng-modules-2.10.8/debian/patches/compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch lttng-modules-2.10.8/debian/patches/compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch --- lttng-modules-2.10.8/debian/patches/compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch 1970-01-01 01:00:00.000000000 +0100 +++ lttng-modules-2.10.8/debian/patches/compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch 2020-05-19 16:53:29.000000000 +0200 @@ -0,0 +1,84 @@ +From 1d618748df5c107151e5d4580fad270ccb79a243 Mon Sep 17 00:00:00 2001 +From: Ovidiu Panait +Date: Thu, 14 May 2020 13:05:24 +0300 +Subject: [PATCH] Fix: Use vmalloc_sync_mappings on kernel 5.6 as well + +Upstream commit [1], that got rid of vmalloc_sync_all and introduced +vmalloc_sync_mappings, is a v5.6 commit: +$ git tag --contains 763802b53a427ed3cbd419dbba255c414fdd9e7c +v5.6 +v5.6-rc7 +v5.7-rc1 +v5.7-rc2 +v5.7-rc3 + +Extend the LINUX_VERSION_CODE check to v5.6 to fix the following warnings: +... +[ 483.242037] LTTng: vmalloc_sync_all symbol lookup failed. +[ 483.257056] Page fault handler and NMI tracing might trigger faults. +... + +[1] https://github.com/torvalds/linux/commit/763802b53a427ed3cbd419dbba255c414fdd9e7c + +Signed-off-by: Ovidiu Panait +Signed-off-by: Mathieu Desnoyers +(cherry picked from commit 1d618748df5c107151e5d4580fad270ccb79a243 lttng) +Signed-off-by: Stefan Bader +--- + wrapper/vmalloc.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +Index: lttng-modules-2.10.8/wrapper/vmalloc.h +=================================================================== +--- lttng-modules-2.10.8.orig/wrapper/vmalloc.h ++++ lttng-modules-2.10.8/wrapper/vmalloc.h +@@ -34,7 +34,7 @@ + #include + #include + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) + + static inline + void wrapper_vmalloc_sync_mappings(void) +@@ -56,7 +56,7 @@ void wrapper_vmalloc_sync_mappings(void) + } + } + +-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */ + + /* + * Map vmalloc_sync_mappings to vmalloc_sync_all() on kernels before 5.7. +@@ -81,11 +81,11 @@ void wrapper_vmalloc_sync_mappings(void) + } + } + +-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */ + + #else + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) + + static inline + void wrapper_vmalloc_sync_mappings(void) +@@ -93,7 +93,7 @@ void wrapper_vmalloc_sync_mappings(void) + return vmalloc_sync_mappings(); + } + +-#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */ + + static inline + void wrapper_vmalloc_sync_mappings(void) +@@ -101,7 +101,7 @@ void wrapper_vmalloc_sync_mappings(void) + return vmalloc_sync_all(); + } + +-#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)) */ ++#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) */ + + #endif + diff -Nru lttng-modules-2.10.8/debian/patches/compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch lttng-modules-2.10.8/debian/patches/compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch --- lttng-modules-2.10.8/debian/patches/compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch 1970-01-01 01:00:00.000000000 +0100 +++ lttng-modules-2.10.8/debian/patches/compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch 2020-05-19 16:53:32.000000000 +0200 @@ -0,0 +1,63 @@ +From 2b3dbafc429e1db16d1f3bc30b95b0bc92932d42 Mon Sep 17 00:00:00 2001 +From: Ovidiu Panait +Date: Thu, 14 May 2020 14:27:17 +0300 +Subject: [PATCH] Update: Use vmalloc_sync_mappings for stable kernels + +Starting from v5.4.28/v5.2.37/v4.19.113/v4.14.175/v4.9.218/v4.4.218, stable +kernel branches backported v5.6 upstream commit [1], causing the following +warnings: +... +[ 483.242037] LTTng: vmalloc_sync_all symbol lookup failed. +[ 483.257056] Page fault handler and NMI tracing might trigger faults. +... + +Extend check for vmalloc_sync_mappings for stable kernels as well. + +[1] https://github.com/torvalds/linux/commit/763802b53a427ed3cbd419dbba255c414fdd9e7c + +[ Edit: minor coding style fix by Mathieu Desnoyers. ] + +Signed-off-by: Ovidiu Panait +Signed-off-by: Mathieu Desnoyers +(cherry picked from commit 2b3dbafc429e1db16d1f3bc30b95b0bc92932d42 lttng) +Signed-off-by: Stefan Bader +--- + wrapper/vmalloc.h | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +Index: lttng-modules-2.10.8/wrapper/vmalloc.h +=================================================================== +--- lttng-modules-2.10.8.orig/wrapper/vmalloc.h ++++ lttng-modules-2.10.8/wrapper/vmalloc.h +@@ -33,8 +33,15 @@ + + #include + #include ++#include "lttng-kernel-version.h" + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) \ ++ || LTTNG_KERNEL_RANGE(5,4,28, 5,5,0) \ ++ || LTTNG_KERNEL_RANGE(5,2,37, 5,3,0) \ ++ || LTTNG_KERNEL_RANGE(4,19,113, 4,20,0) \ ++ || LTTNG_KERNEL_RANGE(4,14,175, 4,15,0) \ ++ || LTTNG_KERNEL_RANGE(4,9,218, 4,10,0) \ ++ || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) + + static inline + void wrapper_vmalloc_sync_mappings(void) +@@ -85,7 +92,13 @@ void wrapper_vmalloc_sync_mappings(void) + + #else + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) \ ++ || LTTNG_KERNEL_RANGE(5,4,28, 5,5,0) \ ++ || LTTNG_KERNEL_RANGE(5,2,37, 5,3,0) \ ++ || LTTNG_KERNEL_RANGE(4,19,113, 4,20,0) \ ++ || LTTNG_KERNEL_RANGE(4,14,175, 4,15,0) \ ++ || LTTNG_KERNEL_RANGE(4,9,218, 4,10,0) \ ++ || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) + + static inline + void wrapper_vmalloc_sync_mappings(void) diff -Nru lttng-modules-2.10.8/debian/patches/compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch lttng-modules-2.10.8/debian/patches/compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch --- lttng-modules-2.10.8/debian/patches/compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch 1970-01-01 01:00:00.000000000 +0100 +++ lttng-modules-2.10.8/debian/patches/compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch 2020-05-19 16:53:35.000000000 +0200 @@ -0,0 +1,36 @@ +Description: Add special Ubuntu releases for vmalloc_sync_mappings + For Ubuntu release which have their own stable support, the kernel version + ranges already set are not matching. For those, special version ranges are + required. +Author: Stefan Bader +Ubuntu-Bug: https://bugs.launchpad.net/ubuntu/+source/lttng-modules/+bug/1874521 +Last-Update: 2020-05-15 + +Index: lttng-modules-2.10.8/wrapper/vmalloc.h +=================================================================== +--- lttng-modules-2.10.8.orig/wrapper/vmalloc.h ++++ lttng-modules-2.10.8/wrapper/vmalloc.h +@@ -41,7 +41,10 @@ + || LTTNG_KERNEL_RANGE(4,19,113, 4,20,0) \ + || LTTNG_KERNEL_RANGE(4,14,175, 4,15,0) \ + || LTTNG_KERNEL_RANGE(4,9,218, 4,10,0) \ +- || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) ++ || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,97, 4,16,0,0) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(5,0,21,48, 5,1,0,0) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(5,3,18,52, 5,4,0,0) + + static inline + void wrapper_vmalloc_sync_mappings(void) +@@ -98,7 +101,10 @@ void wrapper_vmalloc_sync_mappings(void) + || LTTNG_KERNEL_RANGE(4,19,113, 4,20,0) \ + || LTTNG_KERNEL_RANGE(4,14,175, 4,15,0) \ + || LTTNG_KERNEL_RANGE(4,9,218, 4,10,0) \ +- || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) ++ || LTTNG_KERNEL_RANGE(4,4,218, 4,5,0)) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,97, 4,18,0,0) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(5,0,21,48, 5,1,0,0) \ ++ || LTTNG_UBUNTU_KERNEL_RANGE(5,3,18,52, 5,4,0,0) + + static inline + void wrapper_vmalloc_sync_mappings(void) diff -Nru lttng-modules-2.10.8/debian/patches/series lttng-modules-2.10.8/debian/patches/series --- lttng-modules-2.10.8/debian/patches/series 2019-05-31 23:13:39.000000000 +0200 +++ lttng-modules-2.10.8/debian/patches/series 2020-05-19 16:50:42.000000000 +0200 @@ -14,3 +14,8 @@ 0013-fix-mm-vmscan-simplify-trace_reclaim_flags-and-trace.patch 0014-fix-mm-move-recent_rotated-pages-calculation-to-shri.patch 0015-fix-random-only-read-from-dev-random-after-its-pool-.patch +compat-5.6/0001-Update-for-kernel-5.7-use-vmalloc_sync_mappings-on-k.patch +compat-5.6/0002-Fix-missing-wrapper-rename-to-wrapper_vmalloc_sync_m.patch +compat-5.6/0003-Fix-Use-vmalloc_sync_mappings-on-kernel-5.6-as-well.patch +compat-5.6/0004-Update-Use-vmalloc_sync_mappings-for-stable-kernels.patch +compat-5.6/0005-Update-Use-vmalloc_sync_mappings-for-ubuntu.patch