Re: [Bug Report] Bug in "efi/libstub: Add get_event_log() support for CC platforms"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 7 Mar 2024 at 12:08, Ard Biesheuvel <ardb@xxxxxxxxxx> wrote:
>
> Hi Muhammad,
>
> Thanks for the report.
>
> On Thu, 7 Mar 2024 at 12:02, Muhammad Usama Anjum
> <usama.anjum@xxxxxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > The recent patch:
> > 276805fb9c305: efi/libstub: Add get_event_log() support for CC platforms
> > has introduced
> > #define EFI_CC_EVENT_LOG_FORMAT_TCG_2   0x00000002
> >
> > But EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 has the same numerical value:
> > #define EFI_TCG2_EVENT_LOG_FORMAT_TCG_2   0x2
> >
> > Thus there is dead code in efi_retrieve_tcg2_eventlog() i.e, multiple if
> > conditions with (version == 2) I'm unable to decide on what is wrong and
> > what is right here. Please have a look.
> >
>
> Why is this a problem? The compiler will recognize this and simplify
> the conditional. The code as written is semantically correct, the fact
> that the symbolic constants resolve to the same numerical value is
> just an implementation detail.

Ah hold on. I see what you mean now:

if (version == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
+ else if (version == EFI_CC_EVENT_LOG_FORMAT_TCG_2)
+ final_events_table = get_efi_config_table(LINUX_EFI_CC_FINAL_LOG_GUID);

Yes, that is broken.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux