Re: [PATCH] kasan: support use-after-scope detection

From: Andrew Morton
Date: Tue Nov 15 2016 - 18:40:14 EST


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?