[Devel] [PATCH] checkpoint/i386: use task_user_gs to checkpoint gs

Nathan Lynch ntl at pobox.com
Tue Apr 6 16:37:41 PDT 2010


Depending on the setting of CONFIG_X86_32_LAZY_GS, gs may be saved in
the thread_struct or in pt_regs.  Use the task_user_gs() accessor to
checkpoint gs appropriately for both cases.  This solves post-restart
program crashes when CONFIG_X86_32_LAZY_GS=n.

Tested-by: Serge Hallyn <serue at us.ibm.com>
Signed-off-by: Nathan Lynch <ntl at pobox.com>
---
 arch/x86/kernel/checkpoint_32.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/checkpoint_32.c b/arch/x86/kernel/checkpoint_32.c
index 32cde34..c4ce450 100644
--- a/arch/x86/kernel/checkpoint_32.c
+++ b/arch/x86/kernel/checkpoint_32.c
@@ -86,7 +86,6 @@ static unsigned short decode_segment(__u16 seg)
 
 void save_cpu_regs(struct ckpt_hdr_cpu *h, struct task_struct *t)
 {
-	struct thread_struct *thread = &t->thread;
 	struct pt_regs *regs = task_pt_regs(t);
 	unsigned long _gs;
 
@@ -108,15 +107,10 @@ void save_cpu_regs(struct ckpt_hdr_cpu *h, struct task_struct *t)
 	h->ds = encode_segment(regs->ds);
 	h->es = encode_segment(regs->es);
 
-	/*
-	 * for checkpoint in process context (from within a container)
-	 * the GS segment register should be saved from the hardware;
-	 * otherwise it is already saved on the thread structure
-	 */
 	if (t == current)
 		_gs = get_user_gs(regs);
 	else
-		_gs = thread->gs;
+		_gs = task_user_gs(t);
 
 	h->fsindex = encode_segment(regs->fs);
 	h->gsindex = encode_segment(_gs);
-- 
1.6.6.1

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list