Module Name: src Committed By: riz Date: Tue Jun 12 23:23:27 UTC 2012
Modified Files: src/sys/arch/amd64/amd64 [netbsd-4]: machdep.c netbsd32_machdep.c Log Message: Pull up following revision(s) (requested by spz in ticket #1450): sys/arch/amd64/amd64/machdep.c: revision 1.184 sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.77 If the user process provided a bogus signal handler address, kill it now instead of trying to jump to the bogus address. To generate a diff of this commit: cvs rdiff -u -r1.44.2.6 -r1.44.2.7 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.30.2.3 -r1.30.2.4 \ src/sys/arch/amd64/amd64/netbsd32_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.44.2.6 src/sys/arch/amd64/amd64/machdep.c:1.44.2.7 --- src/sys/arch/amd64/amd64/machdep.c:1.44.2.6 Sun Oct 18 15:20:42 2009 +++ src/sys/arch/amd64/amd64/machdep.c Tue Jun 12 23:23:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.44.2.6 2009/10/18 15:20:42 bouyer Exp $ */ +/* $NetBSD: machdep.c,v 1.44.2.7 2012/06/12 23:23:26 riz Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44.2.6 2009/10/18 15:20:42 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.44.2.7 2012/06/12 23:23:26 riz Exp $"); #include "opt_user_ldt.h" #include "opt_ddb.h" @@ -528,6 +528,16 @@ sendsig(const ksiginfo_t *ksi, const sig /* Remember that we're now on the signal stack. */ if (onstack) p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } void Index: src/sys/arch/amd64/amd64/netbsd32_machdep.c diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.3 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.4 --- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.30.2.3 Sun Oct 18 15:22:38 2009 +++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Tue Jun 12 23:23:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_machdep.c,v 1.30.2.3 2009/10/18 15:22:38 bouyer Exp $ */ +/* $NetBSD: netbsd32_machdep.c,v 1.30.2.4 2012/06/12 23:23:26 riz Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.30.2.3 2009/10/18 15:22:38 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.30.2.4 2012/06/12 23:23:26 riz Exp $"); #include "opt_compat_netbsd.h" #include "opt_coredump.h" @@ -257,6 +257,16 @@ netbsd32_sendsig_sigcontext(const ksigin /* Remember that we're now on the signal stack. */ if (onstack) p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } #endif @@ -344,6 +354,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_ /* Remember that we're now on the signal stack. */ if (onstack) p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + + if ((vaddr_t)catcher >= VM_MAXUSER_ADDRESS) { + /* + * process has given an invalid address for the + * handler. Stop it, but do not do it before so + * we can return the right info to userland (or in core dump) + */ + sigexit(l, SIGILL); + /* NOTREACHED */ + } } void