public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
@ 2015-10-16 20:23 Lukas Berk
  0 siblings, 0 replies; 4+ messages in thread
From: Lukas Berk @ 2015-10-16 20:23 UTC (permalink / raw)
  To: elfutils-devel

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

Hey Mark,

Mark Wielaard <mjw@redhat.com> writes:
[...]
> The issue can be triggered with run-strip-strmerge.sh test when configured
> with --enable-gcov. Which will insert a .tbss section and TLS symbols that
> trigger the above checks.

The patch fixes the corner case for me, test passes now. Thanks!

Cheers,

Lukas

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

* Re: [PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
@ 2015-10-18 12:03 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-10-18 12:03 UTC (permalink / raw)
  To: elfutils-devel

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

On Fri, 2015-10-16 at 16:23 -0400, Lukas Berk wrote:
> Mark Wielaard <mjw@redhat.com> writes:
> [...]
> > The issue can be triggered with run-strip-strmerge.sh test when configured
> > with --enable-gcov. Which will insert a .tbss section and TLS symbols that
> > trigger the above checks.
> 
> The patch fixes the corner case for me, test passes now. Thanks!

Thanks for testing. Pushed to master.

For those who didn't know. The reason Lukas hit this issue is because he
publishes code coverage reports for elfutils (which require configuring
with --enable-gcov): 
https://fedorapeople.org/~lberk/elfutils-coverage/
Thanks for publishing those.

Cheers,

Mark

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

* Re: [PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
@ 2015-10-18 11:58 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-10-18 11:58 UTC (permalink / raw)
  To: elfutils-devel

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

On Fri, 2015-10-16 at 16:23 -0400, Lukas Berk wrote:
> Mark Wielaard <mjw@redhat.com> writes:
> [...]
> > The issue can be triggered with run-strip-strmerge.sh test when configured
> > with --enable-gcov. Which will insert a .tbss section and TLS symbols that
> > trigger the above checks.
> 
> The patch fixes the corner case for me, test passes now. Thanks!

Thanks for testing. Pushed to master.

For those who didn't know. The reason Lukas hit this issue is because he
publishes code coverage reports for elfutils (which require configuring
with --enable-gcov): 
https://fedorapeople.org/~lberk/elfutils-coverage/
Thanks for publishing those.

Cheers,

Mark

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

* [PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs.
@ 2015-10-16 19:27 Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2015-10-16 19:27 UTC (permalink / raw)
  To: elfutils-devel

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

In debuginfo files the phdrs file offsets match those of the original ELF
file. So the section header file offsets and the TLS symbol value offset
in debuginfo files cannot be sanity checked against the phdrs file offset.

The issue can be triggered with run-strip-strmerge.sh test when configured
with --enable-gcov. Which will insert a .tbss section and TLS symbols that
trigger the above checks.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 src/ChangeLog | 7 +++++++
 src/elflint.c | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 0d2b1d6..f9e3b4a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
 2015-10-16  Mark Wielaard  <mjw@redhat.com>
 
+	* elflint.c (check_symtab): Don't check TLS symbol value against TLS
+	phdr offset in debuginfo files.
+	(check_sections): Don't try to match section offsets to phdrs offsets
+	in debuginfo files.
+
+2015-10-16  Mark Wielaard  <mjw@redhat.com>
+
 	* elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
 	SHF_MERGE and SHF_STRINGS set.
 
diff --git a/src/elflint.c b/src/elflint.c
index eada4d5..7d72a1f 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -864,7 +864,7 @@ section [%2d] '%s': symbol %zu: TLS symbol but no TLS program header entry\n"),
 section [%2d] '%s': symbol %zu: TLS symbol but couldn't get TLS program header entry\n"),
 				   idx, section_name (ebl, idx), cnt);
 			}
-		      else
+		      else if (!is_debuginfo)
 			{
 			  if (st_value
 			      < destshdr->sh_offset - phdr->p_offset)
@@ -3955,7 +3955,8 @@ section [%2zu] '%s' is both executable and writable\n"),
 	    }
 	}
 
-      if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)
+      if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0
+	  && !is_debuginfo)
 	{
 	  /* Make sure the section is contained in a loaded segment
 	     and that the initialization part matches NOBITS sections.  */
-- 
2.4.3


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

end of thread, other threads:[~2015-10-18 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-16 20:23 [PATCH] elflint: Don't check shdr or TLS symbol offsets against debuginfo phdrs Lukas Berk
  -- strict thread matches above, loose matches on Subject: below --
2015-10-18 12:03 Mark Wielaard
2015-10-18 11:58 Mark Wielaard
2015-10-16 19:27 Mark Wielaard

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 read-only IMAP folder(s) and NNTP newsgroup(s).