From 754728ab4f1008f554a393055c16f3dade93fb4e Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 14 Oct 2019 22:42:47 +0200 Subject: kernels: marlin: hack around unexported tvec_base_deferrable Qualcomm made wild changes to the timers in 50f9e740, but in the process they forgot to EXPORT_SYMBOL(tvec_base_deferrable). So, we claw it back the ugly way. --- kernels/marlin/do.bash | 4 ++++ kernels/marlin/tvec_base_deferrable-hack.patch | 31 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 kernels/marlin/do.bash create mode 100644 kernels/marlin/tvec_base_deferrable-hack.patch diff --git a/kernels/marlin/do.bash b/kernels/marlin/do.bash new file mode 100644 index 0000000..b568033 --- /dev/null +++ b/kernels/marlin/do.bash @@ -0,0 +1,4 @@ +#!/bin/bash +set -ex +BASE="$(readlink -f "$(dirname "$(readlink -f "$0")")")" +patch -d WireGuard -p1 < "$BASE/tvec_base_deferrable-hack.patch" diff --git a/kernels/marlin/tvec_base_deferrable-hack.patch b/kernels/marlin/tvec_base_deferrable-hack.patch new file mode 100644 index 0000000..1eef1db --- /dev/null +++ b/kernels/marlin/tvec_base_deferrable-hack.patch @@ -0,0 +1,31 @@ +diff --git a/src/ratelimiter.c b/src/ratelimiter.c +index e33ec72a..27a34071 100644 +--- a/src/ratelimiter.c ++++ b/src/ratelimiter.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + + static struct kmem_cache *entry_cache; +@@ -29,6 +30,7 @@ static u64 init_refcnt; /* Protected by init_lock, hence not atomic. */ + static atomic_t total_entries = ATOMIC_INIT(0); + static unsigned int max_entries, table_size; + static void wg_ratelimiter_gc_entries(struct work_struct *); ++struct tvec_base { char herp_derp; } tvec_base_deferrable; + static DECLARE_DEFERRABLE_WORK(gc_work, wg_ratelimiter_gc_entries); + static struct hlist_head *table_v4; + #if IS_ENABLED(CONFIG_IPV6) +@@ -216,6 +218,10 @@ err: + + void wg_ratelimiter_uninit(void) + { ++ struct timer_list dummy_timer; ++ setup_deferrable_timer_on_stack(&dummy_timer, NULL, 0); ++ gc_work.timer.base = dummy_timer.base; ++ + mutex_lock(&init_lock); + if (!init_refcnt || --init_refcnt) + goto out; -- cgit v1.2.3-59-g8ed1b