Re: [PATCH] x86/process: Silence KASAN warnings in get_wchan()
From: Andrey Ryabinin
Date: Tue Oct 06 2015 - 03:38:39 EST
On 10/06/2015 10:26 AM, Ingo Molnar wrote:
>
> * Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> wrote:
>
>> On 10/05/2015 07:39 PM, Andi Kleen wrote:
>>>> But, I think I have the solution.
>>>> We could have some blacklist - list of function names which we should be ignored.
>>>> In kasan_report() we could resolve return address to function name and compare it with name in list.
>>>> If name in list -> ignore report.
>>>
>>> I think annotating statements is cleaner than functions, even if it
>>> is more code. Much better documentation
>>>
>>
>> I agree with that, that's why I suggested to add READ_ONCE_NOCHECK():
>> READ_ONCE_NOCHECK()
>> {
>> kasan_disable_current();
>> READ_ONCE();
>> kasan_enable_current();
>> }
>>
>> Anywone objects?
>
> Sounds good to me! As long as it's hidden from plain .c files I'm a happy camper.
>
> This should probably also be faster for KASAN than triggering a warning and having
> to parse a blacklist, right?
>
Sure.
>>> If disabling with an attribute doesn't work, you could put it into a special
>>> section with __attribute__((section ...)) and check the start/end symbol
>>> before reporting. That's how kprobes solves similar issues. It also has the
>>> advantage that it stops inlining.
>>
>> Yes, it might be better. Although, because of broken -fconserve-stack, this may
>> not work in some cases - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
>> Function splitter may split original function into two parts and it always puts
>> one split part in default .text section.
>
> We do a _ton_ of such section tricks in the kernel (all of exception handling is
> based on that) - if that's broken by -fconserve-stack then the kernel is broken
> much more widely.
>
I'm mistaken here. It was broken once, at some point of development of gcc 5, but this was fixed
eventually. I just checked gcc 5.2, 4.9.2, 4.8.4, all of them are ok.
> So unless KASAN wants to do something special here you can rely on sections just
> fine.
>
> Thanks,
>
> Ingo
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/