dump_vma_snapshot() wants to read some memory in a user mapping; to perform the uaccess we therefore need to create a valid user pointer from the mapping address.
uaddr_to_user_ptr_safe() should no longer be used for that purpose. Instead, we use make_user_ptr_for_read_uaccess() to create a user pointer with appropriate bounds and permissions (in PCuABI).
Signed-off-by: Kevin Brodsky kevin.brodsky@arm.com --- fs/coredump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/coredump.c b/fs/coredump.c index 90009027a8af..e02501be38f1 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1181,8 +1181,10 @@ static bool dump_vma_snapshot(struct coredump_params *cprm)
if (m->dump_size == DUMP_SIZE_MAYBE_ELFHDR_PLACEHOLDER) { char elfmag[SELFMAG]; + const void __user *uptr = make_user_ptr_for_read_uaccess( + m->start, SELFMAG);
- if (copy_from_user(elfmag, uaddr_to_user_ptr_safe(m->start), SELFMAG) || + if (copy_from_user(elfmag, uptr, SELFMAG) || memcmp(elfmag, ELFMAG, SELFMAG) != 0) { m->dump_size = 0; } else {