Re: In-Kernel NaT consumption trap when debugging highly-parallel

From: David Mosberger <>
Date: 2004-03-26 11:52:00
>>>>> On Thu, 25 Mar 2004 12:15:51 +1100, Peter Chubb <> said:

  Peter> Hi, I'm trying to debug a highly-threaded user-space program,
  Peter> but gdb is triggering NaT consumption faults in the middle of
  Peter> ptrace.

The attached patch should fix it.  Bjorn, I think the same will be needed
for 2.4.

It appears that the combination of gdb 6.x and NPTL is triggering this
bug (which has been there forever).  What happened is that gdb was
trying to read r4 in a task that was in the middle of a clone2().
clone2() spills that register (via SAVE_SWITCH_STACK) along with the
(primary) UNaT.  Unfortunately, the typo in run_script() which is
fixed by the patch below caused the primary-UNaT address to be
calculated as 0, which would then cause the NULL-pointer dereference.


===== arch/ia64/kernel/unwind.c 1.37 vs edited =====
--- 1.37/arch/ia64/kernel/unwind.c	Thu Feb 19 11:27:59 2004
+++ edited/arch/ia64/kernel/unwind.c	Thu Mar 25 16:34:00 2004
@@ -1746,7 +1746,7 @@
 			if (!state->pri_unat_loc)
 				state->pri_unat_loc = &state->sw->ar_unat;
 			/* register off. is a multiple of 8, so the least 3 bits (type) are 0 */
-			s[dst+1] = (*state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK;
+			s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK;
 		      case UNW_INSN_SETNAT_TYPE:
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Thu Mar 25 20:16:18 2004

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:24 EST