* [PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
@ 2015-03-15 20:00 Helge Deller
2015-03-17 17:13 ` Catalin Marinas
0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2015-03-15 20:00 UTC (permalink / raw)
To: linux-parisc, James Bottomley, John David Anglin
Cc: Catalin Marinas, Bamvor Jian Zhang
This patch is basically the same as commit 9d42d48 from Catalin Marinas
but adopted to the parisc architecture.
The native (64-bit) sigval_t union contains sival_int (32-bit) and sival_ptr
(64-bit). When a compat application invokes a syscall that takes a sigval_t
value (as part of a larger structure, e.g. compat_sys_mq_notify,
compat_sys_timer_create), the compat_sigval_t union is converted to the native
sigval_t with sival_int overlapping with either the least or the most
significant half of sival_ptr, depending on endianness. When the corresponding
signal is delivered to a compat application, on big endian the current
(compat_uptr_t)sival_ptr cast always returns 0 since sival_int corresponds to
the top part of sival_ptr. This patch fixes copy_siginfo_to_user32() so that
sival_int is copied to the compat_siginfo_t structure.
Cc: <stable@vger.kernel.org>
Reported-by: Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index 984abbe..d1f1fcd 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -322,7 +322,6 @@ int
copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
{
compat_uptr_t addr;
- compat_int_t val;
int err;
if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
@@ -361,15 +360,13 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
case __SI_TIMER >> 16:
err |= __put_user(from->si_tid, &to->si_tid);
err |= __put_user(from->si_overrun, &to->si_overrun);
- val = (compat_int_t)from->si_int;
- err |= __put_user(val, &to->si_int);
+ err |= __put_user(from->si_int, &to->si_int);
break;
case __SI_RT >> 16: /* Not generated by the kernel as of now. */
case __SI_MESGQ >> 16:
err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_pid, &to->si_pid);
- val = (compat_int_t)from->si_int;
- err |= __put_user(val, &to->si_int);
+ err |= __put_user(from->si_int, &to->si_int);
break;
}
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian
2015-03-15 20:00 [PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Helge Deller
@ 2015-03-17 17:13 ` Catalin Marinas
0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2015-03-17 17:13 UTC (permalink / raw)
To: Helge Deller
Cc: linux-parisc@vger.kernel.org, James Bottomley, John David Anglin,
Bamvor Jian Zhang
On Sun, Mar 15, 2015 at 08:00:41PM +0000, Helge Deller wrote:
> This patch is basically the same as commit 9d42d48 from Catalin Marinas
> but adopted to the parisc architecture.
>
> The native (64-bit) sigval_t union contains sival_int (32-bit) and sival_ptr
> (64-bit). When a compat application invokes a syscall that takes a sigval_t
> value (as part of a larger structure, e.g. compat_sys_mq_notify,
> compat_sys_timer_create), the compat_sigval_t union is converted to the native
> sigval_t with sival_int overlapping with either the least or the most
> significant half of sival_ptr, depending on endianness. When the corresponding
> signal is delivered to a compat application, on big endian the current
> (compat_uptr_t)sival_ptr cast always returns 0 since sival_int corresponds to
> the top part of sival_ptr. This patch fixes copy_siginfo_to_user32() so that
> sival_int is copied to the compat_siginfo_t structure.
Se below, I don't think this patch is needed.
> diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
> index 984abbe..d1f1fcd 100644
> --- a/arch/parisc/kernel/signal32.c
> +++ b/arch/parisc/kernel/signal32.c
> @@ -322,7 +322,6 @@ int
> copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
> {
> compat_uptr_t addr;
> - compat_int_t val;
> int err;
>
> if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
> @@ -361,15 +360,13 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from)
> case __SI_TIMER >> 16:
> err |= __put_user(from->si_tid, &to->si_tid);
> err |= __put_user(from->si_overrun, &to->si_overrun);
> - val = (compat_int_t)from->si_int;
> - err |= __put_user(val, &to->si_int);
> + err |= __put_user(from->si_int, &to->si_int);
Is there any actual change here? The native si_int is 32-bit already,
same as compat_int_t. I didn't think parisc needed fixing (only if it
was using si_ptr which is 64-bit on a 64-bit architecture).
> break;
> case __SI_RT >> 16: /* Not generated by the kernel as of now. */
> case __SI_MESGQ >> 16:
> err |= __put_user(from->si_uid, &to->si_uid);
> err |= __put_user(from->si_pid, &to->si_pid);
> - val = (compat_int_t)from->si_int;
> - err |= __put_user(val, &to->si_int);
> + err |= __put_user(from->si_int, &to->si_int);
Same here.
--
Catalin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-17 17:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 20:00 [PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Helge Deller
2015-03-17 17:13 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox