Hi Laszlo, The DataSource.c patch was checked-in. A similar patch for DataSink.c was also checked-in.
Lee -----Original Message----- From: Laszlo Ersek [mailto:ler...@redhat.com] Sent: Thursday, January 17, 2013 7:04 PM To: Leahy, Leroy P Cc: edk2-devel@lists.sourceforge.net Subject: Re: [edk2] running the StdLib socket test apps in OVMF [was: ovmf pxeboot] Hello Lee, On 01/17/13 18:27, Leahy, Leroy P wrote: > > I have not built nor tested an OVMF configuration, so my > recommendation is to work with Gerd Hoffman to: > 1. Get his configuration working > 2. Get sockets working > 3. Remove the pieces that you do not want from Gerd's configuration > > As for sockets, it was designed to use the UEFI 2 networking stack so > you should be using IFCONFIG instead of IPCONFIG. From these emails, > I would suggest using a static IP address. Once the IP address is > assigned to the adapter and verified with the command "ifconfig -l" > then it should be possible to run the socket test applications. Note > that for DNS lookup to work the shell's default device needs to > contain the file /Efi/StdLib/etc/resolv.conf and it needs to point to > your DNS servers. (1) I thought I'd give a try to IFCONFIG (it's not documented in the shell references that I checked). After finding "-?" in its source, I even managed to invoke it :) and now I can ping hosts on the public internet. Many thanks for making me aware of IFCONFIG. (2) I ran GetServByName with "ftp" and "tftp", and it correctly returned 21/tcp & 69/udp. I think my StdLib setup is OK. (3) I tried to transfer data from OVMF to the host, using DataSource.efi in TCP mode. There was a byte order error in the port setting. After I fixed that (and also corrected a few messages where htons() was used instead of ntohs(), please see the attached patch), the transfer started to work. Speed was about 280-300 KB/s. (4) Regarding GetHostByName.efi (with ping & DataSource.efi being functional): if I set "host.conf" to "hosts" only, then GetHostByName doesn't crash (although it fails to locate "localhost" from the hosts file.) If I add "dns" to "host.conf", the utility crashes (reboots) the VM. (4a) The following messages are in the debug log, printed mostly by CoreInstallProtocolInterfaceNotify() [MdeModulePkg/Core/Dxe/Hand/Handle.c]: InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B EC04040 Loading driver at 0x0000D22D000 EntryPoint=0x0000D22D260 GetHostByName.efi InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF D348E18 InstallProtocolInterface: 47C7B223-C42A-11D2-8E57-00A0C969723B F9478A0 InstallProtocolInterface: 70FB9CE0-2CB1-4FD7-80EE-AB4B6CF4B43F 0 InstallProtocolInterface: 9C756011-5D44-4EE0-BCE7-C38218FE398D F8CF898 InstallProtocolInterface: FFC659C2-4EF2-4532-B875-CD9AA4274CDE F8CF818 InstallProtocolInterface: 44E03A55-8D97-4511-BFEF-0A8BC62C25AE F8CF798 InstallProtocolInterface: 58E6ED63-1694-440B-9388-E98FED6B65AF D360E20 InstallProtocolInterface: 41D94CD2-35B6-455A-8258-D4E51334AADD D3474A0 InstallProtocolInterface: 3AD9DF29-4501-478D-B1F8-7F7FE70E50F3 D347638 <reboot> After resolving the GUIDs manually and replacing non-NULL & NULL pointers with the those strings themselves, and diffing the output between GetHostByName and GetHostByDns, this is what I get: --- by-name-1.txt 2013-01-17 21:19:58.889255938 +0100 +++ by-dns-1.txt 2013-01-17 21:19:57.961226931 +0100 @@ -1,11 +1,11 @@ InstallProtocolInterface: LoadedImage non-NULL -Loading driver at 0x0000D22D000 EntryPoint=0x0000D22D260 GetHostByName.efi +Loading driver at 0x0000D230000 EntryPoint=0x0000D230260 +GetHostByDns.efi InstallProtocolInterface: LoadedImageDevicePath non-NULL InstallProtocolInterface: EfiShellInterface non-NULL -InstallProtocolInterface: GetHostByName NULL +InstallProtocolInterface: GetHostByDns NULL InstallProtocolInterface: EslIp4Service non-NULL InstallProtocolInterface: EslTcp4Service non-NULL InstallProtocolInterface: EslUdp4Service non-NULL InstallProtocolInterface: EfiSocketProtocol non-NULL InstallProtocolInterface: EfiIp4Protocol non-NULL InstallProtocolInterface: gEfiUdp4Protocol non-NULL <reboot> It is interesting that the Interface pointer is NULL for both GUIDs that belong to AppPkg/Applications/Sockets/{GetHostByName,GetHostByDns}. But I have the impression this isn't what causes the crash. (4b) I also suspected the crash was related to something in the DNS server's response (confusing the StdLib parser code or something after that). When I run "GetHostByName example.com", I can see the following traffic between the guest and the dnsmasq process running on the host: 00:24:06.579841 IP 192.168.122.82.1462 > 192.168.122.1.53: 38438+ A? example.com. (29) 0x0000: 4500 0039 c12d 4000 ff11 44e1 c0a8 7a52 e.....@...d...zr 0x0010: c0a8 7a01 05b6 0035 0025 1e80 9626 0100 ..z....5.%...&.. 0x0020: 0001 0000 0000 0000 0765 7861 6d70 6c65 .........example 0x0030: 0363 6f6d 0000 0100 01 .com..... 00:24:06.613263 IP 192.168.122.1.53 > 192.168.122.82.1462: 38438 1/2/4 A 192.0.43.10 (181) 0x0000: 4500 00d1 0000 4000 4011 c477 c0a8 7a01 E.....@.@..w..z. 0x0010: c0a8 7a52 0035 05b6 00bd 3083 9626 8180 ..zR.5....0..&.. 0x0020: 0001 0001 0002 0004 0765 7861 6d70 6c65 .........example 0x0030: 0363 6f6d 0000 0100 01c0 0c00 0100 0100 .com............ 0x0040: 02a2 c900 04c0 002b 0ac0 0c00 0200 0100 .......+........ 0x0050: 02a2 c900 1401 610c 6961 6e61 2d73 6572 ......a.iana-ser 0x0060: 7665 7273 036e 6574 00c0 0c00 0200 0100 vers.net........ 0x0070: 02a2 c900 0401 62c0 3bc0 5900 0100 0100 ......b.;.Y..... 0x0080: 0006 7a00 04c7 2b85 35c0 5900 1c00 0100 ..z...+.5.Y..... 0x0090: 0006 7a00 1020 0105 0000 8d00 0000 0000 ..z............. 0x00a0: 0000 0000 53c0 3900 0100 0100 0006 7a00 ....S.9.......z. 0x00b0: 04c7 2b84 35c0 3900 1c00 0100 0006 7a00 ..+.5.9.......z. 0x00c0: 1020 0105 0000 8c00 0000 0000 0000 0000 ................ 0x00d0: 53 S and then the VM reboots. (4c) Ultimately I spent hours sprinkling StdLib with DEBUGs and SerialPortWrite()s, and I "narrowed" down the reboot to the following call stack: gethostbyname() [BsdSocketLib/gethostnamadr.c] gethostbyname2(..., AF_INET) init_services() _gethostbyhtname() [BsdSocketLib/gethostbyht.c] _gethostbydnsname() [BsdSocketLib/gethostbydns.c] res_search() [BsdSocketLib/res_query.c] res_querydomain() #1 res_query() res_send() [BsdSocketLib/res_send.c] socket(PF_INET, SOCK_DGRAM, 0) [BsdSocketLib/socket.c] BslSocketProtocolToFd() recvfrom() <= 0 [BsdSocketLib/recvfrom.c] res_close() [BsdSocketLib/res_send.c] close() [LibC/Uefi/SysCalls.c] _closeX() BslSocketClose() via "fo_close" [BsdSocketLib/close.c] BslSocketCloseWork() EslSocketCloseStart() via "pfnCloseStart" [EfiSocketLib/Socket.c] RESTORE_TPL() The SerialPortWrite() call that I added after the RESTORE_TPL() call produces no output, the VM reboots. From RESTORE_TPL() I'm getting the idea that this might be a race between a timer-driven part of the UDP socket implementation (if that expression makes sense) and close(). Thanks, Laszlo
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel