Re: [PATCH v4] x86/fsgsbase/64: Fix the base write helper functions

From: Bae, Chang Seok
Date: Fri Nov 16 2018 - 18:27:35 EST


> On Nov 14, 2018, at 13:46, Bae, Chang Seok <chang.seok.bae@xxxxxxxxx> wrote:
>
> int copy_thread_tls(unsigned long clone_flags, unsigned long sp,
> @@ -758,11 +720,45 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
>
> switch (option) {
> case ARCH_SET_GS: {
> - ret = x86_gsbase_write_task(task, arg2);
> + preempt_disable();
> + if (unlikely(arg2 >= TASK_SIZE_MAX))
> + return -EPERM;

Sorry, preempt_disabled() should go after this.
Chang