Request to add IA32 syscall 270 (tgkill)
linux-ia64,
Running 2.6.0 from linux-ia64-2.5 bk tree,
"IA32 syscall #270 issued, maybe we should implement it"
Would anyone be kind enough to add tgkill (#270) to the IA32 syscall emulation? sys_tgkill looks safe enough (3 int parameters) that it doesn't need a 32-bit wrapper?
Many thanks,
*Goes back to testing signal code*
Cheers,
Carlos.
Quoted 9 lines · Carlos O'Donell
linux-ia64,
Running 2.6.0 from linux-ia64-2.5 bk tree,
"IA32 syscall #270 issued, maybe we should implement it"
Would anyone be kind enough to add tgkill (#270) to the IA32 syscall emulation?
sys_tgkilllooks safe enough (3 int parameters) that it doesn't need a 32-bit wrapper?
Please try the attached patches. These patches add the missing ia32 syscalls to 2.6.
-Arun
fs/compat.c +101 -0
@@ -554,3 +554,104 @@return compat_sys_fcntl64 (fd, cmd, arg); } +extern asmlinkage long sys_io_setup (unsigned nr_reqs,aio_context_t *ctx); + +asmlinkage long compat_sys_io_setup (unsigned nr_reqs,u32 *ctx32p) +{ +long ret; +aio_context_t ctx64; +compat_uptr_t uptr; + +mm_segment_t oldfs =get_fs (); +if (unlikely (get_user (uptr, ctx32p))) +return -EFAULT ; + + ctx64 = (aio_context_t )compat_ptr (uptr); +set_fs (KERNEL_DS ); + ret =sys_io_setup (nr_reqs, &ctx64); +set_fs (oldfs); +/* truncating is ok because it's a user address */ +if (!ret) + ret =put_user ((u32 ) ctx64, ctx32p); +return ret; +} + +extern asmlinkage long sys_io_getevents (aio_context_t ctx_id, +long min_nr, +long nr, +struct io_event *events, +struct timespec *timeout); + +asmlinkage long compat_sys_io_getevents (aio_context_t ctx_id, +unsigned long min_nr, +unsigned long nr, +struct io_event *events, +struct compat_timespec *timeout) +{ +long ret; +struct timespec t; +struct timespec *ut =NULL ; + + ret = -EFAULT ; +if (unlikely (!access_ok (VERIFY_WRITE , events, + nr *sizeof (struct io_event )))) + goto out; +if (timeout) { +if (get_compat_timespec (&t, timeout)) + goto out; + + ut =compat_alloc_user_space (sizeof (*ut)); +if (copy_to_user (ut, &t,sizeof (t)) ) + goto out; + } + ret =sys_io_getevents (ctx_id, min_nr, nr, events, ut); +if (!ret && timeout &&put_compat_timespec (&t, timeout)) +return -EFAULT ; +out: +return ret; +} + +extern asmlinkage long sys_io_submit (aio_context_t ,long , +struct iocb __user **); + +static inline long +copy_iocb (long nr,u32 *ptr32,u64 *ptr64) +{ +compat_uptr_t uptr; +long ret; +int i; + + ret = -EFAULT ; +for (i =0 ; i < nr; ++i) { +if (get_user (uptr, ptr32 + i)) + goto out; +if (put_user ((u64 )compat_ptr (uptr), ptr64 + i)) + goto out; + } + ret =0 ; +out: +return ret; +} + +#define MAX_AIO_SUBMITS (PAGE_SIZE/sizeof(struct iocb *)) + +asmlinkage long +compat_sys_io_submit (aio_context_t ctx_id,int nr,u32 *iocb) +{ +struct iocb **iocb64; +long ret; + +if (unlikely (nr <0 )) +return -EINVAL ; + +if (nr >MAX_AIO_SUBMITS ) + nr =MAX_AIO_SUBMITS ; + + iocb64 =compat_alloc_user_space (nr *sizeof (*iocb64)); + ret =copy_iocb (nr, iocb, (u64 *) iocb64); +if (ret) + goto out; + ret =sys_io_submit (ctx_id, nr, iocb64); +out: +return ret; +}
===== arch/ia64/ia32/ia32_entry.S 1.30 vs edited =====
arch/ia64/ia32/ia32_entry.S +35 -30
87 lines not on this page · raw message
===== arch/ia64/ia32/ia32priv.h 1.8 vs edited =====
arch/ia64/ia32/ia32priv.h +13 -0
@@ -251,6 +251,19 @@ } _sifields; } siginfo_t32; +typedef struct sigevent32 { +sigval_t32 sigev_value; +int sigev_signo; +int sigev_notify; +union { +int _pad[SIGEV_PAD_SIZE32 ]; +struct { +u32 _function; +u32 _attribute;/* really pthread_attr_t */ + } _sigev_thread; + } _sigev_un; +}sigevent_t32 ; +struct old_linux32_dirent {u32 d_ino;u32 d_offset;
===== arch/ia64/ia32/sys_ia32.c 1.83 vs edited =====
arch/ia64/ia32/sys_ia32.c +48 -0
54 lines not on this page · raw message
===== arch/ia64/kernel/ivt.S 1.23 vs edited =====
arch/ia64/kernel/ivt.S +1 -1
@@ -1513,7 +1513,7 @@ alloc r15=ar.pfs,0,0,6,0 // must first in an insn group ;; ld4 r8=[r14],8 // r8 == eax (syscall number) - mov r15=270 // number of entries in ia32 system call table + mov r15=275 // number of entries in ia32 system call table ;; cmp.ltu.unc p6,p7=r8,r15 ld4 out1=[r14],8 // r9 == ecx
===== include/asm-ia64/siginfo.h 1.14 vs edited =====
include/asm-ia64/siginfo.h +1 -1
@@ -9,7 +9,7 @@#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 4)#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 4) - +#define SIGEV_PAD_SIZE32 ((SIGEV_MAX_SIZE/sizeof(int)) - 3)#define HAVE_ARCH_SIGINFO_T #define HAVE_ARCH_COPY_SIGINFO #define HAVE_ARCH_COPY_SIGINFO_TO_USER