Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1690639

Re: [PATCH] lib/strscpy: avoid KASAN false positive

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] lib/strscpy: avoid KASAN false positive
Date 2017-07-18 22:30 +0200
Message-ID <u4Hi2-71I-21@gated-at.bofh.it> (permalink)
References <u4Ekb-5e8-33@gated-at.bofh.it> <u4EtQ-5hK-19@gated-at.bofh.it> <u4Hi2-71I-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 18, 2017 at 1:15 PM, Andrey Ryabinin
<aryabinin@virtuozzo.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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] lib/strscpy: avoid KASAN false positive Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-18 19:30 +0200
  Re: [PATCH] lib/strscpy: avoid KASAN false positive Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-18 22:30 +0200
    Re: [PATCH] lib/strscpy: avoid KASAN false positive Andrew Morton <akpm@linux-foundation.org> - 2017-07-19 00:10 +0200
      Re: [PATCH] lib/strscpy: avoid KASAN false positive Linus Torvalds <torvalds@linux-foundation.org> - 2017-07-19 00:40 +0200
        Re: [PATCH] lib/strscpy: avoid KASAN false positive Dmitry Vyukov <dvyukov@google.com> - 2017-07-19 09:50 +0200
      Re: [PATCH] lib/strscpy: avoid KASAN false positive Dave Jones <davej@codemonkey.org.uk> - 2017-07-19 18:10 +0200
        Re: [PATCH] lib/strscpy: avoid KASAN false positive Dmitry Vyukov <dvyukov@google.com> - 2017-07-26 14:10 +0200

csiph-web