mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-06 13:09:50 +00:00
Revert my previous commit about using CS_SECURE macro.
Requested by: Bruce.
This commit is contained in:
parent
f2cf811ca6
commit
40d5099441
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28496
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $
|
||||
* $Id: linux_sysvec.c,v 1.16 1997/08/18 06:58:59 charnier Exp $
|
||||
*/
|
||||
|
||||
/* XXX we use functions that might not exist. */
|
||||
@ -317,6 +317,7 @@ linux_sigreturn(p, args, retval)
|
||||
* hardware check for invalid selectors, excess privilege in
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(context.sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
return(EINVAL);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $
|
||||
* $Id: db_trace.c,v 1.24 1997/08/18 06:58:06 charnier Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -187,7 +187,7 @@ db_nextframe(fp, ip)
|
||||
*/
|
||||
tf = (struct trapframe *) ((int)*fp + 8);
|
||||
|
||||
esp = CS_SECURE(tf->tf_cs) ? tf->tf_esp : (int)&tf->tf_esp;
|
||||
esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp;
|
||||
switch (frame_type) {
|
||||
case TRAP:
|
||||
if (INKERNEL((int) tf)) {
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $
|
||||
* $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -515,7 +515,7 @@ npxintr(unit)
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
* the SIGFPE handler (if any) as soon as the interrupt
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $
|
||||
* $Id: machdep.c,v 1.256 1997/08/18 06:58:09 charnier Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -672,6 +672,7 @@ sigreturn(p, uap, retval)
|
||||
* hardware check for invalid selectors, excess privilege in
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
#ifdef DEBUG
|
||||
printf("sigreturn: cs = 0x%x\n", scp->sc_cs);
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $
|
||||
* $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -206,7 +206,7 @@ trap(frame)
|
||||
type = frame.tf_trapno;
|
||||
code = frame.tf_err;
|
||||
|
||||
if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) {
|
||||
/* user trap */
|
||||
|
||||
sticks = p->p_sticks;
|
||||
@ -722,7 +722,7 @@ trap_fatal(frame)
|
||||
printf("\n\nFatal trap %d: %s while in %s mode\n",
|
||||
type, trap_msg[type],
|
||||
frame->tf_eflags & PSL_VM ? "vm86" :
|
||||
CS_SECURE(frame->tf_cs) ? "user" : "kernel");
|
||||
ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");
|
||||
#ifdef SMP
|
||||
printf("cpuid = %d\n", cpuid);
|
||||
#endif
|
||||
@ -735,7 +735,7 @@ trap_fatal(frame)
|
||||
}
|
||||
printf("instruction pointer = 0x%x:0x%x\n",
|
||||
frame->tf_cs & 0xffff, frame->tf_eip);
|
||||
if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) {
|
||||
ss = frame->tf_ss & 0xffff;
|
||||
esp = frame->tf_esp;
|
||||
} else {
|
||||
@ -893,7 +893,7 @@ syscall(frame)
|
||||
u_int code;
|
||||
|
||||
sticks = p->p_sticks;
|
||||
if (!CS_SECURE(frame.tf_cs))
|
||||
if (ISPL(frame.tf_cs) != SEL_UPL)
|
||||
panic("syscall");
|
||||
|
||||
p->p_md.md_regs = &frame;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
|
||||
* $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson Exp $
|
||||
* $Id: cpu.h,v 1.31 1997/08/18 06:58:29 charnier Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CPU_H_
|
||||
@ -59,7 +59,7 @@
|
||||
#define cpu_set_init_frame(p, fp) ((p)->p_md.md_regs = (fp))
|
||||
|
||||
#define CLKF_USERMODE(framep) \
|
||||
(CS_SECURE((framep)->cf_cs) || (framep->cf_eflags & PSL_VM))
|
||||
((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM))
|
||||
|
||||
#define CLKF_INTR(framep) (intr_nesting_level >= 2)
|
||||
#if 0
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $
|
||||
* $Id: segments.h,v 1.16 1997/08/18 06:58:31 charnier Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_SEGMENTS_H_
|
||||
@ -59,8 +59,6 @@
|
||||
#define LSEL(s,r) (((s)<<3) | SEL_LDT | r) /* a local selector */
|
||||
#define GSEL(s,r) (((s)<<3) | r) /* a global selector */
|
||||
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
|
||||
/*
|
||||
* Memory and System segment descriptors
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $
|
||||
* $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -515,7 +515,7 @@ npxintr(unit)
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
* the SIGFPE handler (if any) as soon as the interrupt
|
||||
|
@ -23,7 +23,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: db_trace.c,v 1.23 1997/07/20 08:37:17 bde Exp $
|
||||
* $Id: db_trace.c,v 1.24 1997/08/18 06:58:06 charnier Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -187,7 +187,7 @@ db_nextframe(fp, ip)
|
||||
*/
|
||||
tf = (struct trapframe *) ((int)*fp + 8);
|
||||
|
||||
esp = CS_SECURE(tf->tf_cs) ? tf->tf_esp : (int)&tf->tf_esp;
|
||||
esp = (ISPL(tf->tf_cs) == SEL_UPL) ? tf->tf_esp : (int)&tf->tf_esp;
|
||||
switch (frame_type) {
|
||||
case TRAP:
|
||||
if (INKERNEL((int) tf)) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.255 1997/08/09 00:02:40 dyson Exp $
|
||||
* $Id: machdep.c,v 1.256 1997/08/18 06:58:09 charnier Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
@ -672,6 +672,7 @@ sigreturn(p, uap, retval)
|
||||
* hardware check for invalid selectors, excess privilege in
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(scp->sc_cs)) {
|
||||
#ifdef DEBUG
|
||||
printf("sigreturn: cs = 0x%x\n", scp->sc_cs);
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $
|
||||
* $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -206,7 +206,7 @@ trap(frame)
|
||||
type = frame.tf_trapno;
|
||||
code = frame.tf_err;
|
||||
|
||||
if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) {
|
||||
/* user trap */
|
||||
|
||||
sticks = p->p_sticks;
|
||||
@ -722,7 +722,7 @@ trap_fatal(frame)
|
||||
printf("\n\nFatal trap %d: %s while in %s mode\n",
|
||||
type, trap_msg[type],
|
||||
frame->tf_eflags & PSL_VM ? "vm86" :
|
||||
CS_SECURE(frame->tf_cs) ? "user" : "kernel");
|
||||
ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");
|
||||
#ifdef SMP
|
||||
printf("cpuid = %d\n", cpuid);
|
||||
#endif
|
||||
@ -735,7 +735,7 @@ trap_fatal(frame)
|
||||
}
|
||||
printf("instruction pointer = 0x%x:0x%x\n",
|
||||
frame->tf_cs & 0xffff, frame->tf_eip);
|
||||
if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) {
|
||||
ss = frame->tf_ss & 0xffff;
|
||||
esp = frame->tf_esp;
|
||||
} else {
|
||||
@ -893,7 +893,7 @@ syscall(frame)
|
||||
u_int code;
|
||||
|
||||
sticks = p->p_sticks;
|
||||
if (!CS_SECURE(frame.tf_cs))
|
||||
if (ISPL(frame.tf_cs) != SEL_UPL)
|
||||
panic("syscall");
|
||||
|
||||
p->p_md.md_regs = &frame;
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
|
||||
* $Id: cpu.h,v 1.30 1997/08/09 00:03:09 dyson Exp $
|
||||
* $Id: cpu.h,v 1.31 1997/08/18 06:58:29 charnier Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CPU_H_
|
||||
@ -59,7 +59,7 @@
|
||||
#define cpu_set_init_frame(p, fp) ((p)->p_md.md_regs = (fp))
|
||||
|
||||
#define CLKF_USERMODE(framep) \
|
||||
(CS_SECURE((framep)->cf_cs) || (framep->cf_eflags & PSL_VM))
|
||||
((ISPL((framep)->cf_cs) == SEL_UPL) || (framep->cf_eflags & PSL_VM))
|
||||
|
||||
#define CLKF_INTR(framep) (intr_nesting_level >= 2)
|
||||
#if 0
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)segments.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: segments.h,v 1.15 1997/07/19 02:24:37 fsmp Exp $
|
||||
* $Id: segments.h,v 1.16 1997/08/18 06:58:31 charnier Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_SEGMENTS_H_
|
||||
@ -59,8 +59,6 @@
|
||||
#define LSEL(s,r) (((s)<<3) | SEL_LDT | r) /* a local selector */
|
||||
#define GSEL(s,r) (((s)<<3) | r) /* a global selector */
|
||||
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
|
||||
/*
|
||||
* Memory and System segment descriptors
|
||||
*/
|
||||
|
@ -32,7 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.50 1997/08/09 00:03:39 dyson Exp $
|
||||
* $Id: npx.c,v 1.51 1997/08/18 06:58:44 charnier Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -515,7 +515,7 @@ npxintr(unit)
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
if (CS_SECURE(frame->if_cs) || (frame->if_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
* the SIGFPE handler (if any) as soon as the interrupt
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: linux_sysvec.c,v 1.15 1997/07/20 16:06:06 bde Exp $
|
||||
* $Id: linux_sysvec.c,v 1.16 1997/08/18 06:58:59 charnier Exp $
|
||||
*/
|
||||
|
||||
/* XXX we use functions that might not exist. */
|
||||
@ -317,6 +317,7 @@ linux_sigreturn(p, args, retval)
|
||||
* hardware check for invalid selectors, excess privilege in
|
||||
* other selectors, invalid %eip's and invalid %esp's.
|
||||
*/
|
||||
#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
|
||||
if (!CS_SECURE(context.sc_cs)) {
|
||||
trapsignal(p, SIGBUS, T_PROTFLT);
|
||||
return(EINVAL);
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.1 1997/08/19 20:26:01 smp Exp smp $
|
||||
* $Id: trap.c,v 1.106 1997/08/20 05:25:48 fsmp Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -206,7 +206,7 @@ trap(frame)
|
||||
type = frame.tf_trapno;
|
||||
code = frame.tf_err;
|
||||
|
||||
if (CS_SECURE(frame.tf_cs) || (frame.tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame.tf_cs) == SEL_UPL) || (frame.tf_eflags & PSL_VM)) {
|
||||
/* user trap */
|
||||
|
||||
sticks = p->p_sticks;
|
||||
@ -722,7 +722,7 @@ trap_fatal(frame)
|
||||
printf("\n\nFatal trap %d: %s while in %s mode\n",
|
||||
type, trap_msg[type],
|
||||
frame->tf_eflags & PSL_VM ? "vm86" :
|
||||
CS_SECURE(frame->tf_cs) ? "user" : "kernel");
|
||||
ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel");
|
||||
#ifdef SMP
|
||||
printf("cpuid = %d\n", cpuid);
|
||||
#endif
|
||||
@ -735,7 +735,7 @@ trap_fatal(frame)
|
||||
}
|
||||
printf("instruction pointer = 0x%x:0x%x\n",
|
||||
frame->tf_cs & 0xffff, frame->tf_eip);
|
||||
if (CS_SECURE(frame->tf_cs) || (frame->tf_eflags & PSL_VM)) {
|
||||
if ((ISPL(frame->tf_cs) == SEL_UPL) || (frame->tf_eflags & PSL_VM)) {
|
||||
ss = frame->tf_ss & 0xffff;
|
||||
esp = frame->tf_esp;
|
||||
} else {
|
||||
@ -893,7 +893,7 @@ syscall(frame)
|
||||
u_int code;
|
||||
|
||||
sticks = p->p_sticks;
|
||||
if (!CS_SECURE(frame.tf_cs))
|
||||
if (ISPL(frame.tf_cs) != SEL_UPL)
|
||||
panic("syscall");
|
||||
|
||||
p->p_md.md_regs = &frame;
|
||||
|
Loading…
Reference in New Issue
Block a user