mm: replace access_process_vm() write parameter with gup_flags
This removes the 'write' argument from access_process_vm() and replaces it with 'gup_flags' as use of this function previously silently implied FOLL_FORCE, whereas after this patch callers explicitly pass this flag. We make this explicit as use of FOLL_FORCE can result in surprising behaviour (and hence bugs) within the mm subsystem. Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
这个提交包含在:
@@ -453,7 +453,7 @@ ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
copied = access_process_vm(child, addr, &ret, sizeof(ret), 0);
|
||||
copied = access_process_vm(child, addr, &ret, sizeof(ret), FOLL_FORCE);
|
||||
if (copied != sizeof(ret))
|
||||
return -EIO;
|
||||
*val = ret;
|
||||
@@ -489,7 +489,8 @@ ia64_poke (struct task_struct *child, struct switch_stack *child_stack,
|
||||
*ia64_rse_skip_regs(krbs, regnum) = val;
|
||||
}
|
||||
}
|
||||
} else if (access_process_vm(child, addr, &val, sizeof(val), 1)
|
||||
} else if (access_process_vm(child, addr, &val, sizeof(val),
|
||||
FOLL_FORCE | FOLL_WRITE)
|
||||
!= sizeof(val))
|
||||
return -EIO;
|
||||
return 0;
|
||||
@@ -543,7 +544,8 @@ ia64_sync_user_rbs (struct task_struct *child, struct switch_stack *sw,
|
||||
ret = ia64_peek(child, sw, user_rbs_end, addr, &val);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (access_process_vm(child, addr, &val, sizeof(val), 1)
|
||||
if (access_process_vm(child, addr, &val, sizeof(val),
|
||||
FOLL_FORCE | FOLL_WRITE)
|
||||
!= sizeof(val))
|
||||
return -EIO;
|
||||
}
|
||||
@@ -559,7 +561,8 @@ ia64_sync_kernel_rbs (struct task_struct *child, struct switch_stack *sw,
|
||||
|
||||
/* now copy word for word from user rbs to kernel rbs: */
|
||||
for (addr = user_rbs_start; addr < user_rbs_end; addr += 8) {
|
||||
if (access_process_vm(child, addr, &val, sizeof(val), 0)
|
||||
if (access_process_vm(child, addr, &val, sizeof(val),
|
||||
FOLL_FORCE)
|
||||
!= sizeof(val))
|
||||
return -EIO;
|
||||
|
||||
@@ -1156,7 +1159,8 @@ arch_ptrace (struct task_struct *child, long request,
|
||||
case PTRACE_PEEKTEXT:
|
||||
case PTRACE_PEEKDATA:
|
||||
/* read word at location addr */
|
||||
if (access_process_vm(child, addr, &data, sizeof(data), 0)
|
||||
if (access_process_vm(child, addr, &data, sizeof(data),
|
||||
FOLL_FORCE)
|
||||
!= sizeof(data))
|
||||
return -EIO;
|
||||
/* ensure return value is not mistaken for error code */
|
||||
|
在新工单中引用
屏蔽一个用户