public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94722] New: implement __attribute__((no_stack_protector)) function attribute
@ 2020-04-22 21:03 ndesaulniers at google dot com
  2020-04-22 21:16 ` [Bug c/94722] " joseph at codesourcery dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ndesaulniers at google dot com @ 2020-04-22 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94722
           Summary: implement __attribute__((no_stack_protector)) function
                    attribute
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ndesaulniers at google dot com
                CC: jakub at redhat dot com, mliska at suse dot cz
  Target Milestone: ---

There's a couple of places in the Linux kernel where the placement of stack
protector guards causes problems for functions that do some tricky things. 
We'd like to have the ability to keep -fstack-protector* protections throughout
the kernel, but have finer grain resolution to disable the placement and
checking of stack guards on a per function granularity.

clang-8 added support for the function attribute no_stack_protector.
https://clang.llvm.org/docs/AttributeReference.html#no-stack-protector

With this feature implemented, we could have a more portable solution for the
kernel.

Two examples in the kernel where we could make use of this are
[0] https://lore.kernel.org/lkml/20200422192113.GG26846@zn.tnic/T/#t (call to
cpu_startup_entry() in start_secondary() in arch/x86/kernel/smpboot.c after
calls to boot_init_stack_canary() which has modified the stack guard).
[1]
https://lore.kernel.org/lkml/20180621162324.36656-1-ndesaulniers@google.com/
(custom calling conventions)

[0] was worked around with an empty asm statement and a descriptive comment.
[1] was worked around with `extern inline` with gnu_inline semantics.

I would prefer to use a function attribute for both cases.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-18  0:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 21:03 [Bug c/94722] New: implement __attribute__((no_stack_protector)) function attribute 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 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).