Git Product home page Git Product logo

optee_test's People

Contributors

cedric-chaumont-st avatar clementfaure avatar d3zd3z avatar etienne-lms avatar gabor-toth-arm avatar glneo avatar goodbach avatar jbech-linaro avatar jellesels-arm avatar jenswi-linaro avatar jforissier avatar jjayat avatar ldts avatar liuyq avatar lorc avatar maroueneboubakri avatar matthewsukyoung avatar mel-f avatar omasse-linaro avatar omihalac avatar pmoos avatar ricardosalveti avatar ruchi393 avatar sahilnxp avatar sticfeynman avatar vesajaaskelainen avatar vincent-mailhol avatar wamserma avatar weizhaojiang avatar yuzexiyzx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

optee_test's Issues

xtest 9089 get failed when optee_client apply the patch "Check flags before allocating shared memory"

* XTEST_TEE_9089 50-3c-14
DEBUG:   [0x0] TEE-CORE:tee_ta_init_static_ta_session:159:    Lookup for Static TA 534d4152-5443-534c-5443525950544f31
DEBUG:   [0x0] TEE-CORE:init_session_with_signed_ta:614:    Load dynamic TA
DEBUG:   [0x0] TEE-CORE:ta_load:396: Loaded TA at 0x7f100000
DEBUG:   [0x0] TEE-CORE:ta_load:397: ELF load address 0x101000
DEBUG:   [0x0] TEE-CORE:init_session_with_signed_ta:620:       dyn TA : 534d4152-5443-534c-5443525950544f31
FLOW:    [0x0] TEE-CORE:trace_syscall:144: syscall #15 (syscall_cryp_state_alloc)
FLOW:    [0x0] TEE-CORE:trace_syscall:144: syscall #18 (syscall_hash_init)
*** Error in `xtest': free(): invalid pointer: 0x0000007fefc071b0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x6b158)[0x7fb1585158]
/lib64/libc.so.6(+0x70e58)[0x7fb158ae58]
/lib64/libc.so.6(+0x71aa8)[0x7fb158baa8]
xtest[0x46f5a4]
======= Memory map: ========
00400000-00591000 r-xp 00000000 b3:07 115                                /bin/xtest
005a1000-005a5000 rw-p 00191000 b3:07 115                                /bin/xtest
005a5000-005a7000 rw-p 00000000 00:00 0 
04feb000-0500c000 rw-p 00000000 00:00 0                                  [heap]
7fac000000-7fac021000 rw-p 00000000 00:00 0 
7fac021000-7fb0000000 ---p 00000000 00:00 0 
7fb14e8000-7fb14f9000 r-xp 00000000 b3:07 264                            /lib64/libgcc_s.so.1
7fb14f9000-7fb1509000 ---p 00011000 b3:07 264                            /lib64/libgcc_s.so.1
7fb1509000-7fb150a000 rw-p 00011000 b3:07 264                            /lib64/libgcc_s.so.1
7fb150a000-7fb151a000 rw-p 00000000 00:00 0 
7fb151a000-7fb1665000 r-xp 00000000 b3:07 255                            /lib64/libc-2.22.so
7fb1665000-7fb1674000 ---p 0014b000 b3:07 255                            /lib64/libc-2.22.so
7fb1674000-7fb1678000 r--p 0014a000 b3:07 255                            /lib64/libc-2.22.so
7fb1678000-7fb167a000 rw-p 0014e000 b3:07 255                            /lib64/libc-2.22.so
7fb167a000-7fb167e000 rw-p 00000000 00:00 0 
7fb167e000-7fb1697000 r-xp 00000000 b3:07 285                            /lib64/libpthread-2.22.so
7fb1697000-7fb16a6000 ---p 00019000 b3:07 285                            /lib64/libpthread-2.22.so
7fb16a6000-7fb16a7000 r--p 00018000 b3:07 285                            /lib64/libpthread-2.22.so
7fb16a7000-7fb16a8000 rw-p 00019000 b3:07 285                            /lib64/libpthread-2.22.so
7fb16a8000-7fb16ac000 rw-p 00000000 00:00 0 
7fb16ac000-7fb16af000 r-xp 00000000 b3:07 624                            /lib64/libteec.so.1.0
7fb16af000-7fb16be000 ---p 00003000 b3:07 624                            /lib64/libteec.so.1.0
7fb16be000-7fb16bf000 rw-p 00002000 b3:07 624                            /lib64/libteec.so.1.0
7fb16bf000-7fb16de000 r-xp 00000000 b3:07 249                            /lib64/ld-2.22.so
7fb16e7000-7fb16eb000 rw-p 00000000 00:00 0 
7fb16eb000-7fb16ec000 r--p 00000000 00:00 0                              [vvar]
7fb16ec000-7fb16ed000 r-xp 00000000 00:00 0                              [vdso]
7fb16ed000-7fb16ee000 r--p 0001e000 b3:07 249                            /lib64/ld-2.22.so
7fb16ee000-7fb16f0000 rw-p 0001f000 b3:07 249                            /lib64/ld-2.22.so
7fefbe7000-7fefc08000 rw-p 00000000 00:00 0                              [stack]
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:318: tee_ta_close_session(0x7f04bf78)
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:337:    ... Destroy session
FLOW:    [0x0] TEE-CORE:trace_syscall:144: syscall #17 (syscall_cryp_state_free)
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:358:    ... Destroy TA ctx
Aborted

error xtest 1008.3: create session fail

Hello,
I installed optee/qemu.... When I launched the xtest 1008.3, I got an error "create session fail".
Also, when I tried to launch the hello_world example, I got a similar error.
Could you suggest some solutions for this problem?
By the way, I added the ta by modifying filelist-tee.txt and then launch make all run, is there another way to add TAs? I think the TAs are not copied to the correct place !

Thanks!

Build failure due to -Werror=redundant-decls

DEBUG: Executing shell function do_compile
NOTE: make -j 4 TA_DEV_KIT_DIR=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta OPTEE_CLIENT_EXPORT=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr TEEC_EXPORT=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr CROSS_COMPILE_HOST=aarch64-oe-linux- CROSS_COMPILE_ta_arm64=aarch64-oe-linux- V=1 xtest
make -C host/xtest CROSS_COMPILE="aarch64-oe-linux-" \
             --no-builtin-variables \
             q= \
             O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/xtest \
             xtest
make[1]: Entering directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/host/xtest'
  LD      /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/xtest/xtest
make[1]: Leaving directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/host/xtest'
NOTE: make -j 4 TA_DEV_KIT_DIR=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta OPTEE_CLIENT_EXPORT=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr TEEC_EXPORT=/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr CROSS_COMPILE_HOST=aarch64-oe-linux- CROSS_COMPILE_ta_arm64=aarch64-oe-linux- V=1 ta
make -C ta CROSS_COMPILE="" \
          q= \
          O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta \
          ta
make[1]: Entering directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/ta'
make -C create_fail_test O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test &&  make -C crypt O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/crypt &&  make -C os_test O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/os_test &&  make -C rpc_test O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/rpc_test &&  make -C sims O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/sims &&  make -C storage O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/storage &&  make -C concurrent O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/concurrent &&  make -C concurrent_large O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/concurrent_large &&  make -C storage_benchmark O=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/storage_benchmark && true
make[2]: Entering directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/ta/create_fail_test'
mkdir -p /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/
aarch64-oe-linux-cpp -Wp,-P,-MT,/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/ta.lds,-MD,/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/.ta.ld.d \
    -DASM=1 -nostdinc -isystem /build/linaro/build/build/tmp-glibc/sysroots/x86_64-linux/usr/lib/aarch64-oe-linux/gcc/aarch64-oe-linux/5.2.1/include -I./include -I/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test -DARM64=1 -D__LP64__=1 -DTRACE_LEVEL=2 -I. -I/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/ta.ld.S > /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/ta.lds
aarch64-oe-linux-gcc -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0=/usr/src/debug/optee-test/2.0+gitAUTOINC+5bf536242b-r0 -fdebug-prefix-map=/build/linaro/build/build/tmp-glibc/sysroots/x86_64-linux= -fdebug-prefix-map=/build/linaro/build/build/tmp-glibc/sysroots/hikey= -I/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include -std=gnu99 -Werror -fdiagnostics-show-option -Wall -Wcast-align -Werror-implicit-function-declaration -Wextra -Wfloat-equal -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-default -Wwrite-strings -Wno-missing-field-initializers -Wno-format-zero-length -Waggregate-return -Wredundant-decls -Wold-style-definition -Wstrict-aliasing=2 -Wundef -pedantic -Wdeclaration-after-statement -Os -g3 -fpie -mstrict-align -MD -MF /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/.user_ta_header.o.d -MT /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/user_ta_header.o -nostdinc -isystem /build/linaro/build/build/tmp-glibc/sysroots/x86_64-linux/usr/lib/aarch64-oe-linux/gcc/aarch64-oe-linux/5.2.1/include -I./include -DARM64=1 -D__LP64__=1 -DTRACE_LEVEL=2 -I. -I/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include -c /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c -o /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/user_ta_header.o
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:445:24: error: redundant redeclaration of 'fscanf' [-Werror=redundant-decls]
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
                        ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:177:41: note: in definition of macro '__REDIRECT'
 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
                                         ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:427:12: note: previous declaration of 'fscanf' was here
 extern int fscanf (FILE *__restrict __stream,
            ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:448:24: error: redundant redeclaration of 'scanf' [-Werror=redundant-decls]
 extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
                        ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:177:41: note: in definition of macro '__REDIRECT'
 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
                                         ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:433:12: note: previous declaration of 'scanf' was here
 extern int scanf (const char *__restrict __format, ...) __wur;
            ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:450:28: error: redundant redeclaration of 'sscanf' [-Werror=redundant-decls]
 extern int __REDIRECT_NTH (sscanf, (const char *__restrict __s,
                            ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:185:6: note: in definition of macro '__REDIRECT_NTH'
      name proto __asm__ (__ASMNAME (#alias)) __THROW
      ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:435:12: note: previous declaration of 'sscanf' was here
 extern int sscanf (const char *__restrict __s,
            ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:496:24: error: redundant redeclaration of 'vfscanf' [-Werror=redundant-decls]
 extern int __REDIRECT (vfscanf,
                        ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:177:41: note: in definition of macro '__REDIRECT'
 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
                                         ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:473:12: note: previous declaration of 'vfscanf' was here
 extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
            ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:501:24: error: redundant redeclaration of 'vscanf' [-Werror=redundant-decls]
 extern int __REDIRECT (vscanf, (const char *__restrict __format,
                        ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:177:41: note: in definition of macro '__REDIRECT'
 # define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
                                         ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:481:12: note: previous declaration of 'vscanf' was here
 extern int vscanf (const char *__restrict __format, _G_va_list __arg)
            ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/features.h:368:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdint.h:25,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_api_types.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_ta_api.h:33,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:28:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:504:28: error: redundant redeclaration of 'vsscanf' [-Werror=redundant-decls]
 extern int __REDIRECT_NTH (vsscanf,
                            ^
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/sys/cdefs.h:185:6: note: in definition of macro '__REDIRECT_NTH'
      name proto __asm__ (__ASMNAME (#alias)) __THROW
      ^
In file included from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/include/tee_internal_api_extensions.h:33:0,
                 from /build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/src/user_ta_header.c:29:
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/stdio.h:485:12: note: previous declaration of 'vsscanf' was here
 extern int vsscanf (const char *__restrict __s,
            ^
cc1: all warnings being treated as errors
/build/linaro/build/build/tmp-glibc/sysroots/hikey/usr/include/optee/export-user_ta/mk/compile.mk:146: recipe for target '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/user_ta_header.o' failed
make[2]: *** [/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/out/ta/create_fail_test/user_ta_header.o] Error 1
make[2]: Leaving directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/ta/create_fail_test'
Makefile:44: recipe for target 'ta' failed
make[1]: *** [ta] Error 2
make[1]: Leaving directory '/build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/git/ta'
Makefile:35: recipe for target 'ta' failed
make: *** [ta] Error 2
ERROR: oe_runmake failed
ERROR: Function failed: do_compile (log file is located at /build/linaro/build/build/tmp-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5bf536242b-r0/temp/log.do_compile.2075)

Accurracy issue in xtest performance tests

AES and hash test are based on measuring time spent for each invocation from Linux userland client of a command against the TA performing a single buffer AES ciphering or hash computation.

The issue I faced when experiencing this on HW for non-huge buffers (< 1MByte) is that TA invocation is quick (far less than 10ms), that the Linux scheduling generates to much timing deviations for an accurate throughput measurements.

For comparing OP-TEE performances for various setup (HW configs and/or OP-TEE releases), we need quite stable numbers. Could one crosscheck the tool (i.e xtest --aes-perf with buffer sizes (-s argument) from 1kByte to 128kByte) on some HW and give their feedback ?

xtest failed to build on android environment

Hi experts,

As I know, building xtest needs config files from optee-os. And Android.mk in optee-test project add LOCAL_ADDITIONAL_DEPENDENCIES := $(OPTEE_BIN) to ask build system to build optee-os first.

Here is the problem, optee-test use the following code to include conf.mk that should be produced from building optee-os. But when makefile read this line, ths conf.mk has not been generated. So this line does not import configs from optee-os.

-include $(TA_DEV_KIT_DIR)/host_include/conf.mk

This results following code not workable.

ifeq ($(CFG_SECSTOR_TA_MGMT_PTA),y)
srcs += install_ta.c
endif

ifeq ($(CFG_SECURE_DATA_PATH),y)
srcs += sdp_basic.c
endif

At last, it should build failed with errors:

vendor/asr/optee/optee_test/host/xtest/xtest_main.c:105: error: undefined reference to 'install_ta_runner_cmd_parser'
clang.real: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
15:27:45 ninja failed with: exit status 1

If we build optee-os before build optee-test, the problem disappeared.

Adding header files for TA part

Hi there,

I just wanted to use some functions of <sched.h> and it could work for the client application easily while when I'm adding this file into TA's source code I got "error: sched.h: No such file or directory".

Could you please give me some advice for solving this issue?

Thanks.

Link error when compiling with GP test suite

I tried to compile the optee_test with the command:

make CFG_GP_PACKAGE_PATH=path_to_gp_package CROSS_COMPILE=aarch64-linux-gnu-

And it results in a link error says:

 LD      /xxx/optee_test/out/xtest/xtest
/usr/lib/gcc-cross/aarch64-linux-gnu/6/../../../../aarch64-linux-gnu/bin/ld: ../lib/armv8/libcrypto.a(lhash.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `strcmp@@GLIBC_2.17' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc-cross/aarch64-linux-gnu/6/../../../../aarch64-linux-gnu/bin/ld: ../lib/armv8/libcrypto.a(lhash.o)(.text+0x194): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `strcmp@@GLIBC_2.17'
/usr/lib/gcc-cross/aarch64-linux-gnu/6/../../../../aarch64-linux-gnu/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:163: recipe for target 'xtest' failed
make[1]: *** [xtest] Error 1

The static library libcrypto.a is originally included in the folder optee_test/host/lib/armv8/ , and therefore I am not able to re-compile it with -fPIC.

The cross-compiler I have been using is aarch64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516

Any suggestions on how to solve the problem?

GCC 8.1.0 Errors in adbg_run.c and regression_4000.c (see patches attached)

The following errors are generated by optee_test being built with openembedded-core (tip of masters)

 /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/adbg/src/adbg_run.c: In function 'Do_ADBG_AppendToSuite':
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/adbg/src/adbg_run.c:103:3: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
|    strncpy(p, Source_p->SuiteID_p, size);
|    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/adbg/src/adbg_run.c:88:9: note: length computed here
|   size = strlen(Source_p->SuiteID_p);
|          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: all warnings being treated as errors
| Makefile:165: recipe for target '/mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/out/xtest/adbg/src/adbg_run.o' failed
| make[1]: *** [/mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/out/xtest/adbg/src/adbg_run.o] Error 1
| make[1]: *** Waiting for unfinished jobs....
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/regression_4000.c: In function 'xtest_tee_test_4011':
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/regression_4000.c:4986:3: error: 'memmove' pointer overflow between offset [0, 8] and size [4294967295, 2147483647] accessing array 'tmp' with type 'uint8_t[1024]' {aka 'unsigned char[1024]'} [-Werror=array-bounds]
|    memmove(tmp + n + i, tmp + m, tmp_size - m);
|    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/regression_4000.c:4884:10: note: array 'tmp' declared here
|   uint8_t tmp[1024];
|           ^~~
| /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest/regression_4000.c:4986:3: error: 'memmove' specified size 4294967295 exceeds maximum object size 2147483647 [-Werror=stringop-overflow=]
|    memmove(tmp + n + i, tmp + m, tmp_size - m);
|    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1: all warnings being treated as errors
| Makefile:165: recipe for target '/mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/out/xtest/regression_4000.o' failed
| make[1]: *** [/mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/out/xtest/regression_4000.o] Error 1
| make[1]: Leaving directory '/mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/git/host/xtest'
| Makefile:37: recipe for target 'xtest' failed
| make: *** [xtest] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /mnt/data/default_20180621_083657/build-xxx/tmp-xxx-glibc/work/imx7s_warp_xxx-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+45218eb59b-r0/temp/log.do_compile.93910)
NOTE: recipe optee-test-2.6.0+gitAUTOINC+45218eb59b-r0: task do_compile: Failed

patches below:

From 48775c2d53581b323096273f15b2a6b0411aaf6e Mon Sep 17 00:00:00 2001
From: Simon Hughes <[email protected]>
Date: Fri, 22 Jun 2018 10:36:50 +0100
Subject: [PATCH] IOTMBL-438: Fix optee_test adbg_run.c strncpy
 -Werror=stringop-overflow=.

The following provides more information on this commit:
- The error is caused by using GCC 8.1.1.

Signed-off-by: Simon Hughes <[email protected]>
---
 host/xtest/adbg/src/adbg_run.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/host/xtest/adbg/src/adbg_run.c b/host/xtest/adbg/src/adbg_run.c
index 406e429..2739db5 100644
--- a/host/xtest/adbg/src/adbg_run.c
+++ b/host/xtest/adbg/src/adbg_run.c
@@ -100,7 +100,7 @@ int Do_ADBG_AppendToSuite(
 		snprintf(p, size, "%s+%s", Dest_p->SuiteID_p,
 			 Source_p->SuiteID_p);
 	else
-		strncpy(p, Source_p->SuiteID_p, size);
+		snprintf(p, size, "%s", Source_p->SuiteID_p);
 	free((void *)Dest_p->SuiteID_p);
 	Dest_p->SuiteID_p = p;
 
-- 
2.7.4

From eb5308b7868c5dfda080f4753656ee62a057ff41 Mon Sep 17 00:00:00 2001
From: Simon Hughes <[email protected]>
Date: Fri, 22 Jun 2018 10:39:57 +0100
Subject: [PATCH] IOTMBL-438: Fix optee_test error: 'memmove'
 -Werror=array-bounds.

The following provides more information on this commit:
- The reported error was "error: 'memmove' pointer overflow between offset
  [0, 8] and size [4294967295, 2147483647] accessing array 'tmp' with
  type 'uint8_t[1024]' {aka 'unsigned char[1024]'} [-Werror=array-bounds].
- The error is caused by using GCC 8.1.1.

Signed-off-by: Simon Hughes <[email protected]>
---
 host/xtest/regression_4000.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/host/xtest/regression_4000.c b/host/xtest/regression_4000.c
index ebc9bae..8b10c55 100644
--- a/host/xtest/regression_4000.c
+++ b/host/xtest/regression_4000.c
@@ -5041,6 +5041,7 @@ static void xtest_tee_test_4011(ADBG_Case_t *c)
 			if (tmp[m] != 0xff)
 				break;
 		/* 4.2 */
+		tmp_size = sizeof(tmp);
 		memmove(tmp + n + i, tmp + m, tmp_size - m);
 		/* 4.3 */
 		for (n = n + tmp_size - m + i; n < tmp_size; n++)
-- 
2.7.4

I can generate a PR if these patches are acceptable.

See also:

OP-TEE/optee_client#126

Thanks
Simon

0001-IOTMBL-438-Fix-optee_test-adbg_run.c-strncpy-Werror-.patch.txt
0001-IOTMBL-438-Fix-optee_test-error-memmove-Werror-array.patch.txt

optee_test build problem with android

Hello, I'm trying to build optee_test on android

when I try to build it, there's an error message
export-ta_arm64/mk/compile.mk:146: error: Automatic variable `$?' isn't supported yet

Does anybody experience like me or knows how to solve this problem?

thank you previously..

TEEC_AllocateSharedMemory with TEEC_MEMREF_PARTIAL_OUTPUT/INPUT

Hi,

I've found here (GP tests):
https://github.com/OP-TEE/optee_test/blob/master/host/xtest/xml/include/xml_crypto_api.h#L808

that sometimes you use TEEC_MEMREF_PARTIAL_OUTPUT (INPUT) flag when calling TEEC_AllocateSharedMemory. Shouldn't it be a TEEC_MEM_OUTPUT(INPUT) flag instead?

I think TEEC_MEMREF_PARTIAL shouldn't be used for TEEC_AllocateShareMemory, isn't? As far as I understand it is useful when constructing param types with TEEC_PARAM_TYPES(). Or am I completely wrong?

Some types needed by optee_test are no longer exported by optee_os

Build failure:

/projects/xxx/optee_test/host/xtest/xtest_20000.c: In function 'obj_corrupt':
/projects/xxx/optee_test/host/xtest/xtest_20000.c:292:19: error: invalid application of 'sizeof' to incomplete type 'struct tee_fs_file_meta'
            sizeof(struct tee_fs_file_meta);
                   ^
/projects/xxx/optee_test/host/xtest/xtest_20000.c:294:18: error: invalid application of 'sizeof' to incomplete type 'struct tee_fs_file_info'
           sizeof(struct tee_fs_file_info);
                  ^
/projects/xxx/optee_test/host/xtest/xtest_20000.c:296:7: error: 'BLOCK_FILE_SIZE' undeclared (first use in this function)
       BLOCK_FILE_SIZE;
       ^
/projects/xxx/optee_test/host/xtest/xtest_20000.c:296:7: note: each undeclared identifier is reported only once for each function it appears in

Workaround (cut and paste from optee_os... should be done by exposing it in optee_os... or something better changed in optee_test):

diff --git a/host/xtest/xtest_20000.c b/host/xtest/xtest_20000.c
index 7580755..130587e 100644
--- a/host/xtest/xtest_20000.c
+++ b/host/xtest/xtest_20000.c
@@ -273,6 +273,26 @@ static int is_obj_present(TEEC_UUID *p_uuid, void *file_id,
         return 0;
 }
 
+/* bodge up unexported type */
+#define NUM_BLOCKS_PER_FILE	1024
+
+struct tee_fs_file_info {
+	size_t length;
+	uint32_t backup_version_table[NUM_BLOCKS_PER_FILE / 32];
+};
+
+struct tee_fs_file_meta {
+	struct tee_fs_file_info info;
+	uint8_t encrypted_fek[TEE_FS_KM_FEK_SIZE];
+	uint8_t backup_version;
+};
+
+#define BLOCK_FILE_SHIFT	12
+
+#define BLOCK_FILE_SIZE		(1 << BLOCK_FILE_SHIFT)
+
+
+
 static TEEC_Result obj_corrupt(TEEC_UUID *p_uuid, void *file_id,
 		       uint32_t file_id_length,
 		       uint32_t offset, enum tee_fs_file_type file_type,

Problem with saved_cipher_iv variable in xml_crypto_api.h

Hi,
I think there is a misuse of variable saved_cipher_iv in host/xtest/xml/include/xml_crypto_api.h.
This variable is intended to be used in cipher_do_final() (i.e. Invoke_Crypto_CipherDoFinal()) after being filled in Invoke_Crypto_CipherInit(). The point is it is reset/filled only if iv != NULL (cf l. 2133), but used anyway. So if you launch two consecutive tests, the first with iv != NULL and the second with iv == NULL, then the second test will use saved_cipher_iv from first test.
Example: ./xtest 9176 9177

Note that if you launch these tests separately (i.e. ./xtest 9176 && ./xtest 9177), there is obviously no issue.

I would recommend to take CRYPTO_FREE(saved_cipher_iv); l. 2134 out of the if.

The same remark applies also for saved_mac_iv, even if the problematic case is never encountered as the only GP test with iv != NULL is a skipped one.

Failed xtest 4009

* XTEST_TEE_4008 Test TEE Internal API Derive key
o XTEST_TEE_4008.1 Derive DH key success
  XTEST_TEE_4008.1 OK
  XTEST_TEE_4008 OK

* XTEST_TEE_4009 Test TEE Internal API Derive key ECDH
o XETEST_TEE_4009.1 Derive ECDH key - algo = 0x80001042
R TEE-CORE:tee_svc_sys_return_helper:189: TA panicked with code 0xffff000a usr_sp 0x100718 usr_lr 0x20321d
ERR [568] TEEC:TEEC_InvokeCommand:396: Function returns with [-53212]
/home/Freenix/work/forfun/trustzone/optee_test/host/xtest/xtest_helpers.c:320: ret_orig has an unexpected value: 0x3 = TEEC_ORIGIN_TEE, expected 0x4 = TEEC_ORIGIN_TRUSTED_APP
/home/Freenix/work/forfun/trustzone/optee_test/host/xtest/xtest_4000.c:4340: ta_crypt_cmd_derive_key(c, &session, op, sv_handle, params, param_count) has an unexpected value: 0xffff3024 = TEE_ERROR_TARGET_DEAD, expected 0x0 = TEEC_SUCCESS
  XTEST_TEE_4009.1 FAILED
  XTEST_TEE_4009 FAILED
+-----------------------------------------------------
Result of testsuite XTEST_TEE_TEST filtered by "_4":
XTEST_TEE_4001 OK
XTEST_TEE_4002 OK
XTEST_TEE_4003_NO_XTS OK
XTEST_TEE_4003_XTS OK
XTEST_TEE_4004 OK
XTEST_TEE_4005 OK
XTEST_TEE_4006 OK
XTEST_TEE_4007 OK
XTEST_TEE_4008 OK
XTEST_TEE_4009.1 FAILED first error at /home/Freenix/work/forfun/trustzone/optee_test/host/xtest/xtest_helpers.c:320
XTEST_TEE_4009 FAILED
+-----------------------------------------------------

I do not have clear idea on this, any clues?

Socket Communication

Hi,
I'm trying to communicate with another device via socket like in regression_2000 (https://github.com/OP-TEE/optee_test/blob/213ca8aaf4eafe9d26af76db7b31d9595ce57e6f/host/xtest/regression_2000.c). however when i try to compile i get the error that some libraries like "tee_isocket.h" are not known, when i try to compile the file. From my understanding it should be included when i exported TA_DEV_KIT_DIR with "export TA_DEV_KIT_DIR=~/devel/optee/optee_os/out/arm/export-ta_arm32/".
Is my understanding wrong or do you have any suggestions?

regression: both benchmark 2011/2012 tests fail (QEMU, HiKey, RPi3)

root@RPi3:/bin ./xtest -t benchmark 2012

Test ID: 2012
Run test suite with level=0

TEE test application started with device [(null)]
######################################################
#
# benchmark
#
######################################################
 
* benchmark_2012 TEE AES Performance test (TA_AES_CBC)
ERR [171] TEEC:TEEC_InvokeCommand:582: TEE_IOC_INVOKE failed

Secure world output:

DEBUG:   [0x0] TEE-CORE:tee_ta_init_pseudo_ta_session:259:    Lookup for pseudo TA e626662e-c0e2-485c-b8c8-09fbce6edf3d
DEBUG:   [0x0] TEE-CORE:tee_ta_init_user_ta_session:610: Load user TA e626662e-c0e2-485c-b8c8-09fbce6edf3d
DEBUG:   [0x0] TEE-CORE:ta_load:316: ELF load address 0x40001000
read: Bad address
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:378: tee_ta_close_session(0x8482560)
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:397:    ... Destroy session
DEBUG:   [0x0] TEE-CORE:tee_ta_close_session:423:    ... Destroy TA ctx

TEEC_InvokeCommand: 0xffff0000 (orig=2)

xtest failed

Hi,
I run op-tee on imx6q sabrelite. Run the xtest , and the result is that
image
image
image

What's wrong with the failures? What are the causes of failures?Do these failures have any impact on the system?

Thank you!

Wrong flag for OPTEE_CLIENT path in README.md

It is called OPTEE_CLIENT_PATH in README.md but called OPTEE_CLIENT_EXPORT in Makefile:

# By default we expect optee_client exported folder to be on a certain relative
# path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will
# be used instead.
OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export

aosp build error from TAILQ_CONCAT

external/optee_test/host/xtest/adbg/src/adbg_run.c:97:2: error: implicit declaration of function 'TAILQ_CONCAT' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        TAILQ_CONCAT(&Dest_p->cases, &Source_p->cases, link);
        ^

Is TAILQ_CONCAT a glibc extension? Seems not available in bionic.

Workaround:

diff --git a/host/xtest/adbg/src/adbg_run.c b/host/xtest/adbg/src/adbg_run.c
index d652643..24bdb88 100644
--- a/host/xtest/adbg/src/adbg_run.c
+++ b/host/xtest/adbg/src/adbg_run.c
@@ -19,6 +19,23 @@
 /*************************************************************************
  * 2. Definition of external constants and variables
  ************************************************************************/
+# ifdef __ANDROID__
+#define        TAILQ_INIT(head) do { \
+       (head)->tqh_first = NULL; \
+       (head)->tqh_last = &(head)->tqh_first; \
+} while (/*CONSTCOND*/0)
+
+#define        TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
+
+#define        TAILQ_CONCAT(head1, head2, field) do { \
+       if (!TAILQ_EMPTY(head2)) { \
+       *(head1)->tqh_last = (head2)->tqh_first; \
+       (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
+       (head1)->tqh_last = (head2)->tqh_last; \
+       TAILQ_INIT((head2)); \
+       } \
+} while (/*CONSTCOND*/0)
+# endif
 
 /*************************************************************************
  * 3. File scope types, constants and variables

Can this be PRed? If not, what should be the proper fix?

Thanks!

about gp testsuite patch

Dear all:
I want to build gp test suite. so i need to apply the patch. but when i do this, it can't apply.

my shell shows:

!/bin/bash

export TA_DEV_KIT_DIR=_/optee/tdk/ta_export
export CFG_GP_TESTSUITE_ENABLE=y
export CFG_DEV_PATH=_
_/optee
export CFG_GP_PACKAGE_PATH=
_**/optee/optee_test/package/testsuite/global_platform/api_1.0/TEE_Initial_Configuration-Test_Suite_v1_1_0_4-2014_11_07

export CFG_GP_XSL_PACKAGE_PATH=******/optee/optee_test/package/testsuite/global_platform/api_1.0/TEE_Initial_Configuration-Test_Suite_v1_1_0_4-2014_11_07
make patch

and I have change the name "GP_XSL_TEE_Initial_Configuration-Test_Suite_v1_0_0-2014-12-03-STM" to "TEE_Initial_Configuration-Test_Suite_v1_1_0_4-2014_11_07"

how can i go next?
thanks in advance!

When I run 'sudo xtest', the test 1004 is not finished

I installed the hikey_debian version at 8g hikey board. And I want to test about standard TAs which is already included in default image.

when I put the command sudo xtest, the init test pass well but when the next test 1004 is not finished and not showing any results.

How long does it usually take to run all the tests?

optee_test build failed, os_test TA build error.

Build os_test/ta/os_test failed, who can help me, Thanks~
ninja: no work to do.
ninja: no work to do.
vendor/asr/optee/optee_test/product.mk was modified, regenerating...
[684/1057] including ./system/sepolicy/Android.mk ...
./system/sepolicy/Android.mk:111: warning: BOARD_SEPOLICY_VERS not specified, assuming current platform version
[1053/1057] including ./vendor/asr/telephony/lte-telephony/apps/Android.mk ...
vendor/asr/telephony/lte-telephony/apps/atcmd_server/Android.mk:142: warning: "Disable Labtool AT commands for now on 4.2/4.3"
[1057/1057] including ./vendor/nxp/Android.mk ...
No private recovery resources for TARGET_DEVICE aquilac_evb
platform_testing/build/tasks/tests/instrumentation_metric_test_list.mk: warning: continuous_instrumentation_metric_tests: Unknown installed file for module perf-setup.sh
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module RecyclerViewTests
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module SettingsFunctionalTests
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module LauncherFunctionalTests
platform_testing/build/tasks/tests/instrumentation_test_list.mk: warning: continuous_instrumentation_tests: Unknown installed file for module EmergencyInfoTests
platform_testing/build/tasks/tests/native_metric_test_list.mk: warning: continuous_native_metric_tests: Unknown installed file for module perf-setup.sh
ninja: error: 'out/target/product/aquilac_evb/system/lib/optee_armtz/ffd2bded-ab7d-4988-95ee-e4962fff7154.ta', needed by 'out/target/product/aquilac_evb/obj/optee/ta/vendor_asr_optee_optee_test_ta_os_test/5b9e0e40-2636-11e1-ad9e-0002a5d5c51b.ta', missing and no known rule to make it
11:08:14 ninja failed with: exit status 1

failed to build some targets (01:24 (mm:ss))

chaozhu@chaozhu-ChengMing-3967:~/phone_android8.1$

Some wrong buffer part compared in host/xtest/regression_6000.c

In regression test 6010, line 1369, the wrong part of out buffer is compared to data buffer: the last sizeof(data) / 2 bytes are compared, whereas the first sizeof(data) / 2 were filled line 1366
fs_read(&sess, o1, out, sizeof(out) / 2, &n)

We should have:
ADBG_EXPECT_BUFFER(c, data + sizeof(data) / 2, sizeof(data) / 2, out, n);
Instead of:
ADBG_EXPECT_BUFFER(c, data + sizeof(data) / 2, sizeof(data) / 2, out + sizeof(data) / 2, n);

make clean doesn't seem effective

To allow make clean to be effective, I have a local patch

diff --git a/Makefile b/Makefile
index 9e263dd..1c2321f 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,7 @@ ta:
 .PHONY: clean
 ifneq ($(wildcard $(TA_DEV_KIT_DIR)/host_include/conf.mk),)
 clean:
+       @rm -rf `find . -name build`
        $(q)$(MAKE) -C host/xtest O=$(out-dir)/xtest q=$(q) $@
        $(q)$(MAKE) -C ta O=$(out-dir)/ta q=$(q) $@
 else

This is based on the observation

$ find . -name build
./ta/crypt/build
./ta/storage2/build
./ta/create_fail_test/build
./ta/concurrent_large/build
./ta/os_test/build
./ta/storage_benchmark/build
./ta/storage/build
./ta/sha_perf/build
./ta/aes_perf/build
./ta/rpc_test/build
./ta/sims/build
./ta/concurrent/build
./host/xtest/build

contain the generated files. However looking at the Makefile, it seems to be under the impression everything is going in ./out.

It needs some adaptation, or I am simply driving it wrong?

What is the correct way to make make clean do something useful?

Error while building the optee_test

Hi,
I am trying to build the optee_test and ran these
/scratch/devel/optee/optee_test> % export TA_DEV_KIT_DIR=$PWD/../optee_os/out/arm-plat-zynqmp/export-ta_arm32
/scratch/devel/optee/optee_test> % export TA_CROSS_COMPILE=$PWD/../toolchains/aarch32/bin/arm-linux-gnueabihf-
/scratch/devel/optee/optee_test> % export HOST_CROSS_COMPILE=$PWD/../toolchains/aarch32/bin/arm-linux-gnueabihf-
/scratch/devel/optee/optee_test> % export TEEC_EXPORT=$PWD/../optee_client/out/export
/scratch/devel/optee/optee_test> % make

make[1]: Entering directory /scratch/devel/optee/optee_test/host/xtest' CC /scratch/devel/optee/optee_test/host/xtest/install_ta.c In file included from /usr/include/sys/stat.h:106:0, from /scratch/devel/optee/optee_test/host/xtest/install_ta.c:19: /usr/include/bits/stat.h:106:31: error: expected identifier or ‘(’ before ‘[’ token __syscall_slong_t __unused[3]; ^ make[1]: *** [/scratch/devel/optee/optee_test/out/xtest/install_ta.o] Error 1 make[1]: Leaving directory /scratch/devel/optee/optee_test/host/xtest'
make: *** [xtest] Error 2

Thanks
Venkatesh

Format specifier compilation error

I'm getting compilation errors on lines 892 and 896 in host/xtest/regression_1000.c due to some format specifier width problems with size_t (I've resolved it locally by just adding a 'z' to the specifier). Easy fix, just thought you might want to know. I'd submit a pull request myself but I think by the time I figured all that out you'd already have it resolved.

Question about adding test TAs

I want to add some simple TAs for testing and studying about TrustZone. (like printing 'helloworld' at TA)
But when I saw the README of this repo, I think I should buy test suites license at https://www.globalplatform.org/store.asp. but it is quite expensive for me :(
then, is there other way to put test TAs at TEE only for testing?

link failure

After setting NOWERROR=1 to get around all the -Werror related build failures I get an error in the link stage:

| aarch64-oe-linux-ld  -pie -T /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/ta.lds -Map=/build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/5b9e0e40-2636-11e1-ad9e0002a5d5c51b.map --sort-section=alignment  /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/init.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/os_test.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/ta_entry.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_addsub.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_cmp.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_conv.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_div.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_fmm.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_gcd.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_io.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_modulus.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_mul.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_prime.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_shift.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_var.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/testframework.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/test_float_subj.o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/user_ta_header.o  -L/build/linaro/96boards/build-rpb/tmp-rpb-glibc/sysroots/hikey/usr/include/optee/export-user_ta/lib -lutee -lpng -lzlib -lutils -lmpa -lutee -lutils -o /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/5b9e0e40-2636-11e1-ad9e0002a5d5c51b.elf
| /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/os_test.o: In function `test_setjmp':
| /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/ta/os_test/os_test.c:634: undefined reference to `_setjmp'
| /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/tb_gcd.o: In function `test_relative_prime':
| /build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/ta/os_test/tb_gcd.c:137: undefined reference to `__assert_fail'
| /build/linaro/96boards/build-rpb/tmp-rpb-glibc/sysroots/hikey/usr/include/optee/export-user_ta/mk/link.mk:47: recipe for target '/build/linaro/96boards/build-rpb/tmp-rpb-glibc/work/hikey-oe-linux/optee-test/2.0+gitAUTOINC+5b41fbff33-r0/git/out/ta/os_test/5b9e0e40-2636-11e1-ad9e0002a5d5c51b.elf' failed

Android5.1 compile error

Hi all,
Android5.1 compile error. Please help to solve it, thanks

In file included from device/hisilicon/bigfish/HiSTBSDKV6R2/source/tee/core/optee/optee_test/host/xtest/regression_1000.c:23:0:
device/hisilicon/bigfish/HiSTBSDKV6R2/source/tee/core/optee/optee_test/host/xtest/xtest_helpers.h:110:25: error: unknown type name 'pthread_barrier_t'
void xtest_barrier_init(pthread_barrier_t *barrier, unsigned count);

Not able to Open Persistent Object

Hi All,

I am new to TA programming and having some issue with the Persistent Objects creation/opening.
Below is the code snippet and output when i run the code.
In this program first created a Persistent Object then Opened it and then Closed it.
After this I tried creating already created Persistent Object, It gives the TEE_ERROR_ACCESS_CONFLICT, which i fine.

After this when I tried opening that Persistent Object it is again giving the TEE_ERROR_ACCESS_CONFLICT, which I am not able to understand.

I want to know that why Second TEE_OpenPersistentObject is failing ?
Is there any limitation that if you try creating an already created PersistentObject, access to that object is locked somehow ?

Any help on this is really appreciated.

image

image

Thanks
Sahil

os_test.c bad memory access test - calling function at address 0xffffffff is wrongly syntaxed

case 5:
{
static const uint32_t my_undef = 0xffffffff;
((void (*)(void))(uintptr_t) &my_undef) ();
}

Here it has to be as,
case 5:
{
static const uint32_t my_undef = 0xffffffff;
((void (*)(void))(uintptr_t) my_undef) ();
}

if your are trying to simulate a function call at address 0xffffffff. Instead it is actually calling a function at address which falls in stack area.

"for_gp/include: No such file or directory" issue

Commit that causes this issue 43d58a5

make -C /home/igoropaniuk/linaro/reps/repo/default/build/../optee_test \
	CROSS_COMPILE_HOST="/home/igoropaniuk/linaro/reps/repo/default/build/../toolchains/aarch64/bin/aarch64-linux-gnu-" \
	CROSS_COMPILE_TA="/home/igoropaniuk/linaro/reps/repo/default/build/../toolchains/aarch32/bin/arm-linux-gnueabihf-" \
	TA_DEV_KIT_DIR="/home/igoropaniuk/linaro/reps/repo/default/build/../optee_os/out/arm/export-ta_arm32" \
	OPTEE_CLIENT_EXPORT="/home/igoropaniuk/linaro/reps/repo/default/build/../optee_client/out/export"
make[1]: Entering directory '/home/igoropaniuk/linaro/reps/repo/default/optee_test'
make[2]: Entering directory '/home/igoropaniuk/linaro/reps/repo/default/optee_test/host/xtest'
  CC      /home/igoropaniuk/linaro/reps/repo/default/optee_test/host/xtest/regression_4000.c
cc1: error: for_gp/include: No such file or directory [-Werror=missing-include-dirs]
cc1: all warnings being treated as errors

Any plan for GP filtered test cases

Hello

I have integrate the TEE_Initial_Configuration-Test_Suite_v1_1_0_4-2014_11_07 for Extended test (Global Platform tests). I found still have some GP test cases filtered in optee_test Makefike.
Any plan to enable these test cases?

.PHONY: patch-filter
patch-filter:
@echo "INFO: Filter some tests"
$(call patch-filter-one,7038)
$(call patch-filter-one,7522)
$(call patch-filter-one,7538)
$(call patch-filter-one,7540)
$(call patch-filter-one,7546)
$(call patch-filter-one,7557)
....................

Thanks.

Invalid module format error

I have compiled the modules but when trying to insert them I get invalid format errors. Have you seen it before?

-bash-3.2# uname -r
3.10.88

-bash-3.2# modinfo -F vermagic optee.ko
3.10.88 preempt mod_unload modversions ARMv7 p2v8

-bash-3.2# insmod optee.ko
[12029.023267] optee: disagrees about version of symbol module_layout
insmod: error inserting 'optee.ko': -1 Invalid module format

-bash-3.2# modinfo -F vermagic optee_armtz.ko
3.10.88 preempt mod_unload modversions ARMv7 p2v8

-bash-3.2# insmod optee_armtz.ko
[12132.090255] optee_armtz: disagrees about version of symbol module_layout
insmod: error inserting 'optee_armtz.ko': -1 Invalid module format

aarch32 platform attempting to include aarch64/libcrypto.a

I'm attempting to move my platforms to OP-TEE version 3.2.0 [1], but I'm getting an error during my Yocto based build. I see the following error on mx7swarp7, rpi3 and sunxi-bpi_zero:

> | arm-oe-linux-gnueabi-gcc  -march=armv7ve -marm -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/recipe-sysroot -o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/xtest /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_1000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_2000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/sock_server.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/rand_stream.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/adbg_case.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/adbg_enum.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/adbg_expect.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/adbg_log.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/adbg_run.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/adbg/src/security_utils_hex.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/aes_perf.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/benchmark_1000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/benchmark_2000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_4000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_5000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_6000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_7000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_8000.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/regression_8100.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/sha_perf.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/xtest_helpers.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/xtest_main.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/xtest_test.o /linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/git/out/xtest/install_ta.o -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed ../openssl/lib/aarch64/libcrypto.a -ldl -L/linaro/mbl/workspace-linaro/build-mbl/tmp-mbl-glibc/work/imx7s_warp_mbl-oe-linux-gnueabi/optee-test/2.6.0+gitAUTOINC+c0e8678b55-r0/recipe-sysroot/usr/lib -lteec -lpthread -lm
> | ../openssl/lib/aarch64/libcrypto.a: error adding symbols: File format not recognized
> | collect2: error: ld returned 1 exit status

If I revert to a commit before libcrypto.a was introduced [2], all three platforms build fine. This is the commit that breaks my build:

43d58a5

It is subsequently replaced with a slightly different commit [3], but the build failure is basically the same. Presumably due to COMPILE_NS_USER being set to 64, not 32, which in turn could be down to CFG_ARM32_core not be set to "y".

Is there something the platforms should be doing to ensure this code links properly? Or is this perhaps a Yocto specific problem, with some incorrect flags being passed in?

[1] c0e8678
[2] 950ea1c
[3] 4b0d43d

xml_crypto_api.h contains multiple free of unallocated errors

In host/xtest/xml/include/xml_crypto_api.h, the macros ALLOCATE_SHARED_MEMORY and ALLOCATE_AND_FILL_SHARED_MEMORY goto an exit label upon allocation failure. In apparently all uses of these macros, this label is followed by a free of the attempted allocation, which will cause a free of unallocated data.

My suggestion would be to pass the label as a parameter to the macros, and add additional labels so that the exit cleanup is correct. (there are instances of multiple macro calls, so multiple labels are needed).

1004 and 1005 fail on first run

Submitting for tracking. Have only seen this on HiKey so far. 1004 and 1005 will (almost) always fail on first run, but pass on 2nd and subsequent runs.

* XTEST_TEE_1004 Test User Crypt TA
DBG [0x0] TEE-CORE:tee_ta_init_static_ta_session:159:    Lookup for
Static TA cb3e5ba0-adf1-11e0-998b0002a5d5c51b
DBG [0x0] TEE-CORE:tee_ta_open_session:510: init session failed
0xffff0008
DBG [0x0] TEE-CORE:tee_dispatch_open_session:127:   => Error: ffff0008
of 3
/home/victor.chong/work/swg/repo20/optee_test/host/xtest/xtest_1000.c:392:
xtest_teec_open_session( &session, &crypt_usS
  XTEST_TEE_1004 FAILED

* XTEST_TEE_1005 Many sessions
DBG [0x0] TEE-CORE:tee_ta_init_static_ta_session:159:    Lookup for
Static TA 5b9e0e40-2636-11e1-ad9e0002a5d5c51b
DBG [0x0] TEE-CORE:init_session_with_signed_ta:560:    Load dynamic TA
DBG [0x0] TEE-CORE:tee_ta_open_session:510: init session failed
0xffff000f
ERR [885] TEES:write_response:447: TEE_IOC_SUPPL_SEND: Invalid
argument
DBG [0x0] TEE-CORE:tee_dispatch_open_session:127:   => Error: ffff000f
of 3
/home/victor.chong/work/swg/repo20/optee_test/host/xtest/xtest_1000.c:445:
xtest_teec_open_session(&sessions[i], &os_teS
  XTEST_TEE_1005 FAILED

Suggestion: xtest should initialize the environment before starting test

When xtest failed or press "ctrl + c" to stop it, the secure storage test will remain some files.
If xtest start again, it will fail because the files already exist.
With REE FS, we can delete these files manually, but with RPMB FS, it is not easy to delete these files.
So, I suggest that xtest initialize the environment before starting test, such as deleting the file that might affect the test.

modified xtest 4003 encountered TEE_ERROR_BAD_PARAMETERS

I tried to modify cipher_init in xtest 4003 (xtest_4000.c), but I got TEE_ERROR_BAD_PARAMETERS.
I was trying to use the third param, so I wrote something like:
op.params[2].tmpref.buffer = (void *)tmp_iv;
in ta_crypt_cmd_cipher_init function's if (iv != NULL). And malloc space for tmp_iv and modified correspoding paramTypes like:
op.paramTypes = TEEC_PARAM_TYPES(TEEC_VALUE_INPUT,
TEEC_MEMREF_TEMP_INPUT,
TEEC_MEMREF_TEMP_INPUT, TEEC_NONE);

Then I got the TEE_ERROR_BAD_PARAMETERS returned from "tee_ta_invoke_command."
I have noticed that it comes from "optee_os/core/arch/arm/kernel/tee_ta_manager.c"'s tee_ta_invoke_command -> tee_user_ta_enter -> thread_enter_user_mode.
The return value of thread_enter_user_mode has been already the bad_para error.
But thread_enter_user_mode is assembly code, so I am wondering which function will be called by thread_enter_user_mode in this case (cipher_init)?
Or how can I fix this return error?

BTW, I have tried to add a return TEE_ERROR_BAD_FORMAT at the beginning of ta_entry_cipher_init (optee_test/ta/crypt/cryp_taf.c), but I still got bad_para error.
So I think the problem is not at the cryp_taf.c.

-Werror being used with code not being -Werror safe.

The general preference in the open source world is to only enable -Werror in maintainer mode (e.g. 'make dist') since it's hard to predict how sensitive $compiler will be in the future. Case in point:

host/xtest/xtest_benchmark_1000.c:94:20: warning: 'spent_time' may be used uninitialized in this function [-Wmaybe-uninitialized]

While this looks to be a false positive, it breaks the build since -Werror is hardcoded in the Makefile.

Some of the test data should be generated during build time

Some of the OPTEE tests will fail if test suite has no write permissions to the TA folder. For example:

XTEST_TEE_1008.4 Load fake uuid TA

can fail with TEEC_ERROR_ITEM_NOT_FOUND if it can't copy the fake TA:

device/linaro/bootloader/optee_test/host/xtest/xtest_1000.c:621: res has an unexpected value: 0xffff0008 = TEEC_ERROR_ITEM_NOT_FOUND, expected 0xffff000f = TEEC_ERROR_SECURITY

Read-write access to TA folder should not be not a requirement to run a test. Much better approach would be if the runtime test vector generation would be just limited to the data and temporary folders.

Cryptography tests

Hi,

It's more a question than an issue. I'm planning to add some cryptography tests and I'm wondering if should do it in optee sources or libtomcrypt. What would you suggest?

Kris

maybe there are some errors in optee_test

when the test suite was released firstly,i download it and build it,the test suite can run correctly.but now i download it again,when i re- build it ,there are some errors.i try to debug these errors,but i failed.anybody else meets such problems?

regression: all regression_9xxx test fail

I find the following issue while doing regression test. Would you please help on this issue?
thanks.

root@ls1021atsn:~# ./xtest 9001
Test ID: 9001
Run test suite with level=0

TEE test application started with device [(null)]
######################################################

regression

######################################################

  • regression_9001 Sanity Test Corrupt Meta Encrypted Key
    o regression_9001.1 | filename: file_4097B , data size: 4097 byte(s)
    /home/fanjiaheng/ls1021atsn/optee_upstream/optee_os/optee_test/host/xtest/regression_9000.c:515: obj_create(&sess, filename, (sizeof(filename) / sizeof((filename)[0])), 0x00000002, 0, filedata, tv->data_len, &obj_id) has an unexpected value: 0xffff0003, expected 0x0
    regression_9001.1 FAILED
    regression_9001 FAILED
    +-----------------------------------------------------
    Result of testsuite regression filtered by "9001":
    regression_9001.1 FAILED first error at /home/fanjiaheng/ls1021atsn/optee_upstream/optee_os/optee_test/host/xtest/regression_9000.c:515
    regression_9001 FAILED
    +-----------------------------------------------------
    4 subtests of which 1 failed
    1 test case of which 1 failed
    76 test cases was skipped
    TEE test application done!

Secure world output:
DEBUG: [0x0] TEE-CORE:tee_ta_init_pseudo_ta_session:262: Lookup for pseudo TA b689f2a7-8adf-477a-9f99-32e90c0ad0a2
FLOW: [0x0] TEE-CORE:plat_prng_add_jitter_entropy:97: plat_prng_add_jitter_entropy: 0x05
DEBUG: [0x0] TEE-CORE:init_session_with_signed_ta:679: Load dynamic TA
DEBUG: [0x0] TEE-CORE:ta_load:460: ELF load address 0x101000
DEBUG: [0x0] TEE-CORE:init_session_with_signed_ta:685: dyn TA : b689f2a7-8adf-477a-9f99-32e90c0ad0a2
FLOW: [0x0] TEE-CORE:trace_syscall:144: syscall #42 (syscall_storage_obj_create)
FLOW: [0x0] TEE-CORE:plat_prng_add_jitter_entropy:97: plat_prng_add_jitter_entropy: 0xE1
FLOW: [0x0] TEE-CORE:plat_prng_add_jitter_entropy:97: plat_prng_add_jitter_entropy: 0x9B
FLOW: [0x0] TEE-CORE:plat_prng_add_jitter_entropy:97: plat_prng_add_jitter_entropy: 0xCB
FLOW: [0x0] TEE-CORE:plat_prng_add_jitter_entropy:97: plat_prng_add_jitter_entropy: 0x68
DEBUG: [0x0] TEE-CORE:tee_ta_invoke_command:616: => Error: ffff0003 of 4
DEBUG: [0x0] TEE-CORE:tee_ta_close_session:371: tee_ta_close_session(0xbc057e90)
DEBUG: [0x0] TEE-CORE:tee_ta_close_session:390: ... Destroy session
DEBUG: [0x0] TEE-CORE:tee_ta_close_session:414: ... Destroy TA ctx

Docs issues

Hi -

The README.md has some small problems it seems to me.

  1. There is no more any optee_armtz module referenced in there. It looks like it would be called "optee" now.

  2. There is a missing step in the instructions, that the *.ta must be copied into the rootfs, at /lib/optee_armtz (this name seems inconsistent since the module name changed, but it works) for non-Android anyway. tee-supplicant will go fish them out of there and autoload them when the client side asks for the UUID.

Do we agree that these things should be fixed / added to README.md, in which case I can make a PR? Or we think it's super as it is?

Output of xtest --sdp-basic is misleading

There is a negative test in xtest --sdp-basic, i.e., an operation that is expected to fail if SDP works correctly:

root@HiKey:/ xtest --sdp-basic

Secure Data Path basic accesses: NS invokes SDP TA
Allocate in ION heap 'unmapped'
sdp_basic_test: successed

Secure Data Path basic accesses: SDP TA invokes SDP TA
Allocate in ION heap 'unmapped'
sdp_basic_test: successed

Secure Data Path basic accesses: SDP TA invokes SDP pTA
Allocate in ION heap 'unmapped'
sdp_basic_test: successed

Secure Data Path basic accesses: NS invokes SDP pTA (shall fail)
Allocate in ION heap 'unmapped'
Error: invoke SDP test TA (inject) failed ffff0006 3
test failed
-> false negative: pTAs refuse SDP memref from NS clients.
root@HiKey:/ echo $?
0

The messages (especially "test failed") are misleading. I think they should be modified. Maybe use the same format as the regression tests where it is clear when a test starts and ends with the status ("OK"") printed when it ends, so even if there are some error messages inbetween it is less of a problem.

Linaro reference: https://projects.linaro.org/browse/LHG-208

Compile issue for current optee_test code

Can't find the macro definition.

optee_test/host/xtest/regression_1000.c:371:10: error: 'PTA_INVOKE_TESTS_CMD_MUTEX' undeclared (first use in this function)
PTA_INVOKE_TESTS_CMD_MUTEX,

Can some one tell me how to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.