[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdpPVKsirugMkmzo0b99RYJ9=AmVDa9WzNWzWHR4oMb=A@mail.gmail.com>
Date: Wed, 24 Jan 2018 17:53:21 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kees Cook <keescook@...omium.org>,
Eryu Guan <eguan@...hat.com>,
Alexander Potapenko <glider@...gle.com>,
Chris Metcalf <metcalf@...m.mit.edu>,
David Laight <David.Laight@...lab.com>,
Dmitry Vyukov <dvyukov@...gle.com>, stable@...r.kernel.org
Subject: Re: [PATCH] lib/strscpy: remove word-at-a-time optimization.
On Tue, Jan 9, 2018 at 6:37 PM, Andrey Ryabinin <aryabinin@...tuozzo.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-6d510a7b8ec4@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
Powered by blists - more mailing lists