virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <jbeulich@novell.com>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	virtualization@lists.osdl.org, Roland McGrath <roland@redhat.com>,
	Andi Kleen <ak@suse.de>, lkml <linux-kernel@vger.kernel.org>,
	Zachary Amsden <zach@vmware.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [patch 1/2] Relocate VDSO ELF headers to match mapped location with COMPAT_VDSO
Date: Thu, 05 Apr 2007 08:10:40 +0100	[thread overview]
Message-ID: <4614BD10.76E4.0078.0@novell.com> (raw)
In-Reply-To: <20070405045843.333498131@goop.org>

>+static __cpuinit void reloc_dyn(Elf32_Ehdr *ehdr, unsigned offset)
>+{
>+	Elf32_Dyn *dyn = (void *)ehdr + offset;
>+
>+	for(; dyn->d_tag != DT_NULL; dyn++)
>+		switch(dyn->d_tag) {
>+		case DT_PLTGOT:
>+		case DT_HASH:
>+		case DT_STRTAB:
>+		case DT_SYMTAB:
>+		case DT_RELA:
>+		case DT_INIT:
>+		case DT_FINI:
>+		case DT_REL:
>+		case DT_JMPREL:
>+		case DT_VERSYM:
>+		case DT_VERDEF:
>+		case DT_VERNEED:
>+			dyn->d_un.d_val += VDSO_HIGH_BASE;
>+		}
>+}

While there's a certain level of control on what DT_* may appear in the
vDSO, not even considering other than the above types seems fragile to
me. Since future additions to the set are supposedly following a fixed
scheme (distinguishing pointers and values via the low bit when below
OLD_DT_LOOS, and using sub-ranges when between DT_HIOS and
OLD_DT_HIOS), at least also handling those would seem like a good
idea, as would warning about unrecognized types.

Also, even though it shouldn't matter for the final result, if doing things
spec-conforming here you should use d_un.d_ptr.

In addition to Roland's remarks about missing symbol table relocation, I
would also assume section headers, if present, should be relocated.

Jan

  parent reply	other threads:[~2007-04-05  7:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05  4:58 [patch 0/2] Updates to compat VDSOs Jeremy Fitzhardinge
2007-04-05  4:58 ` [patch 1/2] Relocate VDSO ELF headers to match mapped location with COMPAT_VDSO Jeremy Fitzhardinge
2007-04-05  6:31   ` Roland McGrath
2007-04-05  6:46     ` Jeremy Fitzhardinge
2007-04-05  8:14       ` Roland McGrath
2007-04-05  7:10   ` Jan Beulich [this message]
2007-04-05  7:31     ` Jeremy Fitzhardinge
2007-04-05  7:45       ` Raharjo, Cahyo (cahr)
2007-04-05  7:47       ` Jan Beulich
2007-04-05  8:14     ` Roland McGrath
2007-04-05  8:18       ` Jeremy Fitzhardinge
2007-04-05  8:54         ` Jan Beulich
2007-04-05  8:58         ` Roland McGrath
2007-04-05  4:58 ` [patch 2/2] Make COMPAT_VDSO runtime selectable Jeremy Fitzhardinge
  -- strict thread matches above, loose matches on Subject: below --
2007-04-05 15:53 [patch 0/2] Updates to compat VDSOs Jeremy Fitzhardinge
2007-04-05 15:53 ` [patch 1/2] Relocate VDSO ELF headers to match mapped location with COMPAT_VDSO Jeremy Fitzhardinge

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=4614BD10.76E4.0078.0@novell.com \
    --to=jbeulich@novell.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=virtualization@lists.osdl.org \
    --cc=zach@vmware.com \
    /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).