From bc8b519d0f5bbf92cb40d8b35ea92bb2285463c5 Mon Sep 17 00:00:00 2001 From: davidxu Date: Sun, 10 Jul 2005 23:31:11 +0000 Subject: Validate if the value written into {FS,GS}.base is a canonical address, writting non-canonical address can cause kernel a panic, by restricting base values to 0..VM_MAXUSER_ADDRESS, ensuring only canonical values get written to the registers. Reviewed by: peter, Josepha Koshy < joseph.koshy at gmail dot com > Approved by: re (scottl) --- sys/sparc64/sparc64/vm_machdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys/sparc64') diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c index 20bf46b..9dd80fd 100644 --- a/sys/sparc64/sparc64/vm_machdep.c +++ b/sys/sparc64/sparc64/vm_machdep.c @@ -196,13 +196,14 @@ cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, td->td_retval[1] = tf->tf_out[1]; } -void +int cpu_set_user_tls(struct thread *td, void *tls_base) { if (td == curthread) flushw(); td->td_frame->tf_global[7] = (uint64_t) tls_base; + return (0); } /* -- cgit v1.1