Messages in this thread | | | Date | Sat, 13 Dec 2014 07:50:53 -0800 | From | Dave Hansen <> | Subject | Re: [RFC][PATCH 0/8] x86, mpx: Support 32-bit binaries on 64-bit kernels |
| |
On 12/12/2014 05:45 PM, Andy Lutomirski wrote: > I was thinking of this: > > + if (is_64bit_mm(mm)) { > + vaddr_space_size = 1ULL << __VIRTUAL_MASK_SHIFT; > + bd_entry_virt_space = vaddr_space_size / MPX_BD_NR_ENTRIES_64; > + /* > + * __VIRTUAL_MASK takes the 64-bit addressing hole > + * in to accout. This is a noop on 32-bit. > + */ > + addr &= __VIRTUAL_MASK; > + return addr / bd_entry_virt_space; > + } else { > + vaddr_space_size = (1ULL << 32); > + bd_entry_virt_space = vaddr_space_size / MPX_BD_NR_ENTRIES_32; > + return addr / bd_entry_virt_space; > + } > > Is there a scenario in which the return value ends up being insanely > high? If so, does it matter?
Yes, it will be insanely high for a 32-bit process. The kernel could go looking for the bounds directory entry at some bonkers virtual address that makes no sense on 32-bit.
But, that bonkers address is still treated as coming from userspace. The kernel will go and dereference it via a get_user(), fault, notice the bad address and kill the process.
| |