aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2013-08-30 18:43:03 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2013-09-01 17:09:48 -0400
commit7263dda41b5a28ae6566fd126d9b06ada73dd721 (patch)
tree038c70f2e86655fc513ec99e141405a43e3a1632 /arch/x86/include/asm
parentd8dfad3876e4386666b759da3c833d62fb8b2267 (diff)
x86, smap: Handle csum_partial_copy_*_user()
Add SMAP annotations to csum_partial_copy_to/from_user(). These functions legitimately access user space and thus need to set the AC flag. TODO: add explicit checks that the side with the kernel space pointer really points into kernel space. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Link: http://lkml.kernel.org/n/tip-2aps0u00eer658fd5xyanan7@git.kernel.org Cc: <stable@vger.kernel.org> # v3.7+
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/checksum_32.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
index 46fc474fd819..f50de6951738 100644
--- a/arch/x86/include/asm/checksum_32.h
+++ b/arch/x86/include/asm/checksum_32.h
@@ -49,9 +49,15 @@ static inline __wsum csum_partial_copy_from_user(const void __user *src,
49 int len, __wsum sum, 49 int len, __wsum sum,
50 int *err_ptr) 50 int *err_ptr)
51{ 51{
52 __wsum ret;
53
52 might_sleep(); 54 might_sleep();
53 return csum_partial_copy_generic((__force void *)src, dst, 55 stac();
54 len, sum, err_ptr, NULL); 56 ret = csum_partial_copy_generic((__force void *)src, dst,
57 len, sum, err_ptr, NULL);
58 clac();
59
60 return ret;
55} 61}
56 62
57/* 63/*
@@ -176,10 +182,16 @@ static inline __wsum csum_and_copy_to_user(const void *src,
176 int len, __wsum sum, 182 int len, __wsum sum,
177 int *err_ptr) 183 int *err_ptr)
178{ 184{
185 __wsum ret;
186
179 might_sleep(); 187 might_sleep();
180 if (access_ok(VERIFY_WRITE, dst, len)) 188 if (access_ok(VERIFY_WRITE, dst, len)) {
181 return csum_partial_copy_generic(src, (__force void *)dst, 189 stac();
182 len, sum, NULL, err_ptr); 190 ret = csum_partial_copy_generic(src, (__force void *)dst,
191 len, sum, NULL, err_ptr);
192 clac();
193 return ret;
194 }
183 195
184 if (len) 196 if (len)
185 *err_ptr = -EFAULT; 197 *err_ptr = -EFAULT;