patch-2.4.0-test1 linux/arch/ia64/kernel/signal.c
Next file: linux/arch/m68k/kernel/signal.c
Previous file: linux/arch/ia64/ia32/ia32_signal.c
Back to the patch index
Back to the overall index
- Lines: 53
- Date:
Wed May 24 18:38:26 2000
- Orig file:
v2.3.99-pre9/linux/arch/ia64/kernel/signal.c
- Orig date:
Wed Apr 26 16:34:06 2000
diff -u --recursive --new-file v2.3.99-pre9/linux/arch/ia64/kernel/signal.c linux/arch/ia64/kernel/signal.c
@@ -138,6 +138,43 @@
return err;
}
+int copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)
+{
+ if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
+ return -EFAULT;
+ if (from->si_code < 0)
+ return __copy_to_user(to, from, sizeof(siginfo_t));
+ else {
+ int err;
+
+ /* 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. */
+ err = __put_user(from->si_signo, &to->si_signo);
+ err |= __put_user(from->si_errno, &to->si_errno);
+ err |= __put_user((short)from->si_code, &to->si_code);
+ switch (from->si_code >> 16) {
+ case __SI_FAULT >> 16:
+ case __SI_POLL >> 16:
+ err |= __put_user(from->si_addr, &to->si_addr);
+ err |= __put_user(from->si_imm, &to->si_imm);
+ break;
+ case __SI_CHLD >> 16:
+ err |= __put_user(from->si_utime, &to->si_utime);
+ err |= __put_user(from->si_stime, &to->si_stime);
+ err |= __put_user(from->si_status, &to->si_status);
+ default:
+ err |= __put_user(from->si_uid, &to->si_uid);
+ err |= __put_user(from->si_pid, &to->si_pid);
+ break;
+ /* case __SI_RT: This is not generated by the kernel as of now. */
+ }
+ return err;
+ }
+}
+
/*
* When we get here, ((struct switch_stack *) pt - 1) is a
* switch_stack frame that has no defined value. Upon return, we
@@ -290,7 +327,7 @@
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
goto give_sigsegv;
- err = __copy_to_user(&frame->info, info, sizeof(siginfo_t));
+ err = copy_siginfo_to_user(&frame->info, info);
err |= __put_user(current->sas_ss_sp, &frame->sc.sc_stack.ss_sp);
err |= __put_user(current->sas_ss_size, &frame->sc.sc_stack.ss_size);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)