|
@@ -85,6 +85,7 @@
|
|
|
#include <linux/interrupt.h>
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/compat.h>
|
|
|
+#include <linux/ptrace.h>
|
|
|
#include <linux/swap.h>
|
|
|
#include <linux/seq_file.h>
|
|
|
#include <linux/proc_fs.h>
|
|
@@ -1365,7 +1366,6 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
|
|
|
const unsigned long __user *, old_nodes,
|
|
|
const unsigned long __user *, new_nodes)
|
|
|
{
|
|
|
- const struct cred *cred = current_cred(), *tcred;
|
|
|
struct mm_struct *mm = NULL;
|
|
|
struct task_struct *task;
|
|
|
nodemask_t task_nodes;
|
|
@@ -1401,15 +1401,10 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
|
|
|
err = -EINVAL;
|
|
|
|
|
|
/*
|
|
|
- * Check if this process has the right to modify the specified
|
|
|
- * process. The right exists if the process has administrative
|
|
|
- * capabilities, superuser privileges or the same
|
|
|
- * userid as the target process.
|
|
|
+ * Check if this process has the right to modify the specified process.
|
|
|
+ * Use the regular "ptrace_may_access()" checks.
|
|
|
*/
|
|
|
- tcred = __task_cred(task);
|
|
|
- if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) &&
|
|
|
- !uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) &&
|
|
|
- !capable(CAP_SYS_NICE)) {
|
|
|
+ if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) {
|
|
|
rcu_read_unlock();
|
|
|
err = -EPERM;
|
|
|
goto out_put;
|