From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] qemu: add patch to fix SSP support detection
Date: Mon, 16 Nov 2015 07:32:24 +0100 [thread overview]
Message-ID: <56497878.6080500@mind.be> (raw)
In-Reply-To: <CABLs7GXiOVap1qiJw4URKFMusfBe6FRuejb9eCHt02aiMz_okQ@mail.gmail.com>
On 14-11-15 04:32, Rodrigo Rebello wrote:
> Arnout, All,
>
> 2015-11-13 5:10 GMT-02:00 Arnout Vandecappelle <arnout@mind.be>:
> [snip]
>>>> I wonder what would happen if LTO were enabled, since in that case the function
>>>> could be elided again...
>>>>
>>>
>>> Indeed, I've run a test with LTO enabled and no stack protection code
>>> gets emitted due to the optimizations. Finding a test code fragment
>>> that works for all possibilities isn't so simple after all.
>>>
>>> Maybe we should stick to the original v1 of this patch which disables
>>> SSP detection when it's known to be unsupported in the toolchain? Far
>>> from perfect, but at least it's more robust.
>>
>> It would be nicer to find a fundamental upstreamable solution, but yes, the
>> original solution was more robust.
>>
>
> Well, I've improved on the test code and the new version is not only
> shorter (no need for foo()), but it also works with LTO enabled:
>
> [snip]
> cat > $TMPC << EOF
> int main(int argc, char *argv[])
> {
> char arr[64], *p = arr, *c = argv[0];
> while (*c) {
> *p++ = *c++;
> }
> return 0;
> }
> EOF
Yep, this piece of code is perfect, since it _will_ smash the stack (if
strlen(argv[0]) > 64) so the SSP support _must_ be linked in. The only thing
that could happen in some distant future is that the compiler does sufficient
static analysis to detect the problem at compile time and errors out
immediately, but at the moment that's a bit far-fetched.
> [snip]
>
> As this is more robust than the previous one, I've sent a new patch
> upstream. It's already been reviewed by one person, but not yet
> accepted:
> https://patchwork.ozlabs.org/patch/543357/
>
> I suspect I should wait for a while before submitting an update to the
> buildroot list. However, given the great amount of patches the QEMU
> project receives every day, I wonder if that will be looked at anytime
> soon (if ever).
No need to wait to submit it to buildroot IMHO.
>
> On the other hand, modifying the gcc wrapper to error out on
> -fstack-protector-* when SSP is unsupported is straightforward and
> I've already cooked up a patch for that. I could send it immediately
> and maybe mark this qemu-specific patch as rejected or superseded.
Yes, please do send that patch. It is however something that will probably only
be applied to next, while the qemu patch can be applied to master, so you should
probably send both of them.
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
next prev parent reply other threads:[~2015-11-16 6:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-11 22:18 [Buildroot] [PATCH v2 1/1] qemu: add patch to fix SSP support detection Rodrigo Rebello
2015-11-11 23:30 ` Arnout Vandecappelle
2015-11-11 23:49 ` Rodrigo Rebello
2015-11-12 8:19 ` Arnout Vandecappelle
2015-11-12 15:04 ` Rodrigo Rebello
2015-11-13 7:10 ` Arnout Vandecappelle
2015-11-14 3:32 ` Rodrigo Rebello
2015-11-16 6:32 ` Arnout Vandecappelle [this message]
2015-11-16 10:15 ` Rodrigo Rebello
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=56497878.6080500@mind.be \
--to=arnout@mind.be \
--cc=buildroot@busybox.net \
/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