Commit Graph

5818 Commits (d8c500b7945e57023dde5bd0be2b0e40963315d9)
 

Author SHA1 Message Date
Michael Brown d8c500b794 [efi] Drop to TPL_APPLICATION when gathering entropy
Commit c89a446 ("[efi] Run at TPL_CALLBACK to protect against UEFI
timers") introduced a regression in the EFI entropy gathering code.
When the EFI_RNG_PROTOCOL is not present, we fall back to using timer
interrupts (as for the BIOS build).  Since timer interrupts are
disabled at TPL_CALLBACK, WaitForEvent() fails and no entropy can be
gathered.

Fix by dropping to TPL_APPLICATION while entropy gathering is enabled.

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-03-12 11:02:19 +00:00
Hannes Reinecke c84f9d6727 [iscsi] Parse IPv6 address in root path
The iSCSI root path may contain a literal IPv6 address.  Update the
parser to handle this address format correctly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-03-01 13:30:41 +00:00
Michael Brown 47849be3a9 [process] Include process name in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-20 18:02:25 +00:00
Michael Brown f672a27b34 [efi] Raise TPL within EFI_USB_IO_PROTOCOL entry points
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-20 11:19:39 +00:00
Michael Brown a272b7ce57 [efi] Raise TPL within EFI_SIMPLE_NETWORK_PROTOCOL entry points
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-20 11:19:21 +00:00
Michael Brown c89a446cf0 [efi] Run at TPL_CALLBACK to protect against UEFI timers
As noted in the comments, UEFI manages to combines the all of the
worst aspects of both a polling design (inefficiency and inability to
sleep until something interesting happens) and of an interrupt-driven
design (the complexity of code that could be preempted at any time,
thanks to UEFI timers).

This causes problems in particular for UEFI USB keyboards: the
keyboard driver calls UsbAsyncInterruptTransfer() to set up a periodic
timer which is used to poll the USB bus.  This poll may interrupt a
critical section within iPXE, typically resulting in list corruption
and either a hang or reboot.

Work around this problem by mirroring the BIOS design, in which we run
with interrupts disabled almost all of the time.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-20 10:56:31 +00:00
Michael Brown 8dbb73a779 [xhci] Consume event TRB before reporting completion to USB core
Reporting a completion via usb_complete() will pass control outside
the scope of xhci.c, and could potentially result in a further call to
xhci_event_poll() before returning from usb_complete().  Since we
currently update the event consumer counter only after calling
usb_complete(), this can result in duplicate completions and
consequent corruption of the submission TRB ring structures.

Fix by updating the event ring consumer counter before passing control
to usb_complete().

Reported-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Tested-by: Andreas Hammarskjöld <junior@2PintSoftware.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-19 18:59:45 +00:00
Michael Brown 6737a8795f [http] Allow for domain names within NTLM user names
Allow a NetBIOS domain name to be specified within a URL using a
syntax such as:

  http://domain%5Cusername:password@server/path

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-19 11:58:28 +00:00
Michael Brown 546dd51de8 [intel] Work around broken reset mechanism in i219 devices
The i219 appears to have a seriously broken reset mechanism.  After
any transmit or receive activity, resetting the card will break both
the transmit and receive datapaths until the next PCI bus reset.

The Linux and BSD drivers include a convoluted workaround authored by
Intel which involves setting a bit in the undocumented FEXTNVM11
register, then transmitting a dummy 512-byte packet containing garbage
data, then reconfiguring the receive descriptor prefetch thresholds
and temporarily reenabling the receive datapath.  The comments in the
Intel fix do not even remotely match what the code actually does, and
the code accidentally leaves the transmitter enabled after use.

Experimentation suggests that an equivalent fix is to simply set the
undocumented bit in FEXTNVM11 before enabling the transmit or receive
descriptor rings.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-02-03 19:21:54 +00:00
Michael Brown c900751fa6 [xhci] Assume an invalid PSI table if any invalid PSI value is observed
Invalid protocol speed ID tables appear to be increasingly common in
the wild, to the point that it is infeasible to apply an explicit
XHCI_BAD_PSIV flag for each offending PCI device ID.

Fix by assuming an invalid PSI table as soon as any invalid value is
reported by the hardware.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-29 21:28:12 +00:00
Michael Brown fbe8c52d0d [ena] Fix spurious uninitialised variable warning on older versions of gcc
Some older versions of gcc (observed with gcc 4.7.2) report a spurious
uninitialised variable warning in ena_get_device_attributes().  Work
around this warning by manually inlining the relevant code (which has
only a single call site).

Reported-by: xbgmsharp <xbgmsharp@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-17 14:09:56 +00:00
Martin Habets 70189a8e47 [netdevice] Make netdev_irq_enabled() independent of netdev_irq_supported()
The UNDI layer uses the NETDEV_IRQ_ENABLED flag to choose whether to
return PXENV_UNDI_ISR_OUT_OURS or PXENV_UNDI_ISR_OUT_NOT_OURS for a
given interrupt.  For a network device that does not support
interrupts, the flag will never be set and so pxenv_undi_isr() will
always return PXENV_UNDI_ISR_OUT_NOT_OURS.  This causes some NBPs
(such as lpxelinux.0) to hang.

Redefine NETDEV_IRQ_ENABLED as a simple administrative flag which can
be set even on network devices that do not support interrupts.  This
allows pxenv_undi_isr() (which is the sole user of NETDEV_IRQ_ENABLED)
to function as expected by lpxelinux.0.

Signed-off-by: Martin Habets <mhabets@solarflare.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-14 21:53:29 +00:00
Joseph Wong 08db2fd55c [tg3] Add support for SerDes PHY initialization
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-14 21:26:36 +00:00
Michael Brown 329202691f [skel] Remove MII interface
Most drivers do not utilise an MII interface, since the link state is
typically available directly from a memory-mapped register.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-14 21:16:36 +00:00
Michael Brown 2fb70e8b32 [ena] Add driver for Amazon ENA virtual function NIC
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-12 23:46:02 +00:00
Michael Brown 2bb4ec1f54 [build] Avoid use of "ld --oformat binary"
Using "ld --oformat binary" for mbr.bin and usbdisk.bin seems to cause
segmentation faults on some versions of binutils (observed on Fedora
27).  Work around this problem by using ld to create an intermediate
ELF object, followed by objcopy (via the existing %.tmp -> %.bin rule)
to create the final binary.

Note that we cannot simply use a single-stage "objcopy -O binary"
since this will not process the relocation records for x86_64: see
commit 1afcccd ("[build] Do not use "objcopy -O binary" for objects
with relocation records").

Reported-by: Brent S <bts@square-r00t.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2018-01-02 21:26:40 +01:00
Michael Brown 00c5b958c5 [legal] Add missing FILE_LICENCE declarations
Add missing FILE_LICENCE declarations to x86_64 headers based on the
corresponding i386 headers (from which the x86_64 headers were
originally derived).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-29 11:57:00 +00:00
Michael Brown ff648c339d [legal] Add missing FILE_LICENCE declarations
Add missing FILE_LICENCE declarations to EFI headers based on the
corresponding source file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-29 11:54:59 +00:00
Michael Brown be9ed2848d [image] Omit URI query string and fragment from download progress messages
The URIs printed as part of download progress messages are intended to
provide a quick visual progress indication to the user.  Very long
query strings can render this visual indication useless in practice,
since the most important information (generally the URI host and path)
is drowned out by multiple lines of human-illegible URI-encoded data.

Omit the query string entirely from the download progress message.
For consistency and brevity, also omit the URI fragment along with the
username and password (which was previously redacted anyway).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-28 13:42:44 +00:00
Michael Brown 659c484efc [http] Report unsuccessful response status lines at DBGVL_LOG
The precise HTTP response status code is currently visible only at
DBGLVL_EXTRA.  Allow for easier debugging by reporting the whole
status line at DBGLVL_LOG for any unsuccessful responses.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-28 13:04:59 +00:00
Michael Brown ea29122a70 [http] Include error messages for 4xx and 5xx response codes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-28 12:34:07 +00:00
Michael Brown e4461f65d8 [xen] Skip probing of any unsupported device types
Xen 4.4 includes the device "device/suspend/event-channel" which does
not have a "backend" key.  This currently causes the entire XenBus
device tree probe to fail.

Fix by skipping probe attempts for device types for which there is no
iPXE driver.

Debugged-by: Eytan Heidingsfeld <eytanh@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-28 12:09:27 +00:00
Janos Mattyasovszky aeffcce44f [intel] Add PCI device ID for X550-T2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-12-20 12:20:43 +00:00
Michael Brown b5e0b50723 [http] Add support for NTLM authentication
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:04 +00:00
Michael Brown 96bd872c03 [http] Handle parsing of WWW-Authenticate header within authentication scheme
Allow individual authentication schemes to parse WWW-Authenticate
headers that do not comply with RFC2617.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:04 +00:00
Michael Brown c49acbb4d2 [http] Gracefully handle offers of multiple authentication schemes
Servers may provide multiple WWW-Authenticate headers, each offering a
different authentication scheme.  We currently fail the request as
soon as we encounter an unrecognised scheme, which prevents subsequent
offers from succeeding.

Fix by silently ignoring headers for schemes that we do not recognise.
If no schemes are recognised then the request will eventually fail
anyway due to the 401 response code.

If multiple schemes are supported, arbitrarily choose the scheme
appearing first within the response headers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:03 +00:00
Michael Brown fc2f0dd930 [ntlm] Add support for NTLM authentication mechanism
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:03 +00:00
Michael Brown 0077b0933d [crypto] Add MD4 message digest algorithm
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:03 +00:00
Michael Brown 32d54691e9 [crypto] Eliminate repetitions in MD5 round constant table
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-12 18:52:03 +00:00
Michael Brown fb6b66ce13 [crypto] Fix endianness typo in comment
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-11-11 23:45:31 +00:00
Michael Brown 1b67a05646 [efi] Allow for building with older versions of elf.h system header
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-24 19:26:58 +01:00
Heinrich Schuchardt c4ce92599d [efi] Accept (and ignore) R_ARM_V4BX relocations
Relocation type R_ARM_V4BX requires no computation.  It marks the
location of an ARMv4 branch exchange instruction.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-24 18:03:10 +01:00
Ladi Prosek 0631a46a94 [crypto] Fail fast if cross-certificate source is empty
In fully self-contained deployments it may be desirable to build iPXE
with an empty CROSSCERT source to avoid talking to external services.

Add an explicit check for this case and make validator_start_download
fail immediately if the base URI is empty.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-24 17:56:04 +01:00
Michael Brown 74d90b33f8 [efi] Inhibit our driver Start() method during disconnection attempts
Some HP BIOSes (observed with a Z840) seem to attempt to connect our
drivers in the middle of our call to DisconnectController().  The
precise chain of events is unclear, but the symptom is that we see
several calls to our Supported() and Start() methods, followed by a
system lock-up.

Work around this dubious BIOS behaviour by explicitly failing calls to
our Start() method while we are in the middle of attempting to
disconnect drivers.

Reported-by: Jordan Wright <jordan.m.wright@disney.com>
Debugged-by: Adrian Lucrèce Céleste <adrianlucrececeleste@airmail.cc>
Debugged-by: Christian Nilsson <nikize@gmail.com>
Tested-by: Jordan Wright <jordan.m.wright@disney.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-22 18:39:04 +01:00
Michael Brown 7428ab7258 [build] Exclude selected directories from Secure Boot builds
When submitting binaries for UEFI Secure Boot signing, certain
known-dubious subsystems (such as 802.11 and NFS) must be excluded
from the build.  Mark the directories containing these subsystems as
insecure, and allow the build target to include an explicit "security
flag" (a literal "-sb" appended to the build platform) to exclude
these source directories from the build process.

For example:

  make bin-x86_64-efi-sb/ipxe.efi

will build iPXE with all code from the 802.11 and NFS subsystems
excluded from the build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-18 14:38:12 +01:00
Michael Brown d46c53cfc6 [efi] Continue to connect remaining handles after connection errors
Some UEFI BIOSes will deliberately break the implementation of
ConnectController() to return errors for devices that have been
"disabled" via the BIOS setup screen.  (As an added bonus, such BIOSes
may return garbage EFI_STATUS values such as 0xff.)

Work around these broken UEFI BIOSes by ignoring failures and
continuing to attempt to connect any remaining handles.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-13 10:07:55 +03:00
Peter von Konigsmark 9720f8396f [exanic] Add PCI device ID for another X40 variant
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-07 12:37:09 +01:00
Peter von Konigsmark f756fd78f7 [exanic] Power up optical PHYs (if present)
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-07 12:36:33 +01:00
Michael Brown af02a8d071 [dns] Ensure DNS names are NUL-terminated when used as diagnostic strings
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-07 12:19:35 +01:00
Michael Brown e8f30571a3 [efi] Match behaviour of SnpDxe for truncated received packets
The UEFI specification does not state whether or not a return value of
EFI_BUFFER_TOO_SMALL from the SNP Receive() method should follow the
usual EFI API behaviour of allowing the caller to retry the request
with an increased buffer size.

Examination of the SnpDxe driver in EDK2 suggests that Receive() will
just return the truncated packet (complete with any requested
link-layer header fields), so match this behaviour.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 23:56:22 +01:00
Michael Brown 3f429bdcfe [efi] Check buffer length for packets retrieved via our SNP protocol
We do not currently check the length of the caller's buffer for
received packets.  This creates a potential buffer overrun when iPXE
is being used via the SNP or UNDI protocols.

Fix by checking the buffer length and correctly returning the required
length and an EFI_BUFFER_TOO_SMALL error.

Reported-by: Paul McMillan <paul.mcmillan@oracle.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 23:28:21 +01:00
Michael Brown 9faf069126 [dns] Report current DNS query as job progress status message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 11:46:13 +01:00
Michael Brown 53f273af90 [resolv] Use pass-through interfaces for name resolution multiplexer
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 11:43:22 +01:00
Michael Brown 8047baf7c6 [netdevice] Add "hwaddr" setting
Expose the underlying hardware address as a setting.  For IPoIB
devices, this provides scripts with access to the Infiniband GUID.

Requested-by: Allen, Benjamin S. <bsallen@alcf.anl.gov>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 10:52:30 +01:00
Michael Brown 7e673a6b67 [peerdist] Gather and report peer statistics during download
Record and report the number of peers (calculated as the maximum
number of peers discovered for a block's segment at the time that the
block download is complete), and the percentage of blocks retrieved
from peers rather than from the origin server.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown 4674df25ef [monojob] Display job status message, if present
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown a258b0897b [downloader] Allow underlying downloads to provide detailed job progress
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown e30cc5e9e5 [job] Allow jobs to report an arbitrary status message
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown 7e6b367b7e [monojob] Check for job progress only once per timer tick
Checking for job progress is essentially a user interface activity,
and can safely be performed only once per timer tick (as is already
done with checking for keypresses).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown 97f0f56a34 [netdevice] Cancel all pending transmissions on any transmit error
Some external code (such as the UEFI UNDI driver for the Realtek USB
NIC on a Microsoft Surface Book) will block during transmission
attempts and can take several seconds to report a transmit error.  If
there is a large queue of pending transmissions, then the accumulated
time from a series of such failures can easily exceed the EFI watchdog
timeout, resulting in what appears to be a system lockup followed by a
reboot.

Work around this problem by immediately cancelling any pending
transmissions as soon as any transmit error occurs.

The only expected transmit error under normal operation is ENOBUFS
arising when the hardware transmit queue is full.  By definition, this
can happen only for drivers that do not utilise deferred
transmissions, and so this new behaviour will not affect these
drivers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 12:30:04 +01:00