[Patch v3 07/13] x86/process Add arch_set_dumpable

From: Tim Chen
Date: Wed Oct 17 2018 - 14:33:49 EST


Add arch_set_dumpable for setting architecture specific security
modifications on processes according to its dumpable properties.
Non dumpable processes are security sensitive and they can be modified
to gain architecture specific security defenses via arch_set_dumpable.

Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
---
fs/exec.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/exec.c b/fs/exec.c
index e204830..6f329fc 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1940,6 +1940,11 @@ void set_binfmt(struct linux_binfmt *new)
}
EXPORT_SYMBOL(set_binfmt);

+void __weak arch_set_dumpable(struct task_struct *tsk, unsigned int value)
+{
+ return;
+}
+
/*
* set_dumpable stores three-value SUID_DUMP_* into mm->flags.
*/
@@ -1956,6 +1961,7 @@ void set_dumpable(struct task_struct *tsk, unsigned int value)
old = READ_ONCE(tsk->mm->flags);
new = (old & ~MMF_DUMPABLE_MASK) | value;
} while (cmpxchg(&tsk->mm->flags, old, new) != old);
+ arch_set_dumpable(tsk, value);
}

SYSCALL_DEFINE3(execve,
--
2.9.4