public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ndesaulniers at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/94722] implement __attribute__((no_stack_protector)) function attribute
Date: Fri, 18 Dec 2020 00:17:21 +0000	[thread overview]
Message-ID: <bug-94722-4-YqiE8QVkHB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94722-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94722

--- Comment #10 from Nick Desaulniers <ndesaulniers at google dot com> ---
(In reply to Jakub Jelinek from comment #9)
> I've said in that thread that I don't really like disabling the inlining, if
> we wanted to make sure everything is stack protected, we'd need to disable
> all the inlining no matter whether the attribute is there or not, because
> inlining by definition removes the stack protector checks, it is only tested
> on function boundaries, not on inline function boundaries.
> The user has the option to add noinline when he wants.

I'm not against reverting my recent change to LLVM's inlining behavior
(https://reviews.llvm.org/D91816, and the follow up to the docs
https://reviews.llvm.org/D93422).  Would be less work to do for inlining
decisions.

In the kernel, we could introduce a macro that's "noinline_for_lto" or
"noinline_due_to_stackprotectors" or such; this specific case only comes about
due to LTO between TUs with -fstack-protector* and -fno-stack-protector and
inlining between them.

Though, I'm still concerned about local cases (forgetting LTO for a moment)
where folks use __attribute__((no_stack_protector)) will basically have to
remember to additionally use __attribute__((noinline)) lest they hit the same
kind of bugs within a TU.  LLVM's current behavior "helps" developers avoid
such pitfalls; otherwise developers will have to be able to diagnose on their
own when such a case arises such that it causes bugs.

      parent reply	other threads:[~2020-12-18  0:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 21:03 [Bug c/94722] New: " ndesaulniers at google dot com
2020-04-22 21:16 ` [Bug c/94722] " joseph at codesourcery dot com
2020-04-22 21:28 ` ndesaulniers at google dot com
2020-04-22 21:30 ` ndesaulniers at google dot com
2020-04-23  5:31 ` marxin at gcc dot gnu.org
2020-10-22  8:11 ` cvs-commit at gcc dot gnu.org
2020-10-22  8:13 ` marxin at gcc dot gnu.org
2020-12-17  5:34 ` i at maskray dot me
2020-12-17  8:37 ` marxin at gcc dot gnu.org
2020-12-17  8:52 ` jakub at gcc dot gnu.org
2020-12-18  0:17 ` ndesaulniers at google dot com [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=bug-94722-4-YqiE8QVkHB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).