aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-grsec/0001-pax-x86_64-fix-copy_user_generic.patch
blob: da442aae39f6d607545358ee1dffbd062c254303 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From b8bf456d13988fb38cfe248676327f44a2d2ed2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 23 Oct 2013 09:54:54 +0300
Subject: [PATCH] pax: x86_64: fix copy_user_generic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Pax patch removed r10 from clobbers list as all assembly code was
updated to not use it. However, in the error path the assembly code
ends up calling copy_user_handle_tail() C-function that can clobber
r10. This broke things for certain gcc optimizations (at least for gcc
4.8.x), as copy_user_generic() is inline function, and the inline
assembly incorrectly guaranteed not to clobber r10.

Add r10 back to clobbers list like vanilla kernel has it. It is
needed always due to the possibly C-function call in error path.

Signed-off-by: Timo Teräs <timo.teras@iki.f>
Acked-by: Natanael Copa <ncopa@alpinelinux.org>
---
 arch/x86/include/asm/uaccess_64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
index 1dbe82f..9d398f4 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -44,7 +44,7 @@ copy_user_generic(void *to, const void *from, unsigned len)
 			 ASM_OUTPUT2("=a" (ret), "=D" (to), "=S" (from),
 				     "=d" (len)),
 			 "1" (to), "2" (from), "3" (len)
-			 : "memory", "rcx", "r8", "r9", "r11");
+			 : "memory", "rcx", "r8", "r9", "r10", "r11");
 	return ret;
 }
 
-- 
1.8.4.1