lkml.org 
[lkml]   [2014]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -mm] prctl: Return -EFAULT on auxv fetching failure
Dan reported that returning bytes left if copy_from_user failed
is a bad option, return traditional -EFAULT instead.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Dan, this is not for current linux-next, but for Andrew's -mm
queue, since he has prctl code already updated with v4 of the
former patch.

kernel/sys.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6.git/kernel/sys.c
===================================================================
--- linux-2.6.git.orig/kernel/sys.c
+++ linux-2.6.git/kernel/sys.c
@@ -1814,11 +1814,10 @@ static int prctl_set_mm_map(int opt, con

if (prctl_map.auxv_size) {
memset(user_auxv, 0, sizeof(user_auxv));
- error = copy_from_user(user_auxv,
- (const void __user *)prctl_map.auxv,
- prctl_map.auxv_size);
- if (error)
- return error;
+ if (copy_from_user(user_auxv,
+ (const void __user *)prctl_map.auxv,
+ prctl_map.auxv_size))
+ return -EFAULT;

/* Last entry must be AT_NULL as specification requires */
user_auxv[AT_VECTOR_SIZE - 2] = AT_NULL;

\
 
 \ /
  Last update: 2014-08-27 13:21    [W:0.038 / U:1.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site