diff options
| author | Martin Jansa <martin.jansa@gmail.com> | 2023-09-15 22:42:34 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-09-20 05:23:02 -1000 |
| commit | 6ebb52f0270981488022c81a4264bd7030b1ec6d (patch) | |
| tree | 03752cfd7844e4899eac3b746edfee2837f490dc | |
| parent | 992074032e646795d168ae3fbe28d663a7e5e93c (diff) | |
| download | poky-6ebb52f0270981488022c81a4264bd7030b1ec6d.tar.gz | |
gcc: backport a fix for ICE caused by CVE-2023-4039.patch
* see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111418
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111411
(From OE-Core rev: c49f6b9dc8436322359029fecb90b23d639a2100)
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-12.3.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch | 117 |
2 files changed, 118 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-12.3.inc b/meta/recipes-devtools/gcc/gcc-12.3.inc index 5896f26e1a..5655b6f46d 100644 --- a/meta/recipes-devtools/gcc/gcc-12.3.inc +++ b/meta/recipes-devtools/gcc/gcc-12.3.inc | |||
| @@ -64,6 +64,7 @@ SRC_URI = "${BASEURI} \ | |||
| 64 | file://prefix-map-realpath.patch \ | 64 | file://prefix-map-realpath.patch \ |
| 65 | file://hardcoded-paths.patch \ | 65 | file://hardcoded-paths.patch \ |
| 66 | file://CVE-2023-4039.patch \ | 66 | file://CVE-2023-4039.patch \ |
| 67 | file://0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch \ | ||
| 67 | " | 68 | " |
| 68 | SRC_URI[sha256sum] = "949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b" | 69 | SRC_URI[sha256sum] = "949a5d4f99e786421a93b532b22ffab5578de7321369975b91aec97adfda8c3b" |
| 69 | 70 | ||
diff --git a/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch b/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch new file mode 100644 index 0000000000..a408a98698 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | From adb60dc78e0da4877747f32347cee339364775be Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Richard Sandiford <richard.sandiford@arm.com> | ||
| 3 | Date: Fri, 15 Sep 2023 09:19:14 +0100 | ||
| 4 | Subject: [PATCH] aarch64: Fix loose ldpstp check [PR111411] | ||
| 5 | |||
| 6 | aarch64_operands_ok_for_ldpstp contained the code: | ||
| 7 | |||
| 8 | /* One of the memory accesses must be a mempair operand. | ||
| 9 | If it is not the first one, they need to be swapped by the | ||
| 10 | peephole. */ | ||
| 11 | if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
| 12 | && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
| 13 | return false; | ||
| 14 | |||
| 15 | But the requirement isn't just that one of the accesses must be a | ||
| 16 | valid mempair operand. It's that the lower access must be, since | ||
| 17 | that's the access that will be used for the instruction operand. | ||
| 18 | |||
| 19 | gcc/ | ||
| 20 | PR target/111411 | ||
| 21 | * config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require | ||
| 22 | the lower memory access to a mem-pair operand. | ||
| 23 | |||
| 24 | gcc/testsuite/ | ||
| 25 | PR target/111411 | ||
| 26 | * gcc.dg/rtl/aarch64/pr111411.c: New test. | ||
| 27 | |||
| 28 | Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d38f45bcca62ca0c7afef4b579f82c5c2a01610] | ||
| 29 | Signed-off-by: Martin Jansa <martin.jansa@gmail.com> | ||
| 30 | --- | ||
| 31 | gcc/config/aarch64/aarch64.cc | 8 ++- | ||
| 32 | gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | 57 +++++++++++++++++++++ | ||
| 33 | 2 files changed, 60 insertions(+), 5 deletions(-) | ||
| 34 | create mode 100644 gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 35 | |||
| 36 | diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc | ||
| 37 | index 6118a3354ac..9b1f791ca8b 100644 | ||
| 38 | --- a/gcc/config/aarch64/aarch64.cc | ||
| 39 | +++ b/gcc/config/aarch64/aarch64.cc | ||
| 40 | @@ -26154,11 +26154,9 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load, | ||
| 41 | gcc_assert (known_eq (GET_MODE_SIZE (GET_MODE (mem_1)), | ||
| 42 | GET_MODE_SIZE (GET_MODE (mem_2)))); | ||
| 43 | |||
| 44 | - /* One of the memory accesses must be a mempair operand. | ||
| 45 | - If it is not the first one, they need to be swapped by the | ||
| 46 | - peephole. */ | ||
| 47 | - if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1)) | ||
| 48 | - && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2))) | ||
| 49 | + /* The lower memory access must be a mem-pair operand. */ | ||
| 50 | + rtx lower_mem = reversed ? mem_2 : mem_1; | ||
| 51 | + if (!aarch64_mem_pair_operand (lower_mem, GET_MODE (lower_mem))) | ||
| 52 | return false; | ||
| 53 | |||
| 54 | if (REG_P (reg_1) && FP_REGNUM_P (REGNO (reg_1))) | ||
| 55 | diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 56 | new file mode 100644 | ||
| 57 | index 00000000000..ad07e9c6c89 | ||
| 58 | --- /dev/null | ||
| 59 | +++ b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | ||
| 60 | @@ -0,0 +1,57 @@ | ||
| 61 | +/* { dg-do compile { target aarch64*-*-* } } */ | ||
| 62 | +/* { dg-require-effective-target lp64 } */ | ||
| 63 | +/* { dg-options "-O -fdisable-rtl-postreload -fpeephole2 -fno-schedule-fusion" } */ | ||
| 64 | + | ||
| 65 | +extern int data[]; | ||
| 66 | + | ||
| 67 | +void __RTL (startwith ("ira")) foo (void *ptr) | ||
| 68 | +{ | ||
| 69 | + (function "foo" | ||
| 70 | + (param "ptr" | ||
| 71 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
| 72 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
| 73 | + ) ;; param "ptr" | ||
| 74 | + (insn-chain | ||
| 75 | + (block 2 | ||
| 76 | + (edge-from entry (flags "FALLTHRU")) | ||
| 77 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
| 78 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
| 79 | + (insn 5 (set (reg:DI <1>) | ||
| 80 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
| 81 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <0>) | ||
| 82 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
| 83 | + (const_int 0))) | ||
| 84 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <1>) | ||
| 85 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
| 86 | + (const_int 0))) | ||
| 87 | + (edge-to exit (flags "FALLTHRU")) | ||
| 88 | + ) ;; block 2 | ||
| 89 | + ) ;; insn-chain | ||
| 90 | + ) ;; function | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +void __RTL (startwith ("ira")) bar (void *ptr) | ||
| 94 | +{ | ||
| 95 | + (function "bar" | ||
| 96 | + (param "ptr" | ||
| 97 | + (DECL_RTL (reg/v:DI <0> [ ptr ])) | ||
| 98 | + (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ])) | ||
| 99 | + ) ;; param "ptr" | ||
| 100 | + (insn-chain | ||
| 101 | + (block 2 | ||
| 102 | + (edge-from entry (flags "FALLTHRU")) | ||
| 103 | + (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK) | ||
| 104 | + (insn 4 (set (reg:DI <0>) (reg:DI x0))) | ||
| 105 | + (insn 5 (set (reg:DI <1>) | ||
| 106 | + (plus:DI (reg:DI <0>) (const_int 768)))) | ||
| 107 | + (insn 6 (set (mem:SI (plus:DI (reg:DI <1>) | ||
| 108 | + (const_int -256)) [1 &data+512 S4 A4]) | ||
| 109 | + (const_int 0))) | ||
| 110 | + (insn 7 (set (mem:SI (plus:DI (reg:DI <0>) | ||
| 111 | + (const_int 508)) [1 &data+508 S4 A4]) | ||
| 112 | + (const_int 0))) | ||
| 113 | + (edge-to exit (flags "FALLTHRU")) | ||
| 114 | + ) ;; block 2 | ||
| 115 | + ) ;; insn-chain | ||
| 116 | + ) ;; function | ||
| 117 | +} | ||
