Skip to contentSkip to conversation

checkpoint/i386: use task_user_gs to checkpoint gs

PATCH In review Nathan Lynch 1 participant 2 messages Apr 6, 2010 – Apr 29, 2010 1 message not in the archive x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpoint/i386: use task_user_gs to checkpoint gs

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.

---
 arch/x86/kernel/checkpoint_32.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
arch/x86/kernel/checkpoint_32.c +1 -7
index 32cde34..c4ce450 100644
@@ -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);
Signature · 1 line
1.6.6.1
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · Nathan Lynch

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.

Hey Oren,

We noticed this one isn't in ckpt-v21-rc7, so restart is failing on some i386 configurations still.