On Wed, 2024-09-11 at 18:14 +0300, Jarkko Sakkinen wrote: > On Wed Sep 11, 2024 at 11:53 AM EEST, Roberto Sassu wrote: > > I made few measurements. I have a Fedora 38 VM with TPM passthrough. > > I was thinking more like > > sudo bpftrace -e 'k:tpm_transmit { @start[tid] = nsecs; } kr:tpm_transmit { @[kstack, ustack, comm] = sum(nsecs - @start[tid]); delete(@start[tid]); } END { clear(@start); }' > > For example when running "tpm2_createprimary --hierarchy o -G rsa2048 -c owner.txt", I get: Sure: Without HMAC: @[ tpm_transmit_cmd+50 tpm2_pcr_extend+295 tpm_pcr_extend+221 ima_add_template_entry+437 ima_store_template+114 ima_store_measurement+209 process_measurement+2473 ima_file_check+82 security_file_post_open+92 path_openat+550 do_filp_open+171 do_sys_openat2+186 do_sys_open+76 __x64_sys_openat+35 x64_sys_call+9589 do_syscall_64+96 entry_SYSCALL_64_after_hwframe+118 , 0x7f338ee7be55 0x55bf24459ac2 0x7f338eda2b8a 0x7f338eda2c4b 0x55bf2445a9b5 , cat]: 5273648 With HMAC: @[ tpm_transmit_cmd+50 tpm2_flush_context+95 tpm2_start_auth_session+676 tpm2_pcr_extend+39 tpm_pcr_extend+221 ima_add_template_entry+437 ima_store_template+114 ima_store_measurement+209 process_measurement+2473 ima_file_check+82 security_file_post_open+92 path_openat+550 do_filp_open+171 do_sys_openat2+186 do_sys_open+76 __x64_sys_openat+35 x64_sys_call+9589 do_syscall_64+96 entry_SYSCALL_64_after_hwframe+118 , 0x7f03ea0ade55 0x55f929b7dac2 0x7f03e9fd4b8a 0x7f03e9fd4c4b 0x55f929b7e9b5 , cat]: 3128177 @[ tpm_transmit_cmd+50 tpm2_pcr_extend+338 tpm_pcr_extend+221 ima_add_template_entry+437 ima_store_template+114 ima_store_measurement+209 process_measurement+2473 ima_file_check+82 security_file_post_open+92 path_openat+550 do_filp_open+171 do_sys_openat2+186 do_sys_open+76 __x64_sys_openat+35 x64_sys_call+9589 do_syscall_64+96 entry_SYSCALL_64_after_hwframe+118 , 0x7f03ea0ade55 0x55f929b7dac2 0x7f03e9fd4b8a 0x7f03e9fd4c4b 0x55f929b7e9b5 , cat]: 25851638 @[ tpm_transmit_cmd+50 tpm2_load_context+161 tpm2_start_auth_session+98 tpm2_pcr_extend+39 tpm_pcr_extend+221 ima_add_template_entry+437 ima_store_template+114 ima_store_measurement+209 process_measurement+2473 ima_file_check+82 security_file_post_open+92 path_openat+550 do_filp_open+171 do_sys_openat2+186 do_sys_open+76 __x64_sys_openat+35 x64_sys_call+9589 do_syscall_64+96 entry_SYSCALL_64_after_hwframe+118 , 0x7f03ea0ade55 0x55f929b7dac2 0x7f03e9fd4b8a 0x7f03e9fd4c4b 0x55f929b7e9b5 , cat]: 35928108 @[ tpm_transmit_cmd+50 tpm2_start_auth_session+650 tpm2_pcr_extend+39 tpm_pcr_extend+221 ima_add_template_entry+437 ima_store_template+114 ima_store_measurement+209 process_measurement+2473 ima_file_check+82 security_file_post_open+92 path_openat+550 do_filp_open+171 do_sys_openat2+186 do_sys_open+76 __x64_sys_openat+35 x64_sys_call+9589 do_syscall_64+96 entry_SYSCALL_64_after_hwframe+118 , 0x7f03ea0ade55 0x55f929b7dac2 0x7f03e9fd4b8a 0x7f03e9fd4c4b 0x55f929b7e9b5 , cat]: 84616611 Roberto