diff options
author | Alexander Aksenov <a.aksenov@samsung.com> | 2015-11-16 17:26:17 +0300 |
---|---|---|
committer | Alexander Aksenov <a.aksenov@samsung.com> | 2015-11-19 14:29:45 +0300 |
commit | 2dacb37ed05d193802e0384df9235dcef59f15a9 (patch) | |
tree | b31a67f5ef10b7ab9813df487821d60cf991bb98 | |
parent | b02ca12b61c44310b75ac643f290c75bf8fd8936 (diff) | |
download | swap-modules-2dacb37ed05d193802e0384df9235dcef59f15a9.tar.gz swap-modules-2dacb37ed05d193802e0384df9235dcef59f15a9.tar.bz2 swap-modules-2dacb37ed05d193802e0384df9235dcef59f15a9.zip |
[FIX] Kprobe: new task_data
Issue:
- Modules aren't built for kernels older than 3.1, cause
there is no jobctl in task_struct.
- Old task_data module mention remained in spec file
Solution:
- Make jobctl using version-dependent
- Remove remained task_data module from spec
Change-Id: Ie7ae6fc2dc38b221c3780846d1c1ca9fd163efaa
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
-rw-r--r-- | kprobe/swap_kprobes_deps.h | 8 | ||||
-rw-r--r-- | kprobe/swap_ktd.c | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/kprobe/swap_kprobes_deps.h b/kprobe/swap_kprobes_deps.h index 2a4bc692..e555ecb0 100644 --- a/kprobe/swap_kprobes_deps.h +++ b/kprobe/swap_kprobes_deps.h @@ -89,6 +89,14 @@ do { \ #endif /* !(defined(MODULE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 1, 0) + #define task_job(task) (task->jobctl) +#else /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 1, 0) */ + #define task_job(task) (task->group_stop) +#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 1, 0) */ + + + /* --------------------- Declaration of module dependencies ----------------- */ #define DECLARE_MOD_FUNC_DEP(name, ret, ...) ret(*__ref_##name)(__VA_ARGS__) diff --git a/kprobe/swap_ktd.c b/kprobe/swap_ktd.c index 79d1ef02..2eb333f6 100644 --- a/kprobe/swap_ktd.c +++ b/kprobe/swap_ktd.c @@ -25,6 +25,7 @@ #include <linux/module.h> #include <linux/spinlock.h> #include <kprobe/swap_kprobes.h> +#include <kprobe/swap_kprobes_deps.h> #include <ksyms/ksyms.h> #include "swap_ktd.h" #include "swap_td_raw.h" @@ -110,13 +111,13 @@ static void ktd_exit_all(struct td *td, struct task_struct *task) static bool task_prepare_is(struct task_struct *task) { - return !!(task->jobctl & kTD_JOBCTL_PREPARE); + return !!(task_job(task) & kTD_JOBCTL_PREPARE); } static void task_prepare_set(struct task_struct *task) { - if (!(task->jobctl & kTD_JOBCTL_PREPARE)) - task->jobctl |= kTD_JOBCTL_PREPARE; + if (!(task_job(task) & kTD_JOBCTL_PREPARE)) + task_job(task) |= kTD_JOBCTL_PREPARE; else WARN(1, KTD_PREFIX "already prepare"); @@ -125,8 +126,8 @@ static void task_prepare_set(struct task_struct *task) static void task_prepare_clear(struct task_struct *task) { - if (task->jobctl & kTD_JOBCTL_PREPARE) - task->jobctl &= ~kTD_JOBCTL_PREPARE; + if (task_job(task) & kTD_JOBCTL_PREPARE) + task_job(task) &= ~kTD_JOBCTL_PREPARE; else WARN(1, KTD_PREFIX "is not prepare"); |