linux/fs
Mel Gorman a8bef8ff6e mm: migration: avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks
Page migration requires rmap to be able to find all ptes mapping a page
at all times, otherwise the migration entry can be instantiated, but it
is possible to leave one behind if the second rmap_walk fails to find
the page.  If this page is later faulted, migration_entry_to_page() will
call BUG because the page is locked indicating the page was migrated by
the migration PTE not cleaned up. For example

  kernel BUG at include/linux/swapops.h:105!
  invalid opcode: 0000 [#1] PREEMPT SMP
  ...
  Call Trace:
   [<ffffffff810e951a>] handle_mm_fault+0x3f8/0x76a
   [<ffffffff8130c7a2>] do_page_fault+0x44a/0x46e
   [<ffffffff813099b5>] page_fault+0x25/0x30
   [<ffffffff8114de33>] load_elf_binary+0x152a/0x192b
   [<ffffffff8111329b>] search_binary_handler+0x173/0x313
   [<ffffffff81114896>] do_execve+0x219/0x30a
   [<ffffffff8100a5c6>] sys_execve+0x43/0x5e
   [<ffffffff8100320a>] stub_execve+0x6a/0xc0
  RIP  [<ffffffff811094ff>] migration_entry_wait+0xc1/0x129

There is a race between shift_arg_pages and migration that triggers this
bug.  A temporary stack is setup during exec and later moved.  If
migration moves a page in the temporary stack and the VMA is then removed
before migration completes, the migration PTE may not be found leading to
a BUG when the stack is faulted.

This patch causes pages within the temporary stack during exec to be
skipped by migration.  It does this by marking the VMA covering the
temporary stack with an otherwise impossible combination of VMA flags.
These flags are cleared when the temporary stack is moved to its final
location.

[kamezawa.hiroyu@jp.fujitsu.com: idea for having migration skip temporary stacks]
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-25 08:06:59 -07:00
..
9p Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs 2010-05-24 07:41:13 -07:00
adfs
affs
afs AFS: Don't put struct file on the stack 2010-05-21 18:31:28 -04:00
autofs
autofs4 autofs4: Pushdown the bkl from ioctl 2010-05-22 17:44:18 +02:00
befs
bfs bfs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:25 -04:00
btrfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
cachefiles CacheFiles: Fix error handling in cachefiles_determine_cache_security() 2010-05-12 18:23:58 -07:00
ceph Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client 2010-05-24 07:37:52 -07:00
cifs cifs: fix noserverino handling when unix extensions are enabled 2010-05-17 20:59:21 +00:00
coda Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing 2010-05-24 08:01:10 -07:00
configfs Fix the regression created by "set S_DEAD on unlink()..." commit 2010-05-15 07:16:33 -04:00
cramfs
debugfs
devpts Simplify devpts_get_sb() failure exits 2010-05-21 18:31:12 -04:00
dlm dlm: fix ast ordering for user locks 2010-04-30 14:52:51 -05:00
ecryptfs switch ecryptfs_write() to struct inode *, kill on-stack fake files 2010-05-21 18:31:28 -04:00
efs
exofs Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd 2010-05-24 07:57:41 -07:00
exportfs
ext2 ext2: replace inode uid,gid,mode init with helper 2010-05-21 18:31:24 -04:00
ext3 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
ext4 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
fat Merge git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6 2010-05-24 07:41:47 -07:00
freevxfs
fscache
fuse
gfs2 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
hfs
hfsplus hfsplus: Push down BKL into ioctl function 2010-05-17 05:27:03 +02:00
hostfs
hpfs
hppfs
hugetlbfs
isofs
jbd ext3: Fix waiting on transaction during fsync 2010-05-21 19:30:41 +02:00
jbd2 Merge branch 'master' into for-2.6.35 2010-05-21 21:27:26 +02:00
jffs2 jffs2: constify xattr_handler 2010-05-21 18:31:20 -04:00
jfs jfs: replace inode uid,gid,mode init with helper 2010-05-21 18:31:23 -04:00
lockd
logfs logfs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:27 -04:00
minix minix: replace inode uid,gid,mode init with helper 2010-05-21 18:31:24 -04:00
ncpfs ncpfs: BKL ioctl pushdown 2010-05-17 05:27:42 +02:00
nfs NFS: Don't call iput() in nfs_access_cache_shrinker 2010-05-14 15:09:36 -04:00
nfs_common
nfsd sanitize vfs_fsync calling conventions 2010-05-21 18:31:21 -04:00
nilfs2 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
nls
notify Saner locking around deactivate_super() 2010-05-21 18:31:14 -04:00
ntfs
ocfs2 ocfs2: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:25 -04:00
omfs omfs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:25 -04:00
openpromfs
partitions Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
proc pagemap: add #ifdefs CONFIG_HUGETLB_PAGE on code walking hugetlb vma 2010-05-25 08:06:58 -07:00
qnx4
quota new helper: iterate_supers() 2010-05-21 18:31:16 -04:00
ramfs ramfs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:26 -04:00
reiserfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
romfs
smbfs smbfs: Push down BKL into ioctl function 2010-05-17 05:27:04 +02:00
squashfs squashfs: fix potential buffer over-run on 4K block file systems 2010-04-25 02:09:05 +01:00
sysfs sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
sysv sysv: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:26 -04:00
ubifs ubifs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:26 -04:00
udf udf: replace inode uid,gid,mode init with helper 2010-05-21 18:31:27 -04:00
ufs ufs: replace inode uid,gid,mode initialization with helper function 2010-05-21 18:31:27 -04:00
xfs Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
Kconfig
Kconfig.binfmt
Makefile Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
aio.c
anon_inodes.c anon_inode: set S_IFREG on the anon_inode 2010-05-21 18:31:20 -04:00
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c Remove redundant check for CONFIG_MMU 2010-04-27 09:01:26 -07:00
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
binfmt_som.c
bio-integrity.c
bio.c
block_dev.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
buffer.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
char_dev.c
compat.c revert "procfs: provide stack information for threads" and its fixup commits 2010-05-11 17:33:41 -07:00
compat_binfmt_elf.c
compat_ioctl.c pktcdvd: improve BKL and compat_ioctl.c usage 2010-04-29 08:44:37 -07:00
dcache.c fix prune_dcache()/umount() race 2010-05-21 18:31:16 -04:00
dcookies.c
direct-io.c
drop_caches.c new helper: iterate_supers() 2010-05-21 18:31:16 -04:00
eventfd.c
eventpoll.c sched, wait: Use wrapper functions 2010-05-11 17:43:58 +02:00
exec.c mm: migration: avoid race between shift_arg_pages() and rmap_walk() during migration by not migrating temporary stacks 2010-05-25 08:06:59 -07:00
fcntl.c Merge branch 'master' into for-2.6.35 2010-05-21 21:27:26 +02:00
fifo.c
file.c
file_table.c
filesystems.c
fs-writeback.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
fs_struct.c
generic_acl.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00
inode.c vfs: Add inode uid,gid,mode init helper 2010-05-21 18:31:22 -04:00
internal.h Bury __put_super_and_need_restart() 2010-05-21 18:31:16 -04:00
ioctl.c Introduce freeze_super and thaw_super for the fsfreeze ioctl 2010-05-21 18:31:18 -04:00
ioprio.c
libfs.c FS / libfs: Implement simple_write_to_buffer 2010-05-10 23:08:17 +02:00
locks.c
mbcache.c
mpage.c
namei.c namei.c : update mnt when it needed 2010-05-21 18:31:22 -04:00
namespace.c Merge branch 'next' into for-linus 2010-05-18 08:57:00 +10:00
nfsctl.c
no-block.c
open.c Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
pipe.c pipe: set lower and upper limit on max pages in the pipe page array 2010-05-21 21:12:52 +02:00
pnode.c
pnode.h
posix_acl.c
read_write.c
read_write.h
readdir.c
select.c
seq_file.c
signalfd.c
splice.c pipe: add support for shrinking and growing pipes 2010-05-21 21:12:40 +02:00
stack.c
stat.c
statfs.c Take statfs variants to fs/statfs.c 2010-05-21 18:31:17 -04:00
super.c vfs: add lockdep annotation to s_vfs_rename_key for ecryptfs 2010-05-21 18:31:22 -04:00
sync.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2010-05-21 19:37:45 -07:00
timerfd.c fs/timerfd.c: make use of wait_event_interruptible_locked_irq() 2010-05-20 13:21:42 -07:00
utimes.c
xattr.c fs: xattr_handler table should be const 2010-05-21 18:31:18 -04:00
xattr_acl.c