[if !mso]>

Re: [edk2] Report a bug in UDKShell command "ls" with ramdisk

Subject: Re: [edk2] Report a bug in UDKShell command "ls" with ramdisk

From: "Carsey, Jaben" <jaben.carsey@intel.com>

To: winddy_zhang <winddy_zhang@byosoft.com.cn>, "edk2-devel@lists.sourceforge.net" <edk2-devel@lists.sourceforge.net>

Date: 2012-01-31 02:12:27

I have a few questions.

1)      Buffer is allocated via AllocateZeroPool.  What function is changing the value of the struct?  Is the read changing the value and then returning 0 size?  It is not really uninitialized…

2)      What does ths LS error code have to do with this first change?

-Jaben

 

From: winddy_zhang [mailto:winddy_zhang@byosoft.com.cn]
Sent: Saturday, January 28, 2012 6:10 PM
To: edk2-devel
Subject: [edk2] Report a bug in UDKShell command "ls" with ramdisk

 

dear Experts,

    I just want to report a bug in udk shell command "ls".

    First, I switch to ramdisk's file system(FAT16),  then, at root directory, run build-in command "ls", then it will assert and exit.

    After trace, I find the root cause is: there is no file in ramdisk's root dir("." and ".." also do not exist). And in function FileHandleFindFirstFile(), even if return status of reading file is SUCCESS, BufferSize is ZERO. So at that time, File info pointer "Buffer" is just like a "wild pointer", Buffer->Size may be very big and it cause another function allocate memory for FileInfo failed, then assert will be active.

    My suggested solution:  Add returned BufferSize check when return status is EFI_SUCCESS. The sample code is as below:

    And PrintLsOutput() maybe needs be updated also as below:

    thanks.

 

 

EFI_STATUS

EFIAPI

FileHandleFindFirstFile (                                    // ShellPkg\Library\UefiFileHandleLib\UefiFileHandleLib.c

  IN EFI_FILE_HANDLE            DirHandle,

  OUT EFI_FILE_INFO             **Buffer

  )

{

  ...

  //

  // read in the info about the first file

  //

  Status = FileHandleRead (DirHandle, &BufferSize, *Buffer);

  ASSERT(Status != EFI_BUFFER_TOO_SMALL);

  if(EFI_ERROR(Status) || BufferSize==0){                                    // wztest -

    FreePool(*Buffer);

    *Buffer = NULL;

    if(!EFI_ERROR(Status)){                                                            // wztest +

      Status = EFI_NOT_FOUND;                                                     // wztest +

    }                                                                                                // wztest +

    return (Status);

  }

  return (EFI_SUCCESS);

}

 

 

SHELL_STATUS

EFIAPI

PrintLsOutput(                            // ShellPkg\Library\UefiShellLevel2CommandsLib\Ls.c

  IN CONST BOOLEAN Rec,

  IN CONST UINT64  Attribs,

  IN CONST BOOLEAN Sfo,

  IN CONST CHAR16  *Path,

  IN CONST BOOLEAN First,

  IN CONST UINTN   Count,

  IN CONST INT16   TimeZone

  )

{

    ...

  Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);

  if(EFI_ERROR(Status)){

//-    return (SHELL_DEVICE_ERROR);                     // wztest -

    ShellStatus = SHELL_DEVICE_ERROR;                // wztest +

    if(Status == EFI_NOT_FOUND){                            // wztest +

      ShellStatus = SHELL_NOT_FOUND;                    // wztest +

    }                                                                           // wztest +

    return ShellStatus;                                                // wztest +

  }

}

 

 

 

 


winddy_zhang

 

Date: 2012-01-27 06:18

To: edk2-devel

Subject: edk2-devel Digest, Vol 25, Issue 96

Send edk2-devel mailing list submissions to

edk2-devel@lists.sourceforge.net

 

To subscribe or unsubscribe via the World Wide Web, visit

https://lists.sourceforge.net/lists/listinfo/edk2-devel

or, via email, send a message with subject or body 'help' to

edk2-devel-request@lists.sourceforge.net

 

You can reach the person managing the list at

edk2-devel-owner@lists.sourceforge.net

 

When replying, please edit your Subject line so it is more specific

than "Re: Contents of edk2-devel digest..."

 

 

Today's Topics:

 

   1. Adding EFI_SECTION directly to ffs (Justin Johnson)

   2. error building StdLib with GCC44 (Duane Voth)

   3. Re: error building StdLib with GCC44 (Olivier Martin)

   4. [PATCH] MdeModulePkg/Dxe: Fixed the function FindFreePages()

      when a free region is found at 0x0 (Olivier Martin)

 

 

----------------------------------------------------------------------

 

Message: 1

Date: Thu, 26 Jan 2012 20:22:13 +0000

From: Justin Johnson <justinj@ami.com>

Subject: [edk2] Adding EFI_SECTION directly to ffs

To: "edk2-devel@lists.sourceforge.net"

<edk2-devel@lists.sourceforge.net>

Message-ID:

<A9FBE64B0AF8BD4FB56BC85E566A0A491B5CDA85@atlms1.us.megatrends.com>

Content-Type: text/plain; charset="us-ascii"

 

Hi,

I have a tool which builds a section file, of type EFI_SECTION_FREEFORM_SUBTYPE_GUID. That is, the binary file already has the section header prepended. What needs to be entered in the FDF so that GenSec is not run on this binary file. It should just be included as an input to GenFfs.

 

 

I have tried both:

RAW       SEC_BIN                 Optional $(INF_OUTPUT)/$(MODULE_NAME).sec

 

RAW       BIN                     Optional $(INF_OUTPUT)/$(MODULE_NAME).sec

 

But both entries will still cause GenSec to be run on $(MODULE_NAME).sec.

 

--

Justin Johnson

Associate BIOS Engineer

American Megatrends, Inc.

 

 

The information contained in this message may be confidential and proprietary to American Megatrends, Inc.  This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited.  Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.

 

-------------- next part --------------

An HTML attachment was scrubbed...

 

------------------------------

 

Message: 2

Date: Thu, 26 Jan 2012 14:44:10 -0600

From: Duane Voth <duanev@gmail.com>

Subject: [edk2] error building StdLib with GCC44

To: edk2-devel@lists.sourceforge.net

Message-ID:

<CABpPS=pZenAOw-Dda-qBDRmPA9QHSef66ToWF1BwsaNT3peU4w@mail.gmail.com>

Content-Type: text/plain; charset=ISO-8859-1

 

Just tried to build StdLib with GCC44 and found this:

 

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c:1250:

error: ?va_start? used in function with fixed args

 

It doesn't appear that utimes() needs varargs - does no other compiler

catch this?

 

----------------- build stdout ----------------

 

[duanev edk2]$ build -p StdLib/StdLib.dsc

Build environment:

Linux-2.6.33.7-server-2mnb-x86_64-with-mandrake-2010.2-Official

Build start time: 14:39:47, Jan.26 2012

 

WORKSPACE        = /home/duanev/efi/edk2/svn64/edk2

ECP_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EDK_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EFI_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EDK_TOOLS_PATH   = /home/duanev/efi/edk2/svn64/edk2/BaseTools

 

 

Architecture(s)  = X64

Build target     = DEBUG

Toolchain        = GCC44

 

Active Platform          = /home/duanev/efi/edk2/svn64/edk2/StdLib/StdLib.dsc

 

Processing meta-data . done!

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/LibC.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/StdLib/StdLib.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/String/String.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Wchar/Wchar.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Ctype/Ctype.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Time/Time.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Stdio/Stdio.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Locale/Locale.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/Uefi.inf [X64]

"/usr/bin/gcc" -g -fshort-wchar -fno-stack-protector

-fno-strict-aliasing -Wall -Werror -Wno-missing-braces

-Wno-array-bounds -ffunction-sections -fdata-sections -c -include

AutoGen.h -DSTRING_ARRAY_NAME=LibUefiStrings -m64

"-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone

-Wno-address -mcmodel=large -nostdinc -nostdlib -o

/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/Uefi/Uefi/OUTPUT/./SysCalls.obj

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi

-I/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/Uefi/Uefi/DEBUG

-I/home/duanev/efi/edk2/svn64/edk2/StdLib

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/Include

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles/Include

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg/Include

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/ShellPkg

-I/home/duanev/efi/edk2/svn64/edk2/ShellPkg/Include

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c: In

function ?utimes?:

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c:1250:

error: ?va_start? used in function with fixed args

make: *** [/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/Uefi/Uefi/OUTPUT/SysCalls.obj]

Error 1

 

 

build.py...

 : error 7000: Failed to execute command

        make tbuild

[/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/Uefi/Uefi]

 

 

build.py...

 : error F002: Failed to build module

        /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/Uefi.inf

[X64, GCC44, DEBUG]

 

- Failed -

Build end time: 14:39:50, Jan.26 2012

Build total time: 00:00:03

 

 

 

------------------------------

 

Message: 3

Date: Thu, 26 Jan 2012 21:06:32 -0000

From: "Olivier Martin" <olivier.martin@arm.com>

Subject: Re: [edk2] error building StdLib with GCC44

To: <edk2-devel@lists.sourceforge.net>

Message-ID: <000a01ccdc6e$6194d980$24be8c80$@martin@arm.com>

Content-Type: text/plain; charset="windows-1252"

 

Hi Duane,

 

I had a similar build issue this week. I fixed it by creating a function

va_utimes(const char *path, ...) and making utimes() calls this function. It

fixed the build but I did not have the opportunity to check if it was

running correctly.

 

See attached patch.

 

Regards,

Olivier

 

-----Original Message-----

From: Duane Voth [mailto:duanev@gmail.com] 

Sent: 26 January 2012 20:44

To: edk2-devel@lists.sourceforge.net

Subject: [edk2] error building StdLib with GCC44

 

Just tried to build StdLib with GCC44 and found this:

 

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c:1250:

error: ?va_start? used in function with fixed args

 

It doesn't appear that utimes() needs varargs - does no other compiler

catch this?

 

----------------- build stdout ----------------

 

[duanev edk2]$ build -p StdLib/StdLib.dsc

Build environment:

Linux-2.6.33.7-server-2mnb-x86_64-with-mandrake-2010.2-Official

Build start time: 14:39:47, Jan.26 2012

 

WORKSPACE        = /home/duanev/efi/edk2/svn64/edk2

ECP_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EDK_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EFI_SOURCE       = /home/duanev/efi/edk2/svn64/edk2/EdkCompatibilityPkg

EDK_TOOLS_PATH   = /home/duanev/efi/edk2/svn64/edk2/BaseTools

 

 

Architecture(s)  = X64

Build target     = DEBUG

Toolchain        = GCC44

 

Active Platform          =

/home/duanev/efi/edk2/svn64/edk2/StdLib/StdLib.dsc

 

Processing meta-data . done!

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/LibC.inf [X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/StdLib/StdLib.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/String/String.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Wchar/Wchar.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Ctype/Ctype.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Time/Time.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Stdio/Stdio.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Locale/Locale.inf

[X64]

make: Nothing to be done for `tbuild'.

Building ... /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/Uefi.inf

[X64]

"/usr/bin/gcc" -g -fshort-wchar -fno-stack-protector

-fno-strict-aliasing -Wall -Werror -Wno-missing-braces

-Wno-array-bounds -ffunction-sections -fdata-sections -c -include

AutoGen.h -DSTRING_ARRAY_NAME=LibUefiStrings -m64

"-DEFIAPI=__attribute__((ms_abi))" -DNO_BUILTIN_VA_FUNCS -mno-red-zone

-Wno-address -mcmodel=large -nostdinc -nostdlib -o

/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/Ue

fi/Uefi/OUTPUT/./SysCalls.obj

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi

-I/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/

Uefi/Uefi/DEBUG

-I/home/duanev/efi/edk2/svn64/edk2/StdLib

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/Include

-I/home/duanev/efi/edk2/svn64/edk2/StdLib/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles/Include

-I/home/duanev/efi/edk2/svn64/edk2/StdLibPrivateInternalFiles/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg/Include

-I/home/duanev/efi/edk2/svn64/edk2/MdePkg/Include/X64

-I/home/duanev/efi/edk2/svn64/edk2/ShellPkg

-I/home/duanev/efi/edk2/svn64/edk2/ShellPkg/Include

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c: In

function ?utimes?:

/home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/SysCalls.c:1250:

error: ?va_start? used in function with fixed args

make: ***

[/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/U

efi/Uefi/OUTPUT/SysCalls.obj]

Error 1

 

 

build.py...

 : error 7000: Failed to execute command

        make tbuild

[/home/duanev/efi/edk2/svn64/edk2/Build/StdLib/DEBUG_GCC44/X64/StdLib/LibC/U

efi/Uefi]

 

 

build.py...

 : error F002: Failed to build module

        /home/duanev/efi/edk2/svn64/edk2/StdLib/LibC/Uefi/Uefi.inf

[X64, GCC44, DEBUG]

 

- Failed -

Build end time: 14:39:50, Jan.26 2012

Build total time: 00:00:03

 

----------------------------------------------------------------------------

--

Keep Your Developer Skills Current with LearnDevNow!

The most comprehensive online learning library for Microsoft developers

is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,

Metro Style Apps, more. Free future releases when you subscribe now!

http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________

edk2-devel mailing list

edk2-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/edk2-devel

-------------- next part --------------

A non-text attachment was scrubbed...

Name: 0001-StdLib-SysCalls-Fix-GCC44-build-issue.patch

Type: application/octet-stream

Size: 1135 bytes

Desc: not available

 

------------------------------

 

Message: 4

Date: Thu, 26 Jan 2012 22:18:17 -0000

From: "Olivier Martin" <olivier.martin@arm.com>

Subject: [edk2] [PATCH] MdeModulePkg/Dxe: Fixed the function

FindFreePages() when a free region is found at 0x0

To: "Sun, Rui" <rui.sun@intel.com>

Cc: edk2-devel@lists.sourceforge.net

Message-ID: <000e01ccdc78$69a94930$3cfbdb90$@martin@arm.com>

Content-Type: text/plain; charset="windows-1252"

 

Dear EDK2 community and MdeModulePkg maintainer,

 

 

 

Please find the attached patch to fix FindFreePages() when a free region is

found at 0x0.

 

FindFreePages() is returning 0x0 when no free region was found.

 

But it could be possible the region at 0x0 might be the only possible region

returned by FindFreePages() on platforms with system memory that starts at

0x0.

 

In this case, it should be possible to make the difference between the

region 0x0 and the 'not found' error.

 

 

 

The direct and indirect callers of FindFreePages() have also be modified to

handle the change.

 

 

 

Bets Regards,

 

Olivier

-------------- next part --------------

An HTML attachment was scrubbed...

-------------- next part --------------

A non-text attachment was scrubbed...

Name: 0001-MdeModulePkg-Dxe-Fixed-the-function-FindFreePages.patch

Type: application/octet-stream

Size: 9722 bytes

Desc: not available

 

------------------------------

 

------------------------------------------------------------------------------

Keep Your Developer Skills Current with LearnDevNow!

The most comprehensive online learning library for Microsoft developers

is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,

Metro Style Apps, more. Free future releases when you subscribe now!

http://p.sf.net/sfu/learndevnow-d2d

 

------------------------------

 

_______________________________________________

edk2-devel mailing list

edk2-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/edk2-devel

 

 

End of edk2-devel Digest, Vol 25, Issue 96

******************************************