On Tue, Jan 9, 2018 at 6:37 PM, Andrey Ryabinin <aryabi...@virtuozzo.com> wrote:
> strscpy() performs the word-at-a-time optimistic reads. So it may
> may access the memory past the end of the object, which is perfectly fine
> since strscpy() doesn't use that (past-the-end) data and makes sure the
> optimistic read won't cross a page boundary.
>
> But KASAN doesn't know anything about that so it will complain.
> There are several possible ways to address this issue, but none
> are perfect. See 
> https://lkml.kernel.org/r/9f0a9cf6-51f7-cd1f-5dc6-6d510a7b8...@virtuozzo.com
>
> It seems the best solution is to simply disable word-at-a-time
> optimization. My trivial testing shows that byte-at-a-time
> could be up to x4.3 times slower than word-at-a-time.
> It may seems like a lot, but it's actually ~1.2e-10 sec per symbol vs
> ~4.8e-10 sec per symbol on modern hardware. And we don't use strscpy()
> in a performance critical paths to copy large amounts of data,
> so it shouldn't matter anyway.

What prevents you to revert the patch? After this one the all
advantages of the function becomes useless AFAIU.

-- 
With Best Regards,
Andy Shevchenko

Reply via email to