public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112470] New: [AARCH64]stack-protector vulnerability fixing solution impact code size and performance.
@ 2023-11-10  3:29 dongjianqiang2 at huawei dot com
  2023-11-10 22:25 ` [Bug target/112470] [11/12/13/14 regression] [AARCH64] stack-protector " sjames at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: dongjianqiang2 at huawei dot com @ 2023-11-10  3:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112470
           Summary: [AARCH64]stack-protector vulnerability fixing solution
                    impact code size and performance.
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dongjianqiang2 at huawei dot com
  Target Milestone: ---

Hi, after the CVE-2023-4039 patch is installed, the code size and performance
are affected after stack protection is enabled. 
Refer to https://godbolt.org/z/7dWeYd5Kb
After analyzing the patch, I think we can add the following modification
solution: For functions that need to dynamically apply for stackframe, we can
change the stack distribution of local variables, in other cases, the original
stack distribution will be retained.

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 800a8b0e110..342bab89281 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -8538,7 +8538,7 @@ aarch64_save_regs_above_locals_p ()
      it would be possible for a carefully sized smash attack to change
      the saved registers (particularly LR and FP) without reaching the
      canary.  */
-  return crtl->stack_protect_guard;
+  return crtl->stack_protect_guard && cfun->calls_alloca;
 }

 /* Mark the registers that need to be saved by the callee and calculate


Please let me know if you have any comments

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

end of thread, other threads:[~2024-03-25 12:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-10  3:29 [Bug target/112470] New: [AARCH64]stack-protector vulnerability fixing solution impact code size and performance dongjianqiang2 at huawei dot com
2023-11-10 22:25 ` [Bug target/112470] [11/12/13/14 regression] [AARCH64] stack-protector " sjames at gcc dot gnu.org
2023-11-10 22:28 ` pinskia at gcc dot gnu.org
2023-11-13  7:44 ` dongjianqiang2 at huawei dot com
2023-11-13  7:55 ` sjames at gcc dot gnu.org
2023-11-13  9:47 ` rsandifo at gcc dot gnu.org
2023-11-13 10:56 ` dongjianqiang2 at huawei dot com
2023-11-13 11:03 ` rsandifo at gcc dot gnu.org
2023-11-13 12:39 ` dongjianqiang2 at huawei dot com
2023-12-21 19:12 ` pinskia at gcc dot gnu.org
2024-01-25 10:39 ` pinskia at gcc dot gnu.org
2024-01-25 10:39 ` pinskia at gcc dot gnu.org
2024-01-30 12:39 ` xry111 at gcc dot gnu.org
2024-03-19 12:49 ` jakub at gcc dot gnu.org
2024-03-19 13:01 ` xry111 at gcc dot gnu.org
2024-03-25 12:49 ` rguenth at gcc dot gnu.org

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).