From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Wengang <wen.gang.wang@oracle.com>, Linux-MM <linux-mm@kvack.org>,
Andrey Ryabinin <aryabinin@virtuozzo.com>,
Alexander Potapenko <glider@google.com>,
kasan-dev <kasan-dev@googlegroups.com>
Subject: Re: [PATCH 0/5] mm/kasan: advanced check
Date: Thu, 23 Nov 2017 15:07:38 +0900 [thread overview]
Message-ID: <20171123060738.GB31720@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <CACT4Y+ZawvvJFBu7J2EXz8tWpcavMhKWGvuGcYow91WxAPM+Og@mail.gmail.com>
On Wed, Nov 22, 2017 at 09:51:11AM +0100, Dmitry Vyukov wrote:
> On Wed, Nov 22, 2017 at 5:30 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> > On Mon, Nov 20, 2017 at 11:56:05AM -0800, Wengang wrote:
> >>
> >>
> >> On 11/19/2017 05:50 PM, Joonsoo Kim wrote:
> >> >On Fri, Nov 17, 2017 at 11:56:21PM +0100, Dmitry Vyukov wrote:
> >> >>On Fri, Nov 17, 2017 at 11:30 PM, Wengang Wang <wen.gang.wang@oracle.com> wrote:
> >> >>>Kasan advanced check, I'm going to add this feature.
> >> >>>Currently Kasan provide the detection of use-after-free and out-of-bounds
> >> >>>problems. It is not able to find the overwrite-on-allocated-memory issue.
> >> >>>We sometimes hit this kind of issue: We have a messed up structure
> >> >>>(usually dynamially allocated), some of the fields in the structure were
> >> >>>overwritten with unreasaonable values. And kernel may panic due to those
> >> >>>overeritten values. We know those fields were overwritten somehow, but we
> >> >>>have no easy way to find out which path did the overwritten. The advanced
> >> >>>check wants to help in this scenario.
> >> >>>
> >> >>>The idea is to define the memory owner. When write accesses come from
> >> >>>non-owner, error should be reported. Normally the write accesses on a given
> >> >>>structure happen in only several or a dozen of functions if the structure
> >> >>>is not that complicated. We call those functions "allowed functions".
> >> >>>The work of defining the owner and binding memory to owner is expected to
> >> >>>be done by the memory consumer. In the above case, memory consume register
> >> >>>the owner as the functions which have write accesses to the structure then
> >> >>>bind all the structures to the owner. Then kasan will do the "owner check"
> >> >>>after the basic checks.
> >> >>>
> >> >>>As implementation, kasan provides a API to it's user to register their
> >> >>>allowed functions. The API returns a token to users. At run time, users
> >> >>>bind the memory ranges they are interested in to the check they registered.
> >> >>>Kasan then checks the bound memory ranges with the allowed functions.
> >> >>>
> >> >>>
> >> >>>Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
> >> >Hello, Wengang.
> >> >
> >> >Nice idea. I also think that we need this kind of debugging tool. It's very
> >> >hard to detect overwritten bugs.
> >> >
> >> >In fact, I made a quite similar tool, valid access checker (A.K.A.
> >> >vchecker). See the following link.
> >> >
> >> >https://github.com/JoonsooKim/linux/tree/vchecker-master-v0.3-next-20170106
> >> >
> >> >Vchecker has some advanced features compared to yours.
> >> >
> >> >1. Target object can be choosen at runtime by debugfs. It doesn't
> >> >require re-compile to register the target object.
> >> Hi Joonsoo, good to know you are also interested in this!
> >>
> >> Yes, if can be choosen via debugfs, it doesn't need re-compile.
> >> Well, I wonder what do you expect to be chosen from use space?
> >
> > As you mentioned somewhere, this tool can be used when we find the
> > overwritten happend on some particular victims. I assumes that most of
> > the problem would happen on slab objects and userspace can choose the
> > target slab cache via debugfs interface of the vchecker.
>
>
> Most objects are allocated from kmalloc slabs. And this feature can't
> work for all objects allocated from a kmalloc slab. I think checks
> needs to be tied to allocation sites.
I think that this problem can be easily solved by introducing filter.
If the user specify interesting kmalloc() caller via debugfs, vchecker
can distinguish the interesting objects. Manual code addition would
not be needed. I will implement this feature and submit soon.
Thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-11-23 6:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-17 22:30 Wengang Wang
2017-11-17 22:30 ` [PATCH 1/5] mm/kasan: make space in shadow bytes for " Wengang Wang
2017-11-17 22:30 ` [PATCH 2/5] mm/kasan: pass access mode to poison check functions Wengang Wang
2017-11-17 22:30 ` [PATCH 3/5] mm/kasan: do advanced check Wengang Wang
2017-11-17 22:30 ` [PATCH 4/5] mm/kasan: register check and bind it to memory Wengang Wang
2017-11-17 22:30 ` [PATCH 5/5] mm/kasan: add advanced check test case Wengang Wang
2017-11-17 22:32 ` [PATCH 0/5] mm/kasan: advanced check Wengang Wang
2017-11-17 22:56 ` Dmitry Vyukov
2017-11-20 1:50 ` Joonsoo Kim
2017-11-20 8:41 ` Dmitry Vyukov
2017-11-20 20:05 ` Wengang
2017-11-20 20:20 ` Dmitry Vyukov
2017-11-20 20:29 ` Wengang
2017-11-21 9:54 ` Dmitry Vyukov
2017-11-21 19:17 ` Wengang Wang
2017-11-22 8:48 ` Dmitry Vyukov
2017-11-22 21:09 ` Wengang Wang
2017-11-20 19:56 ` Wengang
2017-11-22 4:30 ` Joonsoo Kim
2017-11-22 8:51 ` Dmitry Vyukov
2017-11-23 6:07 ` Joonsoo Kim [this message]
2017-11-22 19:43 ` Wengang Wang
2017-11-23 6:23 ` Joonsoo Kim
2017-11-23 6:35 ` Joonsoo Kim
2017-11-22 12:04 ` Andrey Ryabinin
2017-11-23 5:57 ` Joonsoo Kim
2017-11-22 12:04 ` Andrey Ryabinin
2017-11-22 19:29 ` Wengang Wang
2017-11-26 19:37 ` Wengang Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171123060738.GB31720@js1304-P5Q-DELUXE \
--to=iamjoonsoo.kim@lge.com \
--cc=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-mm@kvack.org \
--cc=wen.gang.wang@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox