diff options
author | Christoph Lameter <[email protected]> | 2012-03-21 16:34:06 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2012-03-21 17:54:58 -0700 |
commit | 3268c63eded4612a3d07b56d1e02ce7731e6608e (patch) | |
tree | c8a07eb4cdf2697d610bb86d23eb46b0a5f892c2 /tools/perf/scripts/python/sctop.py | |
parent | 385de35722c9a22917e7bc5e63cd83a8cffa5ecd (diff) |
mm: fix move/migrate_pages() race on task struct
Migration functions perform the rcu_read_unlock too early. As a result
the task pointed to may change from under us. This can result in an oops,
as reported by Dave Hansen in https://lkml.org/lkml/2012/2/23/302.
The following patch extend the period of the rcu_read_lock until after the
permissions checks are done. We also take a refcount so that the task
reference is stable when calling security check functions and performing
cpuset node validation (which takes a mutex).
The refcount is dropped before actual page migration occurs so there is no
change to the refcounts held during page migration.
Also move the determination of the mm of the task struct to immediately
before the do_migrate*() calls so that it is clear that we switch from
handling the task during permission checks to the mm for the actual
migration. Since the determination is only done once and we then no
longer use the task_struct we can be sure that we operate on a specific
address space that will not change from under us.
[[email protected]: checkpatch fixes]
Signed-off-by: Christoph Lameter <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Reported-by: Dave Hansen <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: KAMEZAWA Hiroyuki <[email protected]>
Cc: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/sctop.py')
0 files changed, 0 insertions, 0 deletions