Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 337659 | Differences between
and this patch

Collapse All | Expand All

(-)linux-2.6.34.7.orig/arch/ia64/include/asm/compat.h (-1 / +1 lines)
Lines 199-205 ptr_to_compat(void __user *uptr) Link Here
199
}
199
}
200
200
201
static __inline__ void __user *
201
static __inline__ void __user *
202
compat_alloc_user_space (long len)
202
arch_compat_alloc_user_space (long len)
203
{
203
{
204
	struct pt_regs *regs = task_pt_regs(current);
204
	struct pt_regs *regs = task_pt_regs(current);
205
	return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
205
	return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
(-)linux-2.6.34.7.orig/arch/mips/include/asm/compat.h (-1 / +1 lines)
Lines 145-151 static inline compat_uptr_t ptr_to_compa Link Here
145
	return (u32)(unsigned long)uptr;
145
	return (u32)(unsigned long)uptr;
146
}
146
}
147
147
148
static inline void __user *compat_alloc_user_space(long len)
148
static inline void __user *arch_compat_alloc_user_space(long len)
149
{
149
{
150
	struct pt_regs *regs = (struct pt_regs *)
150
	struct pt_regs *regs = (struct pt_regs *)
151
		((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
151
		((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
(-)linux-2.6.34.7.orig/arch/parisc/include/asm/compat.h (-1 / +1 lines)
Lines 147-153 static inline compat_uptr_t ptr_to_compa Link Here
147
	return (u32)(unsigned long)uptr;
147
	return (u32)(unsigned long)uptr;
148
}
148
}
149
149
150
static __inline__ void __user *compat_alloc_user_space(long len)
150
static __inline__ void __user *arch_compat_alloc_user_space(long len)
151
{
151
{
152
	struct pt_regs *regs = &current->thread.regs;
152
	struct pt_regs *regs = &current->thread.regs;
153
	return (void __user *)regs->gr[30];
153
	return (void __user *)regs->gr[30];
(-)linux-2.6.34.7.orig/arch/powerpc/include/asm/compat.h (-1 / +1 lines)
Lines 134-140 static inline compat_uptr_t ptr_to_compa Link Here
134
	return (u32)(unsigned long)uptr;
134
	return (u32)(unsigned long)uptr;
135
}
135
}
136
136
137
static inline void __user *compat_alloc_user_space(long len)
137
static inline void __user *arch_compat_alloc_user_space(long len)
138
{
138
{
139
	struct pt_regs *regs = current->thread.regs;
139
	struct pt_regs *regs = current->thread.regs;
140
	unsigned long usp = regs->gpr[1];
140
	unsigned long usp = regs->gpr[1];
(-)linux-2.6.34.7.orig/arch/s390/include/asm/compat.h (-1 / +1 lines)
Lines 181-187 static inline int is_compat_task(void) Link Here
181
181
182
#endif
182
#endif
183
183
184
static inline void __user *compat_alloc_user_space(long len)
184
static inline void __user *arch_compat_alloc_user_space(long len)
185
{
185
{
186
	unsigned long stack;
186
	unsigned long stack;
187
187
(-)linux-2.6.34.7.orig/arch/sparc/include/asm/compat.h (-1 / +1 lines)
Lines 167-173 static inline compat_uptr_t ptr_to_compa Link Here
167
	return (u32)(unsigned long)uptr;
167
	return (u32)(unsigned long)uptr;
168
}
168
}
169
169
170
static inline void __user *compat_alloc_user_space(long len)
170
static inline void __user *arch_compat_alloc_user_space(long len)
171
{
171
{
172
	struct pt_regs *regs = current_thread_info()->kregs;
172
	struct pt_regs *regs = current_thread_info()->kregs;
173
	unsigned long usp = regs->u_regs[UREG_I6];
173
	unsigned long usp = regs->u_regs[UREG_I6];
(-)linux-2.6.34.7.orig/arch/x86/include/asm/compat.h (-1 / +1 lines)
Lines 205-211 static inline compat_uptr_t ptr_to_compa Link Here
205
	return (u32)(unsigned long)uptr;
205
	return (u32)(unsigned long)uptr;
206
}
206
}
207
207
208
static inline void __user *compat_alloc_user_space(long len)
208
static inline void __user *arch_compat_alloc_user_space(long len)
209
{
209
{
210
	struct pt_regs *regs = task_pt_regs(current);
210
	struct pt_regs *regs = task_pt_regs(current);
211
	return (void __user *)regs->sp - len;
211
	return (void __user *)regs->sp - len;
(-)linux-2.6.34.7.orig/include/linux/compat.h (+3 lines)
Lines 360-364 extern ssize_t compat_rw_copy_check_uvec Link Here
360
		const struct compat_iovec __user *uvector, unsigned long nr_segs,
360
		const struct compat_iovec __user *uvector, unsigned long nr_segs,
361
		unsigned long fast_segs, struct iovec *fast_pointer,
361
		unsigned long fast_segs, struct iovec *fast_pointer,
362
		struct iovec **ret_pointer);
362
		struct iovec **ret_pointer);
363
364
extern void __user *compat_alloc_user_space(unsigned long len);
365
363
#endif /* CONFIG_COMPAT */
366
#endif /* CONFIG_COMPAT */
364
#endif /* _LINUX_COMPAT_H */
367
#endif /* _LINUX_COMPAT_H */
(-)linux-2.6.34.7.orig/kernel/compat.c (+22 lines)
Lines 25-30 Link Here
25
#include <linux/posix-timers.h>
25
#include <linux/posix-timers.h>
26
#include <linux/times.h>
26
#include <linux/times.h>
27
#include <linux/ptrace.h>
27
#include <linux/ptrace.h>
28
#include <linux/module.h>
28
#include <linux/gfp.h>
29
#include <linux/gfp.h>
29
30
30
#include <asm/uaccess.h>
31
#include <asm/uaccess.h>
Lines 1137-1139 compat_sys_sysinfo(struct compat_sysinfo Link Here
1137
1138
1138
	return 0;
1139
	return 0;
1139
}
1140
}
1141
1142
/*
1143
 * Allocate user-space memory for the duration of a single system call,
1144
 * in order to marshall parameters inside a compat thunk.
1145
 */
1146
void __user *compat_alloc_user_space(unsigned long len)
1147
{
1148
	void __user *ptr;
1149
1150
	/* If len would occupy more than half of the entire compat space... */
1151
	if (unlikely(len > (((compat_uptr_t)~0) >> 1)))
1152
		return NULL;
1153
1154
	ptr = arch_compat_alloc_user_space(len);
1155
1156
	if (unlikely(!access_ok(VERIFY_WRITE, ptr, len)))
1157
		return NULL;
1158
1159
	return ptr;
1160
}
1161
EXPORT_SYMBOL_GPL(compat_alloc_user_space);

Return to bug 337659