Re: [v2] fs/proc/task_mmu: Implement IOCTL for efficient page table scanning

From: Muhammad Usama Anjum
Date: Tue Jul 25 2023 - 03:27:31 EST


On 7/24/23 9:10 PM, Michał Mirosław wrote:
[...]>>>> @@ -2219,22 +2225,24 @@ static int pagemap_scan_get_args(struct
pm_scan_arg
>>>> *arg,
>>>> arg->category_anyof_mask | arg->return_mask) & ~PM_SCAN_CATEGORIES)
>>>> return -EINVAL;
>>>>
>>>> - start = untagged_addr((unsigned long)arg->start);
>>>> - end = untagged_addr((unsigned long)arg->end);
>>>> - vec = untagged_addr((unsigned long)arg->vec);
>>>> + arg->start = untagged_addr((unsigned long)arg->start);
>>>> + arg->end = untagged_addr((unsigned long)arg->end);
>>>> + arg->vec = untagged_addr((unsigned long)arg->vec);
>>>
>>> BTW, We should we keep the tag in args writeback().
>> Sorry what?
>> After this function, the start, end and vec would be used. We need to make
>> sure that the address are untagged before that.
>
> We do write back the address the walk ended at to arg->start in
> userspace. This pointer I think needs the tag reconstructed so that
> retrying the ioctl() will be possible.
Even if we reconstruct the tag for end and vec, We need to update the start
address. Can we just put same tag as original start in it? I'm not sure.

--
BR,
Muhammad Usama Anjum