public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "i at maskray dot me" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/94722] implement __attribute__((no_stack_protector)) function attribute
Date: Thu, 17 Dec 2020 05:34:46 +0000 [thread overview]
Message-ID: <bug-94722-4-d7a5hLIfAw@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
Fangrui Song <i at maskray dot me> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |i at maskray dot me
--- Comment #7 from Fangrui Song <i at maskray dot me> ---
(In reply to Martin Liška from comment #6)
> Implemented.
#include <string.h>
void foo(const char *a) { char b[34]; strcpy(b, a); }
__attribute__((no_stack_protector))
void bar(const char *a) { foo(a); }
#include <string.h>
__attribute__((no_stack_protector))
void foo(const char *a) { char b[34]; strcpy(b, a); }
void bar(const char *a) { foo(a); }
In both cases, foo can be inlined.
In Clang, the recent resolution https://reviews.llvm.org/D91816 is that a ssp
function cannot be inlined into a nossp function and a nossp function cannot be
inlined into a ssp function.
I think one argument for the no-inline behavior is that ssp conveys the
security enforcement intention and the GCC behavior may degrade the security
hardening while inlining a ssp chunk.
Previously Clang upgraded the caller from nossp to ssp after inlining. However,
that behavior caused
https://lore.kernel.org/lkml/20200422192113.GG26846@zn.tnic/T/#t
(the caller may not have set up %gs and upgrading it to ssp can break it)
The new Clang behavior also disallows a nossp callee from being inlined into a
ssp caller. That makes the rules easier to explain but I haven't thought very
clearly about the implications though.
next prev parent reply other threads:[~2020-12-17 5:34 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 [this message]
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
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-d7a5hLIfAw@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).