Re: [RFC 2/4] lib/strncpy_from_user: Remove redundant user space pointer range check
From: Vineet Gupta
Date: Wed Jan 15 2020 - 18:00:25 EST
On 1/15/20 6:42 AM, Andrey Konovalov wrote:
>> - max_addr = user_addr_max();
>> - src_addr = (unsigned long)untagged_addr(src);
>
> If you end up changing this code, you need to keep the untagged_addr()
> logic, otherwise this breaks arm64 tagged address ABI [1].
It is moot point now, but fwiw untagged_addr() would not have been needed anymore
as it was only needed to compute the pointer difference which my patch got rid of.
>
> [1] https://www.kernel.org/doc/html/latest/arm64/tagged-address-abi.html
>
>> - if (likely(src_addr < max_addr)) {
>> - unsigned long max = max_addr - src_addr;
>> + kasan_check_write(dst, count);
>> + check_object_size(dst, count, false);
>> + if (user_access_begin(src, count)) {