This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fcore status


I fixed the prspinfo, in the included patch. As usual, small bugs take the longest to find. ;) The problem here was not asking libelf to calculate the note header offset in memory, then re-fetching the section header, and only then updating the program header offset for notes. Just updating the structure back to the native bits is not enough; we have to ask libelf to so some shuffling around, then tell use where everything is.

I'll check this in, with a number of other fixes/changes later today.

Regards

Phil

Phil Muldoon wrote:

But at the end of output from readelf, there are some warning infor:

Notes at offset 0x00000000 with length 0x00000098:
  Owner         Data size       Description
readelf: Warning: corrupt note found at offset 0 into core notes
readelf: Warning:  type: 0, namesize: 464c457f, descsize: 00010102

The above "type", namesize and descsize are not equal to that I record
in prpsinfo struct! Although there are some warning info, I checked them
in in order that we both can start working on it. right? :-)

Right, I'll pick up where you left off and l'll run with it today. Looking at it initially, for some reason there is a small offset of gcore/kernel where the notes lives (it does not begin at 0, like ours). I'm wondering if there is some confusion on ElfEHeader and NOTES header. We might have our offsets incorrectly calculated here.


For example in others:

Section Headers:
[Nr] Name Type Addr Off Size ES Flags Lk Inf Al
[ 0] NULL 00000000 000000 000000 0 0 0 0
[ 1] note0 PROGBITS 00000000 000394 00046c 0 A 0 0 1


I will trace down the bug. If I could get some comments from you about
this, it will be appreciated very much.

2006-10-19 Yong Zheng <zhengyo@cn.ibm.com>

    * frysk-core/frysk/util/FCore.java (fillENoteSection): New
    function to construct PT_NOTE section).
    (constructSectionData): New function to construct PT_NOTE data.
    (fillENotePrpsinfo): New function to fill elf_prpsinfo info.
    * frysk-imports/lib/elf/ElfNhdr.java: New file.
    * frysk-imports/lib/elf/ELfNhdrType.h: Ditto.
    * frysk-imports/lib/elf/ELfPrpsinfo.java: Ditto.
    * frysk-imports/lib/elf/cni/ELfNhdr.cxx: Ditto.
    * frysk-imports/lib/elf/cni/ELfPrpsinfo.cxx: Ditto.


All looks great to me. I suspect we'll need above check-in for each prspinfo, prstatus, fpregset, and auxv information. Lots of structures for one section ;) I'll let you know later on today what I come up with.


Regards

Phil

Index: frysk-core/frysk/util/FCore.java
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/util/FCore.java,v
retrieving revision 1.7
diff -u -r1.7 FCore.java
--- frysk-core/frysk/util/FCore.java	19 Oct 2006 10:45:54 -0000	1.7
+++ frysk-core/frysk/util/FCore.java	19 Oct 2006 17:30:48 -0000
@@ -458,6 +458,17 @@
 		noteSectHeader.size = noteSection.getData().getSize();
 		noteSection.update(noteSectHeader);
         
+		// Must first ask libelf to construct offset location before
+		// adding offset back to program header. Otherwise program offset
+		// will be 0.
+		if (local_elf.update(ElfCommand.ELF_C_NULL) < 0) {
+			throw new ElfException("Cannot calculate note section offset");
+		}
+		
+		// Then re-fetch the elf modified header from section. Now offset 
+		// is calculated and correct.
+		noteSectHeader = noteSection.getSectionHeader();
+		
 		// Modify PT_NOTE program header
 		noteProgramHeader = local_elf.getPHeader(0);
 		noteProgramHeader.type = ElfPHeader.PTYPE_NOTE;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]