Re: [PATCH] compat_sys_read/write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Jul 2005 16:02:58 +0100 Christoph Hellwig <[email protected]> wrote:
>
> > And where were you a week ago when I asked if I should post this patch? 
> 
> A :-) Can't remember it at all, maybe you forgot that we mere mortals can't
> read [email protected] ?

Sorry about that, my omniscience must be slipping :-)

Anyway, here is the alternative I offered that was rejected by some (hi Andi :-))
and not particularly like by others ... (without the actual evdev.c fix)

Is this any more palatable to the wider community?
-- 
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/

diff -ruN linus/include/asm-ia64/compat.h linus-willy.3/include/asm-ia64/compat.h
--- linus/include/asm-ia64/compat.h	2005-06-27 16:08:06.000000000 +1000
+++ linus-willy.3/include/asm-ia64/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -4,6 +4,11 @@
  * Architecture specific compatibility types
  */
 #include <linux/types.h>
+#include <linux/sched.h>
+
+#include <asm/system.h>
+#include <asm/ptrace.h>
+#include <asm/processor.h>
 
 #define COMPAT_USER_HZ	100
 
@@ -196,4 +201,9 @@
 	return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len);
 }
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return IS_IA32_PROCESS(ia64_task_regs(t));
+}
+
 #endif /* _ASM_IA64_COMPAT_H */
diff -ruN linus/include/asm-mips/compat.h linus-willy.3/include/asm-mips/compat.h
--- linus/include/asm-mips/compat.h	2005-06-27 16:08:07.000000000 +1000
+++ linus-willy.3/include/asm-mips/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -4,7 +4,9 @@
  * Architecture specific compatibility types
  */
 #include <linux/types.h>
+#include <linux/sched.h>
 #include <asm/page.h>
+#include <asm/processor.h>
 
 #define COMPAT_USER_HZ	100
 
@@ -142,4 +144,9 @@
 #define __COMPAT_ENDIAN_SWAP__ 	1
 #endif
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return (t->thread.mflags & MF_ABI_MASK) == MF_O32;
+}
+
 #endif /* _ASM_COMPAT_H */
diff -ruN linus/include/asm-parisc/compat.h linus-willy.3/include/asm-parisc/compat.h
--- linus/include/asm-parisc/compat.h	2005-06-27 16:08:08.000000000 +1000
+++ linus-willy.3/include/asm-parisc/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -142,4 +142,9 @@
 	return (void __user *)regs->gr[30];
 }
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return personality(t->personality) == PER_LINUX32;
+}
+
 #endif /* _ASM_PARISC_COMPAT_H */
diff -ruN linus/include/asm-ppc64/compat.h linus-willy.3/include/asm-ppc64/compat.h
--- linus/include/asm-ppc64/compat.h	2005-06-27 16:08:08.000000000 +1000
+++ linus-willy.3/include/asm-ppc64/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -200,4 +200,9 @@
 	compat_ulong_t __unused6;
 };
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return test_tsk_thread_flag(t, TIF_32BIT);
+}
+
 #endif /* _ASM_PPC64_COMPAT_H */
diff -ruN linus/include/asm-s390/compat.h linus-willy.3/include/asm-s390/compat.h
--- linus/include/asm-s390/compat.h	2005-06-27 16:08:09.000000000 +1000
+++ linus-willy.3/include/asm-s390/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -195,4 +195,10 @@
 	compat_ulong_t __unused1;
 	compat_ulong_t __unused2;
 };
+
+static inline int is_compat_task(struct task_struct *t)
+{
+	return test_tsk_thread_flag(t, TIF_31BIT);
+}
+
 #endif /* _ASM_S390X_COMPAT_H */
diff -ruN linus/include/asm-sparc64/compat.h linus-willy.3/include/asm-sparc64/compat.h
--- linus/include/asm-sparc64/compat.h	2005-06-27 16:08:10.000000000 +1000
+++ linus-willy.3/include/asm-sparc64/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -4,6 +4,7 @@
  * Architecture specific compatibility types
  */
 #include <linux/types.h>
+#include <linux/sched.h>
 
 #define COMPAT_USER_HZ	100
 
@@ -233,4 +234,9 @@
 	unsigned int	__unused2;
 };
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return test_tsk_thread_flag(t, TIF_32BIT);
+}
+
 #endif /* _ASM_SPARC64_COMPAT_H */
diff -ruN linus/include/asm-x86_64/compat.h linus-willy.3/include/asm-x86_64/compat.h
--- linus/include/asm-x86_64/compat.h	2005-06-27 16:08:10.000000000 +1000
+++ linus-willy.3/include/asm-x86_64/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -202,4 +202,9 @@
 	return (void __user *)regs->rsp - len; 
 }
 
+static inline int is_compat_task(struct task_struct *t)
+{
+	return test_tsk_thread_flag(t, TIF_IA32);
+}
+
 #endif /* _ASM_X86_64_COMPAT_H */
diff -ruN linus/include/linux/compat.h linus-willy.3/include/linux/compat.h
--- linus/include/linux/compat.h	2005-06-27 16:08:11.000000000 +1000
+++ linus-willy.3/include/linux/compat.h	2005-06-27 18:06:35.000000000 +1000
@@ -158,5 +158,9 @@
 int get_compat_sigevent(struct sigevent *event,
 		const struct compat_sigevent __user *u_event);
 
+#else /* CONFIG_COMPAT */
+
+#define is_compat_task(x)	0
+
 #endif /* CONFIG_COMPAT */
 #endif /* _LINUX_COMPAT_H */

Attachment: pgpEnj8IGiRmu.pgp
Description: PGP signature


[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux