lkml.org 
[lkml]   [2014]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: fanotify use after free.
On Tue, 28 Jan 2014, Jan Kara wrote:

> > 2b:* 4d 8b 64 c6 08 mov 0x8(%r14,%rax,8),%r12 <-- trapping instruction
> >
> > R14 is 0x6b6b6b6b6b6b6c03, which looks like a use-after-free.
> Yup. But I'm somewhat puzzled by the trace. We crash when calling
> fsnotify_destroy_event() from fanotify_handle_event(). The fsnotify code
> has been called from do_sys_open() so the event was a 'FS_OPEN' which fails
> the fsn_event->mask & FAN_ALL_PERM_EVENTS test.
>
> Slapping my forehead, that's a really stupid bug. The event
> fsnotify_add_notify_event() returns may be freed by the time we return
> because we already dropped the notification mutex. And then fsn_event->mask
> & FAN_ALL_PERM_EVENTS test will pass because FAN_ALL_PERM_EVENTS matches
> with the poison pattern 0x6b6b6b6b. So yet another hacked up version of
> fanotify fix is attached. And I have to seriously think about use counts
> for fanotify version of that struct.

With the fixed version of the patch, all the fanotify-related oopses are
gone on my system.

--
Jiri Kosina
SUSE Labs


\
 
 \ /
  Last update: 2014-01-28 12:41    [W:0.130 / U:1.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site