Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: BSD_SYMTAB ELF notes



On 09/08/14 04:25, John Nemeth wrote:
> On Aug 8, 11:51am, =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= wrote:
> } On 07/08/14 23:48, Ryan O'Neill wrote:
> } > Hello. After reading through some of the libelf-loader.c and 
> } > libelf-dominfo.c code, it appears that Xen expects BSD guest
> } > kernels to have an ELF .note auxillary entry of type
> } > XEN_ELFNOTE_BSD_SYMTAB that gets parsed in so that Xen knows to
> } > allocate room for the kernels symbol table.
> } 
> } This is only used by PV(H) guests, this note is simply a boolean that
> } tells Xen whether to load the symtab and strtab or not. Linux for
> } example doesn't load the symtab and strtab, because it has no
> } in-kernel debugger and doesn't use the full symbol table.
> } 
> } > I do not see this Note (Or any note segment/section) in my freebsd
> } > guest kernel image (readelf -n). Can someone explain to me if this
> } > Note is still used? If so, then in what case?
> } 
> } You will see this note if you compile a i386 XEN kernel, or if you
> } compile a GENERIC amd64 kernel from -current.
> 
>      No, I don't.  I only see the IDENT note giving the kernel
> version.  However, this might explain something.

This is the output I see when I do a readelf -n of an amd64 FreeBSD HEAD
kernel:

  Owner         Data size       Description
  Xen           0x00000008      Unknown note type: (0x00000006)
  Xen           0x00000009      Unknown note type: (0x00000007)
  Xen           0x00000008      Unknown note type: (0x00000005)
  Xen           0x00000008      Unknown note type: (0x00000003)
  Xen           0x00000008      Unknown note type: (0x00000004)
  Xen           0x00000008      NT_VERSION (version)
  Xen           0x00000008      NT_ARCH (architecture)
  Xen           0x00000008      Unknown note type: (0x0000000c)
  Xen           0x0000005e      Unknown note type: (0x0000000a)
  Xen           0x00000004      Unknown note type: (0x00000009)
  Xen           0x00000008      Unknown note type: (0x0000000d)
  Xen           0x00000008      Unknown note type: (0x00000008)
  Xen           0x00000004      Unknown note type: (0x0000000e)
  Xen           0x00000004      Unknown note type: (0x0000000b)

Better way to display them is to use xl -vvv when creating the guest in
order to see the notes (again this are from the same kernel):

xc: detail: elf_xen_parse_note: GUEST_OS = "FreeBSD"
xc: detail: elf_xen_parse_note: GUEST_VERSION = "0x10c8fa"
xc: detail: elf_xen_parse_note: XEN_VERSION = "xen-3.0"
xc: detail: elf_xen_parse_note: VIRT_BASE = 0xffffffff80000000
xc: detail: elf_xen_parse_note: PADDR_OFFSET = 0xffffffff80000000
xc: detail: elf_xen_parse_note: ENTRY = 0xffffffff80d09000
xc: detail: elf_xen_parse_note: HYPERCALL_PAGE = 0xffffffff80d08000
xc: detail: elf_xen_parse_note: HV_START_LOW = 0xffff800000000000
xc: detail: elf_xen_parse_note: FEATURES =
"writable_descriptor_tables|auto_translated_physmap|supervisor_mode_kernel|hvm_callback_vector"
xc: detail: elf_xen_parse_note: PAE_MODE = "yes"
xc: detail: elf_xen_parse_note: unknown xen elf note (0xd)
xc: detail: elf_xen_parse_note: LOADER = "generic"
xc: detail: elf_xen_parse_note: SUSPEND_CANCEL = 0x0
xc: detail: elf_xen_parse_note: BSD_SYMTAB = "yes"

> One project I
> worked on was trying to make modules work with Xen domU kernels.
> I managed to make them work for very simple modules, but got stymied
> with complex modules due to missing symbols.  This could potentially
> be the cause.  The question now is, how does one go about adding
> these notes?  Even if you don't know how to add the note, do you
> know the details of the note?

The way to add the notes is to use the Xen ELFNOTE macro, see:

http://svnweb.freebsd.org/base/head/sys/amd64/amd64/xen-locore.S?revision=264882&view=markup

But you should keep in mind that Xen only parses the kernel as an ELF
file and loads it into the guest memory in order to run. The modules are
just copied as raw data over to the guest memory (ie: not parsed in any
way).

Roger.


Home | Main Index | Thread Index | Old Index