[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFy-fxPm18RqtwpCJrWX0YvaQeT8HfcKNpF3qC+cxE8fqw@mail.gmail.com>
Date: Tue, 18 Jul 2017 13:26:17 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andrey Ryabinin <aryabinin@...tuozzo.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Dave Jones <davej@...emonkey.org.uk>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>, kasan-dev@...glegroups.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lib/strscpy: avoid KASAN false positive
On Tue, Jul 18, 2017 at 1:15 PM, Andrey Ryabinin
<aryabinin@...tuozzo.com> wrote:
>
> No, it does warn about valid users. The report that Dave posted wasn't about wrong strscpy() usage
> it was about reading 8-bytes from 5-bytes source string. It wasn't about buggy 'count' at all.
> So KASAN will warn for perfectly valid code like this:
> char dest[16];
> strscpy(dest, "12345", sizeof(dest)):
Ugh, ok, yes.
> For strscpy() that would mean making the *whole* read from 'src' buffer unchecked by KASAN.
So we do have that READ_ONCE_NOCHECK(), but could we perhaps have
something that doesn't do a NOCHECK but a partial check and is simply
ok with "this is an optimistc longer access"
We have that for the dcache case too, although there the code does
that odd kasan_unpoison_shadow() instead.
Linus
Powered by blists - more mailing lists