Red Hat Bugzilla – Bug 1518308
UEFI memory map regression (runtime code entry splitting) introduced by c1cab54ce57c
Last modified: 2018-04-10 12:31:21 EDT
*** Description of problem: Upstream commit c1cab54ce57c ("UefiCpuPkg/CpuDxe: Fix out-of-sync issue in page attributes", 2017-09-16) broke some aspects of the UEFI memory map, which is diretly consumed by UEFI operating systems. Some OSes may crash or display other undesired behavior when facing the memory maps in question. Detailed description at <https://bugzilla.tianocore.org/show_bug.cgi?id=753#c0>. *** Version-Release number of selected component (if applicable): ovmf-20171011-1.git92d07e48907f.el7 *** How reproducible: 100% *** Steps to Reproduce: The following steps are based on <https://bugzilla.tianocore.org/show_bug.cgi?id=753#c10>: 1. Start an OVMF domain with "virsh start --console --paused DOMAIN", in "screen" or another utility that lets you capture the serial console traffic. 2. Boot to the UEFI shell, using "UefiShell.iso". (The operating system does not matter for determining the symptoms. In fact an OS need not be installed at all.) 3. At the UEFI shell prompt, run the MEMMAP command. 4. Save the output from "screen.log" to another text file, for later comparison. *** Actual and expected results: The MEMMAP command outputs will differ between "broken" and fixed. One representative diff is: Available 000000007EC7A000-000000007EC7BFFF 0000000000000002 000000000000000F BS_Code 000000007EC7C000-000000007EDF9FFF 000000000000017E 000000000000000F -RT_Code 000000007EDFA000-000000007EE17FFF 000000000000001E 800000000000000F -RT_Code 000000007EE18000-000000007EE1DFFF 0000000000000006 800000000002000F -RT_Code 000000007EE1E000-000000007EE20FFF 0000000000000003 800000000000000F -RT_Code 000000007EE21000-000000007EE27FFF 0000000000000007 800000000002000F -RT_Code 000000007EE28000-000000007EE29FFF 0000000000000002 800000000000000F +RT_Code 000000007EDFA000-000000007EE29FFF 0000000000000030 800000000000000F RT_Data 000000007EE2A000-000000007EE4DFFF 0000000000000024 800000000000000F Reserved 000000007EE4E000-000000007EE51FFF 0000000000000004 000000000000000F Note that in the broken case, the 000000007EDFA000..000000007EE29FFF range (0x30 pages, type RT_Code) is split into five entries, with entries #2 and #4 (in 1-based counting) having attributes 0x800000000002000F. In the fixed case, the range is covered by just one RT_Code entry, with attributes 800000000000000F. (Slight differences are plausible in other parts of the UEFI memmap too.) *** Additional info: For verifying the fix, beyond the above UEFI Shell-based steps, QE should please sanity check OS boot with Fedora 26, Windows 2016, and RHEL-7 guests.
Patches to backport: 1 768bd967847e UefiCpuPkg/CpuDxe: Fix multiple entries of RT_CODE in memory map 2 e38451cd9a87 MdeModulePkg/DxeCore: Filter out all paging capabilities 3 646127c1929a MdeModulePkg/Core: Merge memory map after filtering paging capability
Fix included in ovmf-20171011-3.git92d07e48907f.el7
Reproduced this bug with OVMF-20171011-1.git92d07e48907f.el7.noarch. I attached a screenshot. Verified this bug with OVMF-20171011-4.git92d07e48907f.el7.noarch. I attached a screenshot. According to this result. I am not sure if it is expected result. Laszlo, Could you help me check it? In addition, I am doing sanity check OS boot with Fedora 26, Windows 2016, and RHEL-7 guest. I will update test result to bz later.
Created attachment 1366465 [details] memmap unfix sceenshot
Created attachment 1366466 [details] memmap fixed screenshot
FuXiangChun, the screenshots are not useful. They do not contain the full UEFI memory map, and they cannot be compared textually. Looking at the images from comment 12 and comment 13, they look nearly identical, so I first thought there was a problem with OVMF. Therefore I checked the builds myself: OVMF-20171011-1.git92d07e48907f.el7.noarch.rpm OVMF-20171011-4.git92d07e48907f.el7.noarch.rpm The problem with the attached screenshots is that the differences are only visible in a *later* part of the UEFI memmap dump, which is not displayed in the screenshots. Please don't use screenshots for this. In comment 0, I wrote: > 1. Start an OVMF domain with "virsh start --console --paused DOMAIN", > in "screen" or another utility that lets you capture the serial console > traffic. The "screen" utility captures the terminal traffic after [Ctrl-A H]. (Note the upper-case "H".) - start "screen" - start capturing with [Ctrl-A H]. - issue "virsh start --console --paused DOMAIN", or the equivalent QEMU command (so that the serial console is written to stdio) - enter the UEFI shell, - run MEMMAP - kill the VM - exit "screen" - rename "screen.log" to "test-1.log" Please repeat the same with the updated OVMF (capturing to "test-2.log"), and then upload "test-1.log" and "test-2.log". (Or you can diff them as well.) Thanks!
Thanks Laszlo, I re-tested this problem with with OVMF-20171011-1.git92d07e48907f.el7.noarch. This is part of result. ..... BS_Code 000000007D555000-000000007D6D4FFF 0000000000000180 000000000000000F RT_Code 000000007D6D5000-000000007D6F4FFF 0000000000000020 800000000000000F RT_Code 000000007D6F5000-000000007D6F9FFF 0000000000000005 800000000002000F RT_Code 000000007D6FA000-000000007D6FCFFF 0000000000000003 800000000000000F RT_Code 000000007D6FD000-000000007D702FFF 0000000000000006 800000000002000F RT_Code 000000007D703000-000000007D704FFF 0000000000000002 800000000000000F RT_Data 000000007D705000-000000007D728FFF 0000000000000024 800000000000000F ...... with OVMF-20171011-4.git92d07e48907f.el7.noarch. This is part of result. ....... BS_Code 000000007D558000-000000007D6D4FFF 000000000000017D 000000000000000F RT_Code 000000007D6D5000-000000007D704FFF 0000000000000030 800000000000000F RT_Data 000000007D705000-000000007D728FFF 0000000000000024 800000000000000F ...... This result isn't exactly the same with expected result. I will attach full console log.
Created attachment 1367062 [details] unfix log
Created attachment 1367063 [details] fixed log
Hi FuXiangChun, thanks for the new logs, in comment 16 and comment 17. I diffed them. The differences that matter are: * removed: -RT_Code 000000007D6D5000-000000007D6F4FFF 0000000000000020 800000000000000F -RT_Code 000000007D6F5000-000000007D6F9FFF 0000000000000005 800000000002000F -RT_Code 000000007D6FA000-000000007D6FCFFF 0000000000000003 800000000000000F -RT_Code 000000007D6FD000-000000007D702FFF 0000000000000006 800000000002000F -RT_Code 000000007D703000-000000007D704FFF 0000000000000002 800000000000000F * added: +RT_Code 000000007D6D5000-000000007D704FFF 0000000000000030 800000000000000F Both of these sets of entries cover the 000000007D6D5000-000000007D704FFF range (inclusive). Without the fix, the range is split to 5 entries (due to unmergeable attributes). With the fix, the range is covered by just one entry. So the verification is successful; please set the BZ to VERIFIED status. Thanks!
Thanks Laszlo, set this bug as verified.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0902