Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread H. Peter Anvin
On 01/27/2014 01:54 PM, Andy Lutomirski wrote: > On 01/26/2014 06:10 PM, H. Peter Anvin wrote: >> On 01/26/2014 05:55 PM, Ren Qiaowei wrote: >>> >>> Peter, you mean we should remove these two call and do what they do in >>> user-space, right? >>> >> >> Unless we think there is a benefit to the

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread Andy Lutomirski
On 01/26/2014 06:10 PM, H. Peter Anvin wrote: > On 01/26/2014 05:55 PM, Ren Qiaowei wrote: >> >> Peter, you mean we should remove these two call and do what they do in >> user-space, right? >> > > Unless we think there is a benefit to the kernel to have a on/off switch > for the #BR exception (if

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread Andy Lutomirski
On 01/26/2014 01:08 AM, Qiaowei Ren wrote: > This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() > commands on the x86 platform. These commands can be used to > init and release MPX related resource. > > A MMU notifier will be registered during PR_MPX_INIT > command execution. So the bound

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread Andy Lutomirski
On 01/26/2014 01:08 AM, Qiaowei Ren wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() commands on the x86 platform. These commands can be used to init and release MPX related resource. A MMU notifier will be registered during PR_MPX_INIT command execution. So the bound

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread Andy Lutomirski
On 01/26/2014 06:10 PM, H. Peter Anvin wrote: On 01/26/2014 05:55 PM, Ren Qiaowei wrote: Peter, you mean we should remove these two call and do what they do in user-space, right? Unless we think there is a benefit to the kernel to have a on/off switch for the #BR exception (if disabled,

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-27 Thread H. Peter Anvin
On 01/27/2014 01:54 PM, Andy Lutomirski wrote: On 01/26/2014 06:10 PM, H. Peter Anvin wrote: On 01/26/2014 05:55 PM, Ren Qiaowei wrote: Peter, you mean we should remove these two call and do what they do in user-space, right? Unless we think there is a benefit to the kernel to have a

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/27/2014 10:10 AM, H. Peter Anvin wrote: On 01/26/2014 05:55 PM, Ren Qiaowei wrote: Peter, you mean we should remove these two call and do what they do in user-space, right? Unless we think there is a benefit to the kernel to have a on/off switch for the #BR exception (if disabled, all

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread H. Peter Anvin
On 01/26/2014 05:55 PM, Ren Qiaowei wrote: > > Peter, you mean we should remove these two call and do what they do in > user-space, right? > Unless we think there is a benefit to the kernel to have a on/off switch for the #BR exception (if disabled, all #BR exceptions are signals, regardless of

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/26/2014 11:14 PM, Ingo Molnar wrote: * Ren, Qiaowei wrote: The size of one bound table is 4M bytes for 64bit, and 16K bytes for 32bit. It can not be accessed by user-space, and it will be accessed automatically by hardware. So, here's the bound-table allocation AFAICS: +static bool

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/27/2014 09:50 AM, H. Peter Anvin wrote: On 01/26/2014 12:39 AM, Ingo Molnar wrote: It will be only once per startup. In that case it would be more efficient to make this part of the binary execution environment so that exec() sets it up automatically, not a separate prctl() syscall.

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread H. Peter Anvin
On 01/26/2014 12:39 AM, Ingo Molnar wrote: >> >> It will be only once per startup. > > In that case it would be more efficient to make this part of the > binary execution environment so that exec() sets it up automatically, > not a separate prctl() syscall. > This is not necessarily possible,

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Ren, Qiaowei wrote: > The size of one bound table is 4M bytes for 64bit, and 16K bytes for > 32bit. It can not be accessed by user-space, and it will be accessed > automatically by hardware. So, here's the bound-table allocation AFAICS: +static bool allocate_bt(unsigned long bd_entry) +{

RE: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren, Qiaowei
Peter Zijlstra; Linus Torvalds; Andrew Morton > Subject: Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, > PR_MPX_RELEASE > > > * Qiaowei Ren wrote: > > > @@ -7,6 +9,88 @@ > > #include > > #include > > > > +static struct m

RE: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren, Qiaowei
rg; > linux-kernel@vger.kernel.org; Peter Zijlstra > Subject: Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, > PR_MPX_RELEASE > > > * Ren Qiaowei wrote: > > > On 01/26/2014 04:22 PM, Ingo Molnar wrote: > > > > > >* Qiaowei Ren wrote: >

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Qiaowei Ren wrote: > @@ -7,6 +9,88 @@ > #include > #include > > +static struct mmu_notifier mpx_mn; > +static struct mmu_notifier_ops mpx_mmuops = { > + .invalidate_range_end = mpx_invl_range_end, > +}; > + > +int mpx_init(struct task_struct *tsk) > +{ > + if

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Ren Qiaowei wrote: > On 01/26/2014 04:22 PM, Ingo Molnar wrote: > > > >* Qiaowei Ren wrote: > > > >>This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() > >>commands on the x86 platform. These commands can be used to > >>init and release MPX related resource. > >> > >>A MMU notifier

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/26/2014 04:22 PM, Ingo Molnar wrote: * Qiaowei Ren wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() commands on the x86 platform. These commands can be used to init and release MPX related resource. A MMU notifier will be registered during PR_MPX_INIT command

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Qiaowei Ren wrote: > This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() > commands on the x86 platform. These commands can be used to > init and release MPX related resource. > > A MMU notifier will be registered during PR_MPX_INIT > command execution. So the bound tables can be

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Qiaowei Ren qiaowei@intel.com wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() commands on the x86 platform. These commands can be used to init and release MPX related resource. A MMU notifier will be registered during PR_MPX_INIT command execution. So the bound

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/26/2014 04:22 PM, Ingo Molnar wrote: * Qiaowei Ren qiaowei@intel.com wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() commands on the x86 platform. These commands can be used to init and release MPX related resource. A MMU notifier will be registered during

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Ren Qiaowei qiaowei@intel.com wrote: On 01/26/2014 04:22 PM, Ingo Molnar wrote: * Qiaowei Ren qiaowei@intel.com wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE prctl() commands on the x86 platform. These commands can be used to init and release MPX related resource.

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Qiaowei Ren qiaowei@intel.com wrote: @@ -7,6 +9,88 @@ #include asm/fpu-internal.h #include asm/alternative.h +static struct mmu_notifier mpx_mn; +static struct mmu_notifier_ops mpx_mmuops = { + .invalidate_range_end = mpx_invl_range_end, +}; + +int mpx_init(struct

RE: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren, Qiaowei
; Peter Zijlstra Subject: Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE * Ren Qiaowei qiaowei@intel.com wrote: On 01/26/2014 04:22 PM, Ingo Molnar wrote: * Qiaowei Ren qiaowei@intel.com wrote: This patch adds the PR_MPX_INIT and PR_MPX_RELEASE

RE: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren, Qiaowei
; Andrew Morton Subject: Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE * Qiaowei Ren qiaowei@intel.com wrote: @@ -7,6 +9,88 @@ #include asm/fpu-internal.h #include asm/alternative.h +static struct mmu_notifier mpx_mn; +static struct

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ingo Molnar
* Ren, Qiaowei qiaowei@intel.com wrote: The size of one bound table is 4M bytes for 64bit, and 16K bytes for 32bit. It can not be accessed by user-space, and it will be accessed automatically by hardware. So, here's the bound-table allocation AFAICS: +static bool allocate_bt(unsigned

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread H. Peter Anvin
On 01/26/2014 12:39 AM, Ingo Molnar wrote: It will be only once per startup. In that case it would be more efficient to make this part of the binary execution environment so that exec() sets it up automatically, not a separate prctl() syscall. This is not necessarily possible, and in

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/27/2014 09:50 AM, H. Peter Anvin wrote: On 01/26/2014 12:39 AM, Ingo Molnar wrote: It will be only once per startup. In that case it would be more efficient to make this part of the binary execution environment so that exec() sets it up automatically, not a separate prctl() syscall.

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/26/2014 11:14 PM, Ingo Molnar wrote: * Ren, Qiaowei qiaowei@intel.com wrote: The size of one bound table is 4M bytes for 64bit, and 16K bytes for 32bit. It can not be accessed by user-space, and it will be accessed automatically by hardware. So, here's the bound-table allocation

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread H. Peter Anvin
On 01/26/2014 05:55 PM, Ren Qiaowei wrote: Peter, you mean we should remove these two call and do what they do in user-space, right? Unless we think there is a benefit to the kernel to have a on/off switch for the #BR exception (if disabled, all #BR exceptions are signals, regardless of

Re: [PATCH v3 3/4] x86, mpx: add prctl commands PR_MPX_INIT, PR_MPX_RELEASE

2014-01-26 Thread Ren Qiaowei
On 01/27/2014 10:10 AM, H. Peter Anvin wrote: On 01/26/2014 05:55 PM, Ren Qiaowei wrote: Peter, you mean we should remove these two call and do what they do in user-space, right? Unless we think there is a benefit to the kernel to have a on/off switch for the #BR exception (if disabled, all