ia32_signal.c (256281) | ia32_signal.c (258559) |
---|---|
1/*- 2 * Copyright (c) 2003 Peter Wemm 3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003 Peter Wemm 3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * William Jolitz. 8 * --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: stable/10/sys/amd64/ia32/ia32_signal.c 251039 2013-05-27 18:39:39Z kib $"); | 35__FBSDID("$FreeBSD: stable/10/sys/amd64/ia32/ia32_signal.c 258559 2013-11-25 15:58:48Z emaste $"); |
36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/exec.h> 41#include <sys/fcntl.h> 42#include <sys/imgact.h> 43#include <sys/kernel.h> --- 670 unchanged lines hidden (view full) --- 714 ksiginfo_t ksi; 715 716 regs = td->td_frame; 717 error = copyin(uap->sigcntxp, &sc, sizeof(sc)); 718 if (error != 0) 719 return (error); 720 scp = ≻ 721 eflags = scp->sc_eflags; | 36 37#include "opt_compat.h" 38 39#include <sys/param.h> 40#include <sys/exec.h> 41#include <sys/fcntl.h> 42#include <sys/imgact.h> 43#include <sys/kernel.h> --- 670 unchanged lines hidden (view full) --- 714 ksiginfo_t ksi; 715 716 regs = td->td_frame; 717 error = copyin(uap->sigcntxp, &sc, sizeof(sc)); 718 if (error != 0) 719 return (error); 720 scp = ≻ 721 eflags = scp->sc_eflags; |
722 if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { | 722 if (!EFL_SECURE(eflags, regs->tf_rflags)) { |
723 return (EINVAL); 724 } 725 if (!CS_SECURE(scp->sc_cs)) { 726 ksiginfo_init_trap(&ksi); 727 ksi.ksi_signo = SIGBUS; 728 ksi.ksi_code = BUS_OBJERR; 729 ksi.ksi_trapno = T_PROTFLT; 730 ksi.ksi_addr = (void *)regs->tf_rip; --- 51 unchanged lines hidden (view full) --- 782 if (error != 0) 783 return (error); 784 ucp = &uc; 785 regs = td->td_frame; 786 eflags = ucp->uc_mcontext.mc_eflags; 787 /* 788 * Don't allow users to change privileged or reserved flags. 789 */ | 723 return (EINVAL); 724 } 725 if (!CS_SECURE(scp->sc_cs)) { 726 ksiginfo_init_trap(&ksi); 727 ksi.ksi_signo = SIGBUS; 728 ksi.ksi_code = BUS_OBJERR; 729 ksi.ksi_trapno = T_PROTFLT; 730 ksi.ksi_addr = (void *)regs->tf_rip; --- 51 unchanged lines hidden (view full) --- 782 if (error != 0) 783 return (error); 784 ucp = &uc; 785 regs = td->td_frame; 786 eflags = ucp->uc_mcontext.mc_eflags; 787 /* 788 * Don't allow users to change privileged or reserved flags. 789 */ |
790 /* 791 * XXX do allow users to change the privileged flag PSL_RF. 792 * The cpu sets PSL_RF in tf_eflags for faults. Debuggers 793 * should sometimes set it there too. tf_eflags is kept in 794 * the signal context during signal handling and there is no 795 * other place to remember it, so the PSL_RF bit may be 796 * corrupted by the signal handler without us knowing. 797 * Corruption of the PSL_RF bit at worst causes one more or 798 * one less debugger trap, so allowing it is fairly harmless. 799 */ 800 if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { | 790 if (!EFL_SECURE(eflags, regs->tf_rflags)) { |
801 uprintf("pid %d (%s): freebsd4_freebsd32_sigreturn eflags = 0x%x\n", 802 td->td_proc->p_pid, td->td_name, eflags); 803 return (EINVAL); 804 } 805 806 /* 807 * Don't allow users to load a valid privileged %cs. Let the 808 * hardware check for invalid selectors, excess privilege in --- 59 unchanged lines hidden (view full) --- 868 if (error != 0) 869 return (error); 870 ucp = &uc; 871 regs = td->td_frame; 872 eflags = ucp->uc_mcontext.mc_eflags; 873 /* 874 * Don't allow users to change privileged or reserved flags. 875 */ | 791 uprintf("pid %d (%s): freebsd4_freebsd32_sigreturn eflags = 0x%x\n", 792 td->td_proc->p_pid, td->td_name, eflags); 793 return (EINVAL); 794 } 795 796 /* 797 * Don't allow users to load a valid privileged %cs. Let the 798 * hardware check for invalid selectors, excess privilege in --- 59 unchanged lines hidden (view full) --- 858 if (error != 0) 859 return (error); 860 ucp = &uc; 861 regs = td->td_frame; 862 eflags = ucp->uc_mcontext.mc_eflags; 863 /* 864 * Don't allow users to change privileged or reserved flags. 865 */ |
876 /* 877 * XXX do allow users to change the privileged flag PSL_RF. 878 * The cpu sets PSL_RF in tf_eflags for faults. Debuggers 879 * should sometimes set it there too. tf_eflags is kept in 880 * the signal context during signal handling and there is no 881 * other place to remember it, so the PSL_RF bit may be 882 * corrupted by the signal handler without us knowing. 883 * Corruption of the PSL_RF bit at worst causes one more or 884 * one less debugger trap, so allowing it is fairly harmless. 885 */ 886 if (!EFL_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) { | 866 if (!EFL_SECURE(eflags, regs->tf_rflags)) { |
887 uprintf("pid %d (%s): freebsd32_sigreturn eflags = 0x%x\n", 888 td->td_proc->p_pid, td->td_name, eflags); 889 return (EINVAL); 890 } 891 892 /* 893 * Don't allow users to load a valid privileged %cs. Let the 894 * hardware check for invalid selectors, excess privilege in --- 110 unchanged lines hidden --- | 867 uprintf("pid %d (%s): freebsd32_sigreturn eflags = 0x%x\n", 868 td->td_proc->p_pid, td->td_name, eflags); 869 return (EINVAL); 870 } 871 872 /* 873 * Don't allow users to load a valid privileged %cs. Let the 874 * hardware check for invalid selectors, excess privilege in --- 110 unchanged lines hidden --- |