summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2023-07-28 15:43:44 -0300
committerGitHub <noreply@github.com>2023-07-28 15:43:44 -0300
commit992973ab4bdbabd21a2c1f2cea86d85e60a79c5e (patch)
treed5dcbc164fc3871bc1591c1ae4dcf70f318b37ce
parent5c3deec9612711f6158dbf404388623038ac803a (diff)
parent7ff3191c0de5e84475855e5f07e99ab1fd180a21 (diff)
downloadmeta-freescale-992973ab4bdbabd21a2c1f2cea86d85e60a79c5e.tar.gz
Merge pull request #1628 from MrCry0/master-optee
Upgrade optee-* to lf-6.1.22-2.0.0
-rw-r--r--conf/machine/include/imx-base.inc12
-rw-r--r--recipes-security/optee-imx/optee-client_3.19.0.imx.bb4
-rw-r--r--recipes-security/optee-imx/optee-client_3.21.0.imx.bb7
-rw-r--r--recipes-security/optee-imx/optee-os-fslc.inc2
-rw-r--r--recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch142
-rw-r--r--recipes-security/optee-imx/optee-os/0002-optee-enable-clang-support.patch (renamed from recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch)14
-rw-r--r--recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch (renamed from recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch)25
-rw-r--r--recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch67
-rw-r--r--recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch33
-rw-r--r--recipes-security/optee-imx/optee-os_3.19.0.imx.bb10
-rw-r--r--recipes-security/optee-imx/optee-os_3.21.0.imx.bb12
-rw-r--r--recipes-security/optee-imx/optee-test_3.21.0.imx.bb (renamed from recipes-security/optee-imx/optee-test_3.19.0.imx.bb)4
12 files changed, 207 insertions, 125 deletions
diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index 1492c467..1a1b7c50 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -547,12 +547,12 @@ PREFERRED_VERSION_vulkan-tools:imxvulkan ??= "1.2.182.0.imx"
547PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.2.182.0.imx" 547PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.2.182.0.imx"
548 548
549# Use i.MX optee Version 549# Use i.MX optee Version
550PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "3.19.0.imx" 550PREFERRED_VERSION_optee-os:mx8-nxp-bsp ??= "3.21.0.imx"
551PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "3.19.0.imx" 551PREFERRED_VERSION_optee-os:mx9-nxp-bsp ??= "3.21.0.imx"
552PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "3.19.0.imx" 552PREFERRED_VERSION_optee-client:mx8-nxp-bsp ??= "3.21.0.imx"
553PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "3.19.0.imx" 553PREFERRED_VERSION_optee-client:mx9-nxp-bsp ??= "3.21.0.imx"
554PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "3.19.0.imx" 554PREFERRED_VERSION_optee-test:mx8-nxp-bsp ??= "3.21.0.imx"
555PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "3.19.0.imx" 555PREFERRED_VERSION_optee-test:mx9-nxp-bsp ??= "3.21.0.imx"
556 556
557# Use i.MX opencv Version 557# Use i.MX opencv Version
558PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx" 558PREFERRED_VERSION_opencv:mx8-nxp-bsp ??= "4.6.0.imx"
diff --git a/recipes-security/optee-imx/optee-client_3.19.0.imx.bb b/recipes-security/optee-imx/optee-client_3.19.0.imx.bb
deleted file mode 100644
index 102b3ce9..00000000
--- a/recipes-security/optee-imx/optee-client_3.19.0.imx.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require optee-client-fslc-imx.inc
2
3SRCBRANCH = "lf-6.1.1_1.0.0"
4SRCREV = "01231b7a7ce03cdf9d3f48e7baa0bce17aac28f7"
diff --git a/recipes-security/optee-imx/optee-client_3.21.0.imx.bb b/recipes-security/optee-imx/optee-client_3.21.0.imx.bb
new file mode 100644
index 00000000..5d508911
--- /dev/null
+++ b/recipes-security/optee-imx/optee-client_3.21.0.imx.bb
@@ -0,0 +1,7 @@
1require optee-client-fslc-imx.inc
2
3SRCBRANCH = "lf-6.1.22_2.0.0"
4SRCREV = "8533e0e6329840ee96cf81b6453f257204227e6c"
5
6DEPENDS += "util-linux"
7EXTRA_OEMAKE += "PKG_CONFIG=pkg-config"
diff --git a/recipes-security/optee-imx/optee-os-fslc.inc b/recipes-security/optee-imx/optee-os-fslc.inc
index faa8c993..19ca7b3c 100644
--- a/recipes-security/optee-imx/optee-os-fslc.inc
+++ b/recipes-security/optee-imx/optee-os-fslc.inc
@@ -21,6 +21,8 @@ EXTRA_OEMAKE += " \
21 PLATFORM=imx-${PLATFORM_FLAVOR} \ 21 PLATFORM=imx-${PLATFORM_FLAVOR} \
22 CROSS_COMPILE=${HOST_PREFIX} \ 22 CROSS_COMPILE=${HOST_PREFIX} \
23 CROSS_COMPILE64=${HOST_PREFIX} \ 23 CROSS_COMPILE64=${HOST_PREFIX} \
24 CFLAGS32=--sysroot=${STAGING_DIR_HOST} \
25 CFLAGS64=--sysroot=${STAGING_DIR_HOST} \
24 CFG_TEE_TA_LOG_LEVEL=0 \ 26 CFG_TEE_TA_LOG_LEVEL=0 \
25 CFG_TEE_CORE_LOG_LEVEL=0 \ 27 CFG_TEE_CORE_LOG_LEVEL=0 \
26" 28"
diff --git a/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch b/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch
index 2abd78a8..8a9062f3 100644
--- a/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch
+++ b/recipes-security/optee-imx/optee-os/0001-core-Define-section-attributes-for-clang.patch
@@ -1,7 +1,7 @@
1From f189457b79989543f65b8a4e8729eff2cdf9a758 Mon Sep 17 00:00:00 2001 1From b73c3d2829d3661ca66b5cc6b4181f3bf973b13f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Emekcan Aras <emekcan.aras@arm.com>
3Date: Sat, 13 Aug 2022 19:24:55 -0700 3Date: Wed, 21 Dec 2022 10:55:58 +0000
4Subject: [PATCH] core: Define section attributes for clang 4Subject: [PATCH 1/4] core: Define section attributes for clang
5 5
6Clang's attribute section is not same as gcc, here we need to add flags 6Clang's attribute section is not same as gcc, here we need to add flags
7to sections so they can be eventually collected by linker into final 7to sections so they can be eventually collected by linker into final
@@ -30,16 +30,21 @@ going and match the functionality with gcc.
30 30
31Upstream-Status: Pending 31Upstream-Status: Pending
32Signed-off-by: Khem Raj <raj.khem@gmail.com> 32Signed-off-by: Khem Raj <raj.khem@gmail.com>
33Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
33--- 34---
35
34 core/arch/arm/kernel/thread.c | 19 +++++++++++++++-- 36 core/arch/arm/kernel/thread.c | 19 +++++++++++++++--
35 core/arch/arm/mm/core_mmu_lpae.c | 35 ++++++++++++++++++++++++++++---- 37 core/arch/arm/mm/core_mmu_lpae.c | 35 +++++++++++++++++++++++++++----
38 core/arch/arm/mm/core_mmu_v7.c | 36 +++++++++++++++++++++++++++++---
36 core/arch/arm/mm/pgt_cache.c | 12 ++++++++++- 39 core/arch/arm/mm/pgt_cache.c | 12 ++++++++++-
37 core/kernel/thread.c | 13 +++++++++++- 40 core/kernel/thread.c | 13 +++++++++++-
38 4 files changed, 71 insertions(+), 8 deletions(-) 41 5 files changed, 104 insertions(+), 11 deletions(-)
39 42
43diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c
44index 22ef932f9..7a9078d2e 100644
40--- a/core/arch/arm/kernel/thread.c 45--- a/core/arch/arm/kernel/thread.c
41+++ b/core/arch/arm/kernel/thread.c 46+++ b/core/arch/arm/kernel/thread.c
42@@ -44,16 +44,31 @@ static size_t thread_user_kcode_size __n 47@@ -44,15 +44,30 @@ static size_t thread_user_kcode_size __nex_bss;
43 #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \ 48 #if defined(CFG_CORE_UNMAP_CORE_AT_EL0) && \
44 defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64) 49 defined(CFG_CORE_WORKAROUND_SPECTRE_BP_SEC) && defined(ARM64)
45 long thread_user_kdata_sp_offset __nex_bss; 50 long thread_user_kdata_sp_offset __nex_bss;
@@ -55,27 +60,28 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
55 SMALL_PAGE_SIZE)] 60 SMALL_PAGE_SIZE)]
56 __aligned(SMALL_PAGE_SIZE) 61 __aligned(SMALL_PAGE_SIZE)
57+#ifndef __clang__ 62+#ifndef __clang__
58 #ifndef CFG_VIRTUALIZATION 63 #ifndef CFG_NS_VIRTUALIZATION
59- __section(".nozi.kdata_page"); 64- __section(".nozi.kdata_page");
60+ __section(".nozi.kdata_page") 65+ __section(".nozi.kdata_page")
61 #else 66 #else
62- __section(".nex_nozi.kdata_page"); 67- __section(".nex_nozi.kdata_page");
63+ __section(".nex_nozi.kdata_page") 68+ __section(".nex_nozi.kdata_page")
64 #endif 69 #endif
65 #endif 70+#endif
66+ ; 71+ ;
67+#endif 72+#endif
68+ 73+
69+/* reset BSS section to default ( .bss ) */ 74+/* reset BSS section to default ( .bss ) */
70+#ifdef __clang__ 75+#ifdef __clang__
71+#pragma clang section bss="" 76+#pragma clang section bss=""
72+#endif 77 #endif
73 78
74 #ifdef ARM32 79 #ifdef ARM32
75 uint32_t __nostackcheck thread_get_exceptions(void) 80diff --git a/core/arch/arm/mm/core_mmu_lpae.c b/core/arch/arm/mm/core_mmu_lpae.c
81index 6df2c68cf..a877e4965 100644
76--- a/core/arch/arm/mm/core_mmu_lpae.c 82--- a/core/arch/arm/mm/core_mmu_lpae.c
77+++ b/core/arch/arm/mm/core_mmu_lpae.c 83+++ b/core/arch/arm/mm/core_mmu_lpae.c
78@@ -233,19 +233,46 @@ typedef uint16_t l1_idx_t; 84@@ -238,19 +238,46 @@ typedef uint16_t l1_idx_t;
79 typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES]; 85 typedef uint64_t base_xlat_tbls_t[CFG_TEE_CORE_NB_CORE][NUM_BASE_LEVEL_ENTRIES];
80 typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES]; 86 typedef uint64_t xlat_tbl_t[XLAT_TABLE_ENTRIES];
81 87
@@ -126,59 +132,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
126 /* 132 /*
127 * TAs page table entry inside a level 1 page table. 133 * TAs page table entry inside a level 1 page table.
128 * 134 *
129--- a/core/arch/arm/mm/pgt_cache.c 135diff --git a/core/arch/arm/mm/core_mmu_v7.c b/core/arch/arm/mm/core_mmu_v7.c
130+++ b/core/arch/arm/mm/pgt_cache.c 136index 58596be84..98fa58635 100644
131@@ -410,8 +410,18 @@ void pgt_init(void)
132 * has a large alignment, while .bss has a small alignment. The current
133 * link script is optimized for small alignment in .bss
134 */
135+#ifdef __clang__
136+#pragma clang section bss=".nozi.mmu.l2"
137+#endif
138 static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE]
139- __aligned(PGT_SIZE) __section(".nozi.pgt_cache");
140+ __aligned(PGT_SIZE)
141+#ifndef __clang__
142+ __section(".nozi.pgt_cache")
143+#endif
144+ ;
145+#ifdef __clang__
146+#pragma clang section bss=""
147+#endif
148 size_t n;
149
150 for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) {
151--- a/core/kernel/thread.c
152+++ b/core/kernel/thread.c
153@@ -38,13 +38,24 @@ struct thread_core_local thread_core_loc
154 name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1]
155 #endif
156
157+#define DO_PRAGMA(x) _Pragma (#x)
158+
159+#ifdef __clang__
160+#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
161+DO_PRAGMA (clang section bss=".nozi_stack." #name) \
162+linkage uint32_t name[num_stacks] \
163+ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
164+ STACK_ALIGNMENT) / sizeof(uint32_t)] \
165+ __attribute__((aligned(STACK_ALIGNMENT))); \
166+DO_PRAGMA(clang section bss="")
167+#else
168 #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
169 linkage uint32_t name[num_stacks] \
170 [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
171 STACK_ALIGNMENT) / sizeof(uint32_t)] \
172 __attribute__((section(".nozi_stack." # name), \
173 aligned(STACK_ALIGNMENT)))
174-
175+#endif
176 #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack))
177
178 DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE,
179--- a/core/arch/arm/mm/core_mmu_v7.c 137--- a/core/arch/arm/mm/core_mmu_v7.c
180+++ b/core/arch/arm/mm/core_mmu_v7.c 138+++ b/core/arch/arm/mm/core_mmu_v7.c
181@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_EN 139@@ -204,16 +204,46 @@ typedef uint32_t l1_xlat_tbl_t[NUM_L1_ENTRIES];
182 typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES]; 140 typedef uint32_t l2_xlat_tbl_t[NUM_L2_ENTRIES];
183 typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES]; 141 typedef uint32_t ul1_xlat_tbl_t[NUM_UL1_ENTRIES];
184 142
@@ -228,3 +186,61 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
228 186
229 struct mmu_partition { 187 struct mmu_partition {
230 l1_xlat_tbl_t *l1_table; 188 l1_xlat_tbl_t *l1_table;
189diff --git a/core/arch/arm/mm/pgt_cache.c b/core/arch/arm/mm/pgt_cache.c
190index 79553c6d2..b9efdf427 100644
191--- a/core/arch/arm/mm/pgt_cache.c
192+++ b/core/arch/arm/mm/pgt_cache.c
193@@ -410,8 +410,18 @@ void pgt_init(void)
194 * has a large alignment, while .bss has a small alignment. The current
195 * link script is optimized for small alignment in .bss
196 */
197+#ifdef __clang__
198+#pragma clang section bss=".nozi.mmu.l2"
199+#endif
200 static uint8_t pgt_tables[PGT_CACHE_SIZE][PGT_SIZE]
201- __aligned(PGT_SIZE) __section(".nozi.pgt_cache");
202+ __aligned(PGT_SIZE)
203+#ifndef __clang__
204+ __section(".nozi.pgt_cache")
205+#endif
206+ ;
207+#ifdef __clang__
208+#pragma clang section bss=""
209+#endif
210 size_t n;
211
212 for (n = 0; n < ARRAY_SIZE(pgt_tables); n++) {
213diff --git a/core/kernel/thread.c b/core/kernel/thread.c
214index e48294b3b..8de9064ca 100644
215--- a/core/kernel/thread.c
216+++ b/core/kernel/thread.c
217@@ -38,13 +38,24 @@ struct thread_core_local thread_core_local[CFG_TEE_CORE_NB_CORE] __nex_bss;
218 name[stack_num][sizeof(name[stack_num]) / sizeof(uint32_t) - 1]
219 #endif
220
221+#define DO_PRAGMA(x) _Pragma (#x)
222+
223+#ifdef __clang__
224+#define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
225+DO_PRAGMA (clang section bss=".nozi_stack." #name) \
226+linkage uint32_t name[num_stacks] \
227+ [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
228+ STACK_ALIGNMENT) / sizeof(uint32_t)] \
229+ __attribute__((aligned(STACK_ALIGNMENT))); \
230+DO_PRAGMA(clang section bss="")
231+#else
232 #define DECLARE_STACK(name, num_stacks, stack_size, linkage) \
233 linkage uint32_t name[num_stacks] \
234 [ROUNDUP(stack_size + STACK_CANARY_SIZE + STACK_CHECK_EXTRA, \
235 STACK_ALIGNMENT) / sizeof(uint32_t)] \
236 __attribute__((section(".nozi_stack." # name), \
237 aligned(STACK_ALIGNMENT)))
238-
239+#endif
240 #define GET_STACK(stack) ((vaddr_t)(stack) + STACK_SIZE(stack))
241
242 DECLARE_STACK(stack_tmp, CFG_TEE_CORE_NB_CORE, STACK_TMP_SIZE,
243--
2442.40.1
245
246
diff --git a/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch b/recipes-security/optee-imx/optee-os/0002-optee-enable-clang-support.patch
index dc6d5517..096579c0 100644
--- a/recipes-security/optee-imx/optee-os/0007-allow-setting-sysroot-for-clang.patch
+++ b/recipes-security/optee-imx/optee-os/0002-optee-enable-clang-support.patch
@@ -1,7 +1,7 @@
1From db9e44af75c7cfd3316cab15aaa387383df3e57e Mon Sep 17 00:00:00 2001 1From c67f63d4e7bbe7b21b4c9ef49ae84c6725794aa9 Mon Sep 17 00:00:00 2001
2From: Brett Warren <brett.warren@arm.com> 2From: Brett Warren <brett.warren@arm.com>
3Date: Wed, 23 Sep 2020 09:27:34 +0100 3Date: Wed, 23 Sep 2020 09:27:34 +0100
4Subject: [PATCH] optee: enable clang support 4Subject: [PATCH 2/4] optee: enable clang support
5 5
6When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used 6When compiling with clang, the LIBGCC_LOCATE_CFLAG variable used
7to provide a sysroot wasn't included, which results in not locating 7to provide a sysroot wasn't included, which results in not locating
@@ -10,14 +10,17 @@ compiler-rt. This is mitigated by including the variable as ammended.
10Upstream-Status: Pending 10Upstream-Status: Pending
11ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701 11ChangeId: 8ba69a4b2eb8ebaa047cb266c9aa6c2c3da45701
12Signed-off-by: Brett Warren <brett.warren@arm.com> 12Signed-off-by: Brett Warren <brett.warren@arm.com>
13 13Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
14--- 14---
15
15 mk/clang.mk | 2 +- 16 mk/clang.mk | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-) 17 1 file changed, 1 insertion(+), 1 deletion(-)
17 18
19diff --git a/mk/clang.mk b/mk/clang.mk
20index a045beee8..1ebe2f702 100644
18--- a/mk/clang.mk 21--- a/mk/clang.mk
19+++ b/mk/clang.mk 22+++ b/mk/clang.mk
20@@ -30,7 +30,7 @@ comp-cflags-warns-clang := -Wno-language 23@@ -30,7 +30,7 @@ comp-cflags-warns-clang := -Wno-language-extension-token \
21 24
22 # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of 25 # Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of
23 # libgcc for clang 26 # libgcc for clang
@@ -26,3 +29,6 @@ Signed-off-by: Brett Warren <brett.warren@arm.com>
26 -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) 29 -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null)
27 30
28 # Core ASLR relies on the executable being ready to run from its preferred load 31 # Core ASLR relies on the executable being ready to run from its preferred load
32--
332.40.1
34
diff --git a/recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch b/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch
index b82aabdc..f0fac69f 100644
--- a/recipes-security/optee-imx/optee-os/0010-add-note-GNU-stack-section.patch
+++ b/recipes-security/optee-imx/optee-os/0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch
@@ -1,7 +1,8 @@
1From ec30e84671aac9a2e9549754eb7bc6201728db4c Mon Sep 17 00:00:00 2001 1From f23fb3381422c613890f77c26d11e377234481c6 Mon Sep 17 00:00:00 2001
2From: Jerome Forissier <jerome.forissier@linaro.org> 2From: Jerome Forissier <jerome.forissier@linaro.org>
3Date: Tue, 23 Aug 2022 12:31:46 +0000 3Date: Tue, 23 Aug 2022 12:31:46 +0000
4Subject: [PATCH] arm32: libutils, libutee, ta: add .note.GNU-stack section to 4Subject: [PATCH 3/4] arm32: libutils, libutee, ta: add .note.GNU-stack section
5 to
5 6
6 .S files 7 .S files
7 8
@@ -24,8 +25,9 @@ Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
24 25
25Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> 26Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
26Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499] 27Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
27 28Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
28--- 29---
30
29 lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++ 31 lib/libutee/arch/arm/utee_syscalls_a32.S | 2 ++
30 lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++ 32 lib/libutils/ext/arch/arm/atomic_a32.S | 2 ++
31 lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++ 33 lib/libutils/ext/arch/arm/mcount_a32.S | 2 ++
@@ -35,6 +37,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
35 ta/arch/arm/ta_entry_a32.S | 2 ++ 37 ta/arch/arm/ta_entry_a32.S | 2 ++
36 7 files changed, 14 insertions(+) 38 7 files changed, 14 insertions(+)
37 39
40diff --git a/lib/libutee/arch/arm/utee_syscalls_a32.S b/lib/libutee/arch/arm/utee_syscalls_a32.S
41index 2dea83ab8..668b65a86 100644
38--- a/lib/libutee/arch/arm/utee_syscalls_a32.S 42--- a/lib/libutee/arch/arm/utee_syscalls_a32.S
39+++ b/lib/libutee/arch/arm/utee_syscalls_a32.S 43+++ b/lib/libutee/arch/arm/utee_syscalls_a32.S
40@@ -9,6 +9,8 @@ 44@@ -9,6 +9,8 @@
@@ -46,6 +50,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
46 .section .text 50 .section .text
47 .balign 4 51 .balign 4
48 .code 32 52 .code 32
53diff --git a/lib/libutils/ext/arch/arm/atomic_a32.S b/lib/libutils/ext/arch/arm/atomic_a32.S
54index 2be73ffad..87ddf1065 100644
49--- a/lib/libutils/ext/arch/arm/atomic_a32.S 55--- a/lib/libutils/ext/arch/arm/atomic_a32.S
50+++ b/lib/libutils/ext/arch/arm/atomic_a32.S 56+++ b/lib/libutils/ext/arch/arm/atomic_a32.S
51@@ -7,6 +7,8 @@ 57@@ -7,6 +7,8 @@
@@ -57,6 +63,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
57 /* uint32_t atomic_inc32(uint32_t *v); */ 63 /* uint32_t atomic_inc32(uint32_t *v); */
58 FUNC atomic_inc32 , : 64 FUNC atomic_inc32 , :
59 ldrex r1, [r0] 65 ldrex r1, [r0]
66diff --git a/lib/libutils/ext/arch/arm/mcount_a32.S b/lib/libutils/ext/arch/arm/mcount_a32.S
67index 54dc3c02d..2f24632b8 100644
60--- a/lib/libutils/ext/arch/arm/mcount_a32.S 68--- a/lib/libutils/ext/arch/arm/mcount_a32.S
61+++ b/lib/libutils/ext/arch/arm/mcount_a32.S 69+++ b/lib/libutils/ext/arch/arm/mcount_a32.S
62@@ -9,6 +9,8 @@ 70@@ -9,6 +9,8 @@
@@ -68,6 +76,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
68 /* 76 /*
69 * Convert return address to call site address by subtracting the size of the 77 * Convert return address to call site address by subtracting the size of the
70 * mcount call instruction (blx __gnu_mcount_nc). 78 * mcount call instruction (blx __gnu_mcount_nc).
79diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S
80index 37ae9ec6f..bc6c48b1a 100644
71--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S 81--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S
72+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S 82+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_divmod_a32.S
73@@ -7,6 +7,8 @@ 83@@ -7,6 +7,8 @@
@@ -79,6 +89,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
79 /* 89 /*
80 * signed ret_idivmod_values(signed quot, signed rem); 90 * signed ret_idivmod_values(signed quot, signed rem);
81 * return quotient and remaining the EABI way (regs r0,r1) 91 * return quotient and remaining the EABI way (regs r0,r1)
92diff --git a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S
93index 5c3353e2c..9fb5e0283 100644
82--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S 94--- a/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S
83+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S 95+++ b/lib/libutils/isoc/arch/arm/arm32_aeabi_ldivmod_a32.S
84@@ -7,6 +7,8 @@ 96@@ -7,6 +7,8 @@
@@ -90,6 +102,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
90 /* 102 /*
91 * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d) 103 * __value_in_regs lldiv_t __aeabi_ldivmod( long long n, long long d)
92 */ 104 */
105diff --git a/lib/libutils/isoc/arch/arm/setjmp_a32.S b/lib/libutils/isoc/arch/arm/setjmp_a32.S
106index f8a0b70df..37d7cb88e 100644
93--- a/lib/libutils/isoc/arch/arm/setjmp_a32.S 107--- a/lib/libutils/isoc/arch/arm/setjmp_a32.S
94+++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S 108+++ b/lib/libutils/isoc/arch/arm/setjmp_a32.S
95@@ -53,6 +53,8 @@ 109@@ -53,6 +53,8 @@
@@ -101,6 +115,8 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
101 /* Arm/Thumb interworking support: 115 /* Arm/Thumb interworking support:
102 116
103 The interworking scheme expects functions to use a BX instruction 117 The interworking scheme expects functions to use a BX instruction
118diff --git a/ta/arch/arm/ta_entry_a32.S b/ta/arch/arm/ta_entry_a32.S
119index cd9a12f9d..ccdc19928 100644
104--- a/ta/arch/arm/ta_entry_a32.S 120--- a/ta/arch/arm/ta_entry_a32.S
105+++ b/ta/arch/arm/ta_entry_a32.S 121+++ b/ta/arch/arm/ta_entry_a32.S
106@@ -7,6 +7,8 @@ 122@@ -7,6 +7,8 @@
@@ -112,3 +128,6 @@ Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5499]
112 /* 128 /*
113 * This function is the bottom of the user call stack. Mark it as such so that 129 * This function is the bottom of the user call stack. Mark it as such so that
114 * the unwinding code won't try to go further down. 130 * the unwinding code won't try to go further down.
131--
1322.40.1
133
diff --git a/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch b/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch
new file mode 100644
index 00000000..f72d80dc
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os/0004-core-link-add-no-warn-rwx-segments.patch
@@ -0,0 +1,67 @@
1From b53f5542102b8088448134202c30ca563f5b3c04 Mon Sep 17 00:00:00 2001
2From: Jerome Forissier <jerome.forissier@linaro.org>
3Date: Fri, 5 Aug 2022 09:48:03 +0200
4Subject: [PATCH 4/4] core: link: add --no-warn-rwx-segments
5
6Signed-off-by: Anton Antonov <Anton.Antonov@arm.com>
7Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/5474]
8
9binutils ld.bfd generates one RWX LOAD segment by merging several sections
10with mixed R/W/X attributes (.text, .rodata, .data). After version 2.38 it
11also warns by default when that happens [1], which breaks the build due to
12--fatal-warnings. The RWX segment is not a problem for the TEE core, since
13that information is not used to set memory permissions. Therefore, silence
14the warning.
15
16Link: [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
17Link: https://sourceware.org/bugzilla/show_bug.cgi?id=29448
18Reported-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
19Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
20Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
21Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
22---
23
24 core/arch/arm/kernel/link.mk | 6 ++++--
25 1 file changed, 4 insertions(+), 2 deletions(-)
26
27diff --git a/core/arch/arm/kernel/link.mk b/core/arch/arm/kernel/link.mk
28index e8a518254..60e08966f 100644
29--- a/core/arch/arm/kernel/link.mk
30+++ b/core/arch/arm/kernel/link.mk
31@@ -37,6 +37,7 @@ link-ldflags += --sort-section=alignment
32 link-ldflags += --fatal-warnings
33 link-ldflags += --gc-sections
34 link-ldflags += $(link-ldflags-common)
35+link-ldflags += $(call ld-option,--no-warn-rwx-segments)
36
37 link-ldadd = $(LDADD)
38 link-ldadd += $(ldflags-external)
39@@ -61,6 +62,7 @@ link-script-cppflags := \
40 $(cppflagscore))
41
42 ldargs-all_objs := -T $(link-script-dummy) --no-check-sections \
43+ $(call ld-option,--no-warn-rwx-segments) \
44 $(link-ldflags-common) \
45 $(link-objs) $(link-ldadd) $(libgcccore)
46 cleanfiles += $(link-out-dir)/all_objs.o
47@@ -75,7 +77,7 @@ $(link-out-dir)/unpaged_entries.txt: $(link-out-dir)/all_objs.o
48 $(AWK) '/ ____keep_pager/ { printf "-u%s ", $$3 }' > $@
49
50 unpaged-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \
51- $(link-ldflags-common)
52+ $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments)
53 unpaged-ldadd := $(objs) $(link-ldadd) $(libgcccore)
54 cleanfiles += $(link-out-dir)/unpaged.o
55 $(link-out-dir)/unpaged.o: $(link-out-dir)/unpaged_entries.txt
56@@ -104,7 +106,7 @@ $(link-out-dir)/init_entries.txt: $(link-out-dir)/all_objs.o
57 $(AWK) '/ ____keep_init/ { printf "-u%s ", $$3 }' > $@
58
59 init-ldargs := -T $(link-script-dummy) --no-check-sections --gc-sections \
60- $(link-ldflags-common)
61+ $(link-ldflags-common) $(call ld-option,--no-warn-rwx-segments)
62 init-ldadd := $(link-objs-init) $(link-out-dir)/version.o $(link-ldadd) \
63 $(libgcccore)
64 cleanfiles += $(link-out-dir)/init.o
65--
662.40.1
67
diff --git a/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch b/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch
deleted file mode 100644
index c07d0482..00000000
--- a/recipes-security/optee-imx/optee-os/0006-allow-setting-sysroot-for-libgcc-lookup.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 528aeb42652a3159c1bfd51d6c1442c3ff27b84c Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Tue, 26 May 2020 14:38:02 -0500
4Subject: [PATCH] allow setting sysroot for libgcc lookup
5
6Explicitly pass the new variable LIBGCC_LOCATE_CFLAGS variable when searching
7for the compiler libraries as there's no easy way to reliably pass --sysroot
8otherwise.
9
10Upstream-Status: Pending [https://github.com/OP-TEE/optee_os/issues/4188]
11Signed-off-by: Ross Burton <ross.burton@arm.com>
12
13---
14 mk/gcc.mk | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17--- a/mk/gcc.mk
18+++ b/mk/gcc.mk
19@@ -13,11 +13,11 @@ nostdinc$(sm) := -nostdinc -isystem $(sh
20 -print-file-name=include 2> /dev/null)
21
22 # Get location of libgcc from gcc
23-libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \
24+libgcc$(sm) := $(shell $(CC$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CFLAGS$(arch-bits-$(sm))) \
25 -print-libgcc-file-name 2> /dev/null)
26-libstdc++$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
27+libstdc++$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
28 -print-file-name=libstdc++.a 2> /dev/null)
29-libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
30+libgcc_eh$(sm) := $(shell $(CXX$(sm)) $(LIBGCC_LOCATE_CFLAGS) $(CXXFLAGS$(arch-bits-$(sm))) $(comp-cxxflags$(sm)) \
31 -print-file-name=libgcc_eh.a 2> /dev/null)
32
33 # Define these to something to discover accidental use
diff --git a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb b/recipes-security/optee-imx/optee-os_3.19.0.imx.bb
deleted file mode 100644
index aec204c6..00000000
--- a/recipes-security/optee-imx/optee-os_3.19.0.imx.bb
+++ /dev/null
@@ -1,10 +0,0 @@
1# Copyright (C) 2017-2021 NXP
2
3require optee-os-fslc-imx.inc
4
5SRC_URI += "file://0001-core-Define-section-attributes-for-clang.patch \
6 file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
7 file://0007-allow-setting-sysroot-for-clang.patch \
8 file://0010-add-note-GNU-stack-section.patch"
9SRCBRANCH = "lf-6.1.1_1.0.0"
10SRCREV = "ad4e8389bb2c38efe39853925eec571ac778c575"
diff --git a/recipes-security/optee-imx/optee-os_3.21.0.imx.bb b/recipes-security/optee-imx/optee-os_3.21.0.imx.bb
new file mode 100644
index 00000000..f158441f
--- /dev/null
+++ b/recipes-security/optee-imx/optee-os_3.21.0.imx.bb
@@ -0,0 +1,12 @@
1# Copyright (C) 2017-2021 NXP
2
3require optee-os-fslc-imx.inc
4
5SRC_URI += " \
6 file://0001-core-Define-section-attributes-for-clang.patch \
7 file://0002-optee-enable-clang-support.patch \
8 file://0003-arm32-libutils-libutee-ta-add-.note.GNU-stack-sectio.patch \
9 file://0004-core-link-add-no-warn-rwx-segments.patch \
10"
11SRCBRANCH = "lf-6.1.22_2.0.0"
12SRCREV = "1962aec9581760803b1485d455cd62cb11c14870"
diff --git a/recipes-security/optee-imx/optee-test_3.19.0.imx.bb b/recipes-security/optee-imx/optee-test_3.21.0.imx.bb
index 1ef4cad5..56ed2aa2 100644
--- a/recipes-security/optee-imx/optee-test_3.19.0.imx.bb
+++ b/recipes-security/optee-imx/optee-test_3.21.0.imx.bb
@@ -4,7 +4,7 @@ require optee-test-fslc.inc
4 4
5SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}" 5SRC_URI = "git://github.com/nxp-imx/imx-optee-test.git;protocol=https;branch=${SRCBRANCH}"
6 6
7SRCBRANCH = "lf-6.1.1_1.0.0" 7SRCBRANCH = "lf-6.1.22_2.0.0"
8SRCREV = "7c314e6a0cec0ba19246eb4f1959859d7a6536d6" 8SRCREV = "c2c9f922044d2c8a7ab384812bb124c6da2b7888"
9 9
10COMPATIBLE_MACHINE = "(imx-nxp-bsp)" 10COMPATIBLE_MACHINE = "(imx-nxp-bsp)"