OP-TEE / optee_os

Trusted side of the TEE
Other
1.54k stars 1.04k forks source link

Several testsuite failures on 32bit (i.MX6UL & Stm32MP157DK2) #4139

Closed Emantor closed 3 years ago

Emantor commented 3 years ago

Running xtest shows several errors, I think those are related to the strict TA parameter checking which was recently introduced (OK lines removed):

Result of testsuite regression:
regression_1021.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644
regression_1021.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644
regression_1021.3 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644
regression_1021.4 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1719
regression_1021 FAILED
regression_4002.35 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:259
regression_4002 FAILED
regression_4005.7 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:536
regression_4005 FAILED
regression_4006.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:631
regression_4006 FAILED
regression_4007_symmetric.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.3 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.4 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.5 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.6 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.7 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.8 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.9 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.10 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric FAILED
regression_4007_rsa.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_4007_rsa FAILED
regression_4011 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802
regression_6009.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1081
regression_6009.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1029
regression_6009 FAILED
regression_6010.1.9 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1319
regression_6010.1 FAILED
regression_6010.2.9 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1319
regression_6010.2 FAILED
regression_6010 FAILED
regression_6012.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1380
regression_6012.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1380
regression_6012 FAILED
regression_6017.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1629
regression_6017.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1629
regression_6017 FAILED
regression_6018.1 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1697
regression_6018.2 FAILED first error at /usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1697
regression_6018 FAILED

+-----------------------------------------------------
12481 subtests of which 55 failed
91 test cases of which 12 failed
0 test cases were skipped
TEE test application done!

1021:

* regression_1021 Test panic context release
o regression_1021.1 Multiple Instances Single Session
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644: trigger_panic(&cs[1], ((void *)0)) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0xffff3024 = TEE_ERROR_TARGET_DEAD
  regression_1021.1 FAILED
o regression_1021.2 Single Instance Multi Sessions
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644: trigger_panic(&cs[1], ((void *)0)) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0xffff3024 = TEE_ERROR_TARGET_DEAD
  regression_1021.2 FAILED
o regression_1021.3 Single Instance Multi Sessions Keep Alive
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1644: trigger_panic(&cs[1], ((void *)0)) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0xffff3024 = TEE_ERROR_TARGET_DEAD
  regression_1021.3 FAILED
o regression_1021.4 Multi Sessions TA to TA
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_1000.c:1719: trigger_panic(&cs[1], ((void *)0)) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0xffff3024 = TEE_ERROR_TARGET_DEAD
E/TC:? 0
E/TC:? 0 TA panicked with code 0xbeef
E/LD:  Status of TA a4c04d50-f180-11e8-8eb2-f2801f1b9fd1
E/LD:   arch: arm
E/LD:  region  0: va 0x40002000 pa 0x00000000 size 0x002000 flags rw-s (ldelf)
E/LD:  region  1: va 0x40004000 pa 0x00000000 size 0x005000 flags r-xs (ldelf)
E/LD:  region  2: va 0x40009000 pa 0x00000000 size 0x001000 flags rw-s (ldelf)
E/LD:  region  3: va 0x4000a000 pa 0x00000000 size 0x004000 flags rw-s (ldelf)
E/LD:  region  4: va 0x4000e000 pa 0x00000000 size 0x001000 flags r--s
E/LD:  region  5: va 0x4000f000 pa 0x00000000 size 0x002000 flags rw-s (stack)
E/LD:  region  6: va 0x40070000 pa 0x00001000 size 0x008000 flags r-xs [0]
E/LD:  region  7: va 0x40078000 pa 0x00009000 size 0x014000 flags rw-s [0]
E/LD:   [0] a4c04d50-f180-11e8-8eb2-f2801f1b9fd1 @ 0x40070000
  regression_1021.4 FAILED
  regression_1021 FAILED

4002.35:

o regression_4002.35 MAC case 34 algo 0x30000610
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:259: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:1770: ta_crypt_cmd_mac_final_compute(c, &session, op2, mac_cases[n].in + offs, mac_cases [n].in_len - offs, out, &out_size) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_4002.35 FAILED
  regression_4002 FAILED

4005.7:

o regression_4005.7 AE case 6 algo 0x40000810 line 2836
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:536: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:2977: ta_crypt_cmd_ae_encrypt_final(c, &session, op, ae_cases[n].ptx + ae_cases[n].in_incr, ae_cases[n].ptx_len - ae_cases[n].in_incr, out + out_offs, &out_size, out_tag, &out_tag_len) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_4005.7 FAILED
  regression_4005 FAILED

4006.1:

* regression_4006 Test TEE Internal API Asymmetric Cipher operations
o regression_4006.1 Asym Crypto case 0 algo 0x60000030 line 3131
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:631: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4268: ta_crypt_cmd_asymmetric_encrypt(c, &session, op, ((void *)0), 0, tv->ptx, tv->ptx_len, out_enc, &out_enc_size) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_4006.1 FAILED
  regression_4006 FAILED

4007_symmetric:

* regression_4007_symmetric Test TEE Internal API Generate Symmetric key
o regression_4007_symmetric.1 Generate AES key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.1 FAILED
o regression_4007_symmetric.2 Generate DES key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.2 FAILED
o regression_4007_symmetric.3 Generate DES3 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.3 FAILED
o regression_4007_symmetric.4 Generate HMAC-MD5 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.4 FAILED
o regression_4007_symmetric.5 Generate HMAC-SHA1 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.5 FAILED
o regression_4007_symmetric.6 Generate HMAC-SHA224 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.6 FAILED
o regression_4007_symmetric.7 Generate HMAC-SHA256 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.7 FAILED
o regression_4007_symmetric.8 Generate HMAC-SHA384 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.8 FAILED
o regression_4007_symmetric.9 Generate HMAC-SHA512 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.9 FAILED
o regression_4007_symmetric.10 Generate Generic secret key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_symmetric.10 FAILED
  regression_4007_symmetric FAILED

4007_rsa:

* regression_4007_rsa Test TEE Internal API Generate RSA key
o regression_4007_rsa.1 Generate RSA-256 key
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:802: ret_orig has an unexpected value: 0x1 = TEEC_ORIGIN_API, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4620: ta_crypt_cmd_generate_key(c, s, key, key_size, params, param_count) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_4000.c:4705: generate_and_test_key(c, session, key_types [n].key_type, 1, key_size, ((void *)0), 0) has an unexpected value: 0x0 = false, expected 0x1 = true
  regression_4007_rsa.1 FAILED
  regression_4007_rsa FAILED

6009:

o regression_6009.1 Storage id: 00000001
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1081: fs_next_enum(&sess, e, info, sizeof(info), id, sizeof(id)) has an unexpected value: 0x0 = TEEC_SUCCESS, expected 0xffff0008 = TEEC_ERROR_ITEM_NOT_FOUND
  regression_6009.1 FAILED
o regression_6009.2 Storage id: 80000000
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1029: fs_create(&sess, file_00, sizeof(file_00), 0x00000002, 0, data_01, sizeof(data_01), &obj0, storage_id) has an unexpected value: 0xffff0003 = TEEC_ERROR_ACCESS_CONFLICT, expected 0x0 = TEEC_SUCCESS
  regression_6009.2 FAILED
  regression_6009 FAILED

6010:

o regression_6010.1.9 StartPersistentObjectEnumerator ItemNotFound
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1319: fs_start_enum(&sess, e, storage_id) has an unexpected value: 0x0 = TEEC_SUCCESS, expected 0xffff0008 = TEEC_ERROR_ITEM_NOT_FOUND
  regression_6010.1.9 FAILED

o regression_6010.2.9 StartPersistentObjectEnumerator ItemNotFound
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1319: fs_start_enum(&sess, e, storage_id) has an unexpected value: 0x0 = TEEC_SUCCESS, expected 0xffff0008 = TEEC_ERROR_ITEM_NOT_FOUND
  regression_6010.2.9 FAILED

6012:

* regression_6012 Test TEE GP TTA DS init objects
o regression_6012.1 Storage id: 00000001
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1380: fs_create(&sess, file_04, sizeof(file_04), 0x00000002 | 0x00000004 | 0x00000400, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6012.1 FAILED
o regression_6012.2 Storage id: 80000000
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1380: fs_create(&sess, file_04, sizeof(file_04), 0x00000002 | 0x00000004 | 0x00000400, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6012.2 FAILED
  regression_6012 FAILED

6017:

* regression_6017 Test Persistent objects info
o regression_6017.1 Storage id: 00000001
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1629: fs_create(&sess, file_01, sizeof(file_01), 0x00000002, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6017.1 FAILED
o regression_6017.2 Storage id: 80000000
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1629: fs_create(&sess, file_01, sizeof(file_01), 0x00000002, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6017.2 FAILED
  regression_6017 FAILED

6018:

* regression_6018 Large object
o regression_6018.1 Storage id: 00000001
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1697: fs_create(&sess, file_01, sizeof(file_01), 0x00000002, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6018.1 FAILED
o regression_6018.2 Storage id: 80000000
/usr/src/debug/optee-test/3.11-rc1-r0/git/host/xtest/regression_6000.c:1697: fs_create(&sess, file_01, sizeof(file_01), 0x00000002, 0, ((void *)0), 0, &obj, storage_id) has an unexpected value: 0xffff0006 = TEEC_ERROR_BAD_PARAMETERS, expected 0x0 = TEEC_SUCCESS
  regression_6018.2 FAILED
  regression_6018 FAILED
jforissier commented 3 years ago

Hi,

Running xtest shows several errors, I think those are related to the strict TA parameter checking which was recently introduced (OK lines removed)

xtest was updated in https://github.com/OP-TEE/optee_test/pull/446/commits, are you using an older version?

Emantor commented 3 years ago

I have double checked this, my filesystem manifest says I have installed 3.11.0-rc1, which has SRCREV=159e295d5cc3ad2275ab15fe544620f6604d4ba4 pointing to the current head of the OP-TEE testsuite. Additionally I build the optee-test from a local git checkout, adding a single line to the usage output of xtest to verify the correct binary is contained in the image. This unfortunately produces the same output as above.

Emantor commented 3 years ago

Reverting https://github.com/OP-TEE/optee_client/commit/2de7f2531b704b83f9a44429cbab282df9b984a4 in the optee_client repository fixes my test failures.

jenswi-linaro commented 3 years ago

I doubt this is a 32-bit problem. To me it looks like it has something to do with the shared memory configuration. What is common on these failing platforms?

etienne-lms commented 3 years ago

For info, I'm running back xtest on stm32mp1 against latest optee_{client,os,test}. No issue so far:

# xtest
(...)
24426 subtests of which 0 failed
91 test cases of which 0 failed
0 test cases were skipped
TEE test application done!

Note I test over Linux v5.9. I'll test back with optee's kernel (latest optee branch from linaro-swg/linug.git) and will tell you if I see something wrong.

@Emantor, which commit for optee_os.git are you based on?

Emantor commented 3 years ago

SRCREV = "009a14d6dcc77d8a321464e9e6d6de92dd297b4f" so 009a14d6dcc77d8a321464e9e6d6de92dd297b4f. Is this another bootloader issue? I'll look into it later today. FWIW I am running kernel 5.8.7. I can definitely try kernel v5.9. Looking at the kernel diff, nothing immediate jumps out to me.

jforissier commented 3 years ago

Following up on Jens' comment: does OP-TEE know about the whole non-secure memory which the client library might use to pass parameters to the TEE? It needs to be declared via register_dynamic_shm() or via the DT.

Do the test pass if you rebuild with CFG_CORE_DYN_SHM=n?

ricardosalveti commented 3 years ago

I can confirm this same issue when testing on qemuarm64, and it works fine after reverting the optee_client change that was suggested earlier (https://github.com/OP-TEE/optee_client/commit/2de7f2531b704b83f9a44429cbab282df9b984a4).

ricardosalveti commented 3 years ago

Tested again on qemuarm64 with CFG_CORE_DYN_SHM=n and I still get the failures:

regression_1021.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_1000.c:1644
regression_1021.2 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_1000.c:1644
regression_1021.3 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_1000.c:1644
regression_1021.4 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_1000.c:1719
regression_4002.35 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:259
regression_4005.7 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:536
regression_4006.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:631
regression_4007_symmetric.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.2 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.3 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.4 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.5 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.6 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.7 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.8 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.9 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_symmetric.10 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4007_rsa.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_4011 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_4000.c:802
regression_6012.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1380
regression_6012.2 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1380
regression_6017.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1629
regression_6017.2 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1629
regression_6018.1 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1697
regression_6018.2 FAILED first error at /usr/src/debug/optee-test/3.10.0-r0/git/host/xtest/regression_6000.c:1697

12825 subtests of which 51 failed
91 test cases of which 10 failed
0 test cases were skipped
TEE test application done!

Path is 3.10 but this is latest 3.11-rc1.

So I guess in my case optee is not declaring the all the non-secure memory via register_dynamic_shm during init (which should explain why it works for a few targets but not all).

jenswi-linaro commented 3 years ago

For a standard QEMU v8 configuration I just tested successfully with:

mkdir qemu_v8
cd qemu_v8
repo init -u https://github.com/OP-TEE/manifest.git -m qemu_v8.xml
repo sync
cd build
make toolchains
make all
make run-only

Are you using some odd configuration?

lorc commented 3 years ago

Hello. Just for the record: I'm seeing exactly the same issues on Rcar Gen3 which is arm64 platform.

ricardosalveti commented 3 years ago

Main difference is that I'm using OpenEmbedded and the qemuarm64 target machine.

Using QEMU 5.1.0, ATF 2.3, OP-TEE 3.11.0-rc1, U-Boot 2020.04 and Kernel 5.8.13 (built with GCC 10.2).

make PLATFORM=vexpress-qemu_armv8a CROSS_COMPILE_core=aarch64-lmp-linux- CFG_WERROR=y DEBUG=0 LDFLAGS= CFG_TEE_CORE_LOG_LEVEL=2 CFG_TEE_TA_LOG_LEVEL=2 CFG_ARM64_core=y CROSS_COMPILE_ta_arm64=aarch64-lmp-linux- ta-targets=ta_arm64
qemu-system-aarch64 -device virtio-net-device,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22 -drive id=disk0,file=lmp-base-console-image-qemuarm64.wic,if=none,format=raw -device virtio-blk-device,drive=disk0 -no-acpi -bios flash.bin -nographic -machine virt,secure=on -cpu cortex-a57 -m 1024 -serial tcp:localhost:54320,server,nowait -serial tcp:localhost:54321,server,nowait -S
ricardosalveti commented 3 years ago

Also had a similar issue with zynqmp-zcu102 (CFG_CORE_DYN_SHM is disabled by default).

jenswi-linaro commented 3 years ago

The key difference is that 185d7548c968 ("driver: tee: Handle NULL pointer indication from client") is missing in the failing cases. So there's an error in OP-TEE/optee_client@2de7f25, I'd prefer a proper fix over reverting that commit.

lorc commented 3 years ago

@jenswi-linaro, I cherry-picked mentioned patch to the mainline 5.9 kernel and I still can see that the same tests are failing. All other components (optee_os, optee_client, optee_test) are at 3.11.0-rc1

lorc commented 3 years ago

Jens, please disregard my previous message. I have found that I copied test TAs into wrong place, so xtest ran with TAs from another build. Your patch for kernel really fixes the issue.

ruchi393 commented 3 years ago

@jenswi-linaro , for the NULL pointer handling, are you referring to the use case where tmpref->buffer is NULL and ctx->memref_null is not set ? In that particular scenario, TEEC_RegisterSharedMemory would fail and as per flow before this patch, we should use the TEEC_AllocateSharedMemory. I am not sure I understand how this will work.

If someone passes a NULL pointer as a buffer and ctx->memref_null is not set, calling TEEC_AllocateSharedMemory will return a temporary buffer. But how do you copy from a NULL pointer to this buffer ? So, I don't understand how this temporary buffer will be used.

I can add a patch to add the flow for this. However, I am not sure if this is a valid scenario ?Also, I see that OPTEE_SMC_SEC_CAP_MEMREF_NULL is always set as a capability from optee-os. So if you have the right linux driver, the above situation will never happen .

jenswi-linaro commented 3 years ago

@ruchi393, I haven't looked close enough at what's going in in optee_client. But I expect that all tests that doesn't involve testing NULL pointer behaviour should pass with or without ctx->memref_null being true.

ruchi393 commented 3 years ago

I will send a patch of the missing case.

ruchi393 commented 3 years ago

I have raised a PR - https://github.com/OP-TEE/optee_client/pull/221

Please check if it fixes the issue in your environment. At my end , in my build environment for QEMU ARMv8, I reverted the linux patch (185d7548c968 ("driver: tee: Handle NULL pointer indication from client") and gave this fix a try. It does seem to fix the issues.