From owner-cvs-src@FreeBSD.ORG Sun Jun 18 12:07:05 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9C1116A47B; Sun, 18 Jun 2006 12:07:05 +0000 (UTC) (envelope-from yar@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDA9B43D5E; Sun, 18 Jun 2006 12:07:00 +0000 (GMT) (envelope-from yar@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5IC70sw002797; Sun, 18 Jun 2006 12:07:00 GMT (envelope-from yar@repoman.freebsd.org) Received: (from yar@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5IC70Xl002796; Sun, 18 Jun 2006 12:07:00 GMT (envelope-from yar) Message-Id: <200606181207.k5IC70Xl002796@repoman.freebsd.org> From: Yar Tikhiy Date: Sun, 18 Jun 2006 12:07:00 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/i386/i386 db_trace.c trap.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jun 2006 12:07:05 -0000 yar 2006-06-18 12:07:00 UTC FreeBSD src repository Modified files: sys/i386/i386 db_trace.c trap.c Log: The i386 "call" instruction works as follows: it pushes the return address on the stack and only then "dereferences" %pc. Therefore, in the case of a call to an invalid address, we arrive to the trap handler with the invalid value in tf_eip. This used to prevent db_backtrace() from assigning the most recent and interesting frame on the stack to the right spot in the right function, from which the invalid call was attempted. Try to detect and work around that by recovering the return address from the stack. The work-around requires the fault address be passed to db_backtrace(). Smuggle it as tf_err. MFC after: 1 month Sponsored by: RiNet (Cronyx Plus LLC) Revision Changes Path 1.73 +25 -3 src/sys/i386/i386/db_trace.c 1.290 +3 -0 src/sys/i386/i386/trap.c