--- /dev/null
+From 726d66d3aac4953081a51af1bac9df3682bc1e42 Mon Sep 17 00:00:00 2001
+From: Your Name <your@email.com>
+Date: Thu, 5 Oct 2017 09:43:52 +0300
+Subject: [PATCH 5/9] SWAP-DA(arm64): add CONFIG_SWAP_HOOK_USAUX
+
+---
+ arch/arm64/mm/fault.c | 5 ++++-
+ fs/exec.c | 3 +++
+ include/swap/hook_usaux.h | 38 ++++++++++++++++++++++++++++++++++++++
+ kernel/fork.c | 6 ++++++
+ mm/mmap.c | 9 ++++++++-
+ 5 files changed, 59 insertions(+), 2 deletions(-)
+ create mode 100644 include/swap/hook_usaux.h
+
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
+index 6094c64..74bc366 100644
+--- a/arch/arm64/mm/fault.c
++++ b/arch/arm64/mm/fault.c
+@@ -24,6 +24,7 @@
+ #include <linux/hardirq.h>
+ #include <linux/init.h>
+ #include <linux/kprobes.h>
++#include <swap/hook_usaux.h>
+ #include <linux/uaccess.h>
+ #include <linux/page-flags.h>
+ #include <linux/sched.h>
+@@ -290,8 +291,10 @@ retry:
+ * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
+ */
+ if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP |
+- VM_FAULT_BADACCESS))))
++ VM_FAULT_BADACCESS)))) {
++ swap_usaux_page_fault(addr);
+ return 0;
++ }
+
+ /*
+ * If we are in kernel mode at this point, we have no context to
+diff --git a/fs/exec.c b/fs/exec.c
+index 2e83209..6aa8b24 100644
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -44,6 +44,7 @@
+ #include <linux/module.h>
+ #include <linux/namei.h>
+ #include <linux/mount.h>
++#include <swap/hook_usaux.h>
+ #include <linux/security.h>
+ #include <linux/syscalls.h>
+ #include <linux/tsacct_kern.h>
+@@ -979,6 +980,7 @@ static int de_thread(struct task_struct *tsk)
+ write_unlock_irq(&tasklist_lock);
+ threadgroup_change_end(tsk);
+
++ swap_usaux_change_leader(leader, tsk);
+ release_task(leader);
+ }
+
+@@ -1049,6 +1051,7 @@ void __set_task_comm(struct task_struct *tsk, const char *buf, bool exec)
+ strlcpy(tsk->comm, buf, sizeof(tsk->comm));
+ task_unlock(tsk);
+ perf_event_comm(tsk, exec);
++ swap_usaux_set_comm(tsk);
+ }
+
+ int flush_old_exec(struct linux_binprm * bprm)
+diff --git a/include/swap/hook_usaux.h b/include/swap/hook_usaux.h
+new file mode 100644
+index 0000000..f6a2ef6
+--- /dev/null
++++ b/include/swap/hook_usaux.h
+@@ -0,0 +1,38 @@
++#ifndef _LINUX_SWAP_HOOK_USAUX_H
++#define _LINUX_SWAP_HOOK_USAUX_H
++
++
++static inline void swap_usaux_page_fault(unsigned long addr)
++{
++}
++
++static inline void swap_usaux_copy_process_pre(void)
++{
++}
++
++static inline void swap_usaux_copy_process_post(struct task_struct *task)
++{
++}
++
++static inline void swap_usaux_mm_release(struct task_struct *task)
++{
++}
++
++static inline void swap_usaux_munmap(unsigned long start, unsigned long end)
++{
++}
++
++static inline void swap_usaux_mmap(struct file *file, unsigned long addr)
++{
++}
++
++static inline void swap_usaux_set_comm(struct task_struct *task)
++{
++}
++
++static inline void swap_usaux_change_leader(struct task_struct *prev,
++ struct task_struct *next)
++{
++}
++
++#endif /* _LINUX_SWAP_HOOK_USAUX_H */
+diff --git a/kernel/fork.c b/kernel/fork.c
+index 6ee449f..16c640a 100644
+--- a/kernel/fork.c
++++ b/kernel/fork.c
+@@ -60,6 +60,7 @@
+ #include <linux/freezer.h>
+ #include <swap/hook_syscall_priv.h>
+ #include <swap/hook_taskdata.h>
++#include <swap/hook_usaux.h>
+ #include <linux/delayacct.h>
+ #include <linux/taskstats_kern.h>
+ #include <linux/random.h>
+@@ -811,6 +812,8 @@ static int wait_for_vfork_done(struct task_struct *child,
+ */
+ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
+ {
++ swap_usaux_mm_release(tsk);
++
+ /* Get rid of any futexes when releasing the mm */
+ #ifdef CONFIG_FUTEX
+ if (unlikely(tsk->robust_list)) {
+@@ -1669,8 +1672,11 @@ long do_fork(unsigned long clone_flags,
+ trace = 0;
+ }
+
++ swap_usaux_copy_process_pre();
+ p = copy_process(clone_flags, stack_start, stack_size,
+ child_tidptr, NULL, trace);
++ swap_usaux_copy_process_post(p);
++
+ /*
+ * Do this prior waking up the new thread - the thread pointer
+ * might get invalid after that point, if the thread exits quickly.
+diff --git a/mm/mmap.c b/mm/mmap.c
+index f73ff5b..6a9f9c1 100644
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -20,6 +20,7 @@
+ #include <linux/syscalls.h>
+ #include <linux/capability.h>
+ #include <linux/init.h>
++#include <swap/hook_usaux.h>
+ #include <linux/file.h>
+ #include <linux/fs.h>
+ #include <linux/personality.h>
+@@ -1306,8 +1307,10 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+ * that it represents a valid section of the address space.
+ */
+ addr = get_unmapped_area(file, addr, len, pgoff, flags);
+- if (addr & ~PAGE_MASK)
++ if (addr & ~PAGE_MASK) {
++ swap_usaux_mmap(file, addr);
+ return addr;
++ }
+
+ /* Do simple checking here so the lower-level routines won't have
+ * to. we assume access permissions have been handled by the open
+@@ -1408,6 +1411,8 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
+ ((vm_flags & VM_LOCKED) ||
+ (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE))
+ *populate = len;
++
++ swap_usaux_mmap(file, addr);
+ return addr;
+ }
+
+@@ -2614,6 +2619,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
+ /* Fix up all other VM information */
+ remove_vma_list(mm, vma);
+
++ swap_usaux_munmap(start, end);
++
+ return 0;
+ }
+
+--
+2.1.4
+