From owner-svn-src-all@freebsd.org Wed Jun 22 12:05:09 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C5DDA7AF21; Wed, 22 Jun 2016 12:05:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DBEA2874; Wed, 22 Jun 2016 12:05:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5MC58cd086058; Wed, 22 Jun 2016 12:05:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5MC58Dc086057; Wed, 22 Jun 2016 12:05:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201606221205.u5MC58Dc086057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 22 Jun 2016 12:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302084 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jun 2016 12:05:09 -0000 Author: andrew Date: Wed Jun 22 12:05:08 2016 New Revision: 302084 URL: https://svnweb.freebsd.org/changeset/base/302084 Log: Fix a race when the hardware has raised an exception with an unknown or uncategorised reason. We need to read the fault address register before enabling interrupts as the interrupt handler may cause this register to change. Approved by: re (marius, kib) Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Jun 22 11:45:30 2016 (r302083) +++ head/sys/arm64/arm64/trap.c Wed Jun 22 12:05:08 2016 (r302084) @@ -313,13 +313,11 @@ do_el1h_sync(struct trapframe *frame) * instruction results in an exception with an unknown reason. */ static void -el0_excp_unknown(struct trapframe *frame) +el0_excp_unknown(struct trapframe *frame, uint64_t far) { struct thread *td; - uint64_t far; td = curthread; - far = READ_SPECIALREG(far_el1); call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far); userret(td, frame); } @@ -342,6 +340,7 @@ do_el0_sync(struct trapframe *frame) esr = READ_SPECIALREG(esr_el1); exception = ESR_ELx_EXCEPTION(esr); switch (exception) { + case EXCP_UNKNOWN: case EXCP_INSN_ABORT_L: case EXCP_DATA_ABORT_L: case EXCP_DATA_ABORT: @@ -371,7 +370,7 @@ do_el0_sync(struct trapframe *frame) data_abort(frame, esr, far, 1); break; case EXCP_UNKNOWN: - el0_excp_unknown(frame); + el0_excp_unknown(frame, far); break; case EXCP_SP_ALIGN: call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp);