RE: [PATCH v5 2/3] x86, mpx: hook #BR exception handler to allocate bound tables

2014-02-25 Thread Ren, Qiaowei
> -Original Message- > From: H. Peter Anvin [mailto:h...@zytor.com] > Sent: Tuesday, February 25, 2014 1:52 AM > To: Hansen, Dave; Ren, Qiaowei; Thomas Gleixner; Ingo Molnar > Cc: x...@kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v5 2/3] x86, mpx:

Re: [PATCH v5 2/3] x86, mpx: hook #BR exception handler to allocate bound tables

2014-02-24 Thread H. Peter Anvin
On 02/24/2014 09:27 AM, Dave Hansen wrote: > > Can you talk a little bit about what the design is here? Why does the > kernel have to do the allocation of the virtual address space? Does it > really need to MAP_POPULATE? bt_size looks like 4MB, and that's an > awful lot of memory to eat up at o

Re: [PATCH v5 2/3] x86, mpx: hook #BR exception handler to allocate bound tables

2014-02-24 Thread Dave Hansen
On 02/23/2014 05:27 AM, Qiaowei Ren wrote: > +static bool allocate_bt(unsigned long bd_entry) > +{ > + unsigned long bt_size = 1UL << (MPX_L2_BITS+MPX_L2_SHIFT); > + unsigned long bt_addr, old_val = 0; > + > + bt_addr = sys_mmap_pgoff(0, bt_size, PROT_READ | PROT_WRITE, > +

[PATCH v5 2/3] x86, mpx: hook #BR exception handler to allocate bound tables

2014-02-22 Thread Qiaowei Ren
An access to an invalid bound directory entry will cause a #BR exception. This patch hook #BR exception handler to allocate one bound table and bind it with that buond directory entry. This will avoid the need of forwarding the #BR exception to the user space when bound directory has invalid entry