On Mon, 27 Oct 2014, Ren Qiaowei wrote:
If so, I guess that there are some questions needed to be considered:
1) Almost all palces which call do_munmap() will need to add
mpx_pre_unmap/post_unmap calls, like vm_munmap(), mremap(), shmdt(), etc..
What's the problem with that?
2) before mpx_post_unmap() call, it is possible for those bounds tables within
mm->bd_remove_vmas to be re-used.
In this case, userspace may do new mapping and access one address which will
cover one of those bounds tables. During this period, HW will check if one
bounds table exist, if yes one fault won't be produced.
Errm. Before user space can use the bounds table for the new mapping
it needs to add the entries, right? So:
CPU 0 CPU 1
down_write(mm->bd_sem);
mpx_pre_unmap();
clear bounds directory entries
unmap();
map()
write_bounds_entry()
trap()
down_read(mm->bd_sem);
mpx_post_unmap();
up_write(mm->bd_sem);
allocate_bounds_table();
That's the whole point of bd_sem.
3) According to Dave, those bounds tables related to adjacent VMAs within the
start and the end possibly don't have to be fully unmmaped, and we only need
free the part of backing physical memory.
Care to explain why that's a problem?