Re: [PATCH] kasan: support use-after-scope detection
From: Dmitry Vyukov
Date: Wed Nov 16 2016 - 02:24:15 EST
On Wed, Nov 16, 2016 at 12:40 AM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 15 Nov 2016 17:07:25 +0100 Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
>
>> Gcc revision 241896 implements use-after-scope detection.
>> Will be available in gcc 7. Support it in KASAN.
>>
>> Gcc emits 2 new callbacks to poison/unpoison large stack
>> objects when they go in/out of scope.
>> Implement the callbacks and add a test.
>>
>> ...
>>
>> --- a/lib/test_kasan.c
>> +++ b/lib/test_kasan.c
>> @@ -411,6 +411,29 @@ static noinline void __init copy_user_test(void)
>> kfree(kmem);
>> }
>>
>> +static noinline void __init use_after_scope_test(void)
>
> This reader has no idea why this code uses noinline, and I expect
> others will have the same issue.
>
> Can we please get a code comment in there to reveal the reason?
Mailed v2 with a comment re noinline.
Taking the opportunity also fixed a type in the new comment:
- /* Emitted by compiler to unpoison large objects when they go into
of scope. */
+ /* Emitted by compiler to unpoison large objects when they go into scope. */