* Re: [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files.
@ 2015-10-13 18:04 Jose E. Marchesi
0 siblings, 0 replies; 5+ messages in thread
From: Jose E. Marchesi @ 2015-10-13 18:04 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 207 bytes --]
> What about this.
Looks fine. Pushed (with one tiny white-space fixup).
Thanks! This is all for sparc for now. I will try to have the stack
stuff working for the next release.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files.
@ 2015-10-13 17:45 Mark Wielaard
0 siblings, 0 replies; 5+ messages in thread
From: Mark Wielaard @ 2015-10-13 17:45 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 156 bytes --]
On Tue, 2015-10-13 at 18:39 +0200, Jose E. Marchesi wrote:
> What about this.
Looks fine. Pushed (with one tiny white-space fixup).
Thanks,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files.
@ 2015-10-13 16:39 Jose E. Marchesi
0 siblings, 0 replies; 5+ messages in thread
From: Jose E. Marchesi @ 2015-10-13 16:39 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 3432 bytes --]
> This patch just modifies elflint to not use the hook when -d is
> specified in the command-line. This fixes the test in sparc-* and
> sparc64-* targets (and presumably in alpha* targets too).
>
> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
OK, so you cannot really check this through check_special_section
because you need access to the dynamic section to check whether this is
really is the special section we are looking for. And .dynamic is also
nobits in a debuginfo file. So we cannot verify. I think we should at
least also check that the section itself is NOBITS in that case.
What about this.
commit 01b4f63005dd55632f49373a1d9ffe60acb9c211
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date: Tue Oct 13 12:40:44 2015 -0400
Do not rely on ebl_check_special_section when checking debuginfo files.
The test run-strip-strmerge.sh is failing in sparc targets. This is
because it does an `elflint -d' in a debuginfo file, and this fails
with:
section [21] '.plt' is both executable and writable
elflint uses the ebl_check_special_section hook (implemented only by
the alpha and sparc backends) in order to determine whether an
executable+writable section must be flagged or not. In both cases the
hook will fail analyzing eu-strip debuginfo files (as they should,
because debuginfo files are broken ;).
This patch just modifies elflint to not use the hook when -d is
specified in the command-line. This fixes the test in sparc-* and
sparc64-* targets (and presumably in alpha* targets too).
Additionaly, the patch checks that the type of WE sections in
debuginfo files is NOBITS.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Conflicts:
src/ChangeLog
diff --git a/src/ChangeLog b/src/ChangeLog
index 796878f..0f4ce33 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-13 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elflint.c (check_sections): Do not rely on
+ ebl_check_special_section when checking debuginfo files. Also
+ check that the type of WE sections in debuginfo files is NOBITS.
+
2015-10-07 Mark Wielaard <mjw@redhat.com>
* Makefile.am (ldlex_no_Wstack_usage): New.
diff --git a/src/elflint.c b/src/elflint.c
index fac457e..9683c1c 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3938,12 +3938,20 @@ section [%2zu] '%s' has unexpected type %d for an executable section\n"),
break;
}
- if ((shdr->sh_flags & SHF_WRITE)
- && !ebl_check_special_section (ebl, cnt, shdr,
- section_name (ebl, cnt)))
- ERROR (gettext ("\
+ if (shdr->sh_flags & SHF_WRITE)
+ {
+ if (is_debuginfo && shdr->sh_type != SHT_NOBITS)
+ ERROR (gettext ("\
+section [%2zu] '%s' must be of type NOBITS in debuginfo files\n"),
+ cnt, section_name (ebl, cnt));
+
+ if (!is_debuginfo
+ && !ebl_check_special_section (ebl, cnt, shdr,
+ section_name (ebl, cnt)))
+ ERROR (gettext ("\
section [%2zu] '%s' is both executable and writable\n"),
- cnt, section_name (ebl, cnt));
+ cnt, section_name (ebl, cnt));
+ }
}
if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files.
@ 2015-10-09 14:10 Mark Wielaard
0 siblings, 0 replies; 5+ messages in thread
From: Mark Wielaard @ 2015-10-09 14:10 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1545 bytes --]
On Fri, 2015-10-09 at 14:16 +0200, Jose E. Marchesi wrote:
> commit c5d24f902b7d97d57fe72cece3983d02efd91c5f
> Author: Jose E. Marchesi <jose.marchesi@oracle.com>
> Date: Fri Oct 9 08:09:00 2015 -0400
>
> Do not rely on ebl_check_special_section when checking debuginfo files.
>
> The test run-strip-strmerge.sh is failing in sparc targets. This is
> because it does an `elflint -d' in a debuginfo file, and this fails
> with:
>
> section [21] '.plt' is both executable and writable
>
> elflint uses the ebl_check_special_section hook (implemented only by
> the alpha and sparc backends) in order to determine whether an
> executable+writable section must be flagged or not. In both cases the
> hook will fail analyzing eu-strip debuginfo files (as they should,
> because debuginfo files are broken ;).
>
> This patch just modifies elflint to not use the hook when -d is
> specified in the command-line. This fixes the test in sparc-* and
> sparc64-* targets (and presumably in alpha* targets too).
>
> Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
OK, so you cannot really check this through check_special_section
because you need access to the dynamic section to check whether this is
really is the special section we are looking for. And .dynamic is also
nobits in a debuginfo file. So we cannot verify. I think we should at
least also check that the section itself is NOBITS in that case.
Cheers,
Mark
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files.
@ 2015-10-09 12:16 Jose E. Marchesi
0 siblings, 0 replies; 5+ messages in thread
From: Jose E. Marchesi @ 2015-10-09 12:16 UTC (permalink / raw)
To: elfutils-devel
[-- Attachment #1: Type: text/plain, Size: 1907 bytes --]
commit c5d24f902b7d97d57fe72cece3983d02efd91c5f
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date: Fri Oct 9 08:09:00 2015 -0400
Do not rely on ebl_check_special_section when checking debuginfo files.
The test run-strip-strmerge.sh is failing in sparc targets. This is
because it does an `elflint -d' in a debuginfo file, and this fails
with:
section [21] '.plt' is both executable and writable
elflint uses the ebl_check_special_section hook (implemented only by
the alpha and sparc backends) in order to determine whether an
executable+writable section must be flagged or not. In both cases the
hook will fail analyzing eu-strip debuginfo files (as they should,
because debuginfo files are broken ;).
This patch just modifies elflint to not use the hook when -d is
specified in the command-line. This fixes the test in sparc-* and
sparc64-* targets (and presumably in alpha* targets too).
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
diff --git a/src/ChangeLog b/src/ChangeLog
index 5e69d3a..24e80c0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-09 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elflint.c (check_sections): Do not rely on
+ ebl_check_special_section when checking debuginfo files.
+
2015-10-04 Mark Wielaard <mjw@redhat.com>
* strip.c (handle_elf): Only sanity check section symbols to not
diff --git a/src/elflint.c b/src/elflint.c
index c1f0be5..456d376 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3939,6 +3939,7 @@ section [%2zu] '%s' has unexpected type %d for an executable section\n"),
}
if ((shdr->sh_flags & SHF_WRITE)
+ && !is_debuginfo
&& !ebl_check_special_section (ebl, cnt, shdr,
section_name (ebl, cnt)))
ERROR (gettext ("\
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-13 18:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-13 18:04 [PATCH] elflint: do not rely on ebl_check_special_section when checking debuginfo files Jose E. Marchesi
-- strict thread matches above, loose matches on Subject: below --
2015-10-13 17:45 Mark Wielaard
2015-10-13 16:39 Jose E. Marchesi
2015-10-09 14:10 Mark Wielaard
2015-10-09 12:16 Jose E. Marchesi
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).