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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/