unless the dev.acpi_ibm.0.handlerevents sysctl is set to process
them internally. The default for the latter is to ignore them,
so passing to evdev(4) is enabled by default.
Reviewed by: wulf, imp
Tested on: Lenovo Thinpad X11 Carbon 7Th Gen
Differential Revision: https://reviews.freebsd.org/D48174
(cherry picked from commit c21f5751ef0932796676e55953461e0679020e28)
The SUS doesn't mention this error code as a possible one [1]. The FreeBSD
manual page specifies a possible ECONNRESET for close(2):
[ECONNRESET] The underlying object was a stream socket that was
shut down by the peer before all pending data was
delivered.
In the past it had been EINVAL (see 21367f630d), and this EINVAL was
added as a safety measure in 623dce13c6. After conversion to
ECONNRESET it had been documented in the manual page in 78e3a7fdd5, but
I bet wasn't ever tested to actually be ever returned, cause the
tcp-testsuite[2] didn't exist back then. So documentation is incorrect
since 2006, if my bet wins. Anyway, in the modern FreeBSD the condition
described above doesn't end up with ECONNRESET error code from close(2).
The error condition is reported via SO_ERROR socket option, though. This
can be checked using the tcp-testsuite, temporarily disabling the
getsockopt(SO_ERROR) lines using sed command [3]. Most of these
getsockopt(2)s are followed by '+0.00 close(3) = 0', which will confirm
that close(2) doesn't return ECONNRESET even on a socket that has the
error stored, neither it is returned in the case described in the manual
page. The latter case is covered by multiple tests residing in tcp-
testsuite/state-event-engine/rcv-rst-*.
However, the deleted block of code could be entered in a race condition
between close(2) and processing of incoming packet, when connection had
already been half-closed with shutdown(SHUT_WR) and sits in TCPS_LAST_ACK.
This was reported in the bug 146845. With the block deleted, we will
continue into tcp_disconnect() which has proper handling of INP_DROPPED.
The race explanation follows. The connection is in TCPS_LAST_ACK. The
network input thread acquires the tcpcb lock first, sets INP_DROPPED,
acquires the socket lock in soisdisconnected() and clears SS_ISCONNECTED.
Meanwhile, the syscall thread goes through sodisconnect() which checks for
SS_ISCONNECTED locklessly(!). The check passes and the thread blocks on
the tcpcb lock in tcp_usr_disconnect(). Once input thread releases the
lock, the syscall thread observes INP_DROPPED and returns ECONNRESET.
- Thread 1: tcp_do_segment()->tcp_close()->in_pcbdrop(),soisdisconnected()
- Thread 2: sys_close()...->soclose()->sodisconnect()->tcp_usr_disconnect()
Note that the lockless operation in sodisconnect() isn't correct, but
enforcing the socket lock there will not fix the problem.
[1] https://pubs.opengroup.org/onlinepubs/9799919799/
[2] https://github.com/freebsd-net/tcp-testsuite
[3] sed -i "" -Ee '/\+0\.00 getsockopt\(3, SOL_SOCKET, SO_ERROR, \[ECONNRESET\]/d' $(grep -lr ECONNRESET tcp-testsuite)
PR: 146845
Reviewed by: tuexen, rrs, imp
Differential Revision: https://reviews.freebsd.org/D48148
(cherry picked from commit 053a988497342a6fd0a717cc097d09c23f83e103)
Switching between io and cpu sorting uses a great example in the usage.
[-m io | cpu]. Use that everywhere.
MFC after: 3 days
Reviewed by: mhorne
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D49515
(cherry picked from commit 187d954eab94fdcb33609d91966dbd727acfd720)
Organize key bindings by ascii(7) for consistency and maintainability,
mark them as Interactive Commands, wordsmith them, and sync their
organization between the manual and help screen.
MFC after: 3 days
PR: 282734
Fixes: c8aa5e526 (move command mapping to commands.c)
Reviewed by: imp, mhorne, Jim Brown <jpb@jimby.name>
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D49462
(cherry picked from commit 0a85254d5a33800600477ce57fbaab64591aa6ea)
I recommended the incorrect text to the submitter.
MFC after: 3 days
Fixes: f47cbb29e1c2 (Add /dev/gpt)
Reported by: Mark Millard <marklmi@yahoo.com>
Reviewed by: imp, mhorne
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D49523
(cherry picked from commit 50296dccddf1a7734be2aef606cd8e0408ee8780)
Amazon EC2 m7i cloud instances use PCI hotplug rather than ACPI
hotplug. The card is removed and detach is called to remove the drive
from the system. The hardware is no longer present at this point, but
the bridge doesn't translate the now-missing hardware reads to all ff's
leading us to conclude the hardware is there and we need to do a proper
shutdown of it. Fix this oversight by asking the bridge if the device is
still present as well. We need both tests since some systems one cane
remove the card w/o a hotplug event and we want to fail-safe in those
cases.
Convert gone to a bool while I'm here and update a comment about
shutting down the controller and why that's important.
Tested by: cperciva
Sponsored by: Netflix
(cherry picked from commit dc95228d98474aba940e3885164912b419c5579d)
Since the beginning, Unix has included an ASCII chart. Over the last
half a century to this day, the most common format for lexographical
organization in files is according to ASCII. Consistency is maintainable
and for that reason, crossreference ascii(7) promenently in the
introduction to the File Formats Manual. Additionally, this demonstrates
the often softer style of bullet lists in the manual tradition.
PR: 248562
MFC after: 3 days
Reviewed by: mhorne
Approved by: mhorne (mentor)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1534
(cherry picked from commit a6175f28da7018ba9f824f48fe6db732bd9cb501)
Explain a little about everything is a file,
matching the style of earlier intro pages.
PR: 248562
MFC after: 3 days
Approved by: mhorne (mentor)
Reviewed by: imp, mhorne, Lexi Winter <lexi@le-fay.org>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1534
(cherry picked from commit 37508388d066826d0a36b5ec646c95a9ffb00d28)
Looking around at how everyone else is doing it, this list seems nearly
perfect to me and we should just import it from them. I have added "and
streams" because we have some explanations of those in this section too.
PR: 248562
MFC after: 3 days
Obtained from: OpenBSD
Approved by: mhorne (mentor)
Reviewed by: imp, mhorne, Lexi Winter <lexi@le-fay.org>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1534
(cherry picked from commit 26ec376536622e8fec8f40847aa9b2d1121d585d)
New users are sometimes confused about the difference between /etc/ and
/usr/local/etc. Explain this in the manual as we did in intro(1). Link
hier(7) which now lists base system configuration files in /etc/. Add a
section number to HISTORY for clarity.
PR: 248562
MFC after: 3 days
Approved by: mhorne (mentor)
Reviewed by: imp, mhorne, Lexi Winter <lexi@le-fay.org>
Pull Request: https://github.com/freebsd/freebsd-src/pull/1534
(cherry picked from commit 8d65152cbfc8861f6920846dea6f540c673ab7b6)
Thus far we've relied on the firmware setting HFSCR correctly, enabling
all facilities. However, it appears some recent firmwares do not.
Linux explicitly enables all facilities it supports (including
transactional memory, which new firmwares apparently do not enable), so
do the same here, explicitly enable all the facilities FreeBSD supports.
MFC after: 1 week
(cherry picked from commit fe73eb441f1c98fe350f4822c7d2abfeef046bf8)
Treat Hypervisor Facility Unavailable as an illegal instruction in user
space. This way programs that use facilities like transactional memory,
which will never be supported as it has been removed from the ISA, will
not crash the kernel.
Tested by: pkubaj
MFC after: 1 week
(cherry picked from commit 0b663e0cee89dedf5b070ff4e839d5ad95061535)
main.c - Fix rsdp cast.
framebuffer.c -
- Use temp variable instead of directly passing pointer when
EFI_PHYSICAL_ADDRESS is expected.
Also fix FreePages cast.
- Mask framebuffer address given to us by UEFI.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit 6818ff7797c6a9ab104e5d7e91d4e422874bf50d)
Per the "Intel® 64 and IA-32 Architectures Software Developer’s Manual
Combined Volumes: Vol. 3B 17-7", the Green and Yellow threshold
indicators are mutually exclusive. Add the missing `break` statements so
they're treated that way.
MFC after: 1 week
Reported by: Coverity
Differential Revision: https://reviews.freebsd.org/D48722
(cherry picked from commit 36d7d2044b934103ad9254cd03ea61245c16ccda)
This change is being done first so any functional changes from the tests
will be clearer to reviewers.
No functional change intended.
MFC after: 2 weeks
Ref: https://reviews.freebsd.org/D47826
(cherry picked from commit 991bd461625a2c521d5be4fd6938deed57f60972)
- Fix allocation size in config_get_repositories().
- Fix a memory leak in read_conf_file().
- Avoid a null pointer dereference in an error path in
verify_pubsignature().
Fixes: e3b4a51580fc ("pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME")
Fixes: dc4581589a32 ("pkg: clean support for repositories")
(cherry picked from commit c1557708f1fae1bb9c8e23e3bbb2aa2b055e1211)
FreeBSD Release Infrastructure has been building the Hardware
Release Notes from these subsections in the Kernel Interfaces Manual.
Standardize this behavior in the FreeBSD Manual page style guide with
everything we learned in the 14.2-RELEASE.
To me, this is an enormously exciting discovery, and I believe that
over the next 5 years, this can transform the supported hardware UX,
without reinventing the wheel, by doubling down on our ways instead
of reinventing them.
MFC after: 3 days
Reported by: bz (special thanks)
Reviewed by: imp, mhorne, pauamma, rpolaka
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D48343
(cherry picked from commit 29eb4de61a4c2ab1d940e10f3816db79e74d46b1)
Show two examples in PORTS_MODULES to demonstrate space separation.
This also shows off our working PRIME dual-gpu support.
Switching to this doubled my laptop's battery life!
MFC after: 3 days
Reviewed by: mhorne
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D48342
(cherry picked from commit dcef6ce862cd19b3496486469cc631bb1b71fcbf)
Printing the file name doesn't make sense since mkstemp failing means
that the file wasn't created.
Also add a test case for this.
Co-authored-by: Jose Luis Duran <jlduran@gmail.com>
Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1383
(cherry picked from commit e8d027be6b84ac976eacd46283c286b934dd6f1f)
With the %b format specifier we need enough space to write a uintmax_t
in binary.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1400
(cherry picked from commit d4f9e326393e3298062a58338e2c94ef6baff8b5)
This can be useful when making alternate versions of the loader.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit dcc7b3698d03b2aedc68e88b4e05a0b32b435429)
Prevent G(4) and over from overflowing for 32-bit builds.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit 5360d017be83d2502ba262f391ef45b07e0de680)
In preparation for supporting 64-bit machines with 32-bit UEFI firmware,
add a build option for compiling the ia32 loader. Currently unused.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit fe3f792f9a2982678138e239f5e8d66e8ee71aeb)
In preparation for supporting 64-bit machines with 32-bit UEFI firmware,
add a 32-bit variant of libefi since we need to compile both the 64-bit
version and the 32-bit version at the same time.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit f0d5b1bdf075c68ddb1dcfbc5a0eda0214510b5b)
Using AllocateMaxAddress here means that gfx_state->tg_shadow_fb is
treated as the highest address we can receive. Since
gfx_state->tg_shadow_fb is NULL, we never receive anything. Use
AllocateAnyPages instead.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit 95f75b0e6e5f71d34e4eef151f43822e33838663)
Some machines have 64-bit capable cpus but are stuck on 32-bit uefi
firmware.
Add support for them by building a new "loader_ia32" with
LOADER_DEFAULT_INTERP along with the 64-bit one. The loader
can be disabled using MK_LOADER_IA32.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit f8ca5d45c3c1829759ecd87cb95d53e5ab7d0811)
This handles copying in install-boot.sh and bsdinstall's bootconfig.
install-boot.sh:
make_esp_file now optionally takes extra arguments so it can copy
multiple files. This is used by the amd64 release scripts.
make_esp_device also takes an extra optional argument for efibootname.
This is currently unused, but it can be used in the future to do
something like:
make_esp_device loader.efi bootx64
make_esp_device loader_ia32.efi bootia32
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098
(cherry picked from commit 599273f942b8dc6f957487bb28f36694dab9dad2)
10ms seems to be too strict for some configurations, so increase to
20ms.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1327
(cherry picked from commit e152944f1a16a4ff33b4e20b813ce4a54b884b90)
The UEFI spec states that the minimum garunteed terminal resolution is
80x25.
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1292
(cherry picked from commit 3b68c491d37196bb76a95bce3c02f7c6d5ba22fd)
The longest command we have is "efi-autoresizecons". That combined with
the two spaces before and after the command gives us a total of 23
characters including the null-terminator.
Also move the two trailing spaces to their own pager_output call so they
don't get truncated if the command is too long and increase the minimum
string length to 20 in order to fix alignment issues caused by the
increased buffer size.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1277
(cherry picked from commit ab08da5328b4175e399d8e59adc4dfad0eea24f1)