qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Desnogues <laurent.desnogues@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Fix symfind.
Date: Thu, 30 Jul 2009 19:23:49 +0200	[thread overview]
Message-ID: <761ea48b0907301023x69ad9991gf21195489b030f0e@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Hello,

this patch fixes an issue in symfind.

Assume you have the following symbols:

Address  Size
0045bca0 00000080 T s0
0045bd20 00000112 T s1

You'll notice that s1 is s0 + size.

So the current symfind will find that address 0045bd20 belongs to s0
instead of s1.


Laurent

Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>

[-- Attachment #2: symfind.patch --]
[-- Type: application/octet-stream, Size: 914 bytes --]

diff --git a/elf_ops.h b/elf_ops.h
index 72cd83e..1ecb58c 100644
--- a/elf_ops.h
+++ b/elf_ops.h
@@ -67,7 +67,7 @@ static int glue(symfind, SZ)(const void *s0, const void *s1)
     int result = 0;
     if (key->st_value < sym->st_value) {
         result = -1;
-    } else if (key->st_value > sym->st_value + sym->st_size) {
+    } else if (key->st_value >= sym->st_value + sym->st_size) {
         result = 1;
     }
     return result;
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 63d0ae4..a3ed7e6 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1199,7 +1199,7 @@ static int symfind(const void *s0, const void *s1)
     int result = 0;
     if (key->st_value < sym->st_value) {
         result = -1;
-    } else if (key->st_value > sym->st_value + sym->st_size) {
+    } else if (key->st_value >= sym->st_value + sym->st_size) {
         result = 1;
     }
     return result;

                 reply	other threads:[~2009-07-30 17:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=761ea48b0907301023x69ad9991gf21195489b030f0e@mail.gmail.com \
    --to=laurent.desnogues@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).