lkml.org 
[lkml]   [2018]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Detect early free of a live mm
On Wed 28-02-18 12:18:10, Mark Rutland wrote:
> Ugh, I messed up Peter's email when sending this out. please
> s/infraded/infradead/ if replying to the first mail.
>
> Sorry about that.
>
> Mark.
>
> On Wed, Feb 28, 2018 at 12:14:58PM +0000, Mark Rutland wrote:
> > KASAN splats indicate that in some cases we free a live mm, then
> > continue to access it, with potentially disastrous results. This is
> > likely due to a mismatched mmdrop() somewhere in the kernel, but so far
> > the culprit remains elusive.
> >
> > Let's have __mmdrop() verify that the mm isn't live for the current
> > task, similar to the existing check for init_mm. This way, we can catch
> > this class of issue earlier, and without requiring KASAN.

Wouldn't it be better to check the mm_users count instead?
{VM_}BUG_ON(atomic_read(&mm->mm_users));

Relying on current->mm resetting works currently but this is quite a
subtle dependency.
--
Michal Hocko
SUSE Labs

\
 
 \ /
  Last update: 2018-03-01 10:36    [W:0.077 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site