Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Mark Hatle <mark.hatle@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] insane: detect and warn about relocations in .text
Date: Wed, 7 Nov 2012 10:59:09 +0100	[thread overview]
Message-ID: <509A30ED.2070905@windriver.com> (raw)
In-Reply-To: <1352222654.13864.316.camel@phil-desktop>

On 11/6/12 6:24 PM, Phil Blundell wrote:
> Ping?

I do think we need this.  Having the textrel does prevent prelinking as well.

--Mark

> On Wed, 2012-10-03 at 11:24 +0100, Phil Blundell wrote:
>> Signed-off-by: Phil Blundell <pb@pbcl.net>
>> ---
>> This requires qa.elf.run_objdump() so needs to be applied after the
>> patch which adds that function.
>>
>>   meta/classes/insane.bbclass |   26 +++++++++++++++++++++++++-
>>   1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
>> index 5848ab4..ff35ed8 100644
>> --- a/meta/classes/insane.bbclass
>> +++ b/meta/classes/insane.bbclass
>> @@ -108,7 +108,7 @@ def package_qa_get_machine_dict():
>>
>>
>>   # Currently not being used by default "desktop"
>> -WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir"
>> +WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir textrel"
>>   ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp"
>>
>>   ALL_QA = "${WARN_QA} ${ERROR_QA}"
>> @@ -421,6 +421,30 @@ def package_qa_check_desktop(path, name, d, elf, messages):
>>           for l in output:
>>               messages.append("Desktop file issue: " + l.strip())
>>
>> +QAPATHTEST[textrel] = "package_qa_textrel"
>> +def package_qa_textrel(path, name, d, elf, messages):
>> +    """
>> +    Check if the binary contains relocations in .text
>> +    """
>> +
>> +    if not elf:
>> +        return
>> +
>> +    if os.path.islink(path):
>> +        return
>> +
>> +    phdrs = elf.run_objdump("-p", d)
>> +    sane = True
>> +
>> +    import re
>> +    textrel_re = re.compile("\s+TEXTREL\s+")
>> +    for line in phdrs.split("\n"):
>> +        if textrel_re.match(line):
>> +	   sane = False
>> +
>> +    if not sane:
>> +        messages.append("ELF binary '%s' has relocations in .text" % path)
>> +
>>   QAPATHTEST[ldflags] = "package_qa_hash_style"
>>   def package_qa_hash_style(path, name, d, elf, messages):
>>       """
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>




  reply	other threads:[~2012-11-07 10:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 17:24 [PATCH] insane: detect and warn about relocations in .text Phil Blundell
2012-11-07  9:59 ` Mark Hatle [this message]
2012-11-07 14:37   ` Richard Purdie
  -- strict thread matches above, loose matches on Subject: below --
2012-10-03 15:42 Phil Blundell
2012-10-03 15:56 ` Mark Hatle
2012-10-03 10:24 Phil Blundell
2012-10-03 10:31 ` Martin Jansa
2012-10-03 10:44   ` Phil Blundell
2012-10-03 11:19     ` Richard Purdie
2012-10-03 12:39       ` Phil Blundell

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=509A30ED.2070905@windriver.com \
    --to=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.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