* [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
@ 2017-03-20 14:51 Ard Biesheuvel
2017-03-21 1:28 ` Zeng, Star
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2017-03-20 14:51 UTC (permalink / raw)
To: edk2-devel, star.zeng, feng.tian; +Cc: Ard Biesheuvel
Invocations of EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() may
result in a crash when the value of PcdAcpiExposedTableVersions does
not include EFI_ACPI_TABLE_VERSION_1_0B.
The reason is that EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable() will
only populate the Rsdt1/Rsdt3 pointers when EFI_ACPI_TABLE_VERSION_1_0B
is set, whereas EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() will
invoke PublishTables with EFI_ACPI_TABLE_VERSION_1_0B alawys set,
resulting in a NULL pointer dereference of the Rsdt1/Rsdt3 pointers.
So take PcdAcpiExposedTableVersions into account for UninstallAcpiTable
as well.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index 4bb848df5203..a635e1de5a7c 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -290,24 +290,27 @@ UninstallAcpiTable (
{
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
+ EFI_ACPI_TABLE_VERSION Version;
//
// Get the instance of the ACPI table protocol
//
AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);
+ Version = PcdGet32 (PcdAcpiExposedTableVersions);
+
//
// Uninstall the ACPI table
//
Status = RemoveTableFromList (
AcpiTableInstance,
- EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0,
+ Version,
TableKey
);
if (!EFI_ERROR (Status)) {
Status = PublishTables (
AcpiTableInstance,
- EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0
+ Version
);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
2017-03-20 14:51 [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables Ard Biesheuvel
@ 2017-03-21 1:28 ` Zeng, Star
2017-03-21 7:07 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Zeng, Star @ 2017-03-21 1:28 UTC (permalink / raw)
To: Ard Biesheuvel, edk2-devel@lists.01.org, Tian, Feng; +Cc: Zeng, Star
Reviewed-by: Star Zeng <star.zeng@intel.com>
-----Original Message-----
From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
Sent: Monday, March 20, 2017 10:52 PM
To: edk2-devel@lists.01.org; Zeng, Star <star.zeng@intel.com>; Tian, Feng <feng.tian@intel.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
Invocations of EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() may result in a crash when the value of PcdAcpiExposedTableVersions does not include EFI_ACPI_TABLE_VERSION_1_0B.
The reason is that EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable() will only populate the Rsdt1/Rsdt3 pointers when EFI_ACPI_TABLE_VERSION_1_0B is set, whereas EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() will invoke PublishTables with EFI_ACPI_TABLE_VERSION_1_0B alawys set, resulting in a NULL pointer dereference of the Rsdt1/Rsdt3 pointers.
So take PcdAcpiExposedTableVersions into account for UninstallAcpiTable as well.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index 4bb848df5203..a635e1de5a7c 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -290,24 +290,27 @@ UninstallAcpiTable ( {
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
+ EFI_ACPI_TABLE_VERSION Version;
//
// Get the instance of the ACPI table protocol
//
AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);
+ Version = PcdGet32 (PcdAcpiExposedTableVersions);
+
//
// Uninstall the ACPI table
//
Status = RemoveTableFromList (
AcpiTableInstance,
- EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0,
+ Version,
TableKey
);
if (!EFI_ERROR (Status)) {
Status = PublishTables (
AcpiTableInstance,
- EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0
+ Version
);
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
2017-03-21 1:28 ` Zeng, Star
@ 2017-03-21 7:07 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2017-03-21 7:07 UTC (permalink / raw)
To: Zeng, Star; +Cc: edk2-devel@lists.01.org, Tian, Feng
On 21 March 2017 at 01:28, Zeng, Star <star.zeng@intel.com> wrote:
> Reviewed-by: Star Zeng <star.zeng@intel.com>
>
Pushed as f859c6796f40, thanks
> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Monday, March 20, 2017 10:52 PM
> To: edk2-devel@lists.01.org; Zeng, Star <star.zeng@intel.com>; Tian, Feng <feng.tian@intel.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables
>
> Invocations of EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() may result in a crash when the value of PcdAcpiExposedTableVersions does not include EFI_ACPI_TABLE_VERSION_1_0B.
>
> The reason is that EFI_ACPI_TABLE_PROTOCOL::InstallAcpiTable() will only populate the Rsdt1/Rsdt3 pointers when EFI_ACPI_TABLE_VERSION_1_0B is set, whereas EFI_ACPI_TABLE_PROTOCOL::UninstallAcpiTable() will invoke PublishTables with EFI_ACPI_TABLE_VERSION_1_0B alawys set, resulting in a NULL pointer dereference of the Rsdt1/Rsdt3 pointers.
>
> So take PcdAcpiExposedTableVersions into account for UninstallAcpiTable as well.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> index 4bb848df5203..a635e1de5a7c 100644
> --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
> @@ -290,24 +290,27 @@ UninstallAcpiTable ( {
> EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
> EFI_STATUS Status;
> + EFI_ACPI_TABLE_VERSION Version;
>
> //
> // Get the instance of the ACPI table protocol
> //
> AcpiTableInstance = EFI_ACPI_TABLE_INSTANCE_FROM_THIS (This);
>
> + Version = PcdGet32 (PcdAcpiExposedTableVersions);
> +
> //
> // Uninstall the ACPI table
> //
> Status = RemoveTableFromList (
> AcpiTableInstance,
> - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0,
> + Version,
> TableKey
> );
> if (!EFI_ERROR (Status)) {
> Status = PublishTables (
> AcpiTableInstance,
> - EFI_ACPI_TABLE_VERSION_1_0B | ACPI_TABLE_VERSION_GTE_2_0
> + Version
> );
> }
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-21 7:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-20 14:51 [PATCH] MdeModulePkg/AcpiTableDxe: consider version mask when removing tables Ard Biesheuvel
2017-03-21 1:28 ` Zeng, Star
2017-03-21 7:07 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox