lkml.org 
[lkml]   [2014]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 08/10] x86, mpx: add prctl commands PR_MPX_REGISTER, PR_MPX_UNREGISTER
> The base of the bounds directory is set into mm_struct during
> PR_MPX_REGISTER command execution. This member can be used to
> check whether one application is mpx enabled.

Not really because by the time you ask the question another thread might
have decided to unregister it.


> +int mpx_register(struct task_struct *tsk)
> +{
> + struct mm_struct *mm = tsk->mm;
> +
> + if (!cpu_has_mpx)
> + return -EINVAL;
> +
> + /*
> + * runtime in the userspace will be responsible for allocation of
> + * the bounds directory. Then, it will save the base of the bounds
> + * directory into XSAVE/XRSTOR Save Area and enable MPX through
> + * XRSTOR instruction.
> + *
> + * fpu_xsave() is expected to be very expensive. In order to do
> + * performance optimization, here we get the base of the bounds
> + * directory and then save it into mm_struct to be used in future.
> + */
> + mm->bd_addr = task_get_bounds_dir(tsk);
> + if (!mm->bd_addr)
> + return -EINVAL;

What stops two threads calling this in parallel ?
> +
> + return 0;
> +}
> +
> +int mpx_unregister(struct task_struct *tsk)
> +{
> + struct mm_struct *mm = current->mm;
> +
> + if (!cpu_has_mpx)
> + return -EINVAL;
> +
> + mm->bd_addr = NULL;

or indeed calling this in parallel

What are the semantics across execve() ?

Alan


\
 
 \ /
  Last update: 2014-09-15 02:41    [W:0.292 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site