[edk2] [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is 0" msg to DEBUG_WARN

Laszlo Ersek posted 1 patch 7 years, 7 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[edk2] [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is 0" msg to DEBUG_WARN
Posted by Laszlo Ersek 7 years, 7 months ago
UEFI executables that consist of a single read+write+exec PE/COFF section
trigger this message, but such a binary layout isn't actually an error.
The image can be launched alright, only image protection cannot be applied
to it fully.

One example that elicits the message is (some) Linux kernels (with the EFI
stub of course).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
index 7689c794a8ad..699c9a827720 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
@@ -580,10 +580,10 @@ ProtectUefiImageCommon (
   }
 
   if (ImageRecord->CodeSegmentCount == 0) {
-    DEBUG ((DEBUG_ERROR, "!!!!!!!!  ProtectUefiImageCommon - CodeSegmentCount is 0  !!!!!!!!\n"));
+    DEBUG ((DEBUG_WARN, "!!!!!!!!  ProtectUefiImageCommon - CodeSegmentCount is 0  !!!!!!!!\n"));
     PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);
     if (PdbPointer != NULL) {
-      DEBUG ((DEBUG_ERROR, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
+      DEBUG ((DEBUG_WARN, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
     }
     goto Finish;
   }
-- 
2.9.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is 0" msg to DEBUG_WARN
Posted by Ard Biesheuvel 7 years, 7 months ago
On 20 March 2017 at 11:09, Laszlo Ersek <lersek@redhat.com> wrote:
> UEFI executables that consist of a single read+write+exec PE/COFF section
> trigger this message, but such a binary layout isn't actually an error.
> The image can be launched alright, only image protection cannot be applied
> to it fully.
>
> One example that elicits the message is (some) Linux kernels (with the EFI
> stub of course).
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> index 7689c794a8ad..699c9a827720 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> @@ -580,10 +580,10 @@ ProtectUefiImageCommon (
>    }
>
>    if (ImageRecord->CodeSegmentCount == 0) {
> -    DEBUG ((DEBUG_ERROR, "!!!!!!!!  ProtectUefiImageCommon - CodeSegmentCount is 0  !!!!!!!!\n"));
> +    DEBUG ((DEBUG_WARN, "!!!!!!!!  ProtectUefiImageCommon - CodeSegmentCount is 0  !!!!!!!!\n"));
>      PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);
>      if (PdbPointer != NULL) {
> -      DEBUG ((DEBUG_ERROR, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
> +      DEBUG ((DEBUG_WARN, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
>      }
>      goto Finish;
>    }
> --
> 2.9.3
>
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is 0" msg to DEBUG_WARN
Posted by Yao, Jiewen 7 years, 7 months ago
I agree to downgrade the logging level.

Can we add the comment, from log message to the comment in the C code?
Such as below:
==========================
//
// UEFI executables that consist of a single read+write+exec PE/COFF section
// isn't actually an error.
// The image can be launched alright, only image protection cannot be applied
// to it fully.
//
// One example that elicits this is (some) Linux kernels (with the EFI
// stub of course).
//
==========================

With comment added, reviewed-by: Jiewen.yao@intel.com

Thank you
Yao Jiewen


> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Monday, March 20, 2017 7:10 PM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Tian, Feng
> <feng.tian@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star
> <star.zeng@intel.com>
> Subject: [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is
> 0" msg to DEBUG_WARN
> 
> UEFI executables that consist of a single read+write+exec PE/COFF section
> trigger this message, but such a binary layout isn't actually an error.
> The image can be launched alright, only image protection cannot be applied
> to it fully.
> 
> One example that elicits the message is (some) Linux kernels (with the EFI
> stub of course).
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Feng Tian <feng.tian@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> index 7689c794a8ad..699c9a827720 100644
> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
> @@ -580,10 +580,10 @@ ProtectUefiImageCommon (
>    }
> 
>    if (ImageRecord->CodeSegmentCount == 0) {
> -    DEBUG ((DEBUG_ERROR, "!!!!!!!!  ProtectUefiImageCommon -
> CodeSegmentCount is 0  !!!!!!!!\n"));
> +    DEBUG ((DEBUG_WARN, "!!!!!!!!  ProtectUefiImageCommon -
> CodeSegmentCount is 0  !!!!!!!!\n"));
>      PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN)
> ImageAddress);
>      if (PdbPointer != NULL) {
> -      DEBUG ((DEBUG_ERROR, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
> +      DEBUG ((DEBUG_WARN, "!!!!!!!!  Image - %a  !!!!!!!!\n",
> PdbPointer));
>      }
>      goto Finish;
>    }
> --
> 2.9.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is 0" msg to DEBUG_WARN
Posted by Laszlo Ersek 7 years, 7 months ago
On 03/20/17 16:09, Yao, Jiewen wrote:
> I agree to downgrade the logging level.
> 
> Can we add the comment, from log message to the comment in the C code?
> Such as below:
> ==========================
> //
> // UEFI executables that consist of a single read+write+exec PE/COFF section
> // isn't actually an error.
> // The image can be launched alright, only image protection cannot be applied
> // to it fully.
> //
> // One example that elicits this is (some) Linux kernels (with the EFI
> // stub of course).
> //
> ==========================
> 
> With comment added, reviewed-by: Jiewen.yao@intel.com

I updated the patch with the comment. Commit 38b15ebe4fd5.

Thanks!
Laszlo

> 
> Thank you
> Yao Jiewen
> 
> 
>> -----Original Message-----
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Monday, March 20, 2017 7:10 PM
>> To: edk2-devel-01 <edk2-devel@lists.01.org>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Tian, Feng
>> <feng.tian@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star
>> <star.zeng@intel.com>
>> Subject: [PATCH] MdeModulePkg/Core/Dxe: downgrade "CodeSegmentCount is
>> 0" msg to DEBUG_WARN
>>
>> UEFI executables that consist of a single read+write+exec PE/COFF section
>> trigger this message, but such a binary layout isn't actually an error.
>> The image can be launched alright, only image protection cannot be applied
>> to it fully.
>>
>> One example that elicits the message is (some) Linux kernels (with the EFI
>> stub of course).
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Feng Tian <feng.tian@intel.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Star Zeng <star.zeng@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
>> b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
>> index 7689c794a8ad..699c9a827720 100644
>> --- a/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
>> +++ b/MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
>> @@ -580,10 +580,10 @@ ProtectUefiImageCommon (
>>    }
>>
>>    if (ImageRecord->CodeSegmentCount == 0) {
>> -    DEBUG ((DEBUG_ERROR, "!!!!!!!!  ProtectUefiImageCommon -
>> CodeSegmentCount is 0  !!!!!!!!\n"));
>> +    DEBUG ((DEBUG_WARN, "!!!!!!!!  ProtectUefiImageCommon -
>> CodeSegmentCount is 0  !!!!!!!!\n"));
>>      PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN)
>> ImageAddress);
>>      if (PdbPointer != NULL) {
>> -      DEBUG ((DEBUG_ERROR, "!!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
>> +      DEBUG ((DEBUG_WARN, "!!!!!!!!  Image - %a  !!!!!!!!\n",
>> PdbPointer));
>>      }
>>      goto Finish;
>>    }
>> --
>> 2.9.3
> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel