qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Anatol Pomozov <anatol.pomozov@gmail.com>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] How to make ELF headers/symbol sections available for multiboot?
Date: Mon, 31 Jul 2017 13:27:20 +0200	[thread overview]
Message-ID: <20170731112720.GA12064@localhost.localdomain> (raw)
In-Reply-To: <20170730214231.GC16400@localhost.localdomain>

Am 30.07.2017 um 23:42 hat Eduardo Habkost geschrieben:
> CCing Alex, the original author of load_multiboot(), and Kevin,
> who touched multiboot code recently.

For some values of "recently". :-)

> On Fri, Jul 28, 2017 at 02:28:34PM -0700, Anatol Pomozov wrote:
> > Hi
> > 
> > I am looking at x86 multiboot code and trying to add "ELF section
> > header" info feature. This will let target to learn more about booted
> > binary and its sections.
> 
> Are there existing OSes that use that information?

You mean, like, relevant ones? I've used this feature before myself and
I think I've seen others use it for OSes that will never spread much
beyond their own computer, but from the more popular OSes that implement
Multiboot, it seems that at least NetBSD and the Hurd (or really GNU
Mach) are making some use of it.

> > I have a draft here
> > https://github.com/anatol/qemu/commit/ad943a6eb78feee048b6bb2a1e5f49f5b686e24c
> > 
> > My understanding is that qemu multiboot loads only TEXT/BSS/DATA
> > sections. Other stuff like symbols sections and ELF headers are not
> > available for target.
> > 
> > So I need to perform 2 things:
> > 
> >  - Load ELF section headers into target's memory. I did by appending
> > additional space to mbs.mb_buf and copying header data. Is it the best
> > way to do?

I think I would have done the same.

> >  - Next I need to load other ELF sections such as symbols (e.g.
> > .shstrtab) that store section names. What is the best way to do in
> > multiboo.c code? Would it make sense to load all ELF sections?

I think that the functions in include/hw/elf_ops.h (specifically
load_symbols32) might already do most of what you need. This file is
just a bit hard to navigate because the function names are composed by
preprocessor macros.

In the end it seems to fill a global variable struct syminfo *syminfos.
Maybe you can get the information you need from there, though it seems
to have been processed (keep only function symbols, sort the list). It
would be more correct to provide the original symbol table.

Kevin

  parent reply	other threads:[~2017-07-31 11:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 21:28 [Qemu-devel] How to make ELF headers/symbol sections available for multiboot? Anatol Pomozov
2017-07-30 21:42 ` Eduardo Habkost
2017-07-31  6:25   ` Alexander Graf
2017-07-31 11:27   ` Kevin Wolf [this message]
2017-07-31 17:21   ` Anatol Pomozov
2017-07-31 18:20     ` Richard Henderson
2017-08-02 22:00       ` Anatol Pomozov
2017-08-02 22:45         ` Richard Henderson
2017-08-03  8:39         ` Kevin Wolf
2017-08-04  4:53           ` Anatol Pomozov
2017-08-08 15:04             ` Kevin Wolf
2017-08-17 20:54               ` Anatol Pomozov
2017-09-11 18:48                 ` Anatol Pomozov
2017-09-11 18:49                 ` Anatol Pomozov
2017-08-01 14:06     ` Kevin Wolf
2017-07-31  8:50 ` Peter Maydell
2017-07-31 13:04   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170731112720.GA12064@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=agraf@suse.de \
    --cc=anatol.pomozov@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).