From owner-svn-src-head@FreeBSD.ORG Fri Mar 7 20:32:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F0658F2; Fri, 7 Mar 2014 20:32:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E6291BCB; Fri, 7 Mar 2014 20:32:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s27KWkQh035234; Fri, 7 Mar 2014 20:32:46 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s27KWkr1035231; Fri, 7 Mar 2014 20:32:46 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201403072032.s27KWkr1035231@svn.freebsd.org> From: Ian Lepore Date: Fri, 7 Mar 2014 20:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262903 - head/sys/arm/arm 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.17 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: Fri, 07 Mar 2014 20:32:47 -0000 Author: ian Date: Fri Mar 7 20:32:45 2014 New Revision: 262903 URL: http://svnweb.freebsd.org/changeset/base/262903 Log: Fix the arm sys_sigreturn(): its argument is a struct ucontext, not a struct sigframe containing the struct ucontext. The signal trampoline return code on the other hand DOES have just a struct sigframe on the stack to work with, so have it get a pointer to the ucontext out of there to pass along to sys_sigreturn. In other words, make everything work right whether sys_sigreturn is invoked from the trampoline or from userland code calling sigreturn(2). Submitted by: Takashi Komatsu Reviewed by: cognet Modified: head/sys/arm/arm/genassym.c head/sys/arm/arm/locore.S head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/genassym.c ============================================================================== --- head/sys/arm/arm/genassym.c Fri Mar 7 20:32:26 2014 (r262902) +++ head/sys/arm/arm/genassym.c Fri Mar 7 20:32:45 2014 (r262903) @@ -109,6 +109,8 @@ ASSYM(TF_PC, offsetof(struct trapframe, ASSYM(P_PID, offsetof(struct proc, p_pid)); ASSYM(P_FLAG, offsetof(struct proc, p_flag)); +ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); + #ifdef ARM_TP_ADDRESS ASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS); ASSYM(ARM_RAS_START, ARM_RAS_START); Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Fri Mar 7 20:32:26 2014 (r262902) +++ head/sys/arm/arm/locore.S Fri Mar 7 20:32:45 2014 (r262903) @@ -557,6 +557,7 @@ END(abort) ENTRY_NP(sigcode) mov r0, sp + add r0, r0, #SIGF_UC /* * Call the sigreturn system call. Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Fri Mar 7 20:32:26 2014 (r262902) +++ head/sys/arm/arm/machdep.c Fri Mar 7 20:32:45 2014 (r262903) @@ -742,28 +742,26 @@ sys_sigreturn(td, uap) const struct __ucontext *sigcntxp; } */ *uap; { - struct sigframe sf; - struct trapframe *tf; + ucontext_t uc; int spsr; if (uap == NULL) return (EFAULT); - if (copyin(uap->sigcntxp, &sf, sizeof(sf))) + if (copyin(uap->sigcntxp, &uc, sizeof(uc))) return (EFAULT); /* * Make sure the processor mode has not been tampered with and * interrupts have not been disabled. */ - spsr = sf.sf_uc.uc_mcontext.__gregs[_REG_CPSR]; + spsr = uc.uc_mcontext.__gregs[_REG_CPSR]; if ((spsr & PSR_MODE) != PSR_USR32_MODE || (spsr & (I32_bit | F32_bit)) != 0) return (EINVAL); /* Restore register context. */ - tf = td->td_frame; - set_mcontext(td, &sf.sf_uc.uc_mcontext); + set_mcontext(td, &uc.uc_mcontext); /* Restore signal mask. */ - kern_sigprocmask(td, SIG_SETMASK, &sf.sf_uc.uc_sigmask, NULL, 0); + kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); return (EJUSTRETURN); }