Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/sparc sendsig: don't copy out the ucontext_t ...



details:   https://anonhg.NetBSD.org/src/rev/2ccbd85f02d4
branches:  trunk
changeset: 553202:2ccbd85f02d4
user:      pk <pk%NetBSD.org@localhost>
date:      Sun Oct 12 16:12:20 2003 +0000

description:
sendsig: don't copy out the ucontext_t padding bytes onto the user stack.

diffstat:

 sys/arch/sparc/sparc/machdep.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r dc0e3013d067 -r 2ccbd85f02d4 sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c    Sun Oct 12 16:01:35 2003 +0000
+++ b/sys/arch/sparc/sparc/machdep.c    Sun Oct 12 16:12:20 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.236 2003/10/12 14:36:19 pk Exp $ */
+/*     $NetBSD: machdep.c,v 1.237 2003/10/12 16:12:20 pk Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.236 2003/10/12 14:36:19 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.237 2003/10/12 16:12:20 pk Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_sunos.h"
@@ -678,6 +678,7 @@
        u_int onstack, oldsp, newsp;
        u_int catcher;
        int sig;
+       size_t ucsz;
 
 #ifdef COMPAT_16
        if (p->p_sigacts->sa_sigdesc[ksi->ksi_signo].sd_vers < 2) {
@@ -723,6 +724,7 @@
        uc.uc_link = NULL;
        memset(&uc.uc_stack, 0, sizeof(uc.uc_stack));
        cpu_getmcontext(l, &uc.uc_mcontext, &uc.uc_flags);
+       ucsz = (int)&uc.__uc_pad - (int)&uc;
 
        /*
         * Now copy the stack contents out to user space.
@@ -735,7 +737,7 @@
         */
        newsp = (int)fp - sizeof(struct frame);
        if (copyout(ksi, &fp->sf_si, sizeof *ksi) ||
-           copyout(&uc, &fp->sf_uc, sizeof uc) ||
+           copyout(&uc, &fp->sf_uc, ucsz) ||
            suword(&((struct rwindow *)newsp)->rw_in[6], oldsp)) {
                /*
                 * Process has trashed its stack; give it an illegal



Home | Main Index | Thread Index | Old Index