From owner-svn-src-stable@FreeBSD.ORG Tue Dec 15 20:00:34 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A238D1065693; Tue, 15 Dec 2009 20:00:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90DB58FC1C; Tue, 15 Dec 2009 20:00:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBFK0Y7K073631; Tue, 15 Dec 2009 20:00:34 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBFK0YFO073628; Tue, 15 Dec 2009 20:00:34 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200912152000.nBFK0YFO073628@svn.freebsd.org> From: Marius Strobl Date: Tue, 15 Dec 2009 20:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200585 - in stable/8/sys: sparc64/sparc64 sun4v/sun4v X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Dec 2009 20:00:34 -0000 Author: marius Date: Tue Dec 15 20:00:34 2009 New Revision: 200585 URL: http://svn.freebsd.org/changeset/base/200585 Log: MFC: r200272 Add additional checks of the kernel stack addresses in order to ensure we don't overrun the beginning of the call chain. Modified: stable/8/sys/sparc64/sparc64/stack_machdep.c stable/8/sys/sun4v/sun4v/stack_machdep.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/sparc64/stack_machdep.c ============================================================================== --- stable/8/sys/sparc64/sparc64/stack_machdep.c Tue Dec 15 19:58:23 2009 (r200584) +++ stable/8/sys/sparc64/sparc64/stack_machdep.c Tue Dec 15 20:00:34 2009 (r200585) @@ -36,15 +36,20 @@ __FBSDID("$FreeBSD$"); #include #include -static void stack_capture(struct stack *st, struct frame *fp); +static void stack_capture(struct stack *st, struct frame *frame); static void -stack_capture(struct stack *st, struct frame *fp) +stack_capture(struct stack *st, struct frame *frame) { + struct frame *fp; vm_offset_t callpc; stack_zero(st); - while (1) { + fp = frame; + for (;;) { + if (!INKERNEL((vm_offset_t)fp) || + !ALIGNED_POINTER(fp, uint64_t)) + break; callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; @@ -56,6 +61,9 @@ stack_capture(struct stack *st, struct f break; if (stack_put(st, callpc) == -1) break; + if (v9next_frame(fp) <= fp || + v9next_frame(fp) >= frame + KSTACK_PAGES * PAGE_SIZE) + break; fp = v9next_frame(fp); } } Modified: stable/8/sys/sun4v/sun4v/stack_machdep.c ============================================================================== --- stable/8/sys/sun4v/sun4v/stack_machdep.c Tue Dec 15 19:58:23 2009 (r200584) +++ stable/8/sys/sun4v/sun4v/stack_machdep.c Tue Dec 15 20:00:34 2009 (r200585) @@ -36,20 +36,28 @@ __FBSDID("$FreeBSD$"); #include #include -static void stack_capture(struct stack *st, struct frame *fp); +static void stack_capture(struct stack *st, struct frame *frame); static void -stack_capture(struct stack *st, struct frame *fp) +stack_capture(struct stack *st, struct frame *frame) { + struct frame *fp; vm_offset_t callpc; stack_zero(st); - while (1) { + fp = frame; + for (;;) { + if (!INKERNEL((vm_offset_t)fp) || + !ALIGNED_POINTER(fp, uint64_t)) + break; callpc = fp->fr_pc; if (!INKERNEL(callpc)) break; if (stack_put(st, callpc) == -1) break; + if (v9next_frame(fp) <= fp || + v9next_frame(fp) >= frame + KSTACK_PAGES * PAGE_SIZE) + break; fp = v9next_frame(fp); } }