summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-01-29DynamicTablesPkg: Exempt some _CPC field from checksPierre Gondois2-4/+27
When generating _CPC objects, some fields are mandatory by spec [1]. Some fields cannot be supported by a the Juno platform, which is used to test the _CPC generation. Therefore, rely on the PcdDevelopmentPlatformRelaxations Pcd to either: - warn about the missing fields and and let the OS handle the missing information - consider the missing fields as an error _CPC fields that are exempted from checks when the Pcd is set: - PerformanceLimitedRegister - ReferencePerformanceCounterRegister - DeliveredPerformanceCounterRegister [1] Cf. non-optional fields in: ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)' Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Add PcdDevelopmentPlatformRelaxations PcdPierre Gondois1-0/+4
Some development platforms might not be compliant on some points of some specifications. In order to have a generic code accurately checking against specifications while still allowing some relaxation on specific points for the platforms that desire it, add a Pcd acting as a bitfield to warn instead of returning an error in case of non-compliance. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Add DynamicTablesScmiInfoLibPierre Gondois6-0/+371
The SCP holds some power information that could be advertised through the _CPC object. The communication with the SCP is done through SCMI protocols (c.f. ArmScmiDxe). Use the SCMI protocols to query information and feed it to the DynamicTablesPkg. Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Generate _PSD in SsdtCpuTopologyGeneratorPierre Gondois1-0/+96
Make use of the newly added AmlCreatePsdNode() to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.4, s8.4.5.5 _PSD (P-State Dependency). Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29DynamicTablesPkg: Add AmlCreatePsdNode() to generate _PSDPierre Gondois2-2/+221
Add AmlCreatePsdNode() to the AmlLib to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Add PsdToken field to CM_ARM_GICC_INFO objectPierre Gondois2-1/+7
The _PSD object (cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency) allows to describe CPU's power state dependencies. Add a PsdToken field to the CM_ARM_GICC_INFO object so that interdependent CPUs can reference the same CM_ARM_PSD_INFO object. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29DynamicTablesPkg: Add CM_ARM_PSD_INFO objectPierre Gondois3-0/+41
Add an object describing _PSD information, cf. ACPI 6.5, s8.4.5.5 _PSD (P-State Dependency). Also add the corresponding CmObjParser. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2024-01-29DynamicTablesPkg: Rename AmlCpcInfo.h to AcpiObjects.hPierre Gondois4-3/+3
The DynamicTables framework uses the AmlLib to generate some Aml objects. It is done by using structured known by both frameworks, e.g. the AML_CPC_INFO/CM_ARM_CPC_INFO structures. To prepare adding similar structures (e.g. representing _PSD information), rename AmlCpcInfo.h to AcpiObjects.h. This new file will contain all the structures used by the AmlLib and the DynamicTables framework. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29DynamicTablesPkg: Use new CPC revision macroPierre Gondois1-1/+1
Make use of the newly added CPC revision macro. Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL supportPierre Gondois2-14/+154
The PERFORMANCE_DESCRIBE_FASTCHANNEL Scmi command is available since SCMI v2.0 and allows to query information about the supported fast-channels of the Scmi performance protocol. Add support for this command. Also move SCMI_MESSAGE_ID_PERFORMANCE enum definition up in the file to use it in SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL function declaration. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-29ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSIONPierre Gondois1-5/+8
Rename PERFORMANCE_PROTOCOL_VERSION to reflect the different versions of the protocol. The macro is neither used in edk2 nor in edk2-platforms. Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2024-01-27MdePkg/Library/BaseCpuLibNull: Add missing X86 specific servicesMichael D Kinney3-15/+69
* Add InitializeFloatingPointUnits() to x86 specific file * Add GetCpuFamilyModel() to x86 specific file * Add GetCpuSteppingId() to x86 specific file * Move StandardSignatureIsAuthenticAMD() to x86 specific file. * Add CpuLib library class include to all C files. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Qing Huang <qing.huang@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2024-01-26UefiPayloadPkg/Crypto: Support external Crypto drivers.Gua Guo2-1/+11
Crypto in serveral case will use old version or latest version, Platform may choose to only update Crypto drivers without updating whole UPL, in this case the Crypto driver will provide by platform payload outside the common UPL binary. Reviewed-by: Chasel Chiu <chasel.chiu@intel.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Reviewed-by: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-01-26StandaloneMmPkg/Hob: Integer Overflow in CreateHob()Gua Guo1-0/+35
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 Fix integer overflow in various CreateHob instances. Fixes: CVE-2022-36765 The CreateHob() function aligns the requested size to 8 performing the following operation: ``` HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ``` No checks are performed to ensure this value doesn't overflow, and could lead to CreateHob() returning a smaller HOB than requested, which could lead to OOB HOB accesses. Reported-by: Marc Beatove <mbeatove@google.com> Reviewed-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: John Mathew <john.mathews@intel.com> Authored-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-01-26EmbeddedPkg/Hob: Integer Overflow in CreateHob()Gua Guo1-0/+43
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 Fix integer overflow in various CreateHob instances. Fixes: CVE-2022-36765 The CreateHob() function aligns the requested size to 8 performing the following operation: ``` HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ``` No checks are performed to ensure this value doesn't overflow, and could lead to CreateHob() returning a smaller HOB than requested, which could lead to OOB HOB accesses. Reported-by: Marc Beatove <mbeatove@google.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Abner Chang <abner.chang@amd.com> Cc: John Mathew <john.mathews@intel.com> Authored-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-01-25MdeModulePkg/PciBusDxe: Add feedback status for PciIoMapSheng Wei1-6/+6
PciIoMap () need to feedback the status of mIoMmuProtocol->SetAttribute () return value. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4652 Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Huang Jenny <jenny.huang@intel.com> Cc: Chiang Chris <chris.chiang@intel.com> Signed-off-by: Sheng Wei <w.sheng@intel.com>
2024-01-24MdeModulePkg/DriverSampleDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLYMing Tan4-0/+28
REF: UEFI_Spec_2_10_Aug29.pdf page 1695. In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack(): If the callback function returns with the ActionRequest set to _QUESTION_APPLY, then the Forms Browser will write the current modified question value on the selected form to storage. Update the DriverSampleDxe, add a new question "Question apply test". Signed-off-by: Ming Tan <ming.tan@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-24MdeModulePkg/SetupBrowserDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLYMing Tan1-0/+9
REF: UEFI_Spec_2_10_Aug29.pdf page 1695. In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack(): If the callback function returns with the ActionRequest set to _QUESTION_APPLY, then the Forms Browser will write the current modified question value on the selected form to storage. Update the SetupBrowserDxe, if callback function return EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY, then call SetQuestionValue with GetSetValueWithHiiDriver to apply the change immediately. Signed-off-by: Ming Tan <ming.tan@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-24MdePkg: Add EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLYMing Tan1-0/+1
REF: UEFI_Spec_2_10_Aug29.pdf page 1694 In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack() parameter ActionRequest, add EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY. Signed-off-by: Ming Tan <ming.tan@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-24MdePkg: Add FdtLib gmock supportdevel@edk2.groups.io4-0/+227
Add Google Mock Library for FdtLib Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com>
2024-01-24MdePkg/BaseFdtLib: Rename standard functionsJeff Brasen2-25/+7
Rename the standard functions in the LibFdtSupport to remove conflicts with other libraries that define them. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-24MdeModulePkg/ResetSystemRuntimeDxe: Print Reset DataAshish Singhal1-0/+8
ResetSystem runtime call allows for sending reset data that starts with a NULL terminated string. Add support to print that string on console. Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2024-01-23MdePkg/Library/BaseCpuLibNull: Add StandardSignatureIsAuthenticAMD()devel@edk2.groups.io1-0/+15
CpuLib.h exposes StandardSignatureIsAuthenticAMD() API and we require stub function in its BaseCpuLibNull library instance to avoid potential link issue. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Qing Huang <qing.huang@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-23MdePkg/Include/Guid: Update the definition of FileName in EFI_FILE_INFOSuqiang Ren1-0/+1
Add the description of EFI_FILE_INFO FileName[1] field to align with UEFI spec 2.10 Section 13.5.16. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Suqiang Ren <suqiangx.ren@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-23StandaloneMmPkg/Core: Remove optimization for depex evaluationLaszlo Ersek1-30/+7
The current dependency evaluator violates the memory access permission when patching depex grammar directly in the read-only depex memory area. Laszlo pointed out the optimization issue in the thread (1) "Memory Attribute for depex section" and provided suggested patch to remove the perf optimization. In my testing, removing the optimization does not make significant perf reduction. That makes sense that StandaloneMM dispatcher only searches in MM protocol database and does not depend on UEFI/DXE protocol database. Also, we don't have many protocols in StandaloneMM like UEFI/DXE. From Laszlo, "The patch removes the EFI_DEP_REPLACE_TRUE handling altogether, plus it CONST-ifies the Iterator pointer (which points into the DEPEX section), so that the compiler catch any possible accesses at *build time* that would write to the write-protected DEPEX memory area." (1) https://edk2.groups.io/g/devel/message/113531 Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Tested-by: levi.yun <yeoreum.yun@arm.com> Reviewed-by: levi.yun <yeoreum.yun@arm.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2024-01-23.pytool/Plugin: UncrustifyCheck: use stat instead of os.statJoey Vagedes1-1/+2
The UncrustifyCheck plugin passes os.stat.S_IWRITE to os.chmod, when attempting to change file permissions. os.stat.S_IWRITE does not exist as os.stat is a function. The correct value is stat.S_IWRITE. Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-22PrmPkg/PrmInfo: Drop -r parameterMichael Kubacki1-7/+3
The "-r" parameter was not added to the application so remove it from the help string. The standards section is also updated to point to the current specification location on uefi.org. Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
2024-01-22UefiPayloadPkg: CbParseLib: Fix integer overflowPatrick Rudolph1-1/+1
The IMD entry uses the 32bit start field as relative offset to root. On Ia32X64 this works fine as UINTN is also 32 bit and negative relative offsets are properly calculated due to an integer overflow. On X64 this doesn't work as UINTN is 64 bit and the offset is no longer subtracted, but it's added to the root. Fix that by sign extending the start field to 64 bit. Test: Booting UefiPayloadPkg still works on Ia32X64 and now also works on X64. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2024-01-22CryptoPkg: Add dummy inttypes header to fix clang buildHou, Wenxing2-0/+10
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4642 When use Mbedtls, there is a clang build error. Add dummy inttypes header to fix clang build. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Yi Li <yi1.li@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Signed-off-by: Wenxing Hou <wenxing.hou@intel.com> Reviewed-by: Yi Li <yi1.li@intel.com>
2024-01-20MdePkg/Library/BaseIoLibIntrinsic: Fix TD MMIO read type castZhiquan Li1-3/+3
Currently the types of casting mismatch with TD MMIO read 1, 2 and 4 bytes, that might introduce potential issues. So fix the types as conventional MmioRead[8|16|32] does. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-20MdePkg/IndustryStandard: Add _PSD/_CPC/Coord types definitionsPierre Gondois10-0/+99
Add definitions for: - _PSD version: added in ACPI 3.0 - C-state Coordination Types: added in ACPI 3.0 - _CPC version: added in ACPI 5.0 Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-19FmpDevicePkg: Add DECLARE_LENGTH opcode of dependency expressionYi Li3-12/+110
To avoid messy parsing of the Depex section of a Capsule, it would be a lot easier for everyone involved if we preceded the Capsule Depex Section with a length declaration. It provides simple bounds checking to avoid having to parse the op-codes, but in the case of a malformed depex being parsed, avoid other issues which can be messy. REF: UEFI spec 2.10 Table 23.4 Signed-off-by: Yi Li <yi1.li@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-19MdePkg: Add DECLARE_LENGTH opcode of dependency expressionYi Li1-14/+15
To avoid messy parsing of the Depex section of a Capsule, it would be a lot easier for everyone involved if we preceded the Capsule Depex Section with a length declaration. It provides simple bounds checking to avoid having to parse the op-codes, but in the case of a malformed depex being parsed, avoid other issues which can be messy. REF: UEFI spec 2.10 Table 23.4 Signed-off-by: Yi Li <yi1.li@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Wei6 Xu <wei6.xu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2024-01-19NetworkPkg/Ip4Dxe: Fix Reset To DefaultAshish Singhal1-0/+25
Exercising reset to default does not reset the settings. Add handler code for the case where configuration is disabled. Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
2024-01-18SecurityPkg: : Updating SecurityFixes.yaml after symbol renameDoug Flick1-11/+17
Adding the new commit titles for the symbol renames Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Message-Id: <5e0e851e97459e183420178888d4fcdadc2f1ae1.1705529990.git.doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2024-01-18SecurityPkg: DxeTpmMeasureBootLib: SECURITY PATCH 4117/4118 symbol renameDoug Flick4-26/+26
Updates the sanitation function names to be lib unique names Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Message-Id: <355aa846a99ca6ac0f7574cf5982661da0d9fea6.1705529990.git.doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2024-01-18SecurityPkg: DxeTpm2MeasureBootLib: SECURITY PATCH 4117/4118 symbol renameDoug Flick4-25/+25
Updates the sanitation function names to be lib unique names Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Message-Id: <7b18434c8a8b561654efd40ced3becb8b378c8f1.1705529990.git.doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: move DoErase code block into new functionGerd Hoffmann1-24/+52
Move the DoErase code block into a separate function, call the function instead of jumping around with goto. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240116171105.37831-7-kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: ValidateFvHeader: unwritten state is EOL tooGerd Hoffmann1-0/+5
It is possible to find variable entries with State being 0xff, i.e. not updated since flash block erase. This indicates the variable driver could not complete the header write while appending a new entry, and therefore State was not set to VAR_HEADER_VALID_ONLY. This can only happen at the end of the variable list, so treat this as additional "end of variable list" condition. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-6-kraxel@redhat.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: allow larger writes without block eraseGerd Hoffmann1-8/+10
Raise the limit for writes without block erase from two to four P30_MAX_BUFFER_SIZE_IN_BYTES blocks. With this in place almost all efi variable updates are handled without block erase. With the old limit some variable updates (with device paths) took the block erase code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-5-kraxel@redhat.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: add a loop for NorFlashWriteBuffer calls.Gerd Hoffmann1-13/+8
Replace the two NorFlashWriteBuffer() calls with a loop containing a single NorFlashWriteBuffer() call. With the changes in place the code is able to handle updates larger than two P30_MAX_BUFFER_SIZE_IN_BYTES blocks, even though the patch does not actually change the size limit. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-4-kraxel@redhat.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: clarify block write logic & fix shadowbuffer readsGerd Hoffmann1-8/+28
Introduce 'Start' and 'End' variables to make it easier to follow the logic and code flow. Also add a ascii art diagram (based on a suggestion by Laszlo). This also fixes the 'Size' calculation for the NorFlashRead() call. Without this patch the code will read only one instead of two P30_MAX_BUFFER_SIZE_IN_BYTES blocks in case '*NumBytes' is smaller than P30_MAX_BUFFER_SIZE_IN_BYTES but 'Offset + *NumBytes' is not, i.e. the update range crosses a P30_MAX_BUFFER_SIZE_IN_BYTES boundary. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-3-kraxel@redhat.com>
2024-01-18OvmfPkg/VirtNorFlashDxe: add casts to UINTN and UINT32Gerd Hoffmann2-2/+2
This is needed to avoid bit operations being applied to signed integers. Suggested-by: László Érsek <lersek@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-2-kraxel@redhat.com>
2024-01-16UefiPayloadPkg/Hob: Integer Overflow in CreateHob()Gua Guo3-6/+53
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4166 Fix integer overflow in various CreateHob instances. Fixes: CVE-2022-36765 The CreateHob() function aligns the requested size to 8 performing the following operation: ``` HobLength = (UINT16)((HobLength + 0x7) & (~0x7)); ``` No checks are performed to ensure this value doesn't overflow, and could lead to CreateHob() returning a smaller HOB than requested, which could lead to OOB HOB accesses. Reported-by: Marc Beatove <mbeatove@google.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Cc: John Mathew <john.mathews@intel.com> Authored-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Gua Guo <gua.guo@intel.com>
2024-01-16RedfishPkg/JsonLib: Add JSON delete object functionAbner Chang2-0/+41
To support the deletion on a specified JSON object. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
2024-01-16SecurityPkg: : Adding CVE 2022-36764 to SecurityFixes.yamlDouglas Flick [MSFT]1-0/+14
This creates / adds a security file that tracks the security fixes found in this package and can be used to find the fixes that were applied. Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2024-01-16SecurityPkg: DxeTpmMeasureBootLib: SECURITY PATCH 4118 - CVE 2022-36764Douglas Flick [MSFT]4-10/+168
This commit contains the patch files and tests for DxeTpmMeasureBootLib CVE 2022-36764. Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2024-01-16SecurityPkg: DxeTpm2MeasureBootLib: SECURITY PATCH 4118 - CVE 2022-36764Douglas Flick [MSFT]4-15/+131
This commit contains the patch files and tests for DxeTpm2MeasureBootLib CVE 2022-36764. Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2024-01-16SecurityPkg: : Adding CVE 2022-36763 to SecurityFixes.yamlDouglas Flick [MSFT]1-0/+22
This creates / adds a security file that tracks the security fixes found in this package and can be used to find the fixes that were applied. Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2024-01-16SecurityPkg: DxeTpmMeasureBootLib: SECURITY PATCH 4117 - CVE 2022-36763Douglas Flick [MSFT]8-14/+716
This commit contains the patch files and tests for DxeTpmMeasureBootLib CVE 2022-36763. Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>