Re: [PATCH v3] kasan: add memory corruption identification for software tag-based mode
From: Andrey Ryabinin <hidden>
Date: 2019-07-12 10:52:56
Also in:
linux-mediatek, linux-mm, lkml
On 7/11/19 1:06 PM, Walter Wu wrote:
On Wed, 2019-07-10 at 21:24 +0300, Andrey Ryabinin wrote:quoted
On 7/9/19 5:53 AM, Walter Wu wrote:quoted
On Mon, 2019-07-08 at 19:33 +0300, Andrey Ryabinin wrote:quoted
On 7/5/19 4:34 PM, Dmitry Vyukov wrote:quoted
On Mon, Jul 1, 2019 at 11:56 AM Walter Wu [off-list ref] wrote:quoted
quoted
quoted
Sorry for delays. I am overwhelm by some urgent work. I afraid to promise any dates because the next week I am on a conference, then again a backlog and an intern starting... Andrey, do you still have concerns re this patch? This change allows to print the free stack.I 'm not sure that quarantine is a best way to do that. Quarantine is made to delay freeing, but we don't that here. If we want to remember more free stacks wouldn't be easier simply to remember more stacks in object itself? Same for previously used tags for better use-after-free identification.Hi Andrey, We ever tried to use object itself to determine use-after-free identification, but tag-based KASAN immediately released the pointer after call kfree(), the original object will be used by another pointer, if we use object itself to determine use-after-free issue, then it has many false negative cases. so we create a lite quarantine(ring buffers) to record recent free stacks in order to avoid those false negative situations.I'm telling that *more* than one free stack and also tags per object can be stored. If object reused we would still have information about n-last usages of the object. It seems like much easier and more efficient solution than patch you proposing.To make the object reused, we must ensure that no other pointers uses it after kfree() release the pointer. Scenario: 1). The object reused information is valid when no another pointer uses it. 2). The object reused information is invalid when another pointer uses it. Do you mean that the object reused is scenario 1) ? If yes, maybe we can change the calling quarantine_put() location. It will be fully use that quarantine, but at scenario 2) it looks like to need this patch. If no, maybe i miss your meaning, would you tell me how to use invalid object information? or?
KASAN keeps information about object with the object, right after payload in the kasan_alloc_meta struct. This information is always valid as long as slab page allocated. Currently it keeps only one last free stacktrace. It could be extended to record more free stacktraces and also record previously used tags which will allow you to identify use-after-free and extract right free stacktrace. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel