aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-06-11[efi] Veto the Itautec Ip4ConfigDxe driveritautecMichael Brown1-8/+10
The Ip4ConfigDxe driver bug that was observed on Dell systems in commit 64b4452 ("[efi] Blacklist the Dell Ip4ConfigDxe driver") has also been observed on systems with a manufacturer name of "Itautec S.A.". The symptoms of the bug are identical: an attempt to call DisconnectController() on the LOM device handle will lock up the system. Fix by extending the veto to cover the Ip4ConfigDxe driver for this manufacturer. Debugged-by: Celso Viana <celso.vianna@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-06-07[libc] Match standard prototype for putchar()Michael Brown2-2/+5
Reported-by: Bernhard M. Wiedemann <bwiedemann@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-06-07[base64] Include terminating NUL within base64 character arrayMichael Brown1-1/+1
Reported-by: Bernhard M. Wiedemann <bwiedemann@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-06-07[rndis] Fix size of reserved fieldsrndis_paddingMichael Brown1-2/+2
Most RNDIS data structures include a trailing 4-byte reserved field. For the REMOTE_NDIS_PACKET_MSG and REMOTE_NDIS_INITIALIZE_CMPLT structures, this is an 8-byte field instead. iPXE currently uses incorrect structure definitions with a 4-byte reserved field in all data structures, resulting in data payloads that overlap the last 4 bytes of the 8-byte reserved field. RNDIS uses explicit offsets to locate any data payloads beyond the message header, and so liberal RNDIS parsers (such as those used in Hyper-V and in the Linux USB Ethernet gadget driver) are still able to parse the malformed structures. A stricter RNDIS parser (such as that found in some older Android builds that seem to use an out-of-tree USB Ethernet gadget driver) may reject the malformed structures since the data payload offset is less than the header length, causing iPXE to be unable to transmit packets. Fix by correcting the length of the reserved fields. Debugged-by: Martin Nield <pmn1492@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-06-04[ath5k] Avoid returning uninitialised data on EEPROM read errorsMichael Brown1-0/+3
Originally-implemented-by: Bernhard M. Wiedemann <bwiedemann@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-06-03[crypto] Add memory output constraints for big-integer inline assemblybigint_output_constraintsMichael Brown2-22/+43
The ARM versions of the big-integer inline assembly functions include constraints to indicate that the output value is modified by the assembly code. These constraints are not present in the equivalent code for the x86 versions. As of GCC 11, this results in the compiler reporting that the output values may be uninitialized. Fix by including the relevant memory output constraints. Reported-by: Christian Hesse <mail@eworm.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-24[build] Use SOURCE_DATE_EPOCH for isohybrid MBR ID if it existsMichael Brown1-1/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-24[build] Use SOURCE_DATE_EPOCH for .iso timestamps if it existsMichael Brown1-0/+10
Originally-implemented-by: Bernhard M. Wiedemann <bwiedemann@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-21[efi] Provide an "initrd.magic" file for use by UEFI kernelsMichael Brown1-0/+88
Provide a file "initrd.magic" via the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL that contains the initrd file as constructed for BIOS bzImage kernels (including injected files with CPIO headers constructed by iPXE). This allows BIOS and UEFI kernels to obtain the exact same initramfs image, by adding "initrd=initrd.magic" to the kernel command line. For example: #!ipxe kernel boot/vmlinuz initrd=initrd.magic initrd boot/initrd.img initrd boot/modules/e1000.ko /lib/modules/e1000.ko initrd boot/modules/af_packet.ko /lib/modules/af_packet.ko boot Do not include the "initrd.magic" file within the root directory listing, since doing so would break software such as wimboot that processes all files within the root directory. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-21[efi] Allow for non-image-backed virtual filesMichael Brown1-69/+221
Restructure the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL implementation to allow for the existence of virtual files that are not simply backed by a single underlying image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-21[cpio] Split out bzImage initrd CPIO header constructionMichael Brown5-56/+110
iPXE will construct CPIO headers for images that have a non-empty command line, thereby allowing raw images (without CPIO headers) to be injected into a dynamically constructed initrd. This feature is currently implemented within the BIOS-only bzImage format support. Split out the CPIO header construction logic to allow for reuse in other contexts such as in a UEFI build. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-18[x509] Use case-insensitive comparison for certificate namesMichael Brown2-1/+3
DNS names are case-insensitive, and RFC 5280 (unlike RFC 3280) mandates support for case-insensitive name comparison in X.509 certificates. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-18[libc] Add strncasecmp()Michael Brown3-1/+26
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-17[bnxt] Use hexadecimal values in PCI_ROM entriesJoseph2-141/+64
Use hexadecimal values instead of macros in PCI_ROM entries so Perl script can parse them correctly. Move PCI_ROM entries from header file to C file. Integrate bnxt_vf_nics array into PCI_ROM entries by introducing BNXT_FLAG_PCI_VF flag into driver_data field. Add whitespaces in PCI_ROM entries for style consistency. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-17[intel] Add PCI ID for I219-V and -LM 10 to 15Christian Nilsson1-0/+12
Signed-off-by: Christian Nilsson <nikize@gmail.com>
2021-05-12[image] Support archive image formats independently of "imgextract" commandMichael Brown3-11/+11
Support for the zlib and gzip archive image formats is currently included only if the IMAGE_ARCHIVE_CMD is used to enable the "imgextract" command. The ability to transparently execute a single-member archive image without using the "imgextract" command renders this unintuitive: a user wanting to gain the ability to boot a gzip-compressed kernel image would expect to have to enable IMAGE_GZIP rather than IMAGE_ARCHIVE_CMD. Reverse the inclusion logic, so that archive image formats must now be enabled explicitly (via IMAGE_GZIP and/or IMAGE_ZLIB), with the archive image management commands dragged in as needed if any archive image formats are enabled. The archive image management commands may be explicitly disabled via IMAGE_ARCHIVE_CMD if necessary. This matches the behaviour of IBMGMT_CMD and similar options, where the relevant commands are included only when something else already drags in the underlying feature. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[image] Propagate trust flag to extracted archive imagesMichael Brown1-0/+4
An extracted image is wholly derived from the original archive image. If the original archive image has been verified and marked as trusted, then this trust logically extends to any image extracted from it. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[image] Allow single-member archive images to be executed transparentlyMichael Brown4-0/+33
Provide image_extract_exec() as a helper method to allow single-member archive images (such as gzip compressed images) to be executed without an explicit "imgextract" step. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[undi] Read TSC only when profilingMichael Brown1-2/+9
Avoid using the "rdtsc" instruction unless profiling is enabled. This allows the non-debug build of the UNDI driver to be used on a CPU such as a 486 that does not support the TSC. Reported-by: Nikolai Zhubr <n-a-zhubr@yandex.ru> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[rng] Check for TSC support before using RTC entropy sourceMichael Brown2-0/+14
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-12[prefix] Specify i486 architecture for LZMA decompressorMichael Brown1-1/+1
The decompressor uses the i486 "bswap" instruction, but does not require any instructions that exist only on i586 or above. Update the ".arch" directive to reflect the requirements of the code as implemented. Reported-by: Martin Habets <habetsm.xilinx@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-08[gzip] Add support for gzip archive imagesimgextractMichael Brown7-0/+403
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-08[zlib] Add support for zlib archive imagesMichael Brown7-0/+345
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-08[image] Add "imgextract" command for extracting archive imagesMichael Brown9-0/+326
Add the concept of extracting an image from an archive (which could be a single-file archive such as a gzip-compressed file), along with an "imgextract" command to expose this functionality to scripts. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-08[image] Provide image_set_len() utility functionMichael Brown2-4/+22
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-05-02[cloud] Attempt to include CPUID_SETTINGS only for x86 buildsMichael Brown1-0/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-23[settings] Add --timeout option to "read" commandMichael Brown1-14/+43
Requested-by: Matteo Guglielmi <Matteo.Guglielmi@dalco.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-23[readline] Add an optional timeout to readline_history()Michael Brown4-6/+18
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-21[efi] Show ACPI address space descriptor ranges in debug messagesMichael Brown1-0/+3
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-20[efi] Always map full length of coherent DMA buffer allocationMichael Brown1-1/+2
The EFI PCI API takes a page count as the input to AllocateBuffer() but a byte count as the input to Map(). There is nothing in the UEFI specification that requires us to map exactly the allocated length, and no systems have yet been observed that will fail if the map length does not exactly match the allocated length. However, it is plausible that some implementations may fail if asked to map a length that does not match the length of the corresponding allocation. Avoid potential future problems by always mapping the full allocated length. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-20[build] Fix genfsimg to build ISO with long filenamesMatya1-1/+1
Commit 79c0173 ("[build] Create util/genfsimg for building filesystem-based images") introduced the new genfsimg, which lacks the -l option when building ISO files. This option is required to build level 2 (long plain) ISO9660 filenames, which are required when using the .lkrn extensions on older versions of ISOLINUX. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-20[xen] Avoid infinite loop on allocation failure in xenstore_response()Michael Brown1-6/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-14[xen] Support scatter-gather to allow for jumbo framesxen-sgMichael Brown3-57/+154
The use of jumbo frames for the Xen netfront virtual NIC requires the use of scatter-gather ("feature-sg"), with the receive descriptor ring becoming a list of page-sized buffers and the backend using as many page buffers as required for each packet. Since iPXE's abstraction of an I/O buffer does not include any sort of scatter-gather list, this requires an extra allocation and copy on the receive datapath for any packet that spans more than a single page. This support is required in order to successfully boot an AWS EC2 virtual machine (with non-enhanced networking) via iSCSI if jumbo frames are enabled, since the netback driver used in EC2 seems not to allow "feature-sg" to be renegotiated once the Linux kernel driver takes over. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-13[int13] Do not report INT 13 extension support for emulated floppiesMichael Brown1-2/+2
The INT 13 extensions provide a mechanism for accessing disks using linear (LBA) rather than C/H/S addressing. SAN protocols such as iSCSI invariably support only linear addresses and so iPXE currently provides LBA access to all SAN disks (with autodetection and emulation of an appropriate geometry for C/H/S accesses). Most BIOSes will not report support for INT 13 extensions for floppy disk drives, and some operating systems may be confused by a floppy drive that claims such support. Minimise surprise by reporting the existence of support for INT 13 extensions only for non-floppy drive numbers. Continue to provide support for all drive numbers, to avoid breaking operating systems that may unconditionally use the INT 13 extensions without first checking for support. Reported-by: Valdo Toost <vtoost@hot.ee> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-10[cloud] Enable "poweroff" command in cloud imagesMichael Brown1-0/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-10[netdevice] Ensure driver transmit() and poll() will not be re-enteredMichael Brown2-7/+38
When CONSOLE_SYSLOG is used, a DBG() from within a network device driver may cause its transmit() or poll() methods to be unexpectedly re-entered. Since these methods are not intended to be re-entrant, this can lead to undefined behaviour. Add an explicit re-entrancy guard to both methods. Note that this must operate at a per-netdevice level, since there are legitimate circumstances under which the netdev_tx() or netdev_poll() functions may be re-entered (e.g. when using VLAN devices). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-10[pci] Avoid scanning nonexistent buses when using PCIAPI_DIRECTMichael Brown3-4/+30
There is no method for obtaining the number of PCI buses when using PCIAPI_DIRECT, and we therefore currently scan all possible bus numbers. This can cause a several-second startup delay in some virtualised environments, since PCI configuration space access will necessarily require the involvement of the hypervisor. Ameliorate this situation by defaulting to scanning only a single bus, and expanding the number of PCI buses to accommodate any subordinate buses that are detected during enumeration. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-04-10[intel] Add additional PCI device ID to tableTyler J. Stachecki1-0/+1
Adding this missing identifier allows the X557-AT2 chipset seen on (at least) Super Micro A2SDI-H-TF motherboards to function with iPXE. Signed-off-by: Tyler J. Stachecki <stachecki.tyler@gmail.com>
2021-04-10[efi] Mark PE .reloc and .debug sections as discardableMarvin Häuser1-0/+2
After a PE image is fully loaded and relocated, the loader code may opt to zero discardable sections for security reasons. This includes relocation and debug information, as both contain hints about specific locations within the binary. Mark both generated sections as discardable, which follows the PE specification. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2021-04-10[efi] Align EFI image sections by page sizeMarvin Häuser2-20/+33
For optimal memory permission management, PE sections need to be aligned by the platform's minimum page size. Currently, the PE section alignment is fixed to 32 bytes, which is below the typical 4kB page size. Align all sections to 4kB and adjust ELF to PE image conversion accordingly. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2021-04-10[efi] Discard .pci_devlist.* sections for EFI imagestmpMarvin Häuser1-0/+1
As per https://github.com/ipxe/ipxe/pull/313#issuecomment-816018398, these sections are not required for EFI execution. Discard them to avoid implementation-defined alignment malforming binaries. Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2021-03-11[dhcp] Handle DHCPNAK by returning to discovery stateMichael Brown1-9/+31
Handle a DHCPNAK by returning to the discovery state to allow iPXE to attempt to obtain a replacement IPv4 address. Reuse the existing logic for deferring discovery when the link is blocked: this avoids hammering a misconfigured DHCP server with a non-stop stream of requests and allows the DHCP process to eventually time out and fail. Originally-implemented-by: Blake Rouse <blake.rouse@canonical.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-11[linux] Fail at link time if building slirp.linux without libslirpMichael Brown1-29/+3
The iPXE build system is constructed for a standalone codebase with no external dependencies, and does not have any equivalent of the standard userspace ./configure script. We currently check for the ability to include slirp/libslirp.h and conditionalise portions of linux_api.c on its presence. The actual slirp driver code is built unconditionally, as with all iPXE drivers. This currently leads to a silent runtime failure if attempting to use slirp.linux built on a system that was missing slirp/libslirp.h. Convert this to a link-time failure by deliberately omitting the relevant symbols from linux_api.c when slirp/libslirp.h is not present. This allows other builds (e.g. tap.linux or tests.linux) to succeed: the link-time failure will occur only if the slirp driver is included within the build target. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-03[linux] Do not assume that stat() works on sysfs filesMichael Brown1-29/+20
Linux kernel 3.12 and earlier report a zero size via stat() for all ACPI table files in sysfs. There is no way to determine the file size other than by reading the file until EOF. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-03[linux] Validate length of ACPI table read from sysfsMichael Brown2-0/+11
Consumers of acpi_find() will assume that returned structures include a valid table header and that the length in the table header is correct. These assumptions are necessary when dealing with raw ACPI tables, since there exists no independent source of length information. Ensure that these assumptions are also valid for ACPI tables read from sysfs. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-03[linux] Place -lslirp at end of linker search listMichael Brown1-3/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-03[linux] Use fstat() rather than statx()Michael Brown3-11/+8
The statx() system call has a clean header file and a consistent layout, but was unfortunately added only in kernel 4.11. Using stat() or fstat() directly is extremely messy since glibc does not necessarily use the kernel native data structures. However, as the only current use case is to obtain the length of an open file, we can merely provide a wrapper that does precisely this. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-02[linux] Use generic sysfs mechanism to read SMBIOS tableMichael Brown3-64/+87
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-02[linux] Use generic sysfs mechanism to read ACPI tablesMichael Brown1-78/+21
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2021-03-02[linux] Add a generic function for reading files from sysfsMichael Brown5-0/+143
Signed-off-by: Michael Brown <mcb30@ipxe.org>