[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d6febfc14cf0190f4ccd84fc1bf9bd077a6d6a9f.1550839937.git.andreyknvl@google.com>
Date: Fri, 22 Feb 2019 13:53:21 +0100
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Mark Rutland <mark.rutland@....com>,
Robin Murphy <robin.murphy@....com>,
Kees Cook <keescook@...omium.org>,
Kate Stewart <kstewart@...uxfoundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Shuah Khan <shuah@...nel.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org,
linux-mm@...ck.org, linux-arch@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Dmitry Vyukov <dvyukov@...gle.com>,
Kostya Serebryany <kcc@...gle.com>,
Evgeniy Stepanov <eugenis@...gle.com>,
Lee Smith <Lee.Smith@....com>,
Ramana Radhakrishnan <Ramana.Radhakrishnan@....com>,
Jacob Bramley <Jacob.Bramley@....com>,
Ruben Ayrapetyan <Ruben.Ayrapetyan@....com>,
Chintan Pandya <cpandya@...eaurora.org>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Dave Martin <Dave.Martin@....com>,
Kevin Brodsky <kevin.brodsky@....com>,
Szabolcs Nagy <Szabolcs.Nagy@....com>,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: [PATCH v10 09/12] kernel, arm64: untag user pointers in prctl_set_mm*
prctl_set_mm() and prctl_set_mm_map() use provided user pointers for vma
lookups, which can only by done with untagged pointers.
Untag user pointers in these functions.
Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
---
kernel/sys.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/kernel/sys.c b/kernel/sys.c
index f7eb62eceb24..12910be94b7f 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1992,6 +1992,18 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data
if (copy_from_user(&prctl_map, addr, sizeof(prctl_map)))
return -EFAULT;
+ prctl_map->start_code = untagged_addr(prctl_map.start_code);
+ prctl_map->end_code = untagged_addr(prctl_map.end_code);
+ prctl_map->start_data = untagged_addr(prctl_map.start_data);
+ prctl_map->end_data = untagged_addr(prctl_map.end_data);
+ prctl_map->start_brk = untagged_addr(prctl_map.start_brk);
+ prctl_map->brk = untagged_addr(prctl_map.brk);
+ prctl_map->start_stack = untagged_addr(prctl_map.start_stack);
+ prctl_map->arg_start = untagged_addr(prctl_map.arg_start);
+ prctl_map->arg_end = untagged_addr(prctl_map.arg_end);
+ prctl_map->env_start = untagged_addr(prctl_map.env_start);
+ prctl_map->env_end = untagged_addr(prctl_map.env_end);
+
error = validate_prctl_map(&prctl_map);
if (error)
return error;
@@ -2105,6 +2117,8 @@ static int prctl_set_mm(int opt, unsigned long addr,
opt != PR_SET_MM_MAP_SIZE)))
return -EINVAL;
+ addr = untagged_addr(addr);
+
#ifdef CONFIG_CHECKPOINT_RESTORE
if (opt == PR_SET_MM_MAP || opt == PR_SET_MM_MAP_SIZE)
return prctl_set_mm_map(opt, (const void __user *)addr, arg4);
--
2.21.0.rc0.258.g878e2cd30e-goog
Powered by blists - more mailing lists