diff options
author | André Draszik <andre.draszik@jci.com> | 2019-12-24 08:23:32 +0000 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2020-01-08 16:12:06 -0300 |
commit | 8b51ea3dafe9c5ac667a918911fb8f1050fc8897 (patch) | |
tree | 76093070fbfb8c78f5a1736ee9c6508f5895438d /recipes-security | |
parent | 241312a74438e69063fcc67d91517dc90fa96065 (diff) | |
download | meta-freescale-8b51ea3dafe9c5ac667a918911fb8f1050fc8897.tar.gz |
optee-imx: add (backported) patches for GCC 9 & musl
See the individual patches - all patches are simply
backports from optee upstream releases.
Signed-off-by: André Draszik <andre.draszik@jci.com>
Diffstat (limited to 'recipes-security')
5 files changed, 252 insertions, 0 deletions
diff --git a/recipes-security/optee-imx/optee-test/0003-sock_server-fix-compilation-against-musl-sys-errno.h.patch b/recipes-security/optee-imx/optee-test/0003-sock_server-fix-compilation-against-musl-sys-errno.h.patch new file mode 100644 index 00000000..d32a8eb7 --- /dev/null +++ b/recipes-security/optee-imx/optee-test/0003-sock_server-fix-compilation-against-musl-sys-errno.h.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From dc8cd1c43edeedb9f7335020537c4ffdddd683f8 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> | ||
3 | Date: Thu, 7 Feb 2019 01:26:53 +0000 | ||
4 | Subject: [PATCH 1/3] sock_server: fix compilation against musl (sys/errno.h) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Compiling against musl-libc fails with the following error: | ||
10 | |||
11 | | In file included from .../host/xtest/sock_server.c:24: | ||
12 | | .../usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp] | ||
13 | | #warning redirecting incorrect #include <sys/errno.h> to <errno.h> | ||
14 | | ^~~~~~~ | ||
15 | |||
16 | Just remove the needless include. | ||
17 | |||
18 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
19 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
20 | Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
21 | --- | ||
22 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
23 | Upstream-Status: Backport [3.5.0] | ||
24 | host/xtest/sock_server.c | 1 - | ||
25 | 1 file changed, 1 deletion(-) | ||
26 | |||
27 | diff --git a/host/xtest/sock_server.c b/host/xtest/sock_server.c | ||
28 | index 0d2ff06..1ba73d6 100644 | ||
29 | --- a/host/xtest/sock_server.c | ||
30 | +++ b/host/xtest/sock_server.c | ||
31 | @@ -21,7 +21,6 @@ | ||
32 | #include <netdb.h> | ||
33 | #include <netinet/in.h> | ||
34 | #include <poll.h> | ||
35 | -#include <sys/errno.h> | ||
36 | #include <sys/socket.h> | ||
37 | #include <unistd.h> | ||
38 | |||
39 | -- | ||
40 | 2.23.0.rc1 | ||
41 | |||
diff --git a/recipes-security/optee-imx/optee-test/0004-build-ignore-declaration-after-statement-warnings.patch b/recipes-security/optee-imx/optee-test/0004-build-ignore-declaration-after-statement-warnings.patch new file mode 100644 index 00000000..ed45df60 --- /dev/null +++ b/recipes-security/optee-imx/optee-test/0004-build-ignore-declaration-after-statement-warnings.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 1401b89684ee81bf0b3d3dea06e2926b24ba3f97 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> | ||
3 | Date: Thu, 7 Feb 2019 01:29:08 +0000 | ||
4 | Subject: [PATCH 2/3] build: ignore declaration-after-statement warnings | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | | Makefile:37: recipe for target 'xtest' failed | ||
10 | | make: *** [xtest] Error 2 | ||
11 | | make: *** Waiting for unfinished jobs.... | ||
12 | | arith_taf.c: In function 'get_handle': | ||
13 | | arith_taf.c:56:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
14 | | int h = handle_get(&hdb, ptr); | ||
15 | | ^~~ | ||
16 | | arith_taf.c: In function 'ta_entry_arith_new_var': | ||
17 | | arith_taf.c:82:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
18 | | size_t len = TEE_BigIntSizeInU32(params[0].value.a); | ||
19 | | ^~~~~~ | ||
20 | | arith_taf.c: In function 'ta_entry_arith_new_fmm_var': | ||
21 | | arith_taf.c:129:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
22 | | size_t len = TEE_BigIntFMMSizeInU32(params[0].value.a); | ||
23 | | ^~~~~~ | ||
24 | | arith_taf.c: In function 'ta_entry_arith_free_handle': | ||
25 | | arith_taf.c:150:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
26 | | void *ptr = put_handle(params[0].value.a & ~HT_MASK); | ||
27 | | ^~~~ | ||
28 | | arith_taf.c: In function 'ta_entry_arith_from_octet_string': | ||
29 | | arith_taf.c:165:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
30 | | TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a); | ||
31 | | ^~~~~~~~~~ | ||
32 | | arith_taf.c: In function 'ta_entry_arith_from_s32': | ||
33 | | arith_taf.c:181:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] | ||
34 | | TEE_BigInt *big_int = lookup_handle(HT_BIGINT, params[0].value.a); | ||
35 | | ^~~~~~~~~~ | ||
36 | |||
37 | etc. | ||
38 | |||
39 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
40 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
41 | Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
42 | --- | ||
43 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
44 | Upstream-Status: Backport [3.5.0] | ||
45 | host/xtest/Makefile | 1 + | ||
46 | 1 file changed, 1 insertion(+) | ||
47 | |||
48 | diff --git a/host/xtest/Makefile b/host/xtest/Makefile | ||
49 | index f4291e0..e97e555 100644 | ||
50 | --- a/host/xtest/Makefile | ||
51 | +++ b/host/xtest/Makefile | ||
52 | @@ -154,6 +154,7 @@ CFLAGS += -Wall -Wcast-align -Werror \ | ||
53 | -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ | ||
54 | -Wshadow -Wstrict-prototypes -Wswitch-default \ | ||
55 | -Wwrite-strings \ | ||
56 | + -Wno-declaration-after-statement \ | ||
57 | -Wno-missing-field-initializers -Wno-format-zero-length | ||
58 | endif | ||
59 | |||
60 | -- | ||
61 | 2.23.0.rc1 | ||
62 | |||
diff --git a/recipes-security/optee-imx/optee-test/0005-benchmark_1000-fix-compilation-against-musl-uint.patch b/recipes-security/optee-imx/optee-test/0005-benchmark_1000-fix-compilation-against-musl-uint.patch new file mode 100644 index 00000000..58734aa4 --- /dev/null +++ b/recipes-security/optee-imx/optee-test/0005-benchmark_1000-fix-compilation-against-musl-uint.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | From f74e9f339a8e8cb97fc8ea03bef51d7e3862a60a Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com> | ||
3 | Date: Thu, 7 Feb 2019 01:31:27 +0000 | ||
4 | Subject: [PATCH 3/3] benchmark_1000: fix compilation against musl (uint) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Compiling against musl-libc fails with the following error: | ||
10 | |||
11 | | .../host/xtest/benchmark_1000.c: In function 'show_test_result': | ||
12 | | .../host/xtest/benchmark_1000.c:102:2: error: unknown type name 'uint'; did you mean 'int'? | ||
13 | | uint i; | ||
14 | | ^~~~ | ||
15 | | int | ||
16 | | ...host/xtest/benchmark_1000.c:108:16: error: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Werror=sign-compare] | ||
17 | | for (i = 0; i < size; i++) { | ||
18 | | ^ | ||
19 | |||
20 | etc. | ||
21 | |||
22 | Convert to using more standard size_t | ||
23 | |||
24 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
25 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
26 | Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> | ||
27 | --- | ||
28 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
29 | Upstream-Status: Backport [3.5.0] | ||
30 | host/xtest/benchmark_1000.c | 4 ++-- | ||
31 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
32 | |||
33 | diff --git a/host/xtest/benchmark_1000.c b/host/xtest/benchmark_1000.c | ||
34 | index bf92fa0..1caf420 100644 | ||
35 | --- a/host/xtest/benchmark_1000.c | ||
36 | +++ b/host/xtest/benchmark_1000.c | ||
37 | @@ -99,7 +99,7 @@ static TEEC_Result run_chunk_access_test(enum storage_benchmark_cmd cmd, | ||
38 | |||
39 | static void show_test_result(struct test_record records[], size_t size) | ||
40 | { | ||
41 | - uint i; | ||
42 | + size_t i; | ||
43 | |||
44 | printf("-----------------+---------------+----------------\n"); | ||
45 | printf(" Data Size (B) \t | Time (s)\t | Speed (kB/s)\t \n"); | ||
46 | @@ -119,7 +119,7 @@ static void chunk_test(ADBG_Case_t *c, enum storage_benchmark_cmd cmd) | ||
47 | { | ||
48 | uint32_t chunk_size = DEFAULT_CHUNK_SIZE; | ||
49 | struct test_record records[ARRAY_SIZE(data_size_table) - 1]; | ||
50 | - uint i; | ||
51 | + size_t i; | ||
52 | |||
53 | for (i = 0; data_size_table[i]; i++) { | ||
54 | ADBG_EXPECT_TEEC_SUCCESS(c, | ||
55 | -- | ||
56 | 2.23.0.rc1 | ||
57 | |||
diff --git a/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch b/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch new file mode 100644 index 00000000..1a5c4044 --- /dev/null +++ b/recipes-security/optee-imx/optee-test/0006-regression_8100-use-null-terminated-strings-with-fil.patch | |||
@@ -0,0 +1,88 @@ | |||
1 | From 7d566ed585d1e13f444d48fde5705b5be54de4af Mon Sep 17 00:00:00 2001 | ||
2 | From: Ricardo Salveti <ricardo@foundries.io> | ||
3 | Date: Wed, 26 Jun 2019 17:32:11 -0300 | ||
4 | Subject: [PATCH] regression_8100: use null terminated strings with file_to_c | ||
5 | |||
6 | GCC 9 is more strict with string manipulation, causing the build to | ||
7 | fail as the string data converted via file_to_c is not null terminated, | ||
8 | as described by the following build error: | ||
9 | |||
10 | regression_8100.c:100:29: error: '%*s' directive argument is not a | ||
11 | nul-terminated string [-Werror=format-overflow=] | ||
12 | tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
13 | ^~~ | ||
14 | regression_8100_ca_crt); | ||
15 | ~~~~~~~~~~~~~~~~~~~~~~ | ||
16 | |||
17 | Change file_to_c to terminate the string after conversion and update the | ||
18 | string size to remove the null terminated byte. Also update | ||
19 | regression_8100 to use the size variable defined via file_to_c instead | ||
20 | of manually calling sizeof. | ||
21 | |||
22 | Signed-off-by: Ricardo Salveti <ricardo@foundries.io> | ||
23 | Acked-by: Jens Wiklander <jens.wiklander@linaro.org> | ||
24 | --- | ||
25 | Signed-off-by: André Draszik <andre.draszik@jci.com> | ||
26 | Upstream-Status: Backport [3.6.0] | ||
27 | host/xtest/regression_8100.c | 10 +++++----- | ||
28 | scripts/file_to_c.py | 4 ++-- | ||
29 | 2 files changed, 7 insertions(+), 7 deletions(-) | ||
30 | |||
31 | diff --git a/host/xtest/regression_8100.c b/host/xtest/regression_8100.c | ||
32 | index 04d62d9..13780e1 100644 | ||
33 | --- a/host/xtest/regression_8100.c | ||
34 | +++ b/host/xtest/regression_8100.c | ||
35 | @@ -91,13 +91,13 @@ static void test_8102(ADBG_Case_t *c) | ||
36 | return; | ||
37 | |||
38 | clen = myasprintf(&chain, "%*s\n%*s", | ||
39 | - (int)sizeof(regression_8100_my_crt), | ||
40 | + (int)regression_8100_my_crt_size, | ||
41 | regression_8100_my_crt, | ||
42 | - (int)sizeof(regression_8100_mid_crt), | ||
43 | + (int)regression_8100_mid_crt_size, | ||
44 | regression_8100_mid_crt); | ||
45 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, clen, !=, -1)) | ||
46 | goto out; | ||
47 | - tlen = myasprintf(&trust, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
48 | + tlen = myasprintf(&trust, "%*s", (int)regression_8100_ca_crt_size, | ||
49 | regression_8100_ca_crt); | ||
50 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, tlen, !=, -1)) | ||
51 | goto out; | ||
52 | @@ -282,7 +282,7 @@ static void test_8103(ADBG_Case_t *c) | ||
53 | NULL, &ret_orig))) | ||
54 | return; | ||
55 | |||
56 | - clen = myasprintf(&csr, "%*s", (int)sizeof(regression_8100_my_csr), | ||
57 | + clen = myasprintf(&csr, "%*s", (int)regression_8100_my_csr_size, | ||
58 | regression_8100_my_csr); | ||
59 | if (!ADBG_EXPECT_COMPARE_SIGNED(c, clen, >=, 0)) | ||
60 | goto out; | ||
61 | @@ -300,7 +300,7 @@ static void test_8103(ADBG_Case_t *c) | ||
62 | if (!ADBG_EXPECT_TEEC_SUCCESS(c, res)) | ||
63 | goto out; | ||
64 | |||
65 | - myasprintf(&ca, "%*s", (int)sizeof(regression_8100_ca_crt), | ||
66 | + myasprintf(&ca, "%*s", (int)regression_8100_ca_crt_size, | ||
67 | regression_8100_ca_crt); | ||
68 | if (!ADBG_EXPECT_NOT_NULL(c, ca)) | ||
69 | goto out; | ||
70 | diff --git a/scripts/file_to_c.py b/scripts/file_to_c.py | ||
71 | index 83a9832..ae16f52 100755 | ||
72 | --- a/scripts/file_to_c.py | ||
73 | +++ b/scripts/file_to_c.py | ||
74 | @@ -37,9 +37,9 @@ def main(): | ||
75 | else: | ||
76 | f.write(" ") | ||
77 | |||
78 | - f.write("};\n") | ||
79 | + f.write("'\\0'};\n") | ||
80 | f.write("const size_t " + args.name + "_size = sizeof(" + | ||
81 | - args.name + ");\n") | ||
82 | + args.name + ") - 1;\n") | ||
83 | |||
84 | f.close() | ||
85 | inf.close() | ||
86 | -- | ||
87 | 2.23.0.rc1 | ||
88 | |||
diff --git a/recipes-security/optee-imx/optee-test_3.2.0.imx.bb b/recipes-security/optee-imx/optee-test_3.2.0.imx.bb index 77441df9..c52e70a3 100644 --- a/recipes-security/optee-imx/optee-test_3.2.0.imx.bb +++ b/recipes-security/optee-imx/optee-test_3.2.0.imx.bb | |||
@@ -17,6 +17,10 @@ OPTEE_TEST_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-test.git;p | |||
17 | SRC_URI = "${OPTEE_TEST_SRC};branch=${SRCBRANCH} \ | 17 | SRC_URI = "${OPTEE_TEST_SRC};branch=${SRCBRANCH} \ |
18 | file://0001-regression-4011-correct-potential-overflow.patch \ | 18 | file://0001-regression-4011-correct-potential-overflow.patch \ |
19 | file://0001-xtest-prevent-unexpected-build-warning-with-strncpy.patch \ | 19 | file://0001-xtest-prevent-unexpected-build-warning-with-strncpy.patch \ |
20 | file://0003-sock_server-fix-compilation-against-musl-sys-errno.h.patch \ | ||
21 | file://0004-build-ignore-declaration-after-statement-warnings.patch \ | ||
22 | file://0005-benchmark_1000-fix-compilation-against-musl-uint.patch \ | ||
23 | file://0006-regression_8100-use-null-terminated-strings-with-fil.patch \ | ||
20 | " | 24 | " |
21 | 25 | ||
22 | S = "${WORKDIR}/git" | 26 | S = "${WORKDIR}/git" |