On Mon, Mar 04, 2024 at 08:31:56PM +0800, Miaohe Lin wrote: > On 2024/3/1 5:20, Matthew Wilcox (Oracle) wrote: > > The only user of this function calls page_address_in_vma() immediately > > after page_mapped_in_vma() calculates it and uses it to return true/false. > > Return the address instead, allowing memory-failure to skip the call > > to page_address_in_vma(). > > IIUC, this patch will change the semantic slightly. There is one corner > case where page_mapped_in_vma() returns true but page_address_in_vma() > returns -EFAULT if mremap is done after the check. In that case, > SIGKILL will be sent to the user. But with this patch applied, SIGBUS > will be sent to the user with address before doing mremap. Or am I > miss something? Isn't that an example of a race that userspace can't possibly rely on? It can't observe where the kernel has got to in its processing of the fault, so it's OK if we behave if the mremap() has happened before, during or after the two calls.