ioctl32 consolidation -- call for testing
Hi!
This is next version of ioctl32 consolidation. At one point it compiled on x86-64 and sparc64. I'm not 100% sure it still does...
Could you try to apply it on your architecture, fix whatever breakage it causes, and submit patch back to me?
ia64 has very different ioctl32 emulation (and very short). What is going on there? Also not all architectures knew about register_ioctl32_translation. Ouch.
Pavel
arch/ia64/ia32/ia32_entry.S +1 -1
@@ -252,7 +252,7 @@ data8 sys_acct data8 sys_umount /* recycled never used phys( */ data8 sys32_ni_syscall /* old lock syscall holder */ - data8 sys32_ioctl + data8 compat_ioctl data8 sys32_fcntl /* 55 */ data8 sys32_ni_syscall /* old mpx syscall holder */ data8 sys_setpgid
arch/ia64/ia32/ia32_ioctl.c +0 -218
221 lines not on this page · raw message
arch/mips64/kernel/ioctl32.c +0 -67
70 lines not on this page · raw message
arch/mips64/kernel/scall_o32.S +1 -1
@@ -287,7 +287,7 @@ sys sys_acct 0 sys sys_umount 2 sys sys_ni_syscall 0 - sys sys32_ioctl 3 + sys compat_ioctl 3 sys sys32_fcntl 3 /* 4055 */ sys sys_ni_syscall 2 sys sys_setpgid 2
arch/parisc/kernel/ioctl32.c +0 -143
146 lines not on this page · raw message
arch/ppc64/kernel/ioctl32.c +0 -126
129 lines not on this page · raw message
arch/ppc64/kernel/misc.S +1 -1
@@ -556,7 +556,7 @@ .llong .sys_acct .llong .sys32_umount .llong .sys_ni_syscall /* old lock syscall */ - .llong .sys32_ioctl + .llong .compat_ioctl .llong .sys32_fcntl /* 55 */ .llong .sys_ni_syscall /* old mpx syscall */ .llong .sys32_setpgid
arch/s390x/kernel/ioctl32.c +0 -110
113 lines not on this page · raw message
arch/s390x/kernel/wrapper32.S +1 -1
@@ -225,7 +225,7 @@ llgfr %r2,%r2 # unsigned int llgfr %r3,%r3 # unsigned int llgfr %r4,%r4 # unsigned int - jg sys32_ioctl # branch to system call + jg compat_ioctl # branch to system call .globl sys32_fcntl_wrapper sys32_fcntl_wrapper:
arch/sparc64/kernel/ioctl32.c +3 -140
160 lines not on this page · raw message
arch/sparc64/kernel/sparc64_ksyms.c +2 -2
@@ -89,7 +89,7 @@extern int svr4_getcontext (svr4_ucontext_t *uc,struct pt_regs *regs);extern int svr4_setcontext (svr4_ucontext_t *uc,struct pt_regs *regs);extern int sys_ioctl (unsigned int fd,unsigned int cmd,unsigned long arg); -extern int sys32_ioctl (unsigned int fd,unsigned int cmd,u32 arg); +extern int compat_ioctl (unsigned int fd,unsigned int cmd,u32 arg);extern int (*handle_mathemu)(struct pt_regs *,struct fpustate *);extern long sparc32_open (const char * filename,int flags,int mode);extern int register_ioctl32_conversion (unsigned int cmd,int (*handler)(unsigned int ,unsigned int ,unsigned long ,struct file *));
@@ -316,7 +316,7 @@EXPORT_SYMBOL (svr4_setcontext);EXPORT_SYMBOL (prom_cpu_nodes);EXPORT_SYMBOL (sys_ioctl); -EXPORT_SYMBOL (sys32_ioctl); +EXPORT_SYMBOL (compat_ioctl);EXPORT_SYMBOL (sparc32_open);#endif
arch/sparc64/kernel/sunos_ioctl32.c +26 -26
135 lines not on this page · raw message
arch/sparc64/kernel/systbls.S +1 -1
@@ -29,7 +29,7 @@ .word sys_chown, sys_sync, sys_kill, compat_sys_newstat, sys32_sendfile /*40*/ .word compat_sys_newlstat, sys_dup, sys_pipe, compat_sys_times, sys_getuid .word sys_umount, sys32_setgid16, sys32_getgid16, sys_signal, sys32_geteuid16 -/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, sys32_ioctl +/*50*/ .word sys32_getegid16, sys_acct, sys_nis_syscall, sys_getgid, compat_ioctl .word sys_reboot, sys32_mmap2, sys_symlink, sys_readlink, sys32_execve /*60*/ .word sys_umask, sys_chroot, compat_sys_newfstat, sys_fstat64, sys_getpagesize .word sys_msync, sys_vfork, sys32_pread64, sys32_pwrite64, sys_geteuid
arch/sparc64/solaris/ioctl.c +24 -23
91 lines not on this page · raw message
arch/sparc64/solaris/timod.c +0 -2
@@ -29,8 +29,6 @@ extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd,unsigned long arg); -extern asmlinkage int sys32_ioctl(unsigned int fd, unsigned int cmd, -u32 arg); asmlinkage int solaris_ioctl(unsigned int fd, unsigned int cmd, u32 arg);static spinlock_t timod_pagelock =SPIN_LOCK_UNLOCKED ;
arch/x86_64/ia32/ia32_ioctl.c +3 -223
245 lines not on this page · raw message
arch/x86_64/ia32/ia32entry.S +1 -1
@@ -254,7 +254,7 @@ .quad sys_acct .quad sys_umount /* new_umount */ .quad ni_syscall /* old lock syscall holder */ - .quad sys32_ioctl + .quad compat_ioctl .quad sys32_fcntl64 /* 55 */ .quad ni_syscall /* old mpx syscall holder */ .quad sys_setpgid
include/linux/ioctl32.h +5 -0
@@ -19,5 +19,10 @@extern int unregister_ioctl32_conversion (unsigned int cmd); +struct ioctl_trans { +unsigned long cmd; +int (*handler)(unsigned int ,unsigned int ,unsigned long ,struct file * filp); +struct ioctl_trans *next; +};#endif
kernel/compat.c +222 -0
231 lines not on this page · raw message
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
Quoted 11 lines · Pavel Machek
Hi!
This is next version of ioctl32 consolidation. At one point it compiled on x86-64 and sparc64. I'm not 100% sure it still does...
Could you try to apply it on your architecture, fix whatever breakage it causes, and submit patch back to me?
ia64 has very different ioctl32 emulation (and very short). What is going on there? Also not all architectures knew about
register_ioctl32_translation. Ouch.
FYI, whatever changes you made to sparc64's ioctl32.c broke. Doesn't appear that any of the 32bit ioctl's are registered, so the system never boots to usermode fully (since it's completely 32bit).
Not sure I'll be able to look into the reason, but it's probably simple.
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
Quoted 11 lines · Pavel Machek
Hi!
This is next version of ioctl32 consolidation. At one point it compiled on x86-64 and sparc64. I'm not 100% sure it still does...
Could you try to apply it on your architecture, fix whatever breakage it causes, and submit patch back to me?
ia64 has very different ioctl32 emulation (and very short). What is going on there? Also not all architectures knew about
register_ioctl32_translation. Ouch.
Ok, so it was simple. Do you mind a patch that applies over yours?
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
Quoted 6 lines · Ben Collins
Quoted 5 lines · Pavel Machek
Hi!
This is next version of ioctl32 consolidation. At one point it compiled on x86-64 and sparc64. I'm not 100% sure it still does...
Quoted 9 lines
Quoted 6 lines
Could you try to apply it on your architecture, fix whatever breakage it causes, and submit patch back to me?
ia64 has very different ioctl32 emulation (and very short). What is going on there? Also not all architectures knew about
register_ioctl32_translation. Ouch.Ok, so it was simple. Do you mind a patch that applies over yours?
Here it is. Sparc64's macros for ioctl32's assumed that cmd was u_int instead of u_long. This look ok to you, Dave?
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:27:39 -0500
Here it is. Sparc64's macros for ioctl32's assumed that cmd was u_int instead of u_long. This look ok to you, Dave?
We would love to see that patch :-)
Quoted 7 lines · David S. Miller
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:27:39 -0500Here it is. Sparc64's macros for ioctl32's assumed that cmd was
u_intinstead ofu_long. This look ok to you, Dave?We would love to see that patch :-)
It was real small...so small that it slipped through mutt's open() call and never got attached :)
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
sparc64/kernel/ioctl32.c renamed from sparc64/kernel/ioctl32.c~ +9 -4
@@ -11,6 +11,7 @@#include <linux/config.h> #include <linux/types.h> #include <linux/compat.h> +#include <linux/ioctl32.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/smp.h>
@@ -4274,10 +4275,14 @@#define BNEPGETCONNLIST _IOR('B', 210, int)#define BNEPGETCONNINFO _IOR('B', 211, int) -#define COMPATIBLE_IOCTL (cmd) asm volatile(".word %0, sys_ioctl, 0" : : "i" (cmd)); -#define HANDLE_IOCTL (cmd,handler) asm volatile(".word %0, %1, 0" : : "i" (cmd), "i" (handler)); -#define IOCTL_TABLE_START void ioctl32_foo(void) { asm volatile(".data\n.global ioctl_start\nioctl_start:"); -#define IOCTL_TABLE_END asm volatile("\n.global ioctl_end\nioctl_end:\n\t.previous"); } +typedef int (*ioctl32_handler_t )(unsigned int ,unsigned int ,unsigned long ,struct file *); + +#define COMPATIBLE_IOCTL (cmd) HANDLE_IOCTL((cmd),sys_ioctl) +#define HANDLE_IOCTL (cmd,handler) { (cmd), (ioctl32_handler_t)(handler), NULL }, +#define IOCTL_TABLE_START \ + struct ioctl_trans ioctl_start[] = { +#define IOCTL_TABLE_END \ + }; struct ioctl_trans ioctl_end[0];IOCTL_TABLE_START /* List here exlicitly which ioctl's are known to have
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:34:40 -0500
Quoted 7 lines · David S. Miller
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:27:39 -0500Here it is. Sparc64's macros for ioctl32's assumed that cmd was
u_intinstead ofu_long. This look ok to you, Dave?We would love to see that patch :-)
It was real small...so small that it slipped through mutt's open() call and never got attached :)
Well, you just doubled the size of the table on sparc64. I don't know if I like that.
Quoted 10 lines · David S. Miller
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:34:40 -0500Quoted 6 lines · David S. Miller
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:27:39 -0500Here it is. Sparc64's macros for ioctl32's assumed that cmd was
u_intinstead ofu_long. This look ok to you, Dave?
Quoted 7 lines
Quoted 1 line
We would love to see that patch :-)
It was real small...so small that it slipped through mutt's
open()call and never got attached :)Well, you just doubled the size of the table on sparc64. I don't know if I like that.
Not much of a way around it. Might seem like a big hit now (I think it's like 4k extra), but once these ioctl's start moving into their own driver, and out of arch/*/ioctl32.c, you'll start to get savings anyway.
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:50:44 -0500
Quoted 2 lines · David S. Miller
Well, you just doubled the size of the table on sparc64. I don't know if I like that.
Not much of a way around it.
Such problems are only in your mind. :-)
What's wrong with defining the type and accessor macros in include/asm/compat.h?
Quoted 7 lines · David S. Miller
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:50:44 -0500Quoted 2 lines · David S. Miller
Well, you just doubled the size of the table on sparc64. I don't know if I like that.
Quoted 6 lines
Not much of a way around it.
Such problems are only in your mind. :-)
What's wrong with defining the type and accessor macros in
include/asm/compat.h?
One thing I am just now wondering is why struct ioctl_trans defines cmd as an unsigned long instead of just unsigned int. That adds an uneeded bit of space to the array.
As for your suggestion, sounds great, but I'll leave it to Pavel :)
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
Hi!
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Well, you just doubled the size of the table on sparc64. I don't know if I like that.
Not much of a way around it.
Quoted 8 lines
Quoted 4 lines
Such problems are only in your mind. :-)
What's wrong with defining the type and accessor macros in
include/asm/compat.h?One thing I am just now wondering is why struct
ioctl_transdefines cmd as an unsigned long instead of just unsigned int. That adds an uneeded bit of space to the array.
Do you think so?
cmd probably could be u32 (since it is ioctl32 after all), but I doubt it matters, as two following entries are pointers so it looks to me like it is going to be lost by alignment, anyway.
Quoted 1 line
As for your suggestion, sounds great, but I'll leave it to Pavel :)
First things first, patch probably still breaks all other architectures than x86-64 and sparc64....
Pavel
Signature · 2 lines
Horseback riding is like software... ...vgf orggre jura vgf serr.
Quoted 9 lines
Quoted 3 lines
One thing I am just now wondering is why struct
ioctl_transdefines cmd as an unsigned long instead of just unsigned int. That adds an uneeded bit of space to the array.Do you think so?
cmd probably could be u32 (since it is ioctl32 after all), but I doubt it matters, as two following entries are pointers so it looks to me like it is going to be lost by alignment, anyway.
The thing is, on sparc64, these pointers were cast to u32's, so the struct was only 12 bytes instead of the current 24. Dave's concern is the doubling of this pretty large array.
What you could do is allow each architecture to define the ioctl_trans struct, and also macros for acessing and setting each member. That would probably satisfy this special cases.
Quoted 4 lines
Quoted 1 line
As for your suggestion, sounds great, but I'll leave it to Pavel :)
First things first, patch probably still breaks all other architectures than x86-64 and sparc64....
If you make the change that Dave suggests, it will be fixed :) Even with this patch, sparc64 is still broken for modules (like alsa and ieee1394) that register conversions on load.
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ Deqo - http://www.deqo.com/
From: Pavel Machek <[email protected]>
Date: Fri, 28 Feb 2003 14:23:31 +0100
cmd probably could be u32 (since it is ioctl32 after all), but I doubt it matters, as two following entries are pointers so it looks to me like it is going to be lost by alignment, anyway.
These pointers can (and WERE!) 32-bit on sparc64, so we wouldn't have the alignment problem there.
All kernel text on sparc64 (even in modules) occur in the lower 32-bits of the address apce.
Pavel Machek
AppliedHi!
Quoted 10 lines
Quoted 7 lines
From: Ben Collins <[email protected]>
Date: Thu, 27 Feb 2003 15:27:39 -0500Here it is. Sparc64's macros for ioctl32's assumed that cmd was
u_intinstead ofu_long. This look ok to you, Dave?We would love to see that patch :-)
It was real small...so small that it slipped through mutt's
open()call and never got attached :)
Applied.
Pavel
Signature · 2 lines
Horseback riding is like software... ...vgf orggre jura vgf serr.