Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

early TA: avb #3357

Closed
ldts opened this issue Oct 31, 2019 · 10 comments
Closed

early TA: avb #3357

ldts opened this issue Oct 31, 2019 · 10 comments

Comments

@ldts
Copy link
Contributor

ldts commented Oct 31, 2019

Using the following head

commit cfc0f0743ad9d68bbdd31ec0e50e4643f3a51dc7 (HEAD -> master)
Author: Jerome Forissier <jerome@forissier.org>
Date:   Mon Sep 9 10:53:37 2019 +0200
    ta: ldelf.ld.S: align __reloc_begin on 8 bytes

I have configured optee_os to enable AVB early just so it can be accessed from u-boot:

recipes-security/optee/optee-os_git.bbappend
@@ -12,5 +12,6 @@ EXTRA_OEMAKE_append_aeler-imx7ulpea-ucom = " \
     CFG_RPMB_FS=y CFG_RPMB_FS_DEV_ID=0 \
     CFG_OVERLAY_ADDR=0x65000000 \
+     CFG_IN_TREE_EARLY_TAS=avb/023f8f1a-292a-432b-8fc4-de8471358067 \
     CFG_WITH_USER_TA=y \
     CFG_EARLY_TA=y \

During boot, I can see that the TA is available:

I/TC: Switching console to device: /ahb-bridge0@40000000/serial@402D0000                                                                                                                                                                                                                                                                                                                                                         
I/TC: OP-TEE version: 3.6.0-142-gcfc0f074-dev (gcc version 9.2.0 (GCC)) #1 Thu Jan  1 00:00:00 UTC 1970 arm                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 check_ta_store:646 TA store: "early TA"                                                                                                                                                                                                                                                                                                                                                                                 
D/TC:0 0 check_ta_store:646 TA store: "Secure Storage TA"                                                                                                                                                                                                                                                                                                                                                                        
D/TC:0 0 check_ta_store:646 TA store: "REE [buffered]"                                                                                                                                                                                                                                                                                                                                                                           
D/TC:0 0 early_ta_init:254 Early TA 023f8f1a-292a-432b-8fc4-de8471358067 size 27396 (compressed, uncompressed 67296) 

However when I try to access it, calls - even though they succeed, they never reach AVB (they seem to be handled by PTA.

I added some debug info printing the function number and line number on the file:

=> avb write_pvalue ldts 456
[....]
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 read_compressed:195 4096 bytes
[...]
Wrote 4 bytes
=>

Similarly, when I try to read, calls do succeed by the returned value is not what was written.
I instrumented the TA and I can confirm that calls never reach AVB.

Is there any additional configuration that needs to be set beyond what I specified in the yocto layer?

thanks

@ldts
Copy link
Contributor Author

ldts commented Oct 31, 2019


U-Boot SPL 2019.10-00687-g7cc69d2ea8-dirty (Oct 31 2019 - 10:43:46 +0100)                                                                                                                                                                                                                                                                                                                                                        
Trying to boot from MMC1                                                                                                                                                                                                                                                                                                                                                                                                         
## Checking hash(es) for Image optee ... sha256+ OK                                                                                                                                                                                                                                                                                                                                                                              
## Checking hash(es) for Image uboot ... sha256+ OK                                                                                                                                                                                                                                                                                                                                                                              
## Checking hash(es) for Image ubootfdt ... sha256+ OK                                                                                                                                                                                                                                                                                                                                                                           
D/TC:0 0 add_phys_mem:575 VCORE_UNPG_RX_PA type TEE_RAM_RX 0x9e000000 size 0x0008b000                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 add_phys_mem:575 VCORE_UNPG_RW_PA type TEE_RAM_RW 0x9e08b000 size 0x00075000                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 add_phys_mem:575 TA_RAM_START type TA_RAM 0x9e100000 size 0x01d00000                                                                                                                                                                                                                                                                                                                                                    
D/TC:0 0 add_phys_mem:575 TEE_SHMEM_START type NSEC_SHM 0x9fe00000 size 0x00200000                                                                                                                                                                                                                                                                                                                                               
D/TC:0 0 add_phys_mem:575 ROUNDDOWN((0x402d0000), CORE_MMU_PGDIR_SIZE) type IO_NSEC 0x40200000 size 0x00200000                                                                                                                                                                                                                                                                                                                   
D/TC:0 0 add_phys_mem:575 ROUNDDOWN(0x40020000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x40000000 size 0x00200000                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 add_phys_mem:575 ROUNDDOWN(0x40000000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x40000000 size 0x00800000                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 add_phys_mem:589 Physical mem map overlaps 0x40000000                                                                                                                                                                                                                                                                                                                                                                   
D/TC:0 0 add_phys_mem:575 ROUNDDOWN(0x40800000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x40800000 size 0x00800000                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 add_phys_mem:575 ROUNDDOWN(IRAM_BASE, CORE_MMU_PGDIR_SIZE) type TEE_COHERENT 0x1ff00000 size 0x00100000                                                                                                                                                                                                                                                                                                                 
D/TC:0 0 add_phys_mem:575 M4_AIPS_BASE type IO_SEC 0x41000000 size 0x00100000                                                                                                                                                                                                                                                                                                                                                    
D/TC:0 0 add_phys_mem:575 ROUNDDOWN(0x40240000, CORE_MMU_PGDIR_SIZE) type IO_SEC 0x40200000 size 0x00200000                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 add_phys_mem:589 Physical mem map overlaps 0x40200000                                                                                                                                                                                                                                                                                                                                                                   
D/TC:0 0 verify_special_mem_areas:519 NSEC DDR memory [9fe00000 a0000000]                                                                                                                                                                                                                                                                                                                                                        
D/TC:0 0 add_va_space:615 type RES_VASPACE size 0x00a00000                                                                                                                                                                                                                                                                                                                                                                       
D/TC:0 0 add_va_space:615 type SHM_VASPACE size 0x02000000                                                                                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type IO_SEC       va 0x97e00000..0x985fffff pa 0x40800000..0x40ffffff size 0x00800000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type IO_SEC       va 0x98700000..0x98efffff pa 0x40000000..0x407fffff size 0x00800000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type IO_NSEC      va 0x99000000..0x991fffff pa 0x40200000..0x403fffff size 0x00200000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type NSEC_SHM     va 0x99200000..0x993fffff pa 0x9fe00000..0x9fffffff size 0x00200000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type TA_RAM       va 0x99400000..0x9b0fffff pa 0x9e100000..0x9fdfffff size 0x01d00000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type TEE_COHERENT va 0x9b200000..0x9b2fffff pa 0x1ff00000..0x1fffffff size 0x00100000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type RES_VASPACE  va 0x9b300000..0x9bcfffff pa 0x00000000..0x009fffff size 0x00a00000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type IO_SEC       va 0x9be00000..0x9befffff pa 0x41000000..0x410fffff size 0x00100000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type SHM_VASPACE  va 0x9bf00000..0x9defffff pa 0x00000000..0x01ffffff size 0x02000000 (pgdir)                                                                                                                                                                                                                                                                                                       
D/TC:0 0 dump_mmap_table:746 type TEE_RAM_RX   va 0x9e000000..0x9e08afff pa 0x9e000000..0x9e08afff size 0x0008b000 (smallpg)                                                                                                                                                                                                                                                                                                     
D/TC:0 0 dump_mmap_table:746 type TEE_RAM_RW   va 0x9e08b000..0x9e0fffff pa 0x9e08b000..0x9e0fffff size 0x00075000 (smallpg)                                                                                                                                                                                                                                                                                                     
D/TC:0 0 core_mmu_alloc_l2:272 L2 table used: 1/4                                                                                                                                                                                                                                                                                                                                                                                
I/TC:                                                                                                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 init_canaries:161 #Stack canaries for stack_tmp[0] with top at 0x9e0b2a38                                                                                                                                                                                                                                                                                                                                               
D/TC:0 0 init_canaries:161 watch *0x9e0b2a3c                                                                                                                                                                                                                                                                                                                                                                                     
D/TC:0 0 init_canaries:162 #Stack canaries for stack_abt[0] with top at 0x9e0b3278                                                                                                                                                                                                                                                                                                                                               
D/TC:0 0 init_canaries:162 watch *0x9e0b327c                                                                                                                                                                                                                                                                                                                                                                                     
D/TC:0 0 init_canaries:164 #Stack canaries for stack_thread[0] with top at 0x9e0b52b8                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 init_canaries:164 watch *0x9e0b52bc                                                                                                                                                                                                                                                                                                                                                                                     
D/TC:0 0 init_canaries:164 #Stack canaries for stack_thread[1] with top at 0x9e0b72f8                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 init_canaries:164 watch *0x9e0b72fc                                                                                                                                                                                                                                                                                                                                                                                     
I/TC: Non-secure external DT found                                                                                                                                                                                                                                                                                                                                                                                               
I/TC: imx_lpuart: device parameters ignored (115200n8)                                                                                                                                                                                                                                                                                                                                                                           
I/TC: Switching console to device: /ahb-bridge0@40000000/serial@402D0000                                                                                                                                                                                                                                                                                                                                                         
I/TC: OP-TEE version: 3.6.0-142-gcfc0f074-dev (gcc version 9.2.0 (GCC)) #1 Thu Jan  1 00:00:00 UTC 1970 arm                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 check_ta_store:646 TA store: "early TA"                                                                                                                                                                                                                                                                                                                                                                                 
D/TC:0 0 check_ta_store:646 TA store: "Secure Storage TA"                                                                                                                                                                                                                                                                                                                                                                        
D/TC:0 0 check_ta_store:646 TA store: "REE [buffered]"                                                                                                                                                                                                                                                                                                                                                                           
D/TC:0 0 early_ta_init:254 Early TA 023f8f1a-292a-432b-8fc4-de8471358067 size 27396 (compressed, uncompressed 67296)                                                                                                                                                                                                                                                                                                             
D/TC:0 0 mobj_mapped_shm_init:446 Shared memory address range: 9bf00000, 9df00000                                                                                                                                                                                                                                                                                                                                                
E/TC:0 0 plat_rng_init:354 Warning: seeding RNG with zeroes                                                                                                                                                                                                                                                                                                                                                                      
D/TC:0 0 caam_get_mkvb:152 9e0b27c0  c2 0c 77 ec ad 89 dc 96  b7 9f c8 f7 da ab 97 b4                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 caam_get_mkvb:152 9e0b27d0  2a e8 df 98 3d 74 1c 34  ac a8 63 ca eb 5f de cd                                                                                                                                                                                                                                                                                                                                            
D/TC:0 0 imx_wdog_base:142 path: /ahb-bridge0@40000000/wdog@403D0000                                                                                                                                                                                                                                                                                                                                                             
I/TC: Initialized                                                                                                                                                                                                                                                                                                                                                                                                                
I/TC: Non-secure external DT found                                                                                                                                                                                                                                                                                                                                                                                               
D/TC:0 0 discover_nsec_memory:1051 No non-secure memory found in FDT                                                                                                                                                                                                                                                                                                                                                             
D/TC:0 0 init_primary_helper:1140 Primary CPU switching to normal world boot   

U-Boot 2019.10-00687-g7cc69d2ea8-dirty (Oct 31 2019 - 10:43:46 +0100)                                                                                                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                 
CPU:   Freescale i.MX7ULP rev2.1 at 500 MHz                                                                                                                                                                                                                                                                                                                                                                                      
Reset cause: POR                                                                                                                                                                                                                                                                                                                                                                                                                 
Boot mode: Single boot                                                                                                                                                                                                                                                                                                                                                                                                           
PMC1:  LDO enabled mode                                                                                                                                                                                                                                                                                                                                                                                                          
Model: Embedded Artists i.MX7ULP uCOM Kit                                                                                                                                                                                                                                                                                                                                                                                        
DRAM:  992 MiB                                                                                                                                                                                                                                                                                                                                                                                                                   
WARNING: Caches not enabled                                                                                                                                                                                                                                                                                                                                                                                                      
MMC:   FSL_SDHC: 0                                                                                                                                                                                                                                                                                                                                                                                                               
In:    serial@402D0000                                                                                                                                                                                                                                                                                                                                                                                                           
Out:   serial@402D0000                                                                                                                                                                                                                                                                                                                                                                                                           
Err:   serial@402D0000                                                                                                                                                                                                                                                                                                                                                                                                           
Net:   Net Initialization Skipped                                                                                                                                                                                                                                                                                                                                                                                                
No ethernet found.                                                                                                                                                                                                                                                                                                                                                                                                               
Hit any key to stop autoboot:  0                                                                                                                                                                                                                                                                                                                                                                                                 
=> avb init 0    
=> avb write_pvalue ldts 456                                                                                                                                                                                                                                                                                                                                                                                          [310/38220]
D/TC:0   tee_entry_exchange_capabilities:101 Dynamic shared memory is enabled                                                                                                                                                                                                                                                                                                                                                    
D/TC:0 0 core_mmu_alloc_l2:272 L2 table used: 2/4                                                                                                                                                                                                                                                                                                                                                                                
D/TC:? 0 tee_ta_init_pseudo_ta_session:284 Lookup pseudo TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                 
F/TC:? 0 tee_ta_init_user_ta_session:728 ==> tee_ta_init_user_ta_session 728                                                                                                                                                                                                                                                                                                                                                     
F/TC:? 0 load_ldelf:683 ==> load_ldelf 683
D/TC:? 0 load_ldelf:717 ldelf load address 0x104000
F/TC:? 0 user_ta_enter_open_session:276 ==> user_ta_enter_open_session 276
F/TC:? 0 init_with_ldelf:211 ==> init_with_ldelf 211
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
D/LD:  ldelf:134 Loading TA 023f8f1a-292a-432b-8fc4-de8471358067
F/TC:? 0 trace_syscall:127 syscall #5 (syscall_open_ta_session)
D/TC:? 0 tee_ta_init_pseudo_ta_session:284 Lookup pseudo TA 3a2f8978-5dc0-11e8-9c2d-fa7ae01bbebc
D/TC:? 0 tee_ta_init_pseudo_ta_session:297 Open system.pta
D/TC:? 0 tee_ta_init_pseudo_ta_session:311 system.pta : 3a2f8978-5dc0-11e8-9c2d-fa7ae01bbebc
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
D/TC:? 0 system_open_ta_binary:238 Lookup user TA ELF 023f8f1a-292a-432b-8fc4-de8471358067 (early TA)
D/TC:? 0 system_open_ta_binary:242 res=0x0
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 read_compressed:195 4096 bytes
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 read_compressed:195 60424 bytes
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 read_compressed:195 1016 bytes
F/TC:? 0 read_compressed:195 572 bytes                                                                                                                                                                                                                                                                                                                                                                                           
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 read_compressed:195 308 bytes
F/TC:? 0 read_compressed:195 880 bytes
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)
F/TC:? 0 syscall_invoke_ta_command:851 ==> syscall_invoke_ta_command 851
F/TC:? 0 syscall_invoke_ta_command:857 ==> syscall_invoke_ta_command 857
F/TC:? 0 syscall_invoke_ta_command:862 ==> syscall_invoke_ta_command 862
F/TC:? 0 syscall_invoke_ta_command:871 ==> syscall_invoke_ta_command 871
F/TC:? 0 tee_ta_invoke_command:740 ==> tee_ta_invoke_command 740
F/TC:? 0 tee_ta_invoke_command:763 ==> tee_ta_invoke_command 763
F/TC:? 0 pseudo_ta_enter_invoke_cmd:186 ==> pseudo_ta_enter_invoke_cmd 186
F/TC:? 0 pseudo_ta_enter_invoke_cmd:197 ==> pseudo_ta_enter_invoke_cmd 197
F/TC:? 0 invoke_command:811 ==> invoke_command 811
F/TC:? 0 pseudo_ta_enter_invoke_cmd:203 ==> pseudo_ta_enter_invoke_cmd 203
F/TC:? 0 tee_ta_invoke_command:766 ==> tee_ta_invoke_command 766
F/TC:? 0 tee_ta_invoke_command:779 executing tee_ta_invoke_command executed!
F/TC:? 0 syscall_invoke_ta_command:877 ==> syscall_invoke_ta_command 877
F/TC:? 0 syscall_invoke_ta_command:883 ==> syscall_invoke_ta_command 883
F/TC:? 0 syscall_invoke_ta_command:899 ==> syscall_invoke_ta_command 899
F/TC:? 0 syscall_invoke_ta_command:905 ==> syscall_invoke_ta_command 905
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
D/LD:  ldelf:168 ELF (023f8f1a-292a-432b-8fc4-de8471358067) at 0x111000
F/TC:? 0 trace_syscall:127 syscall #6 (syscall_close_ta_session)
D/TC:? 0 tee_ta_close_session:497 csess 0x9e0a59a8 id 1
D/TC:? 0 tee_ta_close_session:517 Destroy session
F/TC:? 0 user_ta_enter:135 ==> user_ta_enter 135
F/TC:? 0 user_ta_enter:151 ==> user_ta_enter 151
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  __utee_entry:255 ==> __utee_entry 255
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  entry_open_session:191 ==> entry_open_session 191
optee_shm_register:446
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067
F/TC:? 0 user_ta_enter_open_session:276 ==> user_ta_enter_open_session 276
F/TC:? 0 user_ta_enter:135 ==> user_ta_enter 135
F/TC:? 0 user_ta_enter:151 ==> user_ta_enter 151
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  __utee_entry:255 ==> __utee_entry 255
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  entry_open_session:191 ==> entry_open_session 191
optee_shm_register:472 DONE
optee_shm_register:446
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067
F/TC:? 0 user_ta_enter_open_session:276 ==> user_ta_enter_open_session 276
F/TC:? 0 user_ta_enter:135 ==> user_ta_enter 135
F/TC:? 0 user_ta_enter:151 ==> user_ta_enter 151
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  __utee_entry:255 ==> __utee_entry 255
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  entry_open_session:191 ==> entry_open_session 191
optee_shm_register:472 DONE
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067
F/TC:? 0 user_ta_enter_open_session:276 ==> user_ta_enter_open_session 276
F/TC:? 0 user_ta_enter:135 ==> user_ta_enter 135
F/TC:? 0 user_ta_enter:151 ==> user_ta_enter 151
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  __utee_entry:255 ==> __utee_entry 255
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  entry_open_session:191 ==> entry_open_session 191
optee_shm_unregister:482
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067
F/TC:? 0 user_ta_enter_open_session:276 ==> user_ta_enter_open_session 276
F/TC:? 0 user_ta_enter:135 ==> user_ta_enter 135
F/TC:? 0 user_ta_enter:151 ==> user_ta_enter 151
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  __utee_entry:255 ==> __utee_entry 255
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)
F/TA:  entry_open_session:191 ==> entry_open_session 191
optee_shm_unregister:496 DONE
Wrote 4 bytes    
=>

@jbech-linaro
Copy link
Contributor

Hi Jorge,

I'm afraid that this piece of code hasn't been much tested and exercised since @igoropaniuk left Linaro as an assignee. So, I wouldn't be completely surprised if there is a bug or something like that. I have too like experience with AVB myself, so I'm unable to give an good advice. @igoropaniuk , anything you remember/recall?

@vchong
Copy link
Contributor

vchong commented Oct 31, 2019

Hi Jorge,

Not sure about OE but at least make sure the instructions here [1] work first.

[1] https://github.com/OP-TEE/optee_os/blob/master/mk/config.mk#L238

@ldts
Copy link
Contributor Author

ldts commented Oct 31, 2019

hi Joakim and Vee,
yes I did try those instructions: I could provide the path to the TA elf file with EARLY_TA_PATHS; or alternatively I could just handle the path to the CFG_IN_TREE_EARLY_TAS (which seems cleaner to me).

Looking at the trace it seems that the elf file is indeed loaded properly.

It is just when routing the call, somehow it never executes the interface declared in user_ta.c that should land in the TA

static const struct tee_ta_ops user_ta_ops __rodata_unpaged = {
	.enter_open_session = user_ta_enter_open_session,
	.enter_invoke_cmd = user_ta_enter_invoke_cmd,
	.enter_close_session = user_ta_enter_close_session,
	.dump_state = user_ta_dump_state,
#ifdef CFG_TA_FTRACE_SUPPORT
	.dump_ftrace = user_ta_dump_ftrace,
#endif
	.destroy = user_ta_ctx_destroy,
	.get_instance_id = user_ta_get_instance_id,
};

but instead if executes pseudo_ta.c

static const struct tee_ta_ops pseudo_ta_ops = {
	.enter_open_session = pseudo_ta_enter_open_session,
	.enter_invoke_cmd = pseudo_ta_enter_invoke_cmd,
	.enter_close_session = pseudo_ta_enter_close_session,
	.destroy = pseudo_ta_destroy,
};

@jforissier
Copy link
Contributor

jforissier commented Oct 31, 2019

I haven't looked in details, but don't be fooled by the PTA traces. The user TA loading is now done by ldelf in user space, which depends on the 'system' PTA to load and map ELF files into user space.

@ldts
Copy link
Contributor Author

ldts commented Oct 31, 2019

not sure I follow...what do you mean by user space? isnt early TA supposed to load and allow access before userspace boots? we need uboot access to the TA for security validation.

@jforissier
Copy link
Contributor

Early TAs execute in secure user space (SEL0) like "normal" TAs. They are just available earlier since they are not stored in the REE FS.
Pseudo TAs execute in secure kernel space (SEL1).

@ldts
Copy link
Contributor Author

ldts commented Oct 31, 2019

ah by userspace you were also implying exception level. ok I am with you now. I am a bit at lost since uboot does not complain: avb TA invoke requests do succeed (not sure why or how?) but they are not handled in the TA (023f8f1a) since I see no invoke logs coming from it

I simplified the trace: I can see open/close of the TA session (avb/entry.c) but none of the invokes:

=> avb write_pvalue ldts 123                                                                                                                                                                                                                                                                                                                                                                                                     
D/TC:0   tee_entry_exchange_capabilities:101 Dynamic shared memory is enabled                                                                                                                                                                                                                                                                                                                                                    
D/TC:0 0 core_mmu_alloc_l2:272 L2 table used: 2/4                                                                                                                                                                                                                                                                                                                                                                                
D/TC:? 0 tee_ta_init_pseudo_ta_session:280 Lookup pseudo TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                 
D/TC:? 0 load_ldelf:707 ldelf load address 0x104000                                                                                                                                                                                                                                                                                                                                                                              
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
D/LD:  ldelf:134 Loading TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                                                 
F/TC:? 0 trace_syscall:127 syscall #5 (syscall_open_ta_session)                                                                                                                                                                                                                                                                                                                                                                  
D/TC:? 0 tee_ta_init_pseudo_ta_session:280 Lookup pseudo TA 3a2f8978-5dc0-11e8-9c2d-fa7ae01bbebc                                                                                                                                                                                                                                                                                                                                 
D/TC:? 0 tee_ta_init_pseudo_ta_session:293 Open system.pta                                                                                                                                                                                                                                                                                                                                                                       
D/TC:? 0 tee_ta_init_pseudo_ta_session:307 system.pta : 3a2f8978-5dc0-11e8-9c2d-fa7ae01bbebc                                                                                                                                                                                                                                                                                                                                     
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
D/TC:? 0 system_open_ta_binary:238 Lookup user TA ELF 023f8f1a-292a-432b-8fc4-de8471358067 (early TA)                                                                                                                                                                                                                                                                                                                            
D/TC:? 0 system_open_ta_binary:242 res=0x0                                                                                                                                                                                                                                                                                                                                                                                       
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 read_compressed:195 4096 bytes                                                                                                                                                                                                                                                                                                                                                                                          
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 read_compressed:195 60008 bytes                                                                                                                                                                                                                                                                                                                                                                                         
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 read_compressed:195 1024 bytes                                                                                                                                                                                                                                                                                                                                                                                          
F/TC:? 0 read_compressed:195 408 bytes                                                                                                                                                                                                                                                                                                                                                                                           
F/TC:? 0 read_compressed:195 572 bytes                                                                                                                                                                                                                                                                                                                                                                                           
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 read_compressed:195 308 bytes                                                                                                                                                                                                                                                                                                                                                                                           
F/TC:? 0 read_compressed:195 880 bytes                                                                                                                                                                                                                                                                                                                                                                                           
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 trace_syscall:127 syscall #7 (syscall_invoke_ta_command)                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
D/LD:  ldelf:168 ELF (023f8f1a-292a-432b-8fc4-de8471358067) at 0x111000                                                                                                                                                                                                                                                                                                                                                          
F/TC:? 0 trace_syscall:127 syscall #6 (syscall_close_ta_session)                                                                                                                                                                                                                                                                                                                                                                 
D/TC:? 0 tee_ta_close_session:497 csess 0x9e0a59a8 id 1                                                                                                                                                                                                                                                                                                                                                                          
D/TC:? 0 tee_ta_close_session:517 Destroy session                                                                                                                                                                                                                                                                                                                                                                                
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_CreateEntryPoint:281 TA_CreateEntryPoint                                                                                                                                                                                                                                                                                                                                                                               
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_register:446                                                                                                                                                                                                                                                                                                                                                                                                           
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                    
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_register:472 DONE                                                                                                                                                                                                                                                                                                                                                                                                      
optee_shm_register:446                                                                                                                                                                                                                                                                                                                                                                                                           
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                    
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_register:472 DONE                                                                                                                                                                                                                                                                                                                                                                                                      
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                    
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_unregister:482                                                                                                                                                                                                                                                                                                                                                                                                         
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                    
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_unregister:496 DONE                                                                                                                                                                                                                                                                                                                                                                                                    
optee_shm_unregister:482                                                                                                                                                                                                                                                                                                                                                                                                         
D/TC:? 0 tee_ta_init_session_with_context:572 Re-open TA 023f8f1a-292a-432b-8fc4-de8471358067                                                                                                                                                                                                                                                                                                                                    
F/TC:? 0 trace_syscall:127 syscall #1 (syscall_log)                                                                                                                                                                                                                                                                                                                                                                              
E/TA:  TA_OpenSessionEntryPoint:294 TA_OpenSessionEntryPoint                                                                                                                                                                                                                                                                                                                                                                     
optee_shm_unregister:496 DONE                                                                                                                                                                                                                                                                                                                                                                                                    
Wrote 4 bytes                                                                                                                                                                                                                                                                                                                                                                                                                    
=>  

@igoropaniuk
Copy link
Contributor

Hi @ldts,

Just some initial questions to start with:

  1. What version of U-boot are you using?
  2. Is CONFIG_SUPPORT_EMMC_RPMB enabled in U-boot?
  3. What verbosity level is set for TA output (CFG_TEE_CORE_LOG_LEVEL) in OP-TEE?
  4. Was RPMB key programmed (CFG_RPMB_WRITE_KEY=y was set)?
  5. Could you please check if rpmb_process_request() is called in U-boot drivers/tee/optee/rpmb.c when you try to do actual value writing.

Thanks

@ldts
Copy link
Contributor Author

ldts commented Nov 5, 2019

Hi @igoropaniuk @jbech-linaro

I noticed that the situation I described above is reproduceable when dcache is disabled on u-boot (otherwise it works as expected so will not investigate further).

Just for completeness, I disabled the cache as an investigate on 1) reported cache issues in the transfer while executing a tee RPMB request 2) key being rejected when uboot attempts to access the avb TA.

Those problems are both fixable on u-boot.

  1. The first one on the rpmb uboot driver by simply providing aligned buffers.

  2. the second one, (this one more obscure) problem was on the uboot tee supplicant which returns the MMC CID back to the TEE with endian issues hence causing the TEE to generate the wrong rpmb key.

I'll try to post those fixes to u-boot in the coming week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants