From owner-svn-src-head@freebsd.org Wed Jul 8 12:42:45 2015 Return-Path: Delivered-To: svn-src-head@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 401C0996DFE; Wed, 8 Jul 2015 12:42:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 17D0610AC; Wed, 8 Jul 2015 12:42:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t68CgiR8094269; Wed, 8 Jul 2015 12:42:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t68Cgil5094268; Wed, 8 Jul 2015 12:42:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507081242.t68Cgil5094268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 8 Jul 2015 12:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285268 - 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jul 2015 12:42:45 -0000 Author: andrew Date: Wed Jul 8 12:42:44 2015 New Revision: 285268 URL: https://svnweb.freebsd.org/changeset/base/285268 Log: Send the correct signal when vm_fault fails. While here also set the code and address fields. Sponsored by: ABT Systems Ltd Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Jul 8 12:08:58 2015 (r285267) +++ head/sys/arm64/arm64/trap.c Wed Jul 8 12:42:44 2015 (r285268) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,13 +80,14 @@ void do_el0_error(struct trapframe *); int (*dtrace_invop_jump_addr)(struct trapframe *); static __inline void -call_trapsignal(struct thread *td, int sig, u_long code) +call_trapsignal(struct thread *td, int sig, int code, void *addr) { ksiginfo_t ksi; ksiginfo_init_trap(&ksi); ksi.ksi_signo = sig; - ksi.ksi_code = (int)code; + ksi.ksi_code = code; + ksi.ksi_addr = addr; trapsignal(td, &ksi); } @@ -151,7 +153,7 @@ data_abort(struct trapframe *frame, uint vm_prot_t ftype; vm_offset_t va; uint64_t far; - int error, sig; + int error, sig, ucode; td = curthread; pcb = td->td_pcb; @@ -204,13 +206,14 @@ data_abort(struct trapframe *frame, uint error = vm_fault(map, va, ftype, VM_FAULT_NORMAL); } - if (error != 0) { + if (error != KERN_SUCCESS) { if (lower) { - if (error == ENOMEM) - sig = SIGKILL; + sig = SIGSEGV; + if (error == KERN_PROTECTION_FAILURE) + ucode = SEGV_ACCERR; else - sig = SIGSEGV; - call_trapsignal(td, sig, 0); + ucode = SEGV_MAPERR; + call_trapsignal(td, sig, ucode, (void *)far); } else { if (td->td_intr_nesting_level == 0 && pcb->pcb_onfault != 0) {