Date: Mon, 22 Dec 2014 21:46:36 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r276085 - stable/10/sys/i386/i386 Message-ID: <201412222146.sBMLkaDB081261@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Dec 22 21:46:35 2014 New Revision: 276085 URL: https://svnweb.freebsd.org/changeset/base/276085 Log: MFC 275035: MFamd64: Check for invalid flags in the machine context in sigreturn() and setcontext(). Modified: stable/10/sys/i386/i386/machdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/i386/i386/machdep.c ============================================================================== --- stable/10/sys/i386/i386/machdep.c Mon Dec 22 21:32:39 2014 (r276084) +++ stable/10/sys/i386/i386/machdep.c Mon Dec 22 21:46:35 2014 (r276085) @@ -1043,6 +1043,11 @@ sys_sigreturn(td, uap) if (error != 0) return (error); ucp = &uc; + if ((ucp->uc_mcontext.mc_flags & ~_MC_FLAG_MASK) != 0) { + uprintf("pid %d (%s): sigreturn mc_flags %x\n", p->p_pid, + td->td_name, ucp->uc_mcontext.mc_flags); + return (EINVAL); + } regs = td->td_frame; eflags = ucp->uc_mcontext.mc_eflags; if (eflags & PSL_VM) { @@ -3540,7 +3545,8 @@ set_mcontext(struct thread *td, const mc int eflags, ret; tp = td->td_frame; - if (mcp->mc_len != sizeof(*mcp)) + if (mcp->mc_len != sizeof(*mcp) || + (mcp->mc_flags & ~_MC_FLAG_MASK) != 0) return (EINVAL); eflags = (mcp->mc_eflags & PSL_USERCHANGE) | (tp->tf_eflags & ~PSL_USERCHANGE);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412222146.sBMLkaDB081261>