rename to a mor general name
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/genlink@2460 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
30
sys-kernel/linux-server/Manifest
Normal file
30
sys-kernel/linux-server/Manifest
Normal file
@@ -0,0 +1,30 @@
|
||||
AUX hotfixes/2.6.33/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch 4309 RMD160 24e106ee1c2557ae1eac8c429c7e24961c5cfa48 SHA1 80f22664c9ad9569047e46daaed939318f0e1688 SHA256 d47f0960afcf6115cfd29f3796fcf37c2affa56a6af3ccc404910e00ae7cf7f0
|
||||
AUX hotfixes/2.6.33/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch 1896 RMD160 c1fcb7e263e20c1174adf3ed29e9f95e7a4ab80a SHA1 41e9939449f5a6ea24beb1215eaa7d70c4cb6f34 SHA256 8fc2f5114f5bf88bbd7aae38ac86255c62ab4e0f22bbefc8856aca91a5308b5c
|
||||
AUX hotfixes/2.6.33/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch 3528 RMD160 70752d7549fa514f9a58d609de4d874a69dc390d SHA1 1867b54b9abc5d89fc1bd9289aec3cff518b8df8 SHA256 72dbd679c1778a59c213e69986484553907ee03b70064c99b904c031783f904a
|
||||
AUX hotfixes/2.6.34/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch 4926 RMD160 ccbee33c6b4f8f7fcf15c23e5a27709d474ed01c SHA1 eb7abde871fa7cf3081f8e1e6a576e771203a1dc SHA256 b5c369eb8045ecb5099cb98fe513acb64d771c91ce25e133b09c33d4be236999
|
||||
AUX hotfixes/2.6.34/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch 1896 RMD160 c1fcb7e263e20c1174adf3ed29e9f95e7a4ab80a SHA1 41e9939449f5a6ea24beb1215eaa7d70c4cb6f34 SHA256 8fc2f5114f5bf88bbd7aae38ac86255c62ab4e0f22bbefc8856aca91a5308b5c
|
||||
AUX hotfixes/2.6.34/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch 3528 RMD160 70752d7549fa514f9a58d609de4d874a69dc390d SHA1 1867b54b9abc5d89fc1bd9289aec3cff518b8df8 SHA256 72dbd679c1778a59c213e69986484553907ee03b70064c99b904c031783f904a
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-36d001c70d8a0144ac1d038f6876c484849a74de.patch 3516 RMD160 c31766b22b3027f5b4b0f218996277a411f13766 SHA1 cb8af45fd9da0c87399c20f9d69d3ab0ef491206 SHA256 1700ad0eff433539e434b7ad23cdedab114a4a890ffbdd74e0702e6c0b52a8cf
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-c41d68a513c71e35a14f66d71782d27a79a81ea6.patch 7183 RMD160 b273d7811dfdae5a1a0001c45c6b97f30966dbd0 SHA1 25f302813a544e4fabb0086c39761cb50813c6f0 SHA256 4d8ed5ca33d365d7893e50bafb26e4aacb17186161c5bc9ac2ddb469873ad1e2
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-eefdca043e8391dcd719711716492063030b55ac.patch 1863 RMD160 5c3d72d8f1e868f664c3d4cc0ae387ecd1be7ae2 SHA1 904820df0a80e3f4fd0b2c3578eefdb5bf84a510 SHA256 87936b817f3dda8e183042a468c66958a85b1caf0743344201beaf17db36e4ff
|
||||
AUX linux-server-2.6.33-amd64.config 108865 RMD160 5ea4fb1a236653d20277c485d74e9d21aa21b372 SHA1 8aa40e0fe6711ba5a93a5cfa6c537c29689f04c0 SHA256 d197230bf07e8a2b1994ba8e1b8792d5d8a9c442ff6789cdba729e614b67734a
|
||||
AUX linux-server-2.6.33-x86.config 113048 RMD160 b218a0d4577ba824526012fee9791d907fed2f7f SHA1 be5cf1635f7fc781c6105480f8941f76f27d730a SHA256 a73b89d7baff443a5602f2a43bedfe8b43f184f0f15ae644f70600dbc9f91bd0
|
||||
DIST 2.6.33-6.tar.bz2 276326 RMD160 9d167d31046e2497cb97fb2bdb082ff01cc4d89f SHA1 fda1b3eb57fa9412b44a6d75a358014d9adc2131 SHA256 68434df72ead4b5077692a4e4e2a3cd5b77778a9e918fa01992ff446ac721fab
|
||||
DIST 2.6.34-11.tar.bz2 246449 RMD160 e78f6e6e540c0ca14cedd85e9c195ca05f19207b SHA1 7d8dbadae86c36be12759cf7115d0e967ccc9916 SHA256 e69941e359dc9fa8da7b2993939033d0f494e494e4db26a61cad42c4c327ac2b
|
||||
DIST 2.6.35-9.tar.bz2 262028 RMD160 f396aeadc5a5a7bd1a8ecbcf56259157c1555ccf SHA1 7fbd88f36626517e08e18fa57fa2ee08a38e0858 SHA256 94995e8df57acff81c0393dc047d8c5e430c23c815a52d1c3127ca7048fa8413
|
||||
DIST linux-2.6.33.tar.bz2 66266488 RMD160 7f0897db8113bc17249d82d61ca41e3b91eb4664 SHA1 acc8db00f30c7dfb4f04183a88ba35a32b6f8e8d SHA256 63e237de3b3c4c46a21833b9ce7e20574548d52dabbd1a8bf376041e4455d5c6
|
||||
DIST linux-2.6.34.tar.bz2 67633622 RMD160 dafd721b00c13e3652405b517b379eed10020bf4 SHA1 4188857ba71f301991dc56285f593e9c311e5824 SHA256 fa395fec7de633df1cb85b6248b8f35af98380ed128a8bc465fb48bc4d252633
|
||||
DIST linux-2.6.35.tar.bz2 69305709 RMD160 f5d91abb4fa72fac812578d830b22180d85a0e6f SHA1 4cb1fbfbeedcd658ca37739679c65dfaa136bf4e SHA256 18b2e2c336032e366c942622b77302cb05fc034fb19018f086a4ebc9ed41bfcf
|
||||
DIST patch-2.6.34.6.bz2 185209 RMD160 75c9a569f8c80be7c418b75f7cde444fcc0a70ff SHA1 e033e2bc4b46e7cc8ee19c07b5ad6999b4c2a52d SHA256 a62e9392ad435948ea4ea2cce12e60e042da6e6da806691936ba50bbaa0dc8cc
|
||||
DIST patch-2.6.35.4.bz2 75980 RMD160 d3d050d516f6283b17d2e15075d57d6c41235254 SHA1 f17d865d5a8320d79869223049ebc36296a1dedd SHA256 03f88e20d9138fd710b338403b2fc97e43ecc34b1f6f0b0d203e03307485550e
|
||||
DIST patch-2.6.35.5.bz2 115391 RMD160 8a6d0b71aa043531575203aa61ac6807532f35e8 SHA1 1267c980179fe4ab35ac7344523c4dd616d2d5a6 SHA256 94bbeb43c6bd8047fa5f42766a68879199dfdadee11bd3e8f10f1317f698b0f4
|
||||
DIST server-2.6.34-amd64.config 110826 RMD160 3799c0da945996b208a2f5476c695e6b2b20c830 SHA1 37444cd2391a867d0789f2e782f966c24d074734 SHA256 0e43d38e9d419af84d7f6111a77cd7141308fa242740dfcbf5bd5fd8da4cd1d8
|
||||
DIST server-2.6.34-x86.config 114866 RMD160 d50e358b1d7ef5e82bfab3ebf1e08d96ab680a97 SHA1 feb788c85909884a21cf3e24bf25bd561723bc86 SHA256 0ab64dd9294d7ecd0622103c52e898ac3f3bdc66fe187f2a19f180cd9945e668
|
||||
DIST server-2.6.35-r5-amd64.config 116649 RMD160 cdf6b7f80778b67422f863323bc2af29b82dd993 SHA1 d40d3dca7c11d914cd1cd87ba4b7913aea002acf SHA256 cdf88908389dcdcf5a7550b7f06110d6f588612ad356b1d560e9d0cf609eaa92
|
||||
DIST server-2.6.35-r5-x86.config 121641 RMD160 ec930e27853aba07fec610e8d859d609a94201af SHA1 203d7191be89daffd7c829f84b9c5eed0a89e6b5 SHA256 a757eada636d38a845ccafbdc14a001cf79154d0f89e79efa880ea58b1131e3a
|
||||
DIST server-2.6.35-r6-amd64.config 116649 RMD160 cdf6b7f80778b67422f863323bc2af29b82dd993 SHA1 d40d3dca7c11d914cd1cd87ba4b7913aea002acf SHA256 cdf88908389dcdcf5a7550b7f06110d6f588612ad356b1d560e9d0cf609eaa92
|
||||
DIST server-2.6.35-r6-x86.config 121641 RMD160 ec930e27853aba07fec610e8d859d609a94201af SHA1 203d7191be89daffd7c829f84b9c5eed0a89e6b5 SHA256 a757eada636d38a845ccafbdc14a001cf79154d0f89e79efa880ea58b1131e3a
|
||||
EBUILD linux-server-2.6.33.ebuild 729 RMD160 81df987369b3029448fb1b9ee276536d34c0b308 SHA1 0a25774bcae8fc5aff5313c51cd69f11531f72fd SHA256 cf82d8ebd82b0ca12e2cfdbefd5d7a5a43782ba7897cbae83dbf77e20f8499ae
|
||||
EBUILD linux-server-2.6.34.ebuild 782 RMD160 5087c1b1d85cae909f1d9bdbe47de88a2fe4377e SHA1 20fb922ce477eeca14f2fec688f2a65fdef893f8 SHA256 c70a3e046fef0b06f50da8f1dc8d0c4ad6ca16a669fa7eba8a8b6e1cc3084f2d
|
||||
EBUILD linux-server-2.6.35-r5.ebuild 768 RMD160 242286ece09fe24dd5a4ee4c9f4720aded7e349c SHA1 ce299681c79a8c984c0ba0df6dd429d760edbe0c SHA256 50ff86f212e7a8e928c453067934ef071500bc62a4adea7e25c5fd23a3d4d999
|
||||
EBUILD linux-server-2.6.35-r6.ebuild 376 RMD160 db2c64dc68c459fd8db06126a6d8e2b0659cd111 SHA1 9de6ccd9c3f21bf996588f6fa74324701e8ce723 SHA256 22c7adb4e1c31ec128073cbe7fd9b52e5f30f216f4bce37a5609bc614e33ce5d
|
||||
@@ -0,0 +1,122 @@
|
||||
--- linux-2.6.33-sabayon.orig/arch/ia64/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/ia64/include/asm/compat.h
|
||||
@@ -198,7 +198,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
--- linux-2.6.33-sabayon.orig/arch/mips/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/mips/include/asm/compat.h
|
||||
@@ -144,7 +144,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
--- linux-2.6.33-sabayon.orig/arch/parisc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/parisc/include/asm/compat.h
|
||||
@@ -146,7 +146,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
--- linux-2.6.33-sabayon.orig/arch/powerpc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/powerpc/include/asm/compat.h
|
||||
@@ -133,7 +133,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
--- linux-2.6.33-sabayon.orig/arch/s390/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/s390/include/asm/compat.h
|
||||
@@ -180,7 +180,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
--- linux-2.6.33-sabayon.orig/arch/sparc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/sparc/include/asm/compat.h
|
||||
@@ -166,7 +166,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
--- linux-2.6.33-sabayon.orig/arch/x86/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/x86/include/asm/compat.h
|
||||
@@ -204,7 +204,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
--- linux-2.6.33-sabayon.orig/include/linux/compat.h
|
||||
+++ linux-2.6.33-sabayon/include/linux/compat.h
|
||||
@@ -353,5 +353,7 @@ asmlinkage long compat_sys_newfstatat(un
|
||||
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
|
||||
int flags, int mode);
|
||||
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
--- linux-2.6.33-sabayon.orig/kernel/compat.c
|
||||
+++ linux-2.6.33-sabayon/kernel/compat.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <linux/security.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/migrate.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/ptrace.h>
|
||||
@@ -1139,3 +1140,24 @@ compat_sys_sysinfo(struct compat_sysinfo
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
@@ -0,0 +1,50 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
|
||||
commit eefdca043e8391dcd719711716492063030b55ac upstream.
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
|
||||
commit 36d001c70d8a0144ac1d038f6876c484849a74de upstream.
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
@@ -0,0 +1,122 @@
|
||||
--- linux-2.6.34-sabayon.orig/arch/ia64/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/ia64/include/asm/compat.h 2010-09-18 17:09:30.728304722 +0200
|
||||
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
--- linux-2.6.34-sabayon.orig/arch/mips/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/mips/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
--- linux-2.6.34-sabayon.orig/arch/parisc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/parisc/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
--- linux-2.6.34-sabayon.orig/arch/powerpc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/powerpc/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
--- linux-2.6.34-sabayon.orig/arch/s390/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/s390/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -181,7 +181,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
--- linux-2.6.34-sabayon.orig/arch/sparc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/sparc/include/asm/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
--- linux-2.6.34-sabayon.orig/arch/x86/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/x86/include/asm/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
--- linux-2.6.34-sabayon.orig/include/linux/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/include/linux/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -356,5 +356,7 @@ asmlinkage long compat_sys_newfstatat(un
|
||||
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
|
||||
int flags, int mode);
|
||||
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
--- linux-2.6.34-sabayon.orig/kernel/compat.c 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/kernel/compat.c 2010-09-18 17:09:58.574836565 +0200
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/ptrace.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/gfp.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@@ -1140,3 +1141,24 @@ compat_sys_sysinfo(struct compat_sysinfo
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
@@ -0,0 +1,50 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
|
||||
commit eefdca043e8391dcd719711716492063030b55ac upstream.
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
|
||||
commit 36d001c70d8a0144ac1d038f6876c484849a74de upstream.
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: [PATCH] x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: <stable@kernel.org>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
|
||||
index b86feab..84e3a4e 100644
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
From c41d68a513c71e35a14f66d71782d27a79a81ea6 Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 7 Sep 2010 16:16:18 -0700
|
||||
Subject: [PATCH] compat: Make compat_alloc_user_space() incorporate the access_ok()
|
||||
|
||||
compat_alloc_user_space() expects the caller to independently call
|
||||
access_ok() to verify the returned area. A missing call could
|
||||
introduce problems on some architectures.
|
||||
|
||||
This patch incorporates the access_ok() check into
|
||||
compat_alloc_user_space() and also adds a sanity check on the length.
|
||||
The existing compat_alloc_user_space() implementations are renamed
|
||||
arch_compat_alloc_user_space() and are used as part of the
|
||||
implementation of the new global function.
|
||||
|
||||
This patch assumes NULL will cause __get_user()/__put_user() to either
|
||||
fail or access userspace on all architectures. This should be
|
||||
followed by checking the return value of compat_access_user_space()
|
||||
for NULL in the callers, at which time the access_ok() in the callers
|
||||
can also be removed.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
||||
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
|
||||
Acked-by: David S. Miller <davem@davemloft.net>
|
||||
Acked-by: Ingo Molnar <mingo@elte.hu>
|
||||
Acked-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: Tony Luck <tony.luck@intel.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Cc: Arnd Bergmann <arnd@arndb.de>
|
||||
Cc: Fenghua Yu <fenghua.yu@intel.com>
|
||||
Cc: H. Peter Anvin <hpa@zytor.com>
|
||||
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
|
||||
Cc: Helge Deller <deller@gmx.de>
|
||||
Cc: James Bottomley <jejb@parisc-linux.org>
|
||||
Cc: Kyle McMartin <kyle@mcmartin.ca>
|
||||
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
|
||||
Cc: Paul Mackerras <paulus@samba.org>
|
||||
Cc: Ralf Baechle <ralf@linux-mips.org>
|
||||
Cc: <stable@kernel.org>
|
||||
---
|
||||
arch/ia64/include/asm/compat.h | 2 +-
|
||||
arch/mips/include/asm/compat.h | 2 +-
|
||||
arch/parisc/include/asm/compat.h | 2 +-
|
||||
arch/powerpc/include/asm/compat.h | 2 +-
|
||||
arch/s390/include/asm/compat.h | 2 +-
|
||||
arch/sparc/include/asm/compat.h | 2 +-
|
||||
arch/tile/include/asm/compat.h | 2 +-
|
||||
arch/x86/include/asm/compat.h | 2 +-
|
||||
include/linux/compat.h | 3 +++
|
||||
kernel/compat.c | 21 +++++++++++++++++++++
|
||||
10 files changed, 32 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/arch/ia64/include/asm/compat.h b/arch/ia64/include/asm/compat.h
|
||||
index f90edc8..9301a28 100644
|
||||
--- a/arch/ia64/include/asm/compat.h
|
||||
+++ b/arch/ia64/include/asm/compat.h
|
||||
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
|
||||
index 613f691..dbc5106 100644
|
||||
--- a/arch/mips/include/asm/compat.h
|
||||
+++ b/arch/mips/include/asm/compat.h
|
||||
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
|
||||
index 02b77ba..efa0b60 100644
|
||||
--- a/arch/parisc/include/asm/compat.h
|
||||
+++ b/arch/parisc/include/asm/compat.h
|
||||
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
|
||||
index 396d21a..a11d4ea 100644
|
||||
--- a/arch/powerpc/include/asm/compat.h
|
||||
+++ b/arch/powerpc/include/asm/compat.h
|
||||
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
|
||||
index 104f200..a875c2f 100644
|
||||
--- a/arch/s390/include/asm/compat.h
|
||||
+++ b/arch/s390/include/asm/compat.h
|
||||
@@ -181,7 +181,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
|
||||
index 5016f76..6f57325 100644
|
||||
--- a/arch/sparc/include/asm/compat.h
|
||||
+++ b/arch/sparc/include/asm/compat.h
|
||||
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
|
||||
index 306160e..1d9cd27 100644
|
||||
--- a/arch/x86/include/asm/compat.h
|
||||
+++ b/arch/x86/include/asm/compat.h
|
||||
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
diff --git a/include/linux/compat.h b/include/linux/compat.h
|
||||
index 9ddc878..5778b55 100644
|
||||
--- a/include/linux/compat.h
|
||||
+++ b/include/linux/compat.h
|
||||
@@ -360,5 +360,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
|
||||
const struct compat_iovec __user *uvector, unsigned long nr_segs,
|
||||
unsigned long fast_segs, struct iovec *fast_pointer,
|
||||
struct iovec **ret_pointer);
|
||||
+
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
diff --git a/kernel/compat.c b/kernel/compat.c
|
||||
index e167efc..c9e2ec0 100644
|
||||
--- a/kernel/compat.c
|
||||
+++ b/kernel/compat.c
|
||||
@@ -1126,3 +1126,24 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: [PATCH] x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 files changed, 7 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
|
||||
index 84e3a4e..518bb99 100644
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
4949
sys-kernel/linux-server/files/linux-server-2.6.33-amd64.config
Normal file
4949
sys-kernel/linux-server/files/linux-server-2.6.33-amd64.config
Normal file
File diff suppressed because it is too large
Load Diff
5122
sys-kernel/linux-server/files/linux-server-2.6.33-x86.config
Normal file
5122
sys-kernel/linux-server/files/linux-server-2.6.33-x86.config
Normal file
File diff suppressed because it is too large
Load Diff
14
sys-kernel/linux-server/linux-server-2.6.33.ebuild
Normal file
14
sys-kernel/linux-server/linux-server-2.6.33.ebuild
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright 2004-2009 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_SABPATCHES_VER="6"
|
||||
K_KERNEL_SOURCES_PKG="sys-kernel/linux-server-sources-${PVR}"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.33/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch
|
||||
${FILESDIR}/hotfixes/2.6.33/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch
|
||||
${FILESDIR}/hotfixes/2.6.33/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel image"
|
||||
RESTRICT="mirror"
|
||||
16
sys-kernel/linux-server/linux-server-2.6.34.ebuild
Normal file
16
sys-kernel/linux-server/linux-server-2.6.34.ebuild
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2004-2009 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_SABPATCHES_VER="11"
|
||||
K_KERNEL_PATCH_VER="6"
|
||||
K_KERNEL_SOURCES_PKG="sys-kernel/linux-server-sources-${PVR}"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.34/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch
|
||||
${FILESDIR}/hotfixes/2.6.34/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch
|
||||
${FILESDIR}/hotfixes/2.6.34/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel image"
|
||||
RESTRICT="mirror"
|
||||
16
sys-kernel/linux-server/linux-server-2.6.35-r5.ebuild
Normal file
16
sys-kernel/linux-server/linux-server-2.6.35-r5.ebuild
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_SABPATCHES_VER="9"
|
||||
K_KERNEL_PATCH_VER="4"
|
||||
K_KERNEL_SOURCES_PKG="sys-kernel/linux-server-sources-${PVR}"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-c41d68a513c71e35a14f66d71782d27a79a81ea6.patch
|
||||
${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-eefdca043e8391dcd719711716492063030b55ac.patch
|
||||
${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-36d001c70d8a0144ac1d038f6876c484849a74de.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel image"
|
||||
RESTRICT="mirror"
|
||||
12
sys-kernel/linux-server/linux-server-2.6.35-r6.ebuild
Normal file
12
sys-kernel/linux-server/linux-server-2.6.35-r6.ebuild
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_SABPATCHES_VER="9"
|
||||
K_KERNEL_PATCH_VER="5"
|
||||
K_KERNEL_SOURCES_PKG="sys-kernel/linux-server-sources-${PVR}"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel image"
|
||||
RESTRICT="mirror"
|
||||
30
sys-kernel/server-sources/Manifest
Normal file
30
sys-kernel/server-sources/Manifest
Normal file
@@ -0,0 +1,30 @@
|
||||
AUX hotfixes/2.6.33/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch 4309 RMD160 24e106ee1c2557ae1eac8c429c7e24961c5cfa48 SHA1 80f22664c9ad9569047e46daaed939318f0e1688 SHA256 d47f0960afcf6115cfd29f3796fcf37c2affa56a6af3ccc404910e00ae7cf7f0
|
||||
AUX hotfixes/2.6.33/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch 1896 RMD160 c1fcb7e263e20c1174adf3ed29e9f95e7a4ab80a SHA1 41e9939449f5a6ea24beb1215eaa7d70c4cb6f34 SHA256 8fc2f5114f5bf88bbd7aae38ac86255c62ab4e0f22bbefc8856aca91a5308b5c
|
||||
AUX hotfixes/2.6.33/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch 3528 RMD160 70752d7549fa514f9a58d609de4d874a69dc390d SHA1 1867b54b9abc5d89fc1bd9289aec3cff518b8df8 SHA256 72dbd679c1778a59c213e69986484553907ee03b70064c99b904c031783f904a
|
||||
AUX hotfixes/2.6.34/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch 4926 RMD160 ccbee33c6b4f8f7fcf15c23e5a27709d474ed01c SHA1 eb7abde871fa7cf3081f8e1e6a576e771203a1dc SHA256 b5c369eb8045ecb5099cb98fe513acb64d771c91ce25e133b09c33d4be236999
|
||||
AUX hotfixes/2.6.34/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch 1896 RMD160 c1fcb7e263e20c1174adf3ed29e9f95e7a4ab80a SHA1 41e9939449f5a6ea24beb1215eaa7d70c4cb6f34 SHA256 8fc2f5114f5bf88bbd7aae38ac86255c62ab4e0f22bbefc8856aca91a5308b5c
|
||||
AUX hotfixes/2.6.34/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch 3528 RMD160 70752d7549fa514f9a58d609de4d874a69dc390d SHA1 1867b54b9abc5d89fc1bd9289aec3cff518b8df8 SHA256 72dbd679c1778a59c213e69986484553907ee03b70064c99b904c031783f904a
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-36d001c70d8a0144ac1d038f6876c484849a74de.patch 3516 RMD160 c31766b22b3027f5b4b0f218996277a411f13766 SHA1 cb8af45fd9da0c87399c20f9d69d3ab0ef491206 SHA256 1700ad0eff433539e434b7ad23cdedab114a4a890ffbdd74e0702e6c0b52a8cf
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-c41d68a513c71e35a14f66d71782d27a79a81ea6.patch 7183 RMD160 b273d7811dfdae5a1a0001c45c6b97f30966dbd0 SHA1 25f302813a544e4fabb0086c39761cb50813c6f0 SHA256 4d8ed5ca33d365d7893e50bafb26e4aacb17186161c5bc9ac2ddb469873ad1e2
|
||||
AUX hotfixes/2.6.35/linux-2.6.git-eefdca043e8391dcd719711716492063030b55ac.patch 1863 RMD160 5c3d72d8f1e868f664c3d4cc0ae387ecd1be7ae2 SHA1 904820df0a80e3f4fd0b2c3578eefdb5bf84a510 SHA256 87936b817f3dda8e183042a468c66958a85b1caf0743344201beaf17db36e4ff
|
||||
AUX server-sources-2.6.33-amd64.config 108865 RMD160 1cf7e3b6b2471821069b00e2eaf127283005d1b0 SHA1 e8e9ca3f3253f814b6154ebf67190758c4b0b1dc SHA256 fd3e3040f49077798832d937ed201be0efe18af3dc28db4d2bc5792a8cd19bf9
|
||||
AUX server-sources-2.6.33-x86.config 113048 RMD160 c0f5aad88fed93e01c79b61298942b6334d658b4 SHA1 0975fa317e2a5bd723fb4641a48ca78f67a4517c SHA256 94b8eb43766f97e194a3d933256a644d5b9257b7d2b918e7237c26dec987f1bd
|
||||
DIST 2.6.33-6.tar.bz2 276326 RMD160 9d167d31046e2497cb97fb2bdb082ff01cc4d89f SHA1 fda1b3eb57fa9412b44a6d75a358014d9adc2131 SHA256 68434df72ead4b5077692a4e4e2a3cd5b77778a9e918fa01992ff446ac721fab
|
||||
DIST 2.6.34-11.tar.bz2 246449 RMD160 e78f6e6e540c0ca14cedd85e9c195ca05f19207b SHA1 7d8dbadae86c36be12759cf7115d0e967ccc9916 SHA256 e69941e359dc9fa8da7b2993939033d0f494e494e4db26a61cad42c4c327ac2b
|
||||
DIST 2.6.35-9.tar.bz2 262028 RMD160 f396aeadc5a5a7bd1a8ecbcf56259157c1555ccf SHA1 7fbd88f36626517e08e18fa57fa2ee08a38e0858 SHA256 94995e8df57acff81c0393dc047d8c5e430c23c815a52d1c3127ca7048fa8413
|
||||
DIST linux-2.6.33.tar.bz2 66266488 RMD160 7f0897db8113bc17249d82d61ca41e3b91eb4664 SHA1 acc8db00f30c7dfb4f04183a88ba35a32b6f8e8d SHA256 63e237de3b3c4c46a21833b9ce7e20574548d52dabbd1a8bf376041e4455d5c6
|
||||
DIST linux-2.6.34.tar.bz2 67633622 RMD160 dafd721b00c13e3652405b517b379eed10020bf4 SHA1 4188857ba71f301991dc56285f593e9c311e5824 SHA256 fa395fec7de633df1cb85b6248b8f35af98380ed128a8bc465fb48bc4d252633
|
||||
DIST linux-2.6.35.tar.bz2 69305709 RMD160 f5d91abb4fa72fac812578d830b22180d85a0e6f SHA1 4cb1fbfbeedcd658ca37739679c65dfaa136bf4e SHA256 18b2e2c336032e366c942622b77302cb05fc034fb19018f086a4ebc9ed41bfcf
|
||||
DIST patch-2.6.34.6.bz2 185209 RMD160 75c9a569f8c80be7c418b75f7cde444fcc0a70ff SHA1 e033e2bc4b46e7cc8ee19c07b5ad6999b4c2a52d SHA256 a62e9392ad435948ea4ea2cce12e60e042da6e6da806691936ba50bbaa0dc8cc
|
||||
DIST patch-2.6.35.3.bz2 39766 RMD160 de90d8444497c1eaa222cf9df6e81f35a388423e SHA1 38717af633669750bc7e65508ae7253de3c5c527 SHA256 94d321099f20f47dc681304a630391322e0e4d6672bb1106a621e6347c44db83
|
||||
DIST patch-2.6.35.5.bz2 115391 RMD160 8a6d0b71aa043531575203aa61ac6807532f35e8 SHA1 1267c980179fe4ab35ac7344523c4dd616d2d5a6 SHA256 94bbeb43c6bd8047fa5f42766a68879199dfdadee11bd3e8f10f1317f698b0f4
|
||||
DIST server-2.6.34-amd64.config 110826 RMD160 3799c0da945996b208a2f5476c695e6b2b20c830 SHA1 37444cd2391a867d0789f2e782f966c24d074734 SHA256 0e43d38e9d419af84d7f6111a77cd7141308fa242740dfcbf5bd5fd8da4cd1d8
|
||||
DIST server-2.6.34-x86.config 114866 RMD160 d50e358b1d7ef5e82bfab3ebf1e08d96ab680a97 SHA1 feb788c85909884a21cf3e24bf25bd561723bc86 SHA256 0ab64dd9294d7ecd0622103c52e898ac3f3bdc66fe187f2a19f180cd9945e668
|
||||
DIST server-2.6.35-r5-amd64.config 116649 RMD160 cdf6b7f80778b67422f863323bc2af29b82dd993 SHA1 d40d3dca7c11d914cd1cd87ba4b7913aea002acf SHA256 cdf88908389dcdcf5a7550b7f06110d6f588612ad356b1d560e9d0cf609eaa92
|
||||
DIST server-2.6.35-r5-x86.config 121641 RMD160 ec930e27853aba07fec610e8d859d609a94201af SHA1 203d7191be89daffd7c829f84b9c5eed0a89e6b5 SHA256 a757eada636d38a845ccafbdc14a001cf79154d0f89e79efa880ea58b1131e3a
|
||||
DIST server-2.6.35-r6-amd64.config 116649 RMD160 cdf6b7f80778b67422f863323bc2af29b82dd993 SHA1 d40d3dca7c11d914cd1cd87ba4b7913aea002acf SHA256 cdf88908389dcdcf5a7550b7f06110d6f588612ad356b1d560e9d0cf609eaa92
|
||||
DIST server-2.6.35-r6-x86.config 121641 RMD160 ec930e27853aba07fec610e8d859d609a94201af SHA1 203d7191be89daffd7c829f84b9c5eed0a89e6b5 SHA256 a757eada636d38a845ccafbdc14a001cf79154d0f89e79efa880ea58b1131e3a
|
||||
EBUILD server-sources-2.6.33.ebuild 1750 RMD160 b045ce4e036352c20e845600a38b193daf3db249 SHA1 343c118f4f1ae3b81391504d7eb1f3509eda134d SHA256 03f2f6ff75dc19ee91503e07c4ec66e8afa5422d9482eb24b0a58a24cbea55c5
|
||||
EBUILD server-sources-2.6.34.ebuild 970 RMD160 78898d71695b8761e6f13cc4dbebbcc4bbb19a1d SHA1 7722c7ec16ffcea1ae9ffb7d4be9de6a6fed0748 SHA256 23d0a93cdc282cbcd3a93e09c35e590854e15cf05aaa8d5ab80f19547ebd0d7a
|
||||
EBUILD server-sources-2.6.35-r5.ebuild 956 RMD160 2ecd39f80037c281214608f3ae36a7f81e4e387f SHA1 3bd103f4ef3e01d3b889dc0e8d813d74608c2f99 SHA256 f643361429f0c46827ba1a9586d24feaf68622120acfd2c5f511a1cccf7b1654
|
||||
EBUILD server-sources-2.6.35-r6.ebuild 564 RMD160 afb3833a1362233181addf6dec52e1fb12bf0e3c SHA1 8e19663452c3981caf142789174aa8428a982a1c SHA256 2fa33cb729a42bca9c62e044930c53f4e9eae62a10d0decfaf689135a9eb1237
|
||||
@@ -0,0 +1,122 @@
|
||||
--- linux-2.6.33-sabayon.orig/arch/ia64/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/ia64/include/asm/compat.h
|
||||
@@ -198,7 +198,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
--- linux-2.6.33-sabayon.orig/arch/mips/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/mips/include/asm/compat.h
|
||||
@@ -144,7 +144,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
--- linux-2.6.33-sabayon.orig/arch/parisc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/parisc/include/asm/compat.h
|
||||
@@ -146,7 +146,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
--- linux-2.6.33-sabayon.orig/arch/powerpc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/powerpc/include/asm/compat.h
|
||||
@@ -133,7 +133,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
--- linux-2.6.33-sabayon.orig/arch/s390/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/s390/include/asm/compat.h
|
||||
@@ -180,7 +180,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
--- linux-2.6.33-sabayon.orig/arch/sparc/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/sparc/include/asm/compat.h
|
||||
@@ -166,7 +166,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
--- linux-2.6.33-sabayon.orig/arch/x86/include/asm/compat.h
|
||||
+++ linux-2.6.33-sabayon/arch/x86/include/asm/compat.h
|
||||
@@ -204,7 +204,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
--- linux-2.6.33-sabayon.orig/include/linux/compat.h
|
||||
+++ linux-2.6.33-sabayon/include/linux/compat.h
|
||||
@@ -353,5 +353,7 @@ asmlinkage long compat_sys_newfstatat(un
|
||||
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
|
||||
int flags, int mode);
|
||||
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
--- linux-2.6.33-sabayon.orig/kernel/compat.c
|
||||
+++ linux-2.6.33-sabayon/kernel/compat.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <linux/security.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/migrate.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/ptrace.h>
|
||||
@@ -1139,3 +1140,24 @@ compat_sys_sysinfo(struct compat_sysinfo
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
@@ -0,0 +1,50 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
|
||||
commit eefdca043e8391dcd719711716492063030b55ac upstream.
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
|
||||
commit 36d001c70d8a0144ac1d038f6876c484849a74de upstream.
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
@@ -0,0 +1,122 @@
|
||||
--- linux-2.6.34-sabayon.orig/arch/ia64/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/ia64/include/asm/compat.h 2010-09-18 17:09:30.728304722 +0200
|
||||
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
--- linux-2.6.34-sabayon.orig/arch/mips/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/mips/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
--- linux-2.6.34-sabayon.orig/arch/parisc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/parisc/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
--- linux-2.6.34-sabayon.orig/arch/powerpc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/powerpc/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
--- linux-2.6.34-sabayon.orig/arch/s390/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/s390/include/asm/compat.h 2010-09-18 17:09:30.728822831 +0200
|
||||
@@ -181,7 +181,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
--- linux-2.6.34-sabayon.orig/arch/sparc/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/sparc/include/asm/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
--- linux-2.6.34-sabayon.orig/arch/x86/include/asm/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/arch/x86/include/asm/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compa
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
--- linux-2.6.34-sabayon.orig/include/linux/compat.h 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/include/linux/compat.h 2010-09-18 17:09:30.729822459 +0200
|
||||
@@ -356,5 +356,7 @@ asmlinkage long compat_sys_newfstatat(un
|
||||
asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
|
||||
int flags, int mode);
|
||||
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
--- linux-2.6.34-sabayon.orig/kernel/compat.c 2010-05-16 23:17:36.000000000 +0200
|
||||
+++ linux-2.6.34-sabayon/kernel/compat.c 2010-09-18 17:09:58.574836565 +0200
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/ptrace.h>
|
||||
+#include <linux/module.h>
|
||||
#include <linux/gfp.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@@ -1140,3 +1141,24 @@ compat_sys_sysinfo(struct compat_sysinfo
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
@@ -0,0 +1,50 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
|
||||
commit eefdca043e8391dcd719711716492063030b55ac upstream.
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
|
||||
commit 36d001c70d8a0144ac1d038f6876c484849a74de upstream.
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
||||
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
@@ -0,0 +1,97 @@
|
||||
From 36d001c70d8a0144ac1d038f6876c484849a74de Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 14 Sep 2010 12:42:41 -0700
|
||||
Subject: [PATCH] x86-64, compat: Test %rax for the syscall number, not %eax
|
||||
|
||||
On 64 bits, we always, by necessity, jump through the system call
|
||||
table via %rax. For 32-bit system calls, in theory the system call
|
||||
number is stored in %eax, and the code was testing %eax for a valid
|
||||
system call number. At one point we loaded the stored value back from
|
||||
the stack to enforce zero-extension, but that was removed in checkin
|
||||
d4d67150165df8bf1cc05e532f6efca96f907cab. An actual 32-bit process
|
||||
will not be able to introduce a non-zero-extended number, but it can
|
||||
happen via ptrace.
|
||||
|
||||
Instead of re-introducing the zero-extension, test what we are
|
||||
actually going to use, i.e. %rax. This only adds a handful of REX
|
||||
prefixes to the code.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Cc: <stable@kernel.org>
|
||||
Cc: Roland McGrath <roland@redhat.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 14 +++++++-------
|
||||
1 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
|
||||
index b86feab..84e3a4e 100644
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -153,7 +153,7 @@ ENTRY(ia32_sysenter_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz sysenter_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
sysenter_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -195,7 +195,7 @@ sysexit_from_sys_call:
|
||||
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
|
||||
call audit_syscall_entry
|
||||
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
movl %ebx,%edi /* reload 1st syscall arg */
|
||||
movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */
|
||||
@@ -248,7 +248,7 @@ sysenter_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
|
||||
jmp sysenter_do_call
|
||||
CFI_ENDPROC
|
||||
@@ -314,7 +314,7 @@ ENTRY(ia32_cstar_target)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
CFI_REMEMBER_STATE
|
||||
jnz cstar_tracesys
|
||||
- cmpl $IA32_NR_syscalls-1,%eax
|
||||
+ cmpq $IA32_NR_syscalls-1,%rax
|
||||
ja ia32_badsys
|
||||
cstar_do_call:
|
||||
IA32_ARG_FIXUP 1
|
||||
@@ -367,7 +367,7 @@ cstar_tracesys:
|
||||
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
xchgl %ebp,%r9d
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
|
||||
jmp cstar_do_call
|
||||
END(ia32_cstar_target)
|
||||
@@ -425,7 +425,7 @@ ENTRY(ia32_syscall)
|
||||
orl $TS_COMPAT,TI_status(%r10)
|
||||
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
|
||||
jnz ia32_tracesys
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja ia32_badsys
|
||||
ia32_do_call:
|
||||
IA32_ARG_FIXUP
|
||||
@@ -444,7 +444,7 @@ ia32_tracesys:
|
||||
call syscall_trace_enter
|
||||
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
|
||||
RESTORE_REST
|
||||
- cmpl $(IA32_NR_syscalls-1),%eax
|
||||
+ cmpq $(IA32_NR_syscalls-1),%rax
|
||||
ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */
|
||||
jmp ia32_do_call
|
||||
END(ia32_syscall)
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
From c41d68a513c71e35a14f66d71782d27a79a81ea6 Mon Sep 17 00:00:00 2001
|
||||
From: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Date: Tue, 7 Sep 2010 16:16:18 -0700
|
||||
Subject: [PATCH] compat: Make compat_alloc_user_space() incorporate the access_ok()
|
||||
|
||||
compat_alloc_user_space() expects the caller to independently call
|
||||
access_ok() to verify the returned area. A missing call could
|
||||
introduce problems on some architectures.
|
||||
|
||||
This patch incorporates the access_ok() check into
|
||||
compat_alloc_user_space() and also adds a sanity check on the length.
|
||||
The existing compat_alloc_user_space() implementations are renamed
|
||||
arch_compat_alloc_user_space() and are used as part of the
|
||||
implementation of the new global function.
|
||||
|
||||
This patch assumes NULL will cause __get_user()/__put_user() to either
|
||||
fail or access userspace on all architectures. This should be
|
||||
followed by checking the return value of compat_access_user_space()
|
||||
for NULL in the callers, at which time the access_ok() in the callers
|
||||
can also be removed.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|
||||
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
|
||||
Acked-by: David S. Miller <davem@davemloft.net>
|
||||
Acked-by: Ingo Molnar <mingo@elte.hu>
|
||||
Acked-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: Tony Luck <tony.luck@intel.com>
|
||||
Cc: Andrew Morton <akpm@linux-foundation.org>
|
||||
Cc: Arnd Bergmann <arnd@arndb.de>
|
||||
Cc: Fenghua Yu <fenghua.yu@intel.com>
|
||||
Cc: H. Peter Anvin <hpa@zytor.com>
|
||||
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
|
||||
Cc: Helge Deller <deller@gmx.de>
|
||||
Cc: James Bottomley <jejb@parisc-linux.org>
|
||||
Cc: Kyle McMartin <kyle@mcmartin.ca>
|
||||
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
|
||||
Cc: Paul Mackerras <paulus@samba.org>
|
||||
Cc: Ralf Baechle <ralf@linux-mips.org>
|
||||
Cc: <stable@kernel.org>
|
||||
---
|
||||
arch/ia64/include/asm/compat.h | 2 +-
|
||||
arch/mips/include/asm/compat.h | 2 +-
|
||||
arch/parisc/include/asm/compat.h | 2 +-
|
||||
arch/powerpc/include/asm/compat.h | 2 +-
|
||||
arch/s390/include/asm/compat.h | 2 +-
|
||||
arch/sparc/include/asm/compat.h | 2 +-
|
||||
arch/tile/include/asm/compat.h | 2 +-
|
||||
arch/x86/include/asm/compat.h | 2 +-
|
||||
include/linux/compat.h | 3 +++
|
||||
kernel/compat.c | 21 +++++++++++++++++++++
|
||||
10 files changed, 32 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/arch/ia64/include/asm/compat.h b/arch/ia64/include/asm/compat.h
|
||||
index f90edc8..9301a28 100644
|
||||
--- a/arch/ia64/include/asm/compat.h
|
||||
+++ b/arch/ia64/include/asm/compat.h
|
||||
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr)
|
||||
}
|
||||
|
||||
static __inline__ void __user *
|
||||
-compat_alloc_user_space (long len)
|
||||
+arch_compat_alloc_user_space (long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
|
||||
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
|
||||
index 613f691..dbc5106 100644
|
||||
--- a/arch/mips/include/asm/compat.h
|
||||
+++ b/arch/mips/include/asm/compat.h
|
||||
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = (struct pt_regs *)
|
||||
((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
|
||||
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
|
||||
index 02b77ba..efa0b60 100644
|
||||
--- a/arch/parisc/include/asm/compat.h
|
||||
+++ b/arch/parisc/include/asm/compat.h
|
||||
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static __inline__ void __user *compat_alloc_user_space(long len)
|
||||
+static __inline__ void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = ¤t->thread.regs;
|
||||
return (void __user *)regs->gr[30];
|
||||
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
|
||||
index 396d21a..a11d4ea 100644
|
||||
--- a/arch/powerpc/include/asm/compat.h
|
||||
+++ b/arch/powerpc/include/asm/compat.h
|
||||
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current->thread.regs;
|
||||
unsigned long usp = regs->gpr[1];
|
||||
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
|
||||
index 104f200..a875c2f 100644
|
||||
--- a/arch/s390/include/asm/compat.h
|
||||
+++ b/arch/s390/include/asm/compat.h
|
||||
@@ -181,7 +181,7 @@ static inline int is_compat_task(void)
|
||||
|
||||
#endif
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
unsigned long stack;
|
||||
|
||||
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
|
||||
index 5016f76..6f57325 100644
|
||||
--- a/arch/sparc/include/asm/compat.h
|
||||
+++ b/arch/sparc/include/asm/compat.h
|
||||
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = current_thread_info()->kregs;
|
||||
unsigned long usp = regs->u_regs[UREG_I6];
|
||||
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
|
||||
index 306160e..1d9cd27 100644
|
||||
--- a/arch/x86/include/asm/compat.h
|
||||
+++ b/arch/x86/include/asm/compat.h
|
||||
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
|
||||
return (u32)(unsigned long)uptr;
|
||||
}
|
||||
|
||||
-static inline void __user *compat_alloc_user_space(long len)
|
||||
+static inline void __user *arch_compat_alloc_user_space(long len)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(current);
|
||||
return (void __user *)regs->sp - len;
|
||||
diff --git a/include/linux/compat.h b/include/linux/compat.h
|
||||
index 9ddc878..5778b55 100644
|
||||
--- a/include/linux/compat.h
|
||||
+++ b/include/linux/compat.h
|
||||
@@ -360,5 +360,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type,
|
||||
const struct compat_iovec __user *uvector, unsigned long nr_segs,
|
||||
unsigned long fast_segs, struct iovec *fast_pointer,
|
||||
struct iovec **ret_pointer);
|
||||
+
|
||||
+extern void __user *compat_alloc_user_space(unsigned long len);
|
||||
+
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* _LINUX_COMPAT_H */
|
||||
diff --git a/kernel/compat.c b/kernel/compat.c
|
||||
index e167efc..c9e2ec0 100644
|
||||
--- a/kernel/compat.c
|
||||
+++ b/kernel/compat.c
|
||||
@@ -1126,3 +1126,24 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Allocate user-space memory for the duration of a single system call,
|
||||
+ * in order to marshall parameters inside a compat thunk.
|
||||
+ */
|
||||
+void __user *compat_alloc_user_space(unsigned long len)
|
||||
+{
|
||||
+ void __user *ptr;
|
||||
+
|
||||
+ /* If len would occupy more than half of the entire compat space... */
|
||||
+ if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ ptr = arch_compat_alloc_user_space(len);
|
||||
+
|
||||
+ if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return ptr;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(compat_alloc_user_space);
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From eefdca043e8391dcd719711716492063030b55ac Mon Sep 17 00:00:00 2001
|
||||
From: Roland McGrath <roland@redhat.com>
|
||||
Date: Tue, 14 Sep 2010 12:22:58 -0700
|
||||
Subject: [PATCH] x86-64, compat: Retruncate rax after ia32 syscall entry tracing
|
||||
|
||||
In commit d4d6715, we reopened an old hole for a 64-bit ptracer touching a
|
||||
32-bit tracee in system call entry. A %rax value set via ptrace at the
|
||||
entry tracing stop gets used whole as a 32-bit syscall number, while we
|
||||
only check the low 32 bits for validity.
|
||||
|
||||
Fix it by truncating %rax back to 32 bits after syscall_trace_enter,
|
||||
in addition to testing the full 64 bits as has already been added.
|
||||
|
||||
Reported-by: Ben Hawkes <hawkes@sota.gen.nz>
|
||||
Signed-off-by: Roland McGrath <roland@redhat.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
|
||||
---
|
||||
arch/x86/ia32/ia32entry.S | 8 +++++++-
|
||||
1 files changed, 7 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
|
||||
index 84e3a4e..518bb99 100644
|
||||
--- a/arch/x86/ia32/ia32entry.S
|
||||
+++ b/arch/x86/ia32/ia32entry.S
|
||||
@@ -50,7 +50,12 @@
|
||||
/*
|
||||
* Reload arg registers from stack in case ptrace changed them.
|
||||
* We don't reload %eax because syscall_trace_enter() returned
|
||||
- * the value it wants us to use in the table lookup.
|
||||
+ * the %rax value we should see. Instead, we just truncate that
|
||||
+ * value to 32 bits again as we did on entry from user mode.
|
||||
+ * If it's a new value set by user_regset during entry tracing,
|
||||
+ * this matches the normal truncation of the user-mode value.
|
||||
+ * If it's -1 to make us punt the syscall, then (u32)-1 is still
|
||||
+ * an appropriately invalid value.
|
||||
*/
|
||||
.macro LOAD_ARGS32 offset, _r9=0
|
||||
.if \_r9
|
||||
@@ -60,6 +65,7 @@
|
||||
movl \offset+48(%rsp),%edx
|
||||
movl \offset+56(%rsp),%esi
|
||||
movl \offset+64(%rsp),%edi
|
||||
+ movl %eax,%eax /* zero extension */
|
||||
.endm
|
||||
|
||||
.macro CFI_STARTPROC32 simple
|
||||
--
|
||||
1.7.2.3
|
||||
|
||||
4949
sys-kernel/server-sources/files/server-sources-2.6.33-amd64.config
Normal file
4949
sys-kernel/server-sources/files/server-sources-2.6.33-amd64.config
Normal file
File diff suppressed because it is too large
Load Diff
5122
sys-kernel/server-sources/files/server-sources-2.6.33-x86.config
Normal file
5122
sys-kernel/server-sources/files/server-sources-2.6.33-x86.config
Normal file
File diff suppressed because it is too large
Load Diff
52
sys-kernel/server-sources/server-sources-2.6.33.ebuild
Normal file
52
sys-kernel/server-sources/server-sources-2.6.33.ebuild
Normal file
@@ -0,0 +1,52 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_WANT_GENPATCHES=""
|
||||
K_GENPATCHES_VER=""
|
||||
K_SABPATCHES_VER="6"
|
||||
K_SABKERNEL_NAME="server"
|
||||
K_ONLY_SOURCES="1"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.33/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch
|
||||
${FILESDIR}/hotfixes/2.6.33/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch
|
||||
${FILESDIR}/hotfixes/2.6.33/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel sources"
|
||||
RESTRICT="mirror"
|
||||
IUSE="sources_standalone"
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
sources_standalone? ( !=sys-kernel/linux-server-${PVR} )
|
||||
!sources_standalone? ( =sys-kernel/linux-server-${PVR} )"
|
||||
|
||||
src_compile() {
|
||||
kernel-2_src_compile
|
||||
}
|
||||
|
||||
### override sabayon-kernel-src_install()
|
||||
src_install() {
|
||||
|
||||
local version_h_name="usr/src/linux-${KV_FULL}/include/linux"
|
||||
local version_h="${ROOT}${version_h_name}"
|
||||
if [ -f "${version_h}" ]; then
|
||||
einfo "Discarding previously installed version.h to avoid collisions"
|
||||
addwrite "/${version_h_name}"
|
||||
rm -f "${version_h}"
|
||||
fi
|
||||
|
||||
kernel-2_src_install
|
||||
cd "${D}/usr/src/linux-${KV_FULL}"
|
||||
local oldarch=${ARCH}
|
||||
cp "${FILESDIR}/${P}-${ARCH}.config" .config || die "cannot copy kernel config"
|
||||
unset ARCH
|
||||
if ! use sources_standalone; then
|
||||
make modules_prepare || die "failed to run modules_prepare"
|
||||
rm .config || die "cannot remove .config"
|
||||
rm Makefile || die "cannot remove Makefile"
|
||||
rm include/linux/version.h || die "cannot remove include/linux/version.h"
|
||||
fi
|
||||
ARCH=${oldarch}
|
||||
|
||||
}
|
||||
24
sys-kernel/server-sources/server-sources-2.6.34.ebuild
Normal file
24
sys-kernel/server-sources/server-sources-2.6.34.ebuild
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_WANT_GENPATCHES=""
|
||||
K_GENPATCHES_VER=""
|
||||
K_SABPATCHES_VER="11"
|
||||
K_KERNEL_PATCH_VER="6"
|
||||
K_SABKERNEL_NAME="server"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
K_ONLY_SOURCES="1"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.34/x86-64-compat-test-rax-for-the-syscall-number-not-eax.patch
|
||||
${FILESDIR}/hotfixes/2.6.34/x86-64-compat-retruncate-rax-after-ia32-syscall-entry-tracing.patch
|
||||
${FILESDIR}/hotfixes/2.6.34/compat-make-compat_alloc_user_space-incorporate-the-access_ok.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel sources"
|
||||
RESTRICT="mirror"
|
||||
IUSE="sources_standalone"
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
sources_standalone? ( !=sys-kernel/linux-server-${PVR} )
|
||||
!sources_standalone? ( =sys-kernel/linux-server-${PVR} )"
|
||||
24
sys-kernel/server-sources/server-sources-2.6.35-r5.ebuild
Normal file
24
sys-kernel/server-sources/server-sources-2.6.35-r5.ebuild
Normal file
@@ -0,0 +1,24 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_WANT_GENPATCHES=""
|
||||
K_GENPATCHES_VER=""
|
||||
K_SABPATCHES_VER="9"
|
||||
K_KERNEL_PATCH_VER="3"
|
||||
K_SABKERNEL_NAME="server"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
K_ONLY_SOURCES="1"
|
||||
# Security patches for CVE-2010-3081, will be merged in next stable kernel release
|
||||
K_KERNEL_PATCH_HOTFIXES="${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-c41d68a513c71e35a14f66d71782d27a79a81ea6.patch
|
||||
${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-eefdca043e8391dcd719711716492063030b55ac.patch
|
||||
${FILESDIR}/hotfixes/2.6.35/linux-2.6.git-36d001c70d8a0144ac1d038f6876c484849a74de.patch"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel sources"
|
||||
RESTRICT="mirror"
|
||||
IUSE="sources_standalone"
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
sources_standalone? ( !=sys-kernel/linux-server-${PVR} )
|
||||
!sources_standalone? ( =sys-kernel/linux-server-${PVR} )"
|
||||
20
sys-kernel/server-sources/server-sources-2.6.35-r6.ebuild
Normal file
20
sys-kernel/server-sources/server-sources-2.6.35-r6.ebuild
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright 2004-2010 Sabayon Linux
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
ETYPE="sources"
|
||||
K_WANT_GENPATCHES=""
|
||||
K_GENPATCHES_VER=""
|
||||
K_SABPATCHES_VER="9"
|
||||
K_KERNEL_PATCH_VER="5"
|
||||
K_SABKERNEL_NAME="server"
|
||||
K_SABKERNEL_URI_CONFIG="yes"
|
||||
K_ONLY_SOURCES="1"
|
||||
inherit sabayon-kernel
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
DESCRIPTION="Official Sabayon Linux Server kernel sources"
|
||||
RESTRICT="mirror"
|
||||
IUSE="sources_standalone"
|
||||
|
||||
DEPEND="${DEPEND}
|
||||
sources_standalone? ( !=sys-kernel/linux-server-${PVR} )
|
||||
!sources_standalone? ( =sys-kernel/linux-server-${PVR} )"
|
||||
Reference in New Issue
Block a user