From 202e5ccf04076fa49db7a4a7e6f6405b7119fb3d62692cdb99eb4966648814b6 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 25 Sep 2017 20:30:40 +0000 Subject: [PATCH] - Add support for zero-sized VLAs and allocas with -fstack-clash-protection. [bnc #1059075] Changes gcc43-stack-probe.diff . OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc7?expand=0&rev=83 --- cross-aarch64-gcc7.changes | 7 +++++++ cross-arm-gcc7.changes | 7 +++++++ cross-avr-gcc7.changes | 7 +++++++ cross-epiphany-gcc7-bootstrap.changes | 7 +++++++ cross-epiphany-gcc7.changes | 7 +++++++ cross-hppa-gcc7.changes | 7 +++++++ cross-i386-gcc7.changes | 7 +++++++ cross-m68k-gcc7.changes | 7 +++++++ cross-mips-gcc7.changes | 7 +++++++ cross-nvptx-gcc7.changes | 7 +++++++ cross-ppc64-gcc7.changes | 7 +++++++ cross-ppc64le-gcc7.changes | 7 +++++++ cross-rx-gcc7-bootstrap.changes | 7 +++++++ cross-rx-gcc7.changes | 7 +++++++ cross-s390x-gcc7.changes | 7 +++++++ cross-sparc-gcc7.changes | 7 +++++++ cross-sparc64-gcc7.changes | 7 +++++++ cross-x86_64-gcc7.changes | 7 +++++++ gcc7-stack-probe.diff | 27 +++++++++++++++++++++------ gcc7-testresults.changes | 7 +++++++ gcc7.changes | 7 +++++++ 21 files changed, 161 insertions(+), 6 deletions(-) diff --git a/cross-aarch64-gcc7.changes b/cross-aarch64-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-aarch64-gcc7.changes +++ b/cross-aarch64-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-arm-gcc7.changes b/cross-arm-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-arm-gcc7.changes +++ b/cross-arm-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-avr-gcc7.changes b/cross-avr-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-avr-gcc7.changes +++ b/cross-avr-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-epiphany-gcc7-bootstrap.changes b/cross-epiphany-gcc7-bootstrap.changes index fd0d438..10c47f2 100644 --- a/cross-epiphany-gcc7-bootstrap.changes +++ b/cross-epiphany-gcc7-bootstrap.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-epiphany-gcc7.changes b/cross-epiphany-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-epiphany-gcc7.changes +++ b/cross-epiphany-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-hppa-gcc7.changes b/cross-hppa-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-hppa-gcc7.changes +++ b/cross-hppa-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-i386-gcc7.changes b/cross-i386-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-i386-gcc7.changes +++ b/cross-i386-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-m68k-gcc7.changes b/cross-m68k-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-m68k-gcc7.changes +++ b/cross-m68k-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-mips-gcc7.changes b/cross-mips-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-mips-gcc7.changes +++ b/cross-mips-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-nvptx-gcc7.changes b/cross-nvptx-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-nvptx-gcc7.changes +++ b/cross-nvptx-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-ppc64-gcc7.changes b/cross-ppc64-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-ppc64-gcc7.changes +++ b/cross-ppc64-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-ppc64le-gcc7.changes b/cross-ppc64le-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-ppc64le-gcc7.changes +++ b/cross-ppc64le-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-rx-gcc7-bootstrap.changes b/cross-rx-gcc7-bootstrap.changes index fd0d438..10c47f2 100644 --- a/cross-rx-gcc7-bootstrap.changes +++ b/cross-rx-gcc7-bootstrap.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-rx-gcc7.changes b/cross-rx-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-rx-gcc7.changes +++ b/cross-rx-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-s390x-gcc7.changes b/cross-s390x-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-s390x-gcc7.changes +++ b/cross-s390x-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-sparc-gcc7.changes b/cross-sparc-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-sparc-gcc7.changes +++ b/cross-sparc-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-sparc64-gcc7.changes b/cross-sparc64-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-sparc64-gcc7.changes +++ b/cross-sparc64-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/cross-x86_64-gcc7.changes b/cross-x86_64-gcc7.changes index fd0d438..10c47f2 100644 --- a/cross-x86_64-gcc7.changes +++ b/cross-x86_64-gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/gcc7-stack-probe.diff b/gcc7-stack-probe.diff index 9194dda..28fc481 100644 --- a/gcc7-stack-probe.diff +++ b/gcc7-stack-probe.diff @@ -30,12 +30,12 @@ Index: gcc/explow.c HOST_WIDE_INT stack_usage_size = -1; rtx_code_label *final_label; rtx final_target, target; -+ rtx loop_lab, end_lab, last_size; ++ rtx loop_lab, end_lab, skip_lab, last_size, before_skip; + int probe_pass = 0; /* If we're asking for zero bytes, it doesn't matter what we point to since we can't dereference it. But return a reasonable -@@ -1440,6 +1444,24 @@ allocate_dynamic_stack_space (rtx size, +@@ -1440,6 +1444,30 @@ allocate_dynamic_stack_space (rtx size, /* Don't let anti_adjust_stack emit notes. */ suppress_reg_args_size = true; @@ -47,6 +47,12 @@ Index: gcc/explow.c + size = copy_to_mode_reg (Pmode, convert_to_mode (Pmode, size, 1)); + loop_lab = gen_label_rtx (); + end_lab = gen_label_rtx (); ++ skip_lab = gen_label_rtx (); ++ /* We insert 'target = virtual_stack_dynamic_rtx' here, but target ++ is changed later, so that insn can be constructed only later. */ ++ before_skip = get_last_insn (); ++ emit_cmp_and_jump_insns (size, CONST0_RTX (Pmode), EQ, NULL_RTX, ++ Pmode, 1, skip_lab); + emit_label (loop_lab); + emit_cmp_and_jump_insns (size, GEN_INT (PROBE_INTERVAL), LTU, + NULL_RTX, Pmode, 1, end_lab); @@ -60,7 +66,7 @@ Index: gcc/explow.c /* Perform the required allocation from the stack. Some systems do this differently than simply incrementing/decrementing from the stack pointer, such as acquiring the space by calling malloc(). */ -@@ -1499,6 +1521,15 @@ allocate_dynamic_stack_space (rtx size, +@@ -1499,6 +1527,15 @@ allocate_dynamic_stack_space (rtx size, if (STACK_GROWS_DOWNWARD) emit_move_insn (target, virtual_stack_dynamic_rtx); } @@ -76,16 +82,25 @@ Index: gcc/explow.c suppress_reg_args_size = false; -@@ -1510,6 +1541,8 @@ allocate_dynamic_stack_space (rtx size, +@@ -1510,6 +1547,17 @@ allocate_dynamic_stack_space (rtx size, emit_label (final_label); target = final_target; } + if (flag_stack_clash_protection) -+ emit_stack_probe (target); ++ { ++ rtx seq; ++ emit_stack_probe (target); ++ emit_label (skip_lab); ++ start_sequence (); ++ emit_move_insn (target, virtual_stack_dynamic_rtx); ++ seq = get_insns (); ++ end_sequence (); ++ emit_insn_after (seq, before_skip); ++ } target = align_dynamic_address (target, required_align); -@@ -1593,8 +1626,6 @@ emit_stack_probe (rtx address) +@@ -1593,8 +1641,6 @@ emit_stack_probe (rtx address) the current stack pointer. STACK_GROWS_DOWNWARD says whether to add or subtract them from the stack pointer. */ diff --git a/gcc7-testresults.changes b/gcc7-testresults.changes index fd0d438..10c47f2 100644 --- a/gcc7-testresults.changes +++ b/gcc7-testresults.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com diff --git a/gcc7.changes b/gcc7.changes index fd0d438..10c47f2 100644 --- a/gcc7.changes +++ b/gcc7.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Sep 25 20:22:09 UTC 2017 - matz@suse.de + +- Add support for zero-sized VLAs and allocas with + -fstack-clash-protection. [bnc #1059075] + Changes gcc43-stack-probe.diff . + ------------------------------------------------------------------- Tue Aug 29 07:17:15 UTC 2017 - rguenther@suse.com