Hi Timo

On Wed, 2021-08-25 at 11:47 +0300, Timo Lindfors wrote:
> Hi,
> 
> txt-acminfo 5th_gen_i5_i7_SINIT_79.BIN
> 
> segfaults on my system:
> 
> Program received signal SIGSEGV, Segmentation fault.
> does_acmod_match_platform (hdr=hdr@entry=0x7ffff7fc3000) at 
> ../tboot/txt/acmod.c:590
> 590       txt_heap_t *txt_heap = get_txt_heap();
> (gdb) bt
> #0  does_acmod_match_platform (hdr=hdr@entry=0x7ffff7fc3000) at 
> ../tboot/txt/acmod.c:590
> #1  0x00005555555552de in match_platform (hdr=0x7ffff7fc3000) at 
> txt-acminfo.c:207
> #2  main (argc=<optimized out>, argv=<optimized out>) at txt-acminfo.c:244
> (gdb) x/4i $rip
> => 0x555555556612 <does_acmod_match_platform+50>:     movabs 0xfed30300,%rax
>     0x55555555661c <does_acmod_match_platform+60>:    cmpb   $0x4,0x11(%rbp)
>     0x555555556620 <does_acmod_match_platform+64>:    jbe    0x555555556660 
> <does_acmod_match_platform+128>
>     0x555555556622 <does_acmod_match_platform+66>:    cmpl   $0x5,0x8(%rax)
> 
> It seems heap.h defines get_txt_heap() that refers to the real 
> read_pub_config_reg() before it is #define'd later. After I fixed this I 
> noticed that does_acmod_match_platform() then segfaults when it tries to 
> dereference the pointer returned by get_txt_heap().
> 
> I guess txt-acminfo should mmap() TXT heap? Should we then modify 
> get_txt_heap() to behave differently depending on the context or perhaps 
> modify does_acmod_match_platform() to take a pointer to the TXT heap as an 
> argument to avoid this?
> 

It looks like that this issue was introduced in:

o  changeset:   627:d8a8e17f6d41
|  user:        Lukasz Hawrylko <lukasz.hawry...@intel.com>
|  date:        Thu May 13 16:04:27 2021 +0200
|  summary:     Check for client/server match when selecting SINIT

To solve that txt-acminfo should map TXT heap and then pass pointer to
does_acmod_match_platform() function. I think that this will be the best
solution.

May I ask you to prepare the patch?

Thanks,
Lukasz



_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to