summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg: Drop VarLock from RuntimeDxe variable driverBret Barkelew2020-11-175-48/+75
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 Now that everything should be moved to VariablePolicy, drop support for the deprecated VarLock SMI interface and associated functions from variable RuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Change TCG MOR variables to use VariablePolicyBret Barkelew2020-11-174-25/+82
| | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 These were previously using VarLock, which is being deprecated. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Allow VariablePolicy state to delete protected variablesBret Barkelew2020-11-172-0/+12
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 TcgMorLockSmm provides special protections for the TCG MOR variables. This will check IsVariablePolicyEnabled() before enforcing them to allow variable deletion when policy engine is disabled. Only allows deletion, not modification. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg: Connect VariablePolicy business logic to VariableServicesBret Barkelew2020-11-177-0/+670
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2522 VariablePolicy is an updated interface to replace VarLock and VarCheckProtocol. Add connective code to publish the VariablePolicy protocol and wire it to either the SMM communication interface or directly into the VariablePolicyLib business logic. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg DisplayEngineDxe: Correct the local variable name.gechao2020-11-121-8/+8
| | | | | Signed-off-by: gechao <gechao@greatwall.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/DriverSampleDxe: Add HII sample optionsAbner Chang2020-11-113-1/+48
| | | | | | | | | | | | | | | Add x-uefi-ns keyword REST_STYLE HII option and non x-uefi keyword REST_STYLE HII option. Signed-off-by: Abner Chang <abner.chang@hpe.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Fan Wang <fan.wang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/AcpiTableDxe: use pool allocation for RSDP if possibleArd Biesheuvel2020-10-301-9/+24
| | | | | | | | | | Use a pool allocation for the RSDP ACPI root pointer structure if no memory limit is in effect that forces us to use page based allocation, which may be wasteful if they get rounded up to 64 KB as is the case on AArch64. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/AcpiTableDxe: use pool allocation for RSDT/XSDT if possibleArd Biesheuvel2020-10-301-46/+72
| | | | | | | | | | If no memory allocation limit is in effect for ACPI tables, prefer pool allocations over page allocations, to avoid wasting memory on systems where page based allocations are rounded up to 64 KB, such as AArch64. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/AcpiTableDxe: use pool allocations when possibleArd Biesheuvel2020-10-303-28/+66
| | | | | | | | | | | | | | | | On AArch64 systems, page based allocations for memory types that are relevant to the OS are rounded up to 64 KB multiples. This wastes some space in the ACPI table memory allocator, since it uses page based allocations in order to be able to place the ACPI tables low in memory. Since the latter requirement does not exist on AArch64, switch to pool allocations for all ACPI tables except the root tables if the active allocation policy permits them to be anywhere in memory. The root tables will be handled in a subsequent patch. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* Revert "MdeModulePkg/PartitionDxe: Fix the incorrect LBA size in child ..."Zhichao Gao2020-10-201-3/+9
| | | | | | | | | | | | | | | | | | | | This reverts commit e0eacd7daa6f2e59de2b35a5dfe8bb4c38821e31. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3012 The patch to fix LBA size would cause a regression that make the partition of CD image with media type other than NO_EMULATOR unobserved. The patch used to fix the CD image's MBR table issue. The CD MBR table would always be ignored because it would be handled by the Eltorito partition handler first and never go into the MBR handler. So directly revert it. Cc: Ray Ni <ray.ni@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Tested-by: Gary Lin <glin@suse.com>
* MdeModulePkg: Remove code wrapped by DISABLE_NEW_DEPRECATED_INTERFACESZhang, Shenglei2020-10-131-31/+6
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2777 Code wrapped by DISABLE_NEW_DEPRECATED_INTERFACES is deprecated. So remove it. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/HiiDatabase: Do not modify CONST stringJeff Brasen2020-10-071-5/+7
| | | | | | | | Update function behavior to not modify the incoming string that is marked as CONST in the prototype. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg: Fix spelling mistake for occurredMichael D Kinney2020-08-1910-14/+14
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2361 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/PartitionDxe: Fix the incorrect LBA size in child handerZhichao Gao2020-08-131-9/+3
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2843 PartitionInstallChildHandle's parameters Start and End is counted by the BlockSize, but in the implementation it uses the parent device's BlockSize to calculate the new Start, End and LastBlock. It would cause the driver report incorrect block scope and the file system would fail to be found with right block scope. So correct it to the right value. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Gary Lin <glin@suse.com> Cc: Andrew Fish <afish@apple.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Gary Lin <glin@suse.com>
* MdeModulePkg/PartitionDxe: Revert changes for the special MBRZhichao Gao2020-08-131-31/+6
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823 Revert "MdeModulePkg/PartitionDxe: Skip the MBR that add for CD-ROM" Follow the spec definition, the ISO 9660 (and UDF) would be checked before the MBR. So it is not required to skip such MBR talbe that contian the entire block device. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Gary Lin <glin@suse.com> Cc: Andrew Fish <afish@apple.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Gary Lin <glin@suse.com>
* MdeModulePkg/PartitionDxe: Put the UDF check ahead of MBRZhichao Gao2020-08-131-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823 Refer to UEFI spec 2.8, Section 13.3.2, a block device should be scanned as below order: 1. GPT 2. ISO 9660 (El Torito) (UDF should aslo be here) 3. MBR 4. no partition found Note: UDF is using the same boot method as CD, so put it in the same priority with ISO 9660. This would also solve the issue that ISO image with MBR would be treat as MBR device instead of CD/DVD. That would make the behavior of the image boot different: If the CD/DVD's MBR be handled correctly, it would be enumerated as a bootable device with MBR path and FAT filesystem. Some Linux Distributions boot from such path (FAT with MBR path for ISO) would come into the grub console instead of the installation selection. With this change, the CD/DVD would always be enumerated with CD path. And it would always boot to the installation selection. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Gary Lin <glin@suse.com> Cc: Andrew Fish <afish@apple.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Gary Lin <glin@suse.com>
* MdeModulePkg/BdsDxe: Fix spelling mistakeMichael D Kinney2020-08-031-1/+1
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2355 Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* MdeModulePkg/EbcDxe: Fix spelling mistakeMichael D Kinney2020-08-031-1/+1
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2360 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/DisplayEngine: Add Debug message to show mismatch menu infoDandan Bi2020-07-161-0/+125
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2326 Currently when meet mismatch case for one-of and ordered-list menu, just show a popup window to indicate mismatch, no more info for debugging. This patch is to add more debug message about mismatch menu info which is helpful to debug. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/PartitionDxe: Add already start check for child hanldesZhichao Gao2020-07-151-0/+9
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823 The partition binding driver would run serval times during BDS. If the partition support MBR, it would pass the first connection in MBR partition child handler. The second connect for the same device would return already started which would be treated as not found. And it would continue to run next partition child handler check. That is incorrect behavior to do next check if one of the routine functions is passed. It may cause one device installed serval partition child handle on it. So treat the EFI_ALREADY_STARTED as EFI_SUCCESS to avoid incorrect next partition child handle check. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/PartitionDxe: Skip the MBR that add for CD-ROMZhichao Gao2020-07-151-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823 Refer to http://manpages.ubuntu.com/manpages/bionic/man8/mkudffs.8.html. Some Linux ISOs may have the MBR table for compatibility reasons for Windows. The MBR tale would contain the partition entry with start LBA0 and whole media size. There are two methods to check the filesystem in the CD-ROM: 1. MBR partition check (Windows) 2. Whole disk check (MAC OS) UEFI doesn't have the MBR check for UDF and Eltorito. But it may pass the MBR check for such table and fail to detect the filesystem of UDF. Skip the MBR check if the MBR is added for Windows compatiblity so that the partition driver can continue UDF and ElTorito check. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/PartitionDxe: Correct the MBR last block valueZhichao Gao2020-07-151-5/+8
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2823 PartitionValidMbr function's second parameter should be the last sector of the device. For MBR partition, the block size is sector size, i.e. 512 bytes. The original value is media block last LBA which is counted by the media block size. And media block size is not always 512 bytes, it may be larger which would cause the MBR boundary check incorrect. The boundary check is based on the partition entry start LBA and size of LBA which are both counted by the sector number (512 bytes). Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/Variable/RuntimeDxe: Fix return status from Reclaim()Michael D Kinney2020-07-141-12/+18
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2844 Update Reclaim() to return the error status from the reclaim operation and not the status of SynchronizeRuntimeVariableCache() that can be EFI_SUCCESS even through the status from reclaim is an error. Without this change, the return status from SetVariable() can be EFI_SUCCESS even though the variable was not actually set. This occurs if the variable store is full and a Reclaim() is invoked to free up space and even after all possible space is freed, there is still not enough room for the variable being set. This condition should return EFI_OUT_OF_RESOURCES. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg.dec: Change PCDs for status code.Tan, Ming2020-06-186-28/+22
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2786 In order to support enable/disable report status code through memory or serial dynamic, change the following PCDs from [PcdsFeatureFlag] to [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]: PcdStatusCodeUseSerial PcdStatusCodeUseMemory The original plaforms can use PcdsFixedAtBuild in .dsc files to save size. Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Ming Tan <ming.tan@intel.com>
* MdeModulePkg/StatusCodeHandler: do not output \n\r for string dataTan, Ming2020-06-173-3/+3
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2787 When output string data through serial port, will not ouput \n\r now. Caller can output several data in one line, and output \n\r when needed. Signed-off-by: Ming Tan <ming.tan@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/SetupBrowserDxe: Do not reconnect driver with form-updateWalon Li2020-06-102-1/+9
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2701 Recording to the spec, the reconnect is activated upon exiting of the formset or the browser. Exiting is by user but form-browser internal logic. That means the reconnection is only happened when user press ESC or _EXIT action to exit form. Driver callback may update HII form dynamically so form-browser needs to refresh its internal data. It's not exiting formset for user exactly and they didn't know what happened. So use a flag to record that and do not reconnect driver if updated by callback. Signed-off-by: Walon Li <walon.li@hpe.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/RegularExpressionDxe: Optimize the code infrastructureShenglei Zhang2020-05-144-49/+12
| | | | | | | | | | | | OnigurumaIntrinsics.c is now not used. So the implement of function 'memcpy' is now not., which causes build failure with CLANG9 and XCODE. I remove OnigurumaIntrinsics.c and move the necessary function implement to OnigurumaUefiPort.c/h. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/VariableSmmRuntimeDxe: switch to MM communicate 2Ard Biesheuvel2020-05-122-20/+23
| | | | | | | | | Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg/FaultTolerantWriteSmmDxe: switch to MM communicate 2Ard Biesheuvel2020-05-124-15/+18
| | | | | | | | | Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg/CapsuleRuntimeDxe: Add RISCV64 architectureAbner Chang2020-05-071-4/+5
| | | | | | | | | | | | | | | | Add RISC-V in INF for building CapsuleRuntimeDxe RISCV64 image. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2672 Signed-off-by: Abner Chang <abner.chang@hpe.com> Co-authored-by: Gilbert Chen <gilbert.chen@hpe.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Hao A Wu <hao.a.wu@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Gilbert Chen <gilbert.chen@hpe.com>
* MdeModulePkg/SecurityStubDxe: Mark the File parameter as OPTIONALGuomin Jiang2020-04-221-1/+1
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2652 According to the description, the File is optional and can be NULL Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/RamDiskDxe: Use BaseLib linked list iteration macrosMichael Kubacki2020-04-214-21/+11
| | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959 Replaces usage of the linked list iteration macros defined in RamDiskImpl.h with the common definition in BaseLib.h. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
* MdeModulePkg/ReportStatusCodeRouter: Update RSC Data on reallocationMichael Kubacki2020-04-211-0/+1
| | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2670 The RSC router data buffer may be reallocated when the buffer is nearing exhaustion (7/8 portion of the buffer used). While several pointers are updated to point to the newly allocated buffer, the RscData is not updated. This commit updates the RSC data pointer to the same offset in the reallocated data buffer. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Kun Qin <Kun.Qin@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/ReportStatusCodeRouter: Take HeaderSize into ConsiderationMichael Kubacki2020-04-211-2/+2
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2669 Updates ReportDispatcher() to take the size in the HeaderSize field in a EFI_STATUS_CODE_DATA element into account when walking the data buffer. This size will cause the header size to differ from the compiled sizeof header. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Kun Qin <Kun.Qin@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/ReportStatusCodeRouter: Revert end pointer on out of resourcesMichael Kubacki2020-04-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2665 ReportDispatcher() is called by a software module to report a status code. The interface is generic and can be called frequently throughout the boot under various conditions. A certain set of conditions can cause the currently implemented algorithm for resource exhaustion to fail. A sample scenario: 1. ReportStatusCode() is called at a TPL higher than one of the registered status code listeners making the call to the listener deferred until TPL is lowered. 2. Additional calls to ReportStatusCode() occur, so the data buffer continues to expand. 3. A call to ReportStatusCode() is made from within a memory allocation call (e.g. CoreAllocatePoolPages ()) which is protected from re- entrancy with mPoolMemoryLock. This will cause the ReallocatePool() call in ReportDispatcher() to fail. Because the end pointer was already moved to account for the data size, the end pointer is now moved beyond the buffer and invalid. This commit saves the original end pointer value into a local variable called "FailSafeEndPointer" which tracks a safe end pointer to revert to in the case the allocated buffer size (CallbackEntry->EndPointer - CallbackEntry->StatusCodeDataBuffer) is still not large enough for the data. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Kun Qin <Kun.Qin@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/ReportStatusCodeRouter: Clear RSC Data buffer if Data is NULLMichael Kubacki2020-04-211-0/+4
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1969 ReportDispatcher() may be invoked with a NULL Data argument. When TPL is less than TPL_HIGH_LEVEL and Data is NULL, the EFI_STATUS_CODE_DATA structure inside RscData should be cleared so listeners will not receive data from a previous operation. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Kun Qin <Kun.Qin@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/RegularExpressionDxe: Make oniguruma a submodule in edk2.Shenglei Zhang2020-04-1348-75747/+232
| | | | | | | | | | | | Use submodule way to access oniguruma. And upgrade oniguruma version from v6.9.3 to v6.9.4_mark1. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2073 Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg VariablePei: Return GetVariable() attr if EFI_BUFFER_TOO_SMALLMichael Kubacki2020-04-071-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 This commit makes the behavior for PeiGetVariable() match the following specification-defined behavior. It is now consistent with the DXE/SMM variable driver implementation. The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" "Attributes" parameter description states: "If not NULL, a pointer to the memory location to return the attributes bitmask for the variable. See 'Related Definitions.' If not NULL, then Attributes is set on output both when EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned." The attributes were previously only returned from the implementation in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or EFI_BUFFER_TOO_SMALL according to spec. Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
* MdeModulePkg Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALLMichael Kubacki2020-04-072-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" "Attributes" parameter description states: "If not NULL, a pointer to the memory location to return the attributes bitmask for the variable. See 'Related Definitions.' If not NULL, then Attributes is set on output both when EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned." The attributes were previously only returned from the implementation in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or EFI_BUFFER_TOO_SMALL according to spec. Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Guomin Jiang <guomin.jiang@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/SetupBrowserDxe: Fix IsZeroGuid() ASSERT.Nickle Wang2020-03-121-1/+2
| | | | | | | | | From the function description of GetIfrBinaryData(), FormSetGuid can be NULL. However, FormSetGuid is passed to IsZeroGuid(). This causes exception when FormSetGuid is NULL. Signed-off-by: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/DisplayEngine: Zero memory before free (CVE-2019-14558)Dandan Bi2020-02-141-2/+6
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1611 Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/String.c: Zero memory before free (CVE-2019-14558)Dandan Bi2020-02-141-1/+8
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1611 Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/HiiDB: Remove configuration table when it's freed (CVE-2019-14586)Dandan Bi2020-02-141-1/+9
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1995 Fix the corner case issue that the original configuration runtime memory is freed, but it is still exposed to the OS runtime. So this patch is to remove the configuration table to avoid being used in OS runtime when the configuration runtime memory is freed. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/Capsule: Remove RT restriction in UpdateCapsule service.Siyuan Fu2020-02-072-4/+5
| | | | | | | | | | | | | | | | | | Current UpdateCapsule service will reject all non-reset capsule images and return EFI_OUT_OF_RESOURCE if the system is at runtime. This will block a platform CapsuleLib from implementing ProcessCapsuleImage() with runtime capsule processing capability. This patch removes this restriction. The change is controled by a feature PCD PcdSupportProcessCapsuleAtRuntime, and the default value is FALSE which means not enable this feature. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2501 Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
* MdeModulePkg: Perform test only if not ignore memory testHeng Luo2020-02-061-4/+6
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2463 Perform Data and Address line test only if not ignore memory test. Signed-off-by: Heng Luo <heng.luo@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
* MdeModulePkg/Variable: Fix VarErrorFlag RT cache offset calculationMichael Kubacki2020-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2457 This commit fixes an offset calculation that is used to write the VarErrorFlag UEFI variable to the UEFI variable runtime cache. Currently a physical address is used instead of an offset. This commit changes the offset to zero with a length of the entire non-volatile variable store so the entire non-volatile variable store buffer in SMRAM (with the variable update modification) is copied to the runtime variable cache. This follows the same pattern used in other SynchronizeRuntimeVariableCache () calls for consistency. * Observable symptom: An exception in SMM will most likely occur due to the invalid memory reference when the VarErrorFlag variable is written. The variable is most commonly written when the UEFI variable store is full. * The issue only occurs when the variable runtime cache is enabled by the following PCD being set to TRUE: gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache Fixes: aab3b9b9a1e5e1f3fa966fb1667fc3e6c47e7706 Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Turner <michael.turner@microsoft.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg/Setup: Update opcode number variable type to UINTNBrian R Haug2020-01-151-9/+9
| | | | | | | | | | | | | | Update data type of variables which save the opcode numbers to UINTN, in case some configuration module has lots of configuration items. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Brian R Haug <brian.r.haug@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/Smbios: Add TCG PFP rev 105 support.Jiewen Yao2020-01-062-5/+39
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2439 Report EV_EFI_HANDOFF_TABLES2 if the platform chooses PFP >= 105. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Star Zeng <star.zeng@intel.com> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/Smbios: Done measure Smbios multiple times.Jiewen Yao2020-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2439 In current implementation, the SMBIOS table is measured multiple time in every readytoboot event. This causes Smbios Table record appears multiple time in the TCG event log and confuses people. This issue makes it hard to implement 800-155 reference measurement. This patch closes the event to make sure Smbios is measured only once. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Star Zeng <star.zeng@intel.com> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/VariableSmmRuntimeDxe.inf: list local header "Variable.h"Laszlo Ersek2019-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | Commit aab3b9b9a1e5 ("MdeModulePkg/Variable: Add RT GetVariable() cache support", 2019-11-05) added "VariableParsing.h" to "VariableSmmRuntimeDxe.inf". "VariableParsing.h" includes "Variable.h", so the "build" utility is right to warn us that "Variable.h" should be listed in [Sources] too. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael Kubacki <michael.a.kubacki@intel.com> Fixes: aab3b9b9a1e5e1f3fa966fb1667fc3e6c47e7706 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>