public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* avoid infinite loop in x86_64 interrupt return
@ 2005-05-04  5:01 Andrea Arcangeli
  2005-05-04  9:00 ` Rafael J. Wysocki
  2005-05-04 13:22 ` Andi Kleen
  0 siblings, 2 replies; 7+ messages in thread
From: Andrea Arcangeli @ 2005-05-04  5:01 UTC (permalink / raw)
  To: Andi Kleen, Andrew Morton; +Cc: linux-kernel

Hello,

A few minutes ago I've got an unkillable task in R state with vanilla
2.6.12-rc3 on x86_64, luckily system was still up with the other cpu (on
the desktop, so I had no kgdb environment set). Debugging revelaed rdi
corrupt when entering retint_signal (not set to $_TIF_WORK_MASK as
expected). This lead the rdx&rdi to return 0x20000 -> infinite loop.
Precisely rdi is set to ffff810030923f58 instead of $_TIF_WORK_MASK. So
it was the combination of ...2xxxx as rsp with TIF_IA32 in the task
flags. After noticing the rdi screwup the bug was quite clear: rdi was
set to pt_regs instead of $_TIF_WORK_MASK. Of course rsp is set to
ffff810030923f58 too (which also means do_notify_resume didn't clobber
rdi even if it could).

The below should fix the problem, I've no idea how to reproduce the
problem but it works on basic testing. The task looping was java (32bit,
that's where the 0x20000 come from), but it wasn't me starting java, it
must have been some random website (java was hanging around with 100%
system time for half an hour once I noticed it).

Signed-off-by: Andrea Arcangeli <andrea@suse.de>

--- 2.6.12-rc3/arch/x86_64/kernel/entry.S.orig	2005-05-04 06:47:02.000000000 +0200
+++ 2.6.12-rc3/arch/x86_64/kernel/entry.S	2005-05-04 06:50:34.000000000 +0200
@@ -489,6 +489,7 @@ retint_signal:
 	movq %rsp,%rdi		# &pt_regs
 	call do_notify_resume
 	RESTORE_REST
+	movl $_TIF_WORK_MASK,%edi
 	cli
 	GET_THREAD_INFO(%rcx)	
 	jmp retint_check

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-04 18:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-04  5:01 avoid infinite loop in x86_64 interrupt return Andrea Arcangeli
2005-05-04  9:00 ` Rafael J. Wysocki
2005-05-04 13:31   ` Andrea Arcangeli
2005-05-04 18:21     ` Andi Kleen
2005-05-04 18:32       ` Andrea Arcangeli
2005-05-04 13:22 ` Andi Kleen
2005-05-04 13:32   ` Andrea Arcangeli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox