Re: [PATCH v7 07/14] x86/cet/ibt: Add arch_prctl functions for IBT

From: Peter Zijlstra
Date: Fri Jun 07 2019 - 04:12:02 EST


On Thu, Jun 06, 2019 at 01:09:19PM -0700, Yu-cheng Yu wrote:

> +static int handle_bitmap(unsigned long arg2)
> +{
> + unsigned long addr, size;
> +
> + if (get_user(addr, (unsigned long __user *)arg2) ||
> + get_user(size, (unsigned long __user *)arg2 + 1))
> + return -EFAULT;
> +
> + return cet_setup_ibt_bitmap(addr, size);
> +}


> + /*
> + * Allocate legacy bitmap and return address & size to user.
> + */
> + case ARCH_X86_CET_SET_LEGACY_BITMAP:
> + return handle_bitmap(arg2);

AFAICT it does exactly the opposite of that comment; it gets the address
and size from userspace and doesn't allocate anything at all.