public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Peng Yu <pengyu.ut@gmail.com>,
	"gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: Is there a way to distinguish binary files compiled with -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2
Date: Mon, 12 Apr 2021 05:58:46 -0600	[thread overview]
Message-ID: <67f1ff42-bc68-6e78-b9ab-c1987d231532@gmail.com> (raw)
In-Reply-To: <CABrM6wkz+u78g-L6hs1ya34NaPsE2QiQ0P+ndJgoB9wU8NnjHQ@mail.gmail.com>


On 4/7/2021 9:28 PM, Peng Yu via Gcc-help wrote:
> https://gcc.gnu.org/legacy-ml/gcc-patches/2004-09/msg02055.html
>
> When I compile a .c file with -D_FORTIFY_SOURCE=1 and
> -D_FORTIFY_SOURCE=2, the binary files both contain symbols like
> ..._chk@...
>
> So I can not tell whether _FORTIFY_SOURCE is 1 or 2 just by whether
> symbols have ..._chk@....
>
> Is there a way to tell the difference only from the binary file?

annobin/annocheck is probably the most likely way to be able to detect 
this, but I don't know offhand if it can distinguish between the 
different fortify-source levels.  It also (naturally) assumes you've got 
the annobin plugin installed and that it was enabled when you built your 
code.


Nick Clifton (nickc@redhat.com) is probably the best contact point for 
understanding annobin/annocheck's capabilities.


jeff


      parent reply	other threads:[~2021-04-12 11:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  3:28 Peng Yu
2021-04-08 22:54 ` Martin Sebor
2021-04-12 11:58 ` Jeff Law [this message]

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=67f1ff42-bc68-6e78-b9ab-c1987d231532@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=pengyu.ut@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).