L4android mlock on vectors page causes unresolvable page fault

Matthias Petschick matthias at sec.t-labs.tu-berlin.de
Mon Apr 8 01:50:50 CEST 2013


Hey,

On 04/08/2013 12:05 AM, Adam Lackorzynski wrote:
> Hi,
> 
> On Fri Apr 05, 2013 at 10:10:21 +0200, Matthias Petschick wrote:
>> while experimenting with lvm, I noticed that mlocking the vectors page
>> at 0xbffff000 from user space causes an unresolvable page fault (see
>> full trace below). In particular, the lvcreate process attempts to lock
>> its mapped memory regions when activating a volume, which includes the
>> vectors page.
> 
> Thanks for the report. I tried with the following:
> 
> #include <sys/mman.h>
> int main(void)
> {
>   mlockall(MCL_CURRENT);
>   return 0;
> }
> 
> at it just works for me. Does it also work in your setup?
> 

I can't test it right now but without looking too deep, I predict that
it will work because mlockall calls

do_mlock_pages(0, TASK_SIZE, 1);

and TASK_SIZE is 0xbfc00000 for arch/l4, hence the vectors page should
not be touched by it. Will nevertheless give it a shot tomorrow in case
I missed something.

However, for completeness sake I can confirm that

#include <sys/mman.h>
{
  int ret;
  ret = mlock((const void *)0xbffff000, 4096);
  return 0;
}

triggers the exception for me.

- Matthias




More information about the l4-hackers mailing list