mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: objtool/core] objtool: Fix off-by-one in symbol_by_offset()
@ 2020-04-23  7:49 tip-bot2 for Julien Thierry
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Julien Thierry @ 2020-04-23  7:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Julien Thierry, Miroslav Benes, Josh Poimboeuf, Ingo Molnar, x86, LKML

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     5377cae94ae31b089d4a69e7706672501c974f4d
Gitweb:        https://git.kernel.org/tip/5377cae94ae31b089d4a69e7706672501c974f4d
Author:        Julien Thierry <jthierry@redhat.com>
AuthorDate:    Fri, 03 Apr 2020 14:17:30 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 22 Apr 2020 10:53:49 +02:00

objtool: Fix off-by-one in symbol_by_offset()

Sometimes, WARN_FUNC() and other users of symbol_by_offset() will
associate the first instruction of a symbol with the symbol preceding
it.  This is because symbol->offset + symbol->len is already outside of
the symbol's range.

Fixes: 2a362ecc3ec9 ("objtool: Optimize find_symbol_*() and read_symbols()")
Signed-off-by: Julien Thierry <jthierry@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 tools/objtool/elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 09ddc8f..c4857fa 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
 
 	if (*o < s->offset)
 		return -1;
-	if (*o > s->offset + s->len)
+	if (*o >= s->offset + s->len)
 		return 1;
 
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [tip: objtool/core] objtool: Fix off-by-one in symbol_by_offset()
@ 2020-04-22 22:24 tip-bot2 for Julien Thierry
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Julien Thierry @ 2020-04-22 22:24 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Julien Thierry, Miroslav Benes, Josh Poimboeuf, x86, LKML

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     943331cbc831741731a5b2d45dad018ecc80413b
Gitweb:        https://git.kernel.org/tip/943331cbc831741731a5b2d45dad018ecc80413b
Author:        Julien Thierry <jthierry@redhat.com>
AuthorDate:    Fri, 03 Apr 2020 14:17:30 +01:00
Committer:     Josh Poimboeuf <jpoimboe@redhat.com>
CommitterDate: Tue, 14 Apr 2020 10:39:24 -05:00

objtool: Fix off-by-one in symbol_by_offset()

Sometimes, WARN_FUNC() and other users of symbol_by_offset() will
associate the first instruction of a symbol with the symbol preceding
it.  This is because symbol->offset + symbol->len is already outside of
the symbol's range.

Fixes: 2a362ecc3ec9 ("objtool: Optimize find_symbol_*() and read_symbols()")
Signed-off-by: Julien Thierry <jthierry@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 tools/objtool/elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 09ddc8f..c4857fa 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -105,7 +105,7 @@ static int symbol_by_offset(const void *key, const struct rb_node *node)
 
 	if (*o < s->offset)
 		return -1;
-	if (*o > s->offset + s->len)
+	if (*o >= s->offset + s->len)
 		return 1;
 
 	return 0;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23  7:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23  7:49 [tip: objtool/core] objtool: Fix off-by-one in symbol_by_offset() tip-bot2 for Julien Thierry
  -- strict thread matches above, loose matches on Subject: below --
2020-04-22 22:24 tip-bot2 for Julien Thierry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®