public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] prctl: Use access_ok instead of TASK_SIZE in prctl_set_mm
@ 2012-09-25 12:08 Cyrill Gorcunov
  0 siblings, 0 replies; only message in thread
From: Cyrill Gorcunov @ 2012-09-25 12:08 UTC (permalink / raw)
  To: Andrew Morton
  Cc: LKML, Eric W. Biederman, Mark Salter, Kees Cook, Pavel Emelyanov

Eric pointed that better to use access_ok instead
of TASK_SIZE for testing if address is allowed for
use.

Reported-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Mark Salter <msalter@redhat.com>
CC: Kees Cook <keescook@chromium.org>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Pavel Emelyanov <xemul@parallels.com>
---
 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/kernel/sys.c
===================================================================
--- linux-2.6.git.orig/kernel/sys.c
+++ linux-2.6.git/kernel/sys.c
@@ -1865,7 +1865,7 @@ static int prctl_set_mm(int opt, unsigne
 	if (opt == PR_SET_MM_EXE_FILE)
 		return prctl_set_mm_exe_file(mm, (unsigned int)addr);
 
-	if (addr >= TASK_SIZE || addr < mmap_min_addr)
+	if (!access_ok(VERIFY_READ, addr, sizeof(addr)) || addr < mmap_min_addr)
 		return -EINVAL;
 
 	error = -EINVAL;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-25 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 12:08 [PATCH] prctl: Use access_ok instead of TASK_SIZE in prctl_set_mm Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox