iPXE discussion forum
Possible bug in rtc_entropy.c - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Possible bug in rtc_entropy.c (/showthread.php?tid=17560)

Possible bug in rtc_entropy.c - bugdude - 2019-03-10 18:21


I have been working with iPXE for a special project and ran into issues with Hyper-V Gen-1 VMs. I read through the forum and saw the history behind this and noted that the code to detect a broken RTC was added to mainline code some time ago. I instrumented the code and found that on newer versions of Hyper-V that test passes and the RTC code attempts to instantiate DRBG and fails when it calls get_noise. Tracing through I found that the process runs along fine until rtc_sample where it just freezes. Looking at the Assembly code in rtc_sample I noticed something odd. The current mainline code has two jz instructions that reference the label :1b, but that label does not exist in the code fragment. I'm bit sure why the assembler doesn't complain about it, but I suppose it leaves it for the linker to deal with and the linker ignores the issue because the code is embedded. In any event looking at the code I also noticed there are two identical labels :1 present. Overall it looks like some cutting and pasting may have resulted in assembly code that has flaws. I changed the second label to :2 leaving the first as :1 and then targeted the first jz at :1 an the second at :2 and the code started to function and the VMs could boot.

Perhaps this could be reviewed and updated if my assumptions are correct ?

RE: Possible bug in rtc_entropy.c - NiKiZe - 2019-03-11 11:12

I would recommend that you post this to the ipxe-devel mailing list for it to reach the right audience.