[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230918081250.143237-1-haibo.li@mediatek.com>
Date: Mon, 18 Sep 2023 16:12:50 +0800
From: Haibo Li <haibo.li@...iatek.com>
To: <jannh@...gle.com>
CC: <akpm@...ux-foundation.org>, <andreyknvl@...il.com>,
<angelogioacchino.delregno@...labora.com>, <dvyukov@...gle.com>,
<glider@...gle.com>, <haibo.li@...iatek.com>,
<kasan-dev@...glegroups.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <linux-mm@...ck.org>,
<mark.rutland@....com>, <matthias.bgg@...il.com>,
<ryabinin.a.a@...il.com>, <vincenzo.frascino@....com>,
<xiaoming.yu@...iatek.com>
Subject: Re: [PATCH] kasan:fix access invalid shadow address when input is illegal
> On Fri, Sep 15, 2023 at 6:51 PM Andrey Konovalov <andreyknvl@...il.com> wrote:
> > On Fri, Sep 15, 2023 at 4:46 AM 'Haibo Li' via kasan-dev
> > <kasan-dev@...glegroups.com> wrote:
> > >
> > > The patch checks each shadow address,so it introduces extra overhead.
> >
> > Ack. Could still be fine, depends on the overhead.
> >
> > But if the message printed by kasan_non_canonical_hook is good enough
> > for your use case, I would rather stick to that.
If we check shadow address before invalid access,
we get below message before oops:
"
BUG: KASAN: invalid-access in do_ib_ob+0xf4/0x110
Read of size 8 at addr caffff80aaaaaaaa by task sh/100
"
We get below message while using kasan_non_canonical_hook:
"
Unable to handle kernel paging request at virtual address ffffff80aaaaaaaa
KASAN: maybe wild-memory-access in range [0xfffffc0aaaaaaaa0-0xfffffc0aaaaaaaaf]
"
Both indicate the original accessed address which causes oops.
> >
> > > Now kasan_non_canonical_hook only works for CONFIG_KASAN_INLINE.
> > >
> > > And CONFIG_KASAN_OUTLINE is set in my case.
> > >
> > > Is it possible to make kasan_non_canonical_hook works for both
> > > INLINE and OUTLINE by simply remove the "#ifdef CONFIG_KASAN_INLINE"?
> >
> > Yes, it should just work if you remove the ifdefs in mm/kasan/report.c
> > and in include/linux/kasan.h.
> >
> > Jann, do you have any objections to enabling kasan_non_canonical_hook
> > for the outline mode too?
>
> No objections from me.
Thanks.
Shall I send a new patch to fix this problem by using kasan_non_canonical_hook
Powered by blists - more mailing lists