Skip to content
Commit b4768792 authored by Pavel Emelyanov's avatar Pavel Emelyanov
Browse files

irmap: Get root mntfd before releasing tasks on predump



We have a use-after-free in predump code:

1st the free_pstree() is called in pre_dump_tasks(), then we
go to irmap_predump_run() which may call the lookup_irmap()
which, in turn, dereferences the root_item to get the root
mount ns fd.

But the problem is bigger than that. After we've released the
tasks (done before freeing pstree on predump) we can no longer
access them by PIDs, so keeping the root-item after irmap
scan is not a fix.

Fix is to get the root fd before releasing the tasks and using
one in irmap scanner.

Caught recently on iterative inotify_irmap test.

Signed-off-by: default avatarPavel Emelyanov <xemul@parallels.com>
Acked-by: default avatarAndrew Vagin <avagin@parallels.com>
parent 66944032
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment