diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2015-01-31 21:43:46 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2015-01-31 21:43:46 +0000 |
commit | 206f09eb469eb8ec040e98b00a2bbc3a8bc3fbfe (patch) | |
tree | c59ea8ad2996445d89d6f2338e4a25a24ab968a8 /sys/amd64 | |
parent | e0a60ae16abc4faf14abbd8edb324d33ad48667c (diff) | |
download | src-206f09eb469eb8ec040e98b00a2bbc3a8bc3fbfe.tar.gz src-206f09eb469eb8ec040e98b00a2bbc3a8bc3fbfe.zip |
Do not qualify the mcontext_t *mcp argument for set_mcontext(9) as
const. On x86, even after the machine context is supposedly read into
the struct ucontext, lazy FPU state save code might only mark the FPU
data as hardware-owned. Later, set_fpcontext() needs to fetch the
state from hardware, modifying the *mcp.
The set_mcontext(9) is called from sigreturn(2) and setcontext(2)
implementations and old create_thread(2) interface, which throw the
*mcp out after the set_mcontext() call.
Reported by: dim
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=278001
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/machdep.c | 6 | ||||
-rw-r--r-- | sys/amd64/ia32/ia32_signal.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 839da018cc35..355964968ae2 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -157,7 +157,7 @@ extern u_int64_t hammer_time(u_int64_t, u_int64_t); static void cpu_startup(void *); static void get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, size_t xfpusave_len); -static int set_fpcontext(struct thread *td, const mcontext_t *mcp, +static int set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len); SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); @@ -2480,7 +2480,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int flags) * touch the cs selector. */ int -set_mcontext(struct thread *td, const mcontext_t *mcp) +set_mcontext(struct thread *td, mcontext_t *mcp) { struct pcb *pcb; struct trapframe *tp; @@ -2567,7 +2567,7 @@ get_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpusave, } static int -set_fpcontext(struct thread *td, const mcontext_t *mcp, char *xfpustate, +set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate, size_t xfpustate_len) { struct savefpu *fpstate; diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 75a0511480a2..da01647d61df 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -118,7 +118,7 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, } static int -ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp, +ia32_set_fpcontext(struct thread *td, struct ia32_mcontext *mcp, char *xfpustate, size_t xfpustate_len) { int error; @@ -197,7 +197,7 @@ ia32_get_mcontext(struct thread *td, struct ia32_mcontext *mcp, int flags) * touch the cs selector. */ static int -ia32_set_mcontext(struct thread *td, const struct ia32_mcontext *mcp) +ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp) { struct trapframe *tp; char *xfpustate; |