linux32_sysvec.c (256281) | linux32_sysvec.c (258559) |
---|---|
1/*- 2 * Copyright (c) 2004 Tim J. Robbins 3 * Copyright (c) 2003 Peter Wemm 4 * Copyright (c) 2002 Doug Rabson 5 * Copyright (c) 1998-1999 Andrew Gallatin 6 * Copyright (c) 1994-1996 S��ren Schmidt 7 * All rights reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2004 Tim J. Robbins 3 * Copyright (c) 2003 Peter Wemm 4 * Copyright (c) 2002 Doug Rabson 5 * Copyright (c) 1998-1999 Andrew Gallatin 6 * Copyright (c) 1994-1996 S��ren Schmidt 7 * All rights reserved. 8 * --- 17 unchanged lines hidden (view full) --- 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: stable/10/sys/amd64/linux32/linux32_sysvec.c 250423 2013-05-09 21:42:43Z dchagin $"); | 34__FBSDID("$FreeBSD: stable/10/sys/amd64/linux32/linux32_sysvec.c 258559 2013-11-25 15:58:48Z emaste $"); |
35#include "opt_compat.h" 36 37#ifndef COMPAT_FREEBSD32 38#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!" 39#endif 40 41#define __ELF_WORD_SIZE 32 42 --- 539 unchanged lines hidden (view full) --- 582 if (copyin(args->sfp, &frame, sizeof(frame)) != 0) 583 return (EFAULT); 584 585 /* 586 * Check for security violations. 587 */ 588#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) 589 eflags = frame.sf_sc.sc_eflags; | 35#include "opt_compat.h" 36 37#ifndef COMPAT_FREEBSD32 38#error "Unable to compile Linux-emulator due to missing COMPAT_FREEBSD32 option!" 39#endif 40 41#define __ELF_WORD_SIZE 32 42 --- 539 unchanged lines hidden (view full) --- 582 if (copyin(args->sfp, &frame, sizeof(frame)) != 0) 583 return (EFAULT); 584 585 /* 586 * Check for security violations. 587 */ 588#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) 589 eflags = frame.sf_sc.sc_eflags; |
590 /* 591 * XXX do allow users to change the privileged flag PSL_RF. The 592 * cpu sets PSL_RF in tf_eflags for faults. Debuggers should 593 * sometimes set it there too. tf_eflags is kept in the signal 594 * context during signal handling and there is no other place 595 * to remember it, so the PSL_RF bit may be corrupted by the 596 * signal handler without us knowing. Corruption of the PSL_RF 597 * bit at worst causes one more or one less debugger trap, so 598 * allowing it is fairly harmless. 599 */ 600 if (!EFLAGS_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) | 590 if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) |
601 return(EINVAL); 602 603 /* 604 * Don't allow users to load a valid privileged %cs. Let the 605 * hardware check for invalid selectors, excess privilege in 606 * other selectors, invalid %eip's and invalid %esp's. 607 */ 608#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) --- 75 unchanged lines hidden (view full) --- 684 685 context = &uc.uc_mcontext; 686 687 /* 688 * Check for security violations. 689 */ 690#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) 691 eflags = context->sc_eflags; | 591 return(EINVAL); 592 593 /* 594 * Don't allow users to load a valid privileged %cs. Let the 595 * hardware check for invalid selectors, excess privilege in 596 * other selectors, invalid %eip's and invalid %esp's. 597 */ 598#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) --- 75 unchanged lines hidden (view full) --- 674 675 context = &uc.uc_mcontext; 676 677 /* 678 * Check for security violations. 679 */ 680#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0) 681 eflags = context->sc_eflags; |
692 /* 693 * XXX do allow users to change the privileged flag PSL_RF. The 694 * cpu sets PSL_RF in tf_eflags for faults. Debuggers should 695 * sometimes set it there too. tf_eflags is kept in the signal 696 * context during signal handling and there is no other place 697 * to remember it, so the PSL_RF bit may be corrupted by the 698 * signal handler without us knowing. Corruption of the PSL_RF 699 * bit at worst causes one more or one less debugger trap, so 700 * allowing it is fairly harmless. 701 */ 702 if (!EFLAGS_SECURE(eflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) | 682 if (!EFLAGS_SECURE(eflags, regs->tf_rflags)) |
703 return(EINVAL); 704 705 /* 706 * Don't allow users to load a valid privileged %cs. Let the 707 * hardware check for invalid selectors, excess privilege in 708 * other selectors, invalid %eip's and invalid %esp's. 709 */ 710#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) --- 494 unchanged lines hidden --- | 683 return(EINVAL); 684 685 /* 686 * Don't allow users to load a valid privileged %cs. Let the 687 * hardware check for invalid selectors, excess privilege in 688 * other selectors, invalid %eip's and invalid %esp's. 689 */ 690#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL) --- 494 unchanged lines hidden --- |