untagged_addr_remote() in do_madvise()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I noticed that mm/madivse.c:do_madvise() calls untagged_addr_remote()
after validating start.

Looking through git blame shows that this line was moved in
428e106ae1ad4 ("mm: Introduce untagged_addr_remote()") [1], with the
reason being:

    The new helper untagged_addr_remote() has to be used when the address
    targets remote process. It requires the mmap lock for target mm to be
    taken.

Although this may be needed, we cannot move the untagging below
validating the start/end because we have not validated the start/end
that will be used for the operation, or at least, isn't clear why it's
okay?

Can anyone tell me why the code today is correct?  That is, how can we
trust the validation of start/end is still okay after we change the
start/end by untagging the start?

I think we have to move the locking and the untagging above the
validation for this to work as expected?

[1] https://lore.kernel.org/all/20230312112612.31869-6-kirill.shutemov@xxxxxxxxxxxxxxx/

Thanks,
Liam




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux