aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/signal32.c
diff options
context:
space:
mode:
authorCarlos O'Donell Jr <carlos@systemhalted.org>2007-02-16 10:54:10 -0500
committerKyle McMartin <kyle@athena.road.mcmartin.ca>2007-02-17 01:22:00 -0500
commitf6744bdd7346dcdf94b9a7ac6fb820693b2724cd (patch)
tree4b69d15e8784e50a024287624426ed59d87892fc /arch/parisc/kernel/signal32.c
parent1e67685b1b654138a20a4db487cf12c3fca968f2 (diff)
[PARISC] Compat signal fixes for 64-bit parisc
In copy_siginfo_from_user32: Use compat_uptr_t. Use compat_ptr(). In copy_siginfo_to_user32: Use compat_int_t. Use ptr_to_compat(). The sigevent_t structure has a 64-bit si_ptr field that when copied to a 32-bit si_ptr will copy the wrong word. For the compat copy use the si_int field instead. Signed-off-by: Carlos O'Donell <carlos@systemhalted.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/kernel/signal32.c')
-rw-r--r--arch/parisc/kernel/signal32.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
index 2cbb4af15a19..1c1a37f73053 100644
--- a/arch/parisc/kernel/signal32.c
+++ b/arch/parisc/kernel/signal32.c
@@ -403,7 +403,7 @@ setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __
403int 403int
404copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from) 404copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
405{ 405{
406 unsigned long tmp; 406 compat_uptr_t addr;
407 int err; 407 int err;
408 408
409 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t))) 409 if (!access_ok(VERIFY_READ, from, sizeof(compat_siginfo_t)))
@@ -426,8 +426,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
426 err |= __get_user(to->si_uid, &from->si_uid); 426 err |= __get_user(to->si_uid, &from->si_uid);
427 break; 427 break;
428 case __SI_FAULT >> 16: 428 case __SI_FAULT >> 16:
429 err |= __get_user(tmp, &from->si_addr); 429 err |= __get_user(addr, &from->si_addr);
430 to->si_addr = (void __user *) tmp; 430 to->si_addr = compat_ptr(addr);
431 break; 431 break;
432 case __SI_POLL >> 16: 432 case __SI_POLL >> 16:
433 err |= __get_user(to->si_band, &from->si_band); 433 err |= __get_user(to->si_band, &from->si_band);
@@ -447,7 +447,8 @@ copy_siginfo_from_user32 (siginfo_t *to, compat_siginfo_t __user *from)
447int 447int
448copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from) 448copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
449{ 449{
450 unsigned int addr; 450 compat_uptr_t addr;
451 compat_int_t val;
451 int err; 452 int err;
452 453
453 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) 454 if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t)))
@@ -476,8 +477,8 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
476 err |= __put_user(from->si_uid, &to->si_uid); 477 err |= __put_user(from->si_uid, &to->si_uid);
477 break; 478 break;
478 case __SI_FAULT >> 16: 479 case __SI_FAULT >> 16:
479 /* avoid type-checking warnings by copying _pad[0] in lieu of si_addr... */ 480 addr = ptr_to_compat(from->si_addr);
480 err |= __put_user(from->_sifields._pad[0], &to->si_addr); 481 err |= __put_user(addr, &to->si_addr);
481 break; 482 break;
482 case __SI_POLL >> 16: 483 case __SI_POLL >> 16:
483 err |= __put_user(from->si_band, &to->si_band); 484 err |= __put_user(from->si_band, &to->si_band);
@@ -486,15 +487,15 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, siginfo_t *from)
486 case __SI_TIMER >> 16: 487 case __SI_TIMER >> 16:
487 err |= __put_user(from->si_tid, &to->si_tid); 488 err |= __put_user(from->si_tid, &to->si_tid);
488 err |= __put_user(from->si_overrun, &to->si_overrun); 489 err |= __put_user(from->si_overrun, &to->si_overrun);
489 addr = (unsigned long) from->si_ptr; 490 val = (compat_int_t)from->si_int;
490 err |= __put_user(addr, &to->si_ptr); 491 err |= __put_user(val, &to->si_int);
491 break; 492 break;
492 case __SI_RT >> 16: /* Not generated by the kernel as of now. */ 493 case __SI_RT >> 16: /* Not generated by the kernel as of now. */
493 case __SI_MESGQ >> 16: 494 case __SI_MESGQ >> 16:
494 err |= __put_user(from->si_uid, &to->si_uid); 495 err |= __put_user(from->si_uid, &to->si_uid);
495 err |= __put_user(from->si_pid, &to->si_pid); 496 err |= __put_user(from->si_pid, &to->si_pid);
496 addr = (unsigned long) from->si_ptr; 497 val = (compat_int_t)from->si_int;
497 err |= __put_user(addr, &to->si_ptr); 498 err |= __put_user(val, &to->si_int);
498 break; 499 break;
499 } 500 }
500 } 501 }