Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102703798
D29025.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D29025.diff
View Options
Index: sys/amd64/amd64/vm_machdep.c
===================================================================
--- sys/amd64/amd64/vm_machdep.c
+++ sys/amd64/amd64/vm_machdep.c
@@ -569,12 +569,14 @@
* Those not loaded individually below get their default
* values here.
*/
- if (td0 == curthread)
- update_pcb_bases(td0->td_pcb);
bcopy(td0->td_pcb, pcb2, sizeof(*pcb2));
clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE |
PCB_KERNFPU);
pcb2->pcb_save = get_pcb_user_save_pcb(pcb2);
+
+ /* Reset the fs and gs bases. */
+ pcb2->pcb_fsbase = 0;
+ pcb2->pcb_gsbase = 0;
set_pcb_flags_raw(pcb2, PCB_FULL_IRET);
/*
@@ -603,7 +605,6 @@
* If we didn't copy the pcb, we'd need to do the following registers:
* pcb2->pcb_dr*: cloned above.
* pcb2->pcb_onfault: cloned above (always NULL here?).
- * pcb2->pcb_[fg]sbase: cloned above
*/
/* Setup to release spin count in fork_exit(). */
Index: sys/i386/i386/sys_machdep.c
===================================================================
--- sys/i386/i386/sys_machdep.c
+++ sys/i386/i386/sys_machdep.c
@@ -108,7 +108,8 @@
fill_based_sd(&sd, base);
critical_enter();
td->td_pcb->pcb_fsd = sd;
- PCPU_GET(fsgs_gdt)[0] = sd;
+ if (td == curthread)
+ PCPU_GET(fsgs_gdt)[0] = sd;
critical_exit();
}
@@ -120,7 +121,8 @@
fill_based_sd(&sd, base);
critical_enter();
td->td_pcb->pcb_gsd = sd;
- PCPU_GET(fsgs_gdt)[1] = sd;
+ if (td == curthread)
+ PCPU_GET(fsgs_gdt)[1] = sd;
critical_exit();
}
Index: sys/i386/i386/vm_machdep.c
===================================================================
--- sys/i386/i386/vm_machdep.c
+++ sys/i386/i386/vm_machdep.c
@@ -438,6 +438,10 @@
PCB_KERNNPX);
pcb2->pcb_save = get_pcb_user_save_pcb(pcb2);
+ /* Reset the fs and gs bases. */
+ set_fsbase(td, 0);
+ set_gsbase(td, 0);
+
/*
* Create a new fresh stack for the new thread.
*/
@@ -461,14 +465,13 @@
pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */
pcb2->pcb_ebx = (int)td; /* trampoline arg */
pcb2->pcb_eip = (int)fork_trampoline + setidt_disp;
- pcb2->pcb_gs = rgs();
+ pcb2->pcb_gs = _udatasel;
/*
* If we didn't copy the pcb, we'd need to do the following registers:
* pcb2->pcb_cr3: cloned above.
* pcb2->pcb_dr*: cloned above.
* pcb2->pcb_flags: cloned above.
* pcb2->pcb_onfault: cloned above (always NULL here?).
- * pcb2->pcb_gs: cloned above.
* pcb2->pcb_ext: cleared below.
*/
pcb2->pcb_ext = NULL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 2:27 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14669183
Default Alt Text
D29025.diff (2 KB)
Attached To
Mode
D29025: x86: Reset fsbase and gsbase for new threads.
Attached
Detach File
Event Timeline
Log In to Comment