Commit eeb3e3b9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ppc/ppc64: Add posix message queue syscalls

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

This patch adds the posix message queue syscalls to ppc32 and 64 and fixes
our implementation of compat copy siginfo to 32 bits userland which wasn't
using the si_code but still doing a switch/case on the signal number.

I also reserved some syscalls for the numa API
parent d5b1f484
......@@ -1372,4 +1372,16 @@ _GLOBAL(sys_call_table)
.long sys_statfs64
.long sys_fstatfs64
.long ppc_fadvise64_64
.long sys_ni_syscall /* 255 - rtas (used on ppc64) */
.long sys_ni_syscall /* 255 - rtas (used on ppc64) */
.long sys_ni_syscall /* 256 reserved for sys_debug_setcontext */
.long sys_ni_syscall /* 257 reserved for vserver */
.long sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
.long sys_ni_syscall /* 259 reserved for new sys_mbind */
.long sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
.long sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */
.long sys_mq_open
.long sys_mq_unlink
.long sys_mq_timedsend
.long sys_mq_timedreceive /* 265 */
.long sys_mq_notify
.long sys_mq_getsetattr
......@@ -828,6 +828,18 @@ _GLOBAL(sys_call_table32)
.llong .compat_fstatfs64
.llong .ppc32_fadvise64_64 /* 32bit only fadvise64_64 */
.llong .ppc_rtas /* 255 */
.llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */
.llong .sys_ni_syscall /* 257 reserved for vserver */
.llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
.llong .sys_ni_syscall /* 259 reserved for new sys_mbind */
.llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
.llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */
.llong .compat_sys_mq_open
.llong .sys_mq_unlink
.llong .compat_sys_mq_timedsend
.llong .compat_sys_mq_timedreceive /* 265 */
.llong .compat_sys_mq_notify
.llong .compat_sys_mq_getsetattr
.balign 8
_GLOBAL(sys_call_table)
......@@ -1087,3 +1099,15 @@ _GLOBAL(sys_call_table)
.llong .sys_fstatfs64
.llong .sys_ni_syscall /* 32bit only fadvise64_64 */
.llong .ppc_rtas /* 255 */
.llong .sys_ni_syscall /* 256 reserved for sys_debug_setcontext */
.llong .sys_ni_syscall /* 257 reserved for vserver */
.llong .sys_ni_syscall /* 258 reserved for new sys_remap_file_pages */
.llong .sys_ni_syscall /* 259 reserved for new sys_mbind */
.llong .sys_ni_syscall /* 260 reserved for new sys_get_mempolicy */
.llong .sys_ni_syscall /* 261 reserved for new sys_set_mempolicy */
.llong .sys_mq_open
.llong .sys_mq_unlink
.llong .sys_mq_timedsend
.llong .sys_mq_timedreceive /* 265 */
.llong .sys_mq_notify
.llong .sys_mq_getsetattr
......@@ -437,37 +437,46 @@ static long copy_siginfo_to_user32(compat_siginfo_t *d, siginfo_t *s)
if (!access_ok (VERIFY_WRITE, d, sizeof(*d)))
return -EFAULT;
/* If you change siginfo_t structure, please be sure
* this code is fixed accordingly.
* It should never copy any pad contained in the structure
* to avoid security leaks, but must copy the generic
* 3 ints plus the relevant union member.
* This routine must convert siginfo from 64bit to 32bit as well
* at the same time.
*/
err = __put_user(s->si_signo, &d->si_signo);
err |= __put_user(s->si_errno, &d->si_errno);
err |= __put_user((short)s->si_code, &d->si_code);
if (s->si_signo >= SIGRTMIN) {
if (s->si_code < 0)
err |= __copy_to_user(&d->_sifields._pad, &s->_sifields._pad,
SI_PAD_SIZE32);
else switch(s->si_code >> 16) {
case __SI_CHLD >> 16:
err |= __put_user(s->si_pid, &d->si_pid);
err |= __put_user(s->si_uid, &d->si_uid);
err |= __put_user(s->si_utime, &d->si_utime);
err |= __put_user(s->si_stime, &d->si_stime);
err |= __put_user(s->si_status, &d->si_status);
break;
case __SI_FAULT >> 16:
err |= __put_user((unsigned int)(unsigned long)s->si_addr,
&d->si_addr);
break;
case __SI_POLL >> 16:
case __SI_TIMER >> 16:
err |= __put_user(s->si_band, &d->si_band);
err |= __put_user(s->si_fd, &d->si_fd);
break;
case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ >> 16:
err |= __put_user(s->si_int, &d->si_int);
} else {
switch (s->si_signo) {
/* XXX: What about POSIX1.b timers */
case SIGCHLD:
err |= __put_user(s->si_pid, &d->si_pid);
err |= __put_user(s->si_status, &d->si_status);
err |= __put_user(s->si_utime, &d->si_utime);
err |= __put_user(s->si_stime, &d->si_stime);
break;
case SIGSEGV:
case SIGBUS:
case SIGFPE:
case SIGILL:
err |= __put_user((long)(s->si_addr), &d->si_addr);
break;
case SIGPOLL:
err |= __put_user(s->si_band, &d->si_band);
err |= __put_user(s->si_fd, &d->si_fd);
break;
default:
err |= __put_user(s->si_pid, &d->si_pid);
err |= __put_user(s->si_uid, &d->si_uid);
break;
}
/* fallthrough */
case __SI_KILL >> 16:
default:
err |= __put_user(s->si_pid, &d->si_pid);
err |= __put_user(s->si_uid, &d->si_uid);
break;
}
return err;
}
......
......@@ -260,8 +260,20 @@
#define __NR_fstatfs64 253
#define __NR_fadvise64_64 254
#define __NR_rtas 255
/* Number 256 is reserved for sys_debug_setcontext */
/* Number 257 is reserved for vserver */
/* Number 258 is reserved for new sys_remap_file_pages */
/* Number 259 is reserved for new sys_mbind */
/* Number 260 is reserved for new sys_get_mempolicy */
/* Number 261 is reserved for new sys_set_mempolicy */
#define __NR_mq_open 262
#define __NR_mq_unlink 263
#define __NR_mq_timedsend 264
#define __NR_mq_timedreceive 265
#define __NR_mq_notify 266
#define __NR_mq_getsetattr 267
#define __NR_syscalls 256
#define __NR_syscalls 268
#define __NR(n) #n
......
......@@ -266,8 +266,20 @@
#define __NR_fstatfs64 253
#define __NR_fadvise64_64 254
#define __NR_rtas 255
/* Number 256 is reserved for sys_debug_setcontext */
/* Number 257 is reserved for vserver */
/* Number 258 is reserved for new sys_remap_file_pages */
/* Number 259 is reserved for new sys_mbind */
/* Number 260 is reserved for new sys_get_mempolicy */
/* Number 261 is reserved for new sys_set_mempolicy */
#define __NR_mq_open 262
#define __NR_mq_unlink 263
#define __NR_mq_timedsend 264
#define __NR_mq_timedreceive 265
#define __NR_mq_notify 266
#define __NR_mq_getsetattr 267
#define __NR_syscalls 256
#define __NR_syscalls 268
#ifdef __KERNEL__
#define NR_syscalls __NR_syscalls
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment