Re: [PATCH v5 32/38] kmsan: disable strscpy() optimization under KMSAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> Instead of disabling the optimization, can't you make KMSAN aware of the
> "has_zero()" call (which I believe is the part that will trip up KMSAN) and
> just not report it?
>
> -- Steve

I don't think this is the right thing to do.
If we read a short string - e.g. only 4 bytes long, using
read_word_at_a_time(), we'll also read uninitialized bytes after the
trailing zero, which will lead to false positives we're trying to
avoid.
But if there's no trailing zero, or if the first 4 bytes are
uninitialized as well, we want to catch that, so we must not ignore
functions that operate on those bytes.
We could theoretically make read_word_at_a_time() mask out the bytes
past the trailing zero in KMSAN mode, but IIUC that function may read
binary data as well.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux