Bug 3388

Summary: LinuxTask does not expose full Task memory
Product: frysk Reporter: Phil Muldoon <pmuldoon>
Component: generalAssignee: Unassigned <frysk-bugzilla>
Status: RESOLVED DUPLICATE    
Severity: normal CC: mark, qiyaoltc, timoore, zhengyo
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2243, 3387, 1537, 4313    

Description Phil Muldoon 2006-10-18 18:12:52 UTC
In Linux task, this code:


  // XXX: For moment wire in standard 32-bit memory
  // map. This will be replaced by a memory map created using
  // information from /proc/PID/maps.
  private void setupMapsXXX () throws TaskException
  {
    ByteOrder byteOrder = getIsa().getByteOrder();
    // XXX: For writing at least, PTRACE must be used as /proc/mem
    // cannot be written to.
    memory = new PtraceByteBuffer(id.id, PtraceByteBuffer.Area.DATA,
                                  0xffffffffl);
    memory.order(byteOrder);
    registerBank = getIsa().getRegisterBankBuffers(id.id);
  }

Does not expose all memory that is map-able, possibly rendering some maps
inaccessible 

Potentially should be move as a part of the Isa?
Comment 1 Yao Qi 2006-10-20 06:31:53 UTC
IMO, Isa only provides some primitives to access ISA information, so how about
setup map still in LinuxTask.java per wordSize?  Here is a patch,

Index: frysk-core/frysk/proc/LinuxTask.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/proc/LinuxTask.java,v
retrieving revision 1.38
diff -u -r1.38 LinuxTask.java
--- frysk-core/frysk/proc/LinuxTask.java        11 Oct 2006 21:33:01 -0000      1.38
+++ frysk-core/frysk/proc/LinuxTask.java        20 Oct 2006 06:22:39 -0000
@@ -66,7 +66,13 @@
     ByteOrder byteOrder = getIsa().getByteOrder();
     // XXX: For writing at least, PTRACE must be used as /proc/mem
     // cannot be written to. 
-    memory = new PtraceByteBuffer(id.id, PtraceByteBuffer.Area.DATA,
+    // For 64-bit address space.
+    if (getIsa().getWordSize() == 8)
+      memory = new PtraceByteBuffer(id.id, PtraceByteBuffer.Area.DATA,
+                                   0x7fffffffffffffffl);
+    // For 32-bit address space.
+    else
+      memory = new PtraceByteBuffer(id.id, PtraceByteBuffer.Area.DATA,
                                   0xffffffffl);
     memory.order(byteOrder);
     registerBank = getIsa().getRegisterBankBuffers(id.id);
Comment 2 Phil Muldoon 2006-10-23 00:30:39 UTC
That would be good, too. Right now I cannot get very many core maps on x86_64
because I get buffer underflows. Your patch fixes that on x86_64 at least. I'd
be happy to see it in CVS.

Any objections Andrew?
Comment 3 Andrew Cagney 2006-10-23 16:10:31 UTC
The change is ok as a workaround, however it still leaves half of 64-bit memory
inaccessable.  Likely bignum's are needed for that.
Comment 4 Yao Qi 2006-10-24 03:53:54 UTC
Check in the patch in comment#1 as a workaround.

2006-10-24  Yao Qi  <qiyaoltc@cn.ibm.com>
 
        * LinuxTask.java (Task): Enlarge the boundary of PtraceByteBuffer
        for 64-bit address space.
Comment 5 Andrew Cagney 2006-10-27 17:58:00 UTC
Workaround committed.  See #1537 for ultimate fix
Comment 6 Phil Muldoon 2007-04-03 18:18:34 UTC
It seems that on FC6, vDSO is now mapped at the end of the address space on
x86_64  systems. Not sure if that is with some processes, or all.

A possible fix here would be to use BigIntegers instead of longs.

As a note, as this is the vDSO segments that are affected, backtraces will be
affected, as well as fcore dumps.
Comment 7 Mark Wielaard 2007-07-23 09:48:00 UTC
#1537 has been fixed, which was the right fix also for this bug.

*** This bug has been marked as a duplicate of 1537 ***