Re: BUG: KASAN: global-out-of-bounds in strscpy+0x807/0x970

From: Kees Cook
Date: Wed Oct 11 2017 - 03:21:55 EST


On Tue, Oct 10, 2017 at 9:37 PM, Tyler Hicks <tyhicks@xxxxxxxxxxxxx> wrote:
> On 10/10/2017 10:32 PM, Simon Brewer wrote:
>> Hint start looking at this thread. https://lkml.org/lkml/2017/7/18/874
>>
>> Summary: strscpy and KASAN are currently incompatible. strscpy does a
>> 64 bit speculative fetch on a char pointer (for efficiency reasons).
>> KASAN spots this and flags an error.
>
> Thanks, Simon. I had already reviewed the loop in
> seccomp_names_from_actions_logged() and couldn't spot an issue so my
> next step was to take a look at strscpy() itself. Your reply was well
> timed. :)
>
> @Kees, this is a false positive. I picked strscpy() because of its sane
> return codes for easy error handling but its word-at-a-time complexity
> is overkill for this sysctl. Are you alright with this KASAN false
> positive or would you like me to change over to strlcpy()?

I tend to prefer strscpy. I don't think we need a change here. Thanks!

-Kees

--
Kees Cook
Pixel Security