From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 39A10385DC1F; Wed, 22 Apr 2020 21:03:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39A10385DC1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587589420; bh=UcfCcBMBDYZX5sE7idZD7lsaFUk3syK5TJqF4gxbNp4=; h=From:To:Subject:Date:From; b=qzA5A9K60KayyurTuIxmwRM3P6B60dyyFek1szRcWB9NlE3+qYCE4LU80n0IygN+3 MmsMK8UelSwA7zuOCTRhT0JiPaJyS07l5eZCBA8M03FAtkfWCTrQtR/0wvX/WKu7+P NC0q8jNG3usyPW28F/d8XANkOD/tfU85/JwOgxWU= From: "ndesaulniers at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94722] New: implement __attribute__((no_stack_protector)) function attribute Date: Wed, 22 Apr 2020 21:03:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ndesaulniers at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2020 21:03:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94722 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.= =20 We'd like to have the ability to keep -fstack-protector* protections throug= hout 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 t= he 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.=