Commit 8886bdb0 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix mq 32-bit compatibility

From: Jakub Jelinek <jakub@redhat.com>

The first change removes just a useless put_user (si_int and si_ptr are
part of the same union, si_ptr is on all arches covering whole union), the
rest is fixes for signal handling of SI_MESGQ.
parent 4f990f49
...@@ -114,8 +114,8 @@ copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from) ...@@ -114,8 +114,8 @@ copy_siginfo_from_user32 (siginfo_t *to, siginfo_t32 *from)
err |= __get_user(to->si_band, &from->si_band); err |= __get_user(to->si_band, &from->si_band);
err |= __get_user(to->si_fd, &from->si_fd); err |= __get_user(to->si_fd, &from->si_fd);
break; break;
case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: case __SI_MESGQ >> 16:
err |= __get_user(to->si_pid, &from->si_pid); err |= __get_user(to->si_pid, &from->si_pid);
err |= __get_user(to->si_uid, &from->si_uid); err |= __get_user(to->si_uid, &from->si_uid);
err |= __get_user(to->si_int, &from->si_int); err |= __get_user(to->si_int, &from->si_int);
......
...@@ -358,8 +358,8 @@ static int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from) ...@@ -358,8 +358,8 @@ static int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
err |= __put_user(from->si_band, &to->si_band); err |= __put_user(from->si_band, &to->si_band);
err |= __put_user(from->si_fd, &to->si_fd); err |= __put_user(from->si_fd, &to->si_fd);
break; break;
case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: case __SI_MESGQ >> 16:
err |= __put_user(from->si_pid, &to->si_pid); err |= __put_user(from->si_pid, &to->si_pid);
err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_int, &to->si_int); err |= __put_user(from->si_int, &to->si_int);
......
...@@ -74,8 +74,8 @@ int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from) ...@@ -74,8 +74,8 @@ int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE); err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
else { else {
switch (from->si_code >> 16) { switch (from->si_code >> 16) {
case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: case __SI_MESGQ >> 16:
err |= __put_user(from->si_int, &to->si_int); err |= __put_user(from->si_int, &to->si_int);
/* fallthrough */ /* fallthrough */
case __SI_KILL >> 16: case __SI_KILL >> 16:
......
...@@ -129,8 +129,8 @@ int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from) ...@@ -129,8 +129,8 @@ int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from)
err |= __put_user(from->si_trapno, &to->si_trapno); err |= __put_user(from->si_trapno, &to->si_trapno);
err |= __put_user((long)from->si_addr, &to->si_addr); err |= __put_user((long)from->si_addr, &to->si_addr);
break; break;
case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: case __SI_MESGQ >> 16:
err |= __put_user(from->si_pid, &to->si_pid); err |= __put_user(from->si_pid, &to->si_pid);
err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_int, &to->si_int); err |= __put_user(from->si_int, &to->si_int);
......
...@@ -85,8 +85,8 @@ int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from) ...@@ -85,8 +85,8 @@ int ia32_copy_siginfo_to_user(siginfo_t32 __user *to, siginfo_t *from)
err |= __put_user(from->si_overrun, &to->si_overrun); err |= __put_user(from->si_overrun, &to->si_overrun);
err |= __put_user((u32)(u64)from->si_ptr, &to->si_ptr); err |= __put_user((u32)(u64)from->si_ptr, &to->si_ptr);
break; break;
case __SI_RT: /* This is not generated by the kernel as of now. */ case __SI_RT >> 16: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: case __SI_MESGQ >> 16:
err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_int, &to->si_int); err |= __put_user(from->si_int, &to->si_int);
break; break;
......
...@@ -175,7 +175,7 @@ typedef struct siginfo32 { ...@@ -175,7 +175,7 @@ typedef struct siginfo32 {
#undef SI_MESGQ #undef SI_MESGQ
#define SI_ASYNCIO -2 /* sent by AIO completion */ #define SI_ASYNCIO -2 /* sent by AIO completion */
#define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */ #define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
#define SI_MESGQ -4 /* sent by real time mesq state change */ #define SI_MESGQ __SI_CODE(__SI_MESGQ,-4) /* sent by real time mesq state change */
#ifdef __KERNEL__ #ifdef __KERNEL__
......
...@@ -2052,7 +2052,6 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from) ...@@ -2052,7 +2052,6 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from)
case __SI_MESGQ: /* But this is */ case __SI_MESGQ: /* But this is */
err |= __put_user(from->si_pid, &to->si_pid); err |= __put_user(from->si_pid, &to->si_pid);
err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_int, &to->si_int);
err |= __put_user(from->si_ptr, &to->si_ptr); err |= __put_user(from->si_ptr, &to->si_ptr);
break; break;
default: /* this is just in case for now ... */ default: /* this is just in case for now ... */
......
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