[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eb96f240-63ba-c1b1-7696-07ace3ffe13b@infradead.org>
Date: Thu, 5 Mar 2020 09:04:07 -0800
From: Randy Dunlap <rdunlap@...radead.org>
To: Peter Zijlstra <peterz@...radead.org>,
Walter Wu <walter-zh.wu@...iatek.com>
Cc: akpm@...ux-foundation.org, broonie@...nel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-next@...r.kernel.org, mhocko@...e.cz,
mm-commits@...r.kernel.org, sfr@...b.auug.org.au,
Josh Poimboeuf <jpoimboe@...hat.com>, dvyukov@...gle.com
Subject: Re: mmotm 2020-03-03-22-28 uploaded (warning: objtool:)
On 3/5/20 1:54 AM, Peter Zijlstra wrote:
> On Thu, Mar 05, 2020 at 05:16:22PM +0800, Walter Wu wrote:
>> On Thu, 2020-03-05 at 09:18 +0100, Peter Zijlstra wrote:
>>> On Thu, Mar 05, 2020 at 09:17:17AM +0100, Peter Zijlstra wrote:
>>>> On Wed, Mar 04, 2020 at 09:34:49AM -0800, Randy Dunlap wrote:
>>>
>>>>> mm/kasan/common.o: warning: objtool: kasan_report()+0x13: call to report_enabled() with UACCESS enabled
>>>>
>>>> I used next/master instead, and found the below broken commit
>>>> responsible for this.
Yes, I see that same warning in linux-next of 20200305.
>>>> @@ -634,12 +637,20 @@ void kasan_free_shadow(const struct vm_struct *vm)
>>>> #endif
>>>>
>>>> extern void __kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip);
>>>> +extern bool report_enabled(void);
>>>>
>>>> -void kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
>>>> +bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
>>>> {
>>>> - unsigned long flags = user_access_save();
>>>> + unsigned long flags;
>>>> +
>>>> + if (likely(!report_enabled()))
>>>> + return false;
>>>
>>> This adds an explicit call before the user_access_save() and that is a
>>> straight on bug.
>>>
>> Hi Peter,
>>
>> Thanks for your help. Unfortunately, I don't reproduce it in our
>> environment, so I have asked Stephen, if I can reproduce it, then we
>> will send new patch.
>
> The patch is trivial; and all you need is an x86_64 (cross) compiler to
> reproduce.
>
>
> diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> index ad2dc0c9cc17..2906358e42f0 100644
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -618,16 +618,17 @@ extern bool report_enabled(void);
>
> bool kasan_report(unsigned long addr, size_t size, bool is_write, unsigned long ip)
> {
> - unsigned long flags;
> + unsigned long flags = user_access_save();
> + bool ret = false;
>
> - if (likely(!report_enabled()))
> - return false;
> + if (likely(report_enabled())) {
> + __kasan_report(addr, size, is_write, ip);
> + ret = true;
> + }
>
> - flags = user_access_save();
> - __kasan_report(addr, size, is_write, ip);
> user_access_restore(flags);
>
> - return true;
> + return ret;
> }
>
> #ifdef CONFIG_MEMORY_HOTPLUG
>
and that fixes the warning. Thanks.
Acked-by: Randy Dunlap <rdunlap@...radead.org> # build-tested
--
~Randy
Powered by blists - more mailing lists