From 131c5cffaa16bb0ebd26c53124adcbc3beaf938f Mon Sep 17 00:00:00 2001 From: David Smith Date: Fri, 8 Jun 2012 09:46:13 -0500 Subject: [PATCH] Fix rawhide crashes by using kernel's own strncpy_from_user(). * runtime/copy.c: Use the kernel's generic strncpy_from_user() function when available. --- runtime/copy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/copy.c b/runtime/copy.c index 40f151175..9ddfbcc5d 100644 --- a/runtime/copy.c +++ b/runtime/copy.c @@ -49,6 +49,10 @@ static long __stp_strncpy_from_user(char *dst, const char __user *src, long count); +#ifdef CONFIG_GENERIC_STRNCPY_FROM_USER +#define __stp_strncpy_from_user(dst,src,count,res) \ + do { res = strncpy_from_user(dst, src, count); } while(0) +#else /* !CONFIG_GENERIC_STRNCPY_FROM_USER */ #if defined (__i386__) #define __stp_strncpy_from_user(dst,src,count,res) \ do { \ @@ -112,8 +116,8 @@ do { \ #elif defined (__s390__) || defined (__s390x__) #define __stp_strncpy_from_user(dst,src,count,res) \ do { res = strncpy_from_user(dst, src, count); } while(0) - #endif +#endif /* !CONFIG_GENERIC_STRNCPY_FROM_USER */ /** Copy a NULL-terminated string from userspace. * On success, returns the length of the string (not including the trailing -- 2.43.5