diff options
Diffstat (limited to 'recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch')
| -rw-r--r-- | recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch b/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch new file mode 100644 index 000000000..f0fac69fc --- /dev/null +++ b/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | From f23fb3381422c613890f77c26d11e377234481c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jerome Forissier <jerome.forissier@linaro.org> | ||
| 3 | Date: Tue, 23 Aug 2022 12:31:46 +0000 | ||
| 4 | Subject: [PATCH 3/4] arm32: libutils, libutee, ta: add .note.GNU-stack section | ||
| 5 | to | ||
| 6 | |||
| 7 | .S files | ||
| 8 | |||
| 9 | When building for arm32 with GNU binutils 2.39, the linker outputs | ||
| 10 | warnings when linking Trusted Applications: | ||
| 11 | |||
| 12 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: warning: utee_syscalls_a32.o: missing .note.GNU-stack section implies executable stack | ||
| 13 | arm-unknown-linux-uclibcgnueabihf-ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker | ||
| 14 | |||
| 15 | We could silence the warning by adding the '-z execstack' option to the | ||
| 16 | TA link flags, like we did in the parent commit for the TEE core and | ||
| 17 | ldelf. Indeed, ldelf always allocates a non-executable piece of memory | ||
| 18 | for the TA to use as a stack. | ||
| 19 | |||
| 20 | However it seems preferable to comply with the common ELF practices in | ||
| 21 | this case. A better fix is therefore to add the missing .note.GNU-stack | ||
| 22 | sections in the assembler files. | ||
| 23 | |||
| 24 | Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
| 25 | |||
| 26 | Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> | ||
| 27 | Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] | ||
| 28 | Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io> | ||
| 29 | --- | ||
| 30 | |||
| 31 | lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ | ||
| 32 | lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ | ||
| 33 | lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ | ||
| 34 | lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | 2 ++ | ||
| 35 | lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | 2 ++ | ||
| 36 | lib/libutils/isoc/arch/arm/setjmp_a32.S | 2 ++ | ||
| 37 | ta/arch/arm/ta_entry_a32.S | 2 ++ | ||
| 38 | 7 files changed, 14 insertions(+) | ||
| 39 | |||
| 40 | diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
| 41 | index 2dea83ab8..668b65a86 100644 | ||
| 42 | --- a/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
| 43 | +++ b/lib/libutee/arch/arm/utee_syscalls_a32.S | ||
| 44 | @@ -9,6 +9,8 @@ | ||
| 45 | |||
| 46 | .section .note.GNU-stack,"",%progbits | ||
| 47 | |||
| 48 | + .section .note.GNU-stack,"",%progbits | ||
| 49 | + | ||
| 50 | .section .text | ||
| 51 | .balign 4 | ||
| 52 | .code 32 | ||
| 53 | diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S | ||
| 54 | index 2be73ffad..87ddf1065 100644 | ||
| 55 | --- a/lib/libutils/ext/arch/arm/atomic_a32.S | ||
| 56 | +++ b/lib/libutils/ext/arch/arm/atomic_a32.S | ||
| 57 | @@ -7,6 +7,8 @@ | ||
| 58 | |||
| 59 | .section .note.GNU-stack,"",%progbits | ||
| 60 | |||
| 61 | + .section .note.GNU-stack,"",%progbits | ||
| 62 | + | ||
| 63 | /* uint32_t atomic_inc32(uint32_t *v); */ | ||
| 64 | FUNC atomic_inc32 , : | ||
| 65 | ldrex r1, [r0] | ||
| 66 | diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S | ||
| 67 | index 54dc3c02d..2f24632b8 100644 | ||
| 68 | --- a/lib/libutils/ext/arch/arm/mcount_a32.S | ||
| 69 | +++ b/lib/libutils/ext/arch/arm/mcount_a32.S | ||
| 70 | @@ -9,6 +9,8 @@ | ||
| 71 | |||
| 72 | .section .note.GNU-stack,"",%progbits | ||
| 73 | |||
| 74 | + .section .note.GNU-stack,"",%progbits | ||
| 75 | + | ||
| 76 | /* | ||
| 77 | * Convert return address to call site address by subtracting the size of the | ||
| 78 | * mcount call instruction (blx __gnu_mcount_nc). | ||
| 79 | diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
| 80 | index 37ae9ec6f..bc6c48b1a 100644 | ||
| 81 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
| 82 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S | ||
| 83 | @@ -7,6 +7,8 @@ | ||
| 84 | |||
| 85 | .section .note.GNU-stack,"",%progbits | ||
| 86 | |||
| 87 | + .section .note.GNU-stack,"",%progbits | ||
| 88 | + | ||
| 89 | /* | ||
| 90 | * signed ret_idivmod_values(signed quot, signed rem); | ||
| 91 | * return quotient and remaining the EABI way (regs r0,r1) | ||
| 92 | diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
| 93 | index 5c3353e2c..9fb5e0283 100644 | ||
| 94 | --- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
| 95 | +++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S | ||
| 96 | @@ -7,6 +7,8 @@ | ||
| 97 | |||
| 98 | .section .note.GNU-stack,"",%progbits | ||
| 99 | |||
| 100 | + .section .note.GNU-stack,"",%progbits | ||
| 101 | + | ||
| 102 | /* | ||
| 103 | * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) | ||
| 104 | */ | ||
| 105 | diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
| 106 | index f8a0b70df..37d7cb88e 100644 | ||
| 107 | --- a/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
| 108 | +++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S | ||
| 109 | @@ -53,6 +53,8 @@ | ||
| 110 | |||
| 111 | .section .note.GNU-stack,"",%progbits | ||
| 112 | |||
| 113 | + .section .note.GNU-stack,"",%progbits | ||
| 114 | + | ||
| 115 | /* Arm/Thumb interworking support: | ||
| 116 | |||
| 117 | The interworking scheme expects functions to use a BX instruction | ||
| 118 | diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S | ||
| 119 | index cd9a12f9d..ccdc19928 100644 | ||
| 120 | --- a/ta/arch/arm/ta_entry_a32.S | ||
| 121 | +++ b/ta/arch/arm/ta_entry_a32.S | ||
| 122 | @@ -7,6 +7,8 @@ | ||
| 123 | |||
| 124 | .section .note.GNU-stack,"",%progbits | ||
| 125 | |||
| 126 | + .section .note.GNU-stack,"",%progbits | ||
| 127 | + | ||
| 128 | /* | ||
| 129 | * This function is the bottom of the user call stack. Mark it as such so that | ||
| 130 | * the unwinding code won't try to go further down. | ||
| 131 | -- | ||
| 132 | 2.40.1 | ||
| 133 | |||
