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

From: Thomas Gleixner
Date: Thu Oct 18 2018 - 09:28:27 EST


On Wed, 17 Oct 2018, Tim Chen wrote:

> 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.

You love that sentence, right? But it's still wrong.

arch_set_dumpable() does arch specific extra modifications depending on
'value'. It's not a one way street. It can tighten or relax.

> Signed-off-by: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
> ---
> fs/exec.c | 6 ++++++

And this is related to the subsystem in $subject (x86/process) in which way?

> 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);

So now the obvious question. set_dumpable() operates on tsk->mm. i.e. it's
a process wide operation. But arch_set_dumpable() operates on the task
itself. What about the other tasks of that process?

Thanks,

tglx