Current tboot fails to boot a Linux 4.4 kernel on an Intel S2600GL
(Xeon E5-2600 v2) system, hanging after printing "TBOOT: transfering
control to kernel @0x1000000...".

I isolated the problem to the change "Initiaize kernel header comdline
buffer before copying kernel cmdline arguments to the buffer"
(https://sourceforge.net/p/tboot/code/ci/356ad4b1d363c70d7b25907f812bd411a28eecd3/).
This change tries to avoid leaving trailing garbage on the kernel
command line by zeroing a 1024-byte buffer.

However, the command line buffer resides in the real-mode boot header,
which if tboot/include/linux_defns.h is to be believed, leaves only
0x9100 - 0x9000 = 256 bytes for the command line. With this change,
tboot ends up zeroing another 768 bytes in the "Do not use. Reserved
for BIOS EBDA" region.

Also, tboot assumes fixed boundaries for the EBDA (real_mode_base +
0x99100 to real_mode_base + 0xa0000), while according to
https://www.kernel.org/doc/Documentation/x86/boot.txt the BIOS decides
how much space it needs and reports it via int 12h. At least tboot
should fail gracefully if the BIOS expects more space than tboot
reserves.

Finally, there doesn't appear to be any bounds checking on the
kernel_cmdline string; whatever get_cmdline() returns is blindly
memcpyed into the buffer up to the first null, possibly overwriting
part of the BIOS EBDA with user-provided data.

I can hack around the problem on my system by changing
LEGACY_REAL_START to 0x80000, but I think a proper fix needs to
address the above issues.

--Ed

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
tboot-devel mailing list
tboot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tboot-devel

Reply via email to