migrate.c (eb42c75878e4d13941dcbcf2ef1027c257b099a6) | migrate.c (76aac0e9a17742e60d408be1a706e9aaad370891) |
---|---|
1/* 2 * Memory Migration functionality - linux/mm/migration.c 3 * 4 * Copyright (C) 2006 Silicon Graphics, Inc., Christoph Lameter 5 * 6 * Page migration was first developed in the context of the memory hotplug 7 * project. The main authors of the migration code are: 8 * --- 827 unchanged lines hidden (view full) --- 836static int do_move_page_to_node_array(struct mm_struct *mm, 837 struct page_to_node *pm, 838 int migrate_all) 839{ 840 int err; 841 struct page_to_node *pp; 842 LIST_HEAD(pagelist); 843 | 1/* 2 * Memory Migration functionality - linux/mm/migration.c 3 * 4 * Copyright (C) 2006 Silicon Graphics, Inc., Christoph Lameter 5 * 6 * Page migration was first developed in the context of the memory hotplug 7 * project. The main authors of the migration code are: 8 * --- 827 unchanged lines hidden (view full) --- 836static int do_move_page_to_node_array(struct mm_struct *mm, 837 struct page_to_node *pm, 838 int migrate_all) 839{ 840 int err; 841 struct page_to_node *pp; 842 LIST_HEAD(pagelist); 843 |
844 migrate_prep(); | |
845 down_read(&mm->mmap_sem); 846 847 /* 848 * Build a list of pages to migrate 849 */ | 844 down_read(&mm->mmap_sem); 845 846 /* 847 * Build a list of pages to migrate 848 */ |
849 migrate_prep(); |
|
850 for (pp = pm; pp->node != MAX_NUMNODES; pp++) { 851 struct vm_area_struct *vma; 852 struct page *page; 853 854 /* 855 * A valid page pointer that will not match any of the 856 * pages that will be moved. 857 */ --- 185 unchanged lines hidden (view full) --- 1043asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, 1044 const void __user * __user *pages, 1045 const int __user *nodes, 1046 int __user *status, int flags) 1047{ 1048 struct task_struct *task; 1049 struct mm_struct *mm; 1050 int err; | 850 for (pp = pm; pp->node != MAX_NUMNODES; pp++) { 851 struct vm_area_struct *vma; 852 struct page *page; 853 854 /* 855 * A valid page pointer that will not match any of the 856 * pages that will be moved. 857 */ --- 185 unchanged lines hidden (view full) --- 1043asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages, 1044 const void __user * __user *pages, 1045 const int __user *nodes, 1046 int __user *status, int flags) 1047{ 1048 struct task_struct *task; 1049 struct mm_struct *mm; 1050 int err; |
1051 uid_t uid, euid; |
|
1051 1052 /* Check flags */ 1053 if (flags & ~(MPOL_MF_MOVE|MPOL_MF_MOVE_ALL)) 1054 return -EINVAL; 1055 1056 if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE)) 1057 return -EPERM; 1058 --- 11 unchanged lines hidden (view full) --- 1070 return -EINVAL; 1071 1072 /* 1073 * Check if this process has the right to modify the specified 1074 * process. The right exists if the process has administrative 1075 * capabilities, superuser privileges or the same 1076 * userid as the target process. 1077 */ | 1052 1053 /* Check flags */ 1054 if (flags & ~(MPOL_MF_MOVE|MPOL_MF_MOVE_ALL)) 1055 return -EINVAL; 1056 1057 if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE)) 1058 return -EPERM; 1059 --- 11 unchanged lines hidden (view full) --- 1071 return -EINVAL; 1072 1073 /* 1074 * Check if this process has the right to modify the specified 1075 * process. The right exists if the process has administrative 1076 * capabilities, superuser privileges or the same 1077 * userid as the target process. 1078 */ |
1078 if ((current->euid != task->suid) && (current->euid != task->uid) && 1079 (current->uid != task->suid) && (current->uid != task->uid) && | 1079 uid = current_uid(); 1080 euid = current_euid(); 1081 if (euid != task->suid && euid != task->uid && 1082 uid != task->suid && uid != task->uid && |
1080 !capable(CAP_SYS_NICE)) { 1081 err = -EPERM; 1082 goto out; 1083 } 1084 1085 err = security_task_movememory(task); 1086 if (err) 1087 goto out; --- 34 unchanged lines hidden --- | 1083 !capable(CAP_SYS_NICE)) { 1084 err = -EPERM; 1085 goto out; 1086 } 1087 1088 err = security_task_movememory(task); 1089 if (err) 1090 goto out; --- 34 unchanged lines hidden --- |