Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107167878
D31954.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D31954.diff
View Options
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -166,9 +166,6 @@
extern u_int64_t hammer_time(u_int64_t, u_int64_t);
-#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
-#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
-
static void cpu_startup(void *);
static void get_fpcontext(struct thread *td, mcontext_t *mcp,
char *xfpusave, size_t xfpusave_len);
diff --git a/sys/amd64/ia32/ia32_reg.c b/sys/amd64/ia32/ia32_reg.c
--- a/sys/amd64/ia32/ia32_reg.c
+++ b/sys/amd64/ia32/ia32_reg.c
@@ -73,9 +73,6 @@
#include <machine/pcb.h>
#include <machine/cpufunc.h>
-#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
-#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
-
int
fill_regs32(struct thread *td, struct reg32 *regs)
{
diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
--- a/sys/amd64/ia32/ia32_signal.c
+++ b/sys/amd64/ia32/ia32_signal.c
@@ -85,9 +85,6 @@
static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *);
#endif
-#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
-#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
-
static void
ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp,
char *xfpusave, size_t xfpusave_len)
diff --git a/sys/amd64/include/frame.h b/sys/amd64/include/frame.h
--- a/sys/amd64/include/frame.h
+++ b/sys/amd64/include/frame.h
@@ -46,4 +46,9 @@
register_t pti_ss;
};
+#ifdef _KERNEL
+#define CS_SECURE(cs) (ISPL(cs) == SEL_UPL)
+#define EFL_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
+#endif
+
#endif
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -555,9 +555,7 @@
* Corruption of the PSL_RF bit at worst causes one more or
* one less debugger trap, so allowing it is fairly harmless.
*/
-
-#define RFLAG_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
- if (!RFLAG_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) {
+ if (!EFL_SECURE(rflags & ~PSL_RF, regs->tf_rflags & ~PSL_RF)) {
printf("linux_rt_sigreturn: rflags = 0x%lx\n", rflags);
return (EINVAL);
}
@@ -567,7 +565,6 @@
* 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)) {
printf("linux_rt_sigreturn: cs = 0x%x\n", context->sc_cs);
ksiginfo_init_trap(&ksi);
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -519,9 +519,8 @@
return (EFAULT);
/* Check for security violations. */
-#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
eflags = frame.sf_sc.sc_eflags;
- if (!EFLAGS_SECURE(eflags, regs->tf_rflags))
+ if (!EFL_SECURE(eflags, regs->tf_rflags))
return(EINVAL);
/*
@@ -529,7 +528,6 @@
* 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(frame.sf_sc.sc_cs)) {
ksiginfo_init_trap(&ksi);
ksi.ksi_signo = SIGBUS;
@@ -602,9 +600,8 @@
context = &uc.uc_mcontext;
/* Check for security violations. */
-#define EFLAGS_SECURE(ef, oef) ((((ef) ^ (oef)) & ~PSL_USERCHANGE) == 0)
eflags = context->sc_eflags;
- if (!EFLAGS_SECURE(eflags, regs->tf_rflags))
+ if (!EFL_SECURE(eflags, regs->tf_rflags))
return(EINVAL);
/*
@@ -612,7 +609,6 @@
* 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)) {
ksiginfo_init_trap(&ksi);
ksi.ksi_signo = SIGBUS;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 12, 4:04 AM (2 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15760983
Default Alt Text
D31954.diff (3 KB)
Attached To
Mode
D31954: amd64: stop using top of the thread' kernel stack for FPU user save area
Attached
Detach File
Event Timeline
Log In to Comment