Update dirdpes.mk et al
Update to latest dirdeps related makefiles.
dirdeps.mk tweaks useful for universe among other corner cases.
also additional filtering for bogus paths ending in /
gendirdeps.mk allow more debugging
also additional filtering for bogus paths ending in /
install-new.mk fix bug when isPOSIX_SHELL is true
meta2deps.?? handle file names with spaces by ignoring them
Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D57683
imgact_elf.c indicate that interpreter is an interpreter
Use a value that do_execve will ignore since there's nothing there to do.
With this we can set the 'indirect' flag on rtld, to prevent direct execution
being used to bypass the 'indirect' flag on python3:
root at vuefi:~ # /libexec/ld-elf32.so.1 /usr/bin/python3 -c 'print("pwned")'
pwned
root at vuefi:~ # veriexec -z enforce
root at vuefi:~ # /libexec/ld-elf32.so.1 /usr/bin/python3 -c 'print("pwned")'
/libexec/ld-elf32.so.1: Operation not permitted.
root at vuefi:~ #
load_file seems missnamed since it is only used by load_interp
so rename it to load_interp_file.
Reviewed by: imp
Sponsored by: Hewlett Packard Enterprise Development LP
Differential Revision: https://reviews.freebsd.org/D57649
thunderbolt.4: Explain what driver does in manpage
Reviewed by: ziaee, ngie
Approved by: ziaee
Fixes: 2f7a796b590e ("thunderbolt.4: Initial manual for HW Relnotes")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57668
jail: call PR_METHOD_ATTACH again (with old jail) if the first call fails
jail_attach lets modules do attachment-specific work by calling
osd_jail_call(PR_METHOD_ATTACH). If one of the modules returns an
error, the call needs to be repeated with the thread's current prison,
so possible earlier modules and undo any changes they may have made.
MFC after: 5 days
firewire: extract shared helpers from fwe and fwip
Add fw_net.h with common inline helpers used by both if_fwe and
if_fwip: ISO chunk init, TX xfer allocation, xferlist free,
send queue drain, and DEVICE_POLLING ioctl handling.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D57615
sys/cdefs.h: Introduce __maybe_unused attribute
The __maybe_unused attribute should be used for variables which may or
may not be used, such as when their only use is in an assertion. This
attribute is functionally identical to __unused, suppressing compiler
warnings for particular variable if it remains unused.
Reviewed by: Minsoo Choo <minsoo at minsoo.io>, imp
Differential Revision: https://reviews.freebsd.org/D56517
(cherry picked from commit 84a95741805d84f0074a34d61b93ccf86f422cf3)
rc.d/routing: Silence errors for loopback routes
_loopback entry in `static_routes` ensures a loopback route
exists in all routing tables.
However, loopback routes may already be added by the kernel.
Therefore, re-adding them triggers an `EEXIST` error on every boot.
This change suppresses those harmless errors.
PR: 259553
MFC after: 1 week
Reviewed by: glebius, jlduran, markj
Differential Revision: https://reviews.freebsd.org/D57470
(cherry picked from commit 9f80c8b90bdaa8ffac887a8c478a16c84d74a87b)
tests: Add pjdfstest integration
Use ATF to wrap the new reimplementation of pjdfstest that came out of
GSOC 2022, now available in the ports tree as filesystems/pjdfstest.
So far I added tests for UFS (with several different option
combinations), tmpfs and ZFS, plus ZFS+nullfs. All of these create a
memory disk, initialize the filesystem, and point the pjdfstest
executable at it.
In the future it would be good to add tests for at least NFS and p9fs.
Reviewed by: asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D56605
ctermid(3): Fix return values section
ctermid() doesn't, and has never, set errno.
While here, add ctermid_r to the name section and align the parameter
name in the source file.
Reviewed by: bnovkov
Approved by: bnovkov
MFC after: 3 days
Obtained from: https://github.com/apple-oss-distributions/libc
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D57396
uart: Add support for the Intel XScale controller
The ns8250 driver avoids clearing IER bit 0x10 to account for the
split "receiver time-out interrupt enable" bit, but it never sets
it in `ier_rxbits` even though a comment in `ns8250_init` implies so.
Fix this by setting `IER_RXTMOUT` if we've matched an XScale uart.
Differential Revision: https://reviews.freebsd.org/D57629
Reviewed by: imp
MFC after: 2 weeks
netlink: Indicate that ifinfomsg uses IFT_* types
On Linux struct ifinfomsg uses ARPHRD_* values, while we used IFT_*
types (which derive from SNMP ifType definitions in RFC 1573).
Update the header to reflect this.
PR: 272144
Reviewed by: pouria
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57334
(cherry picked from commit 21a75a85f0e0cc328b6e9b437d783ef0c25dc52e)
bsnmpd/snmp_hostres: fix hrFSTable remoteMountPoint leak
Free the previous value before re-strdup'ing, and initialise
remoteMountPoint to NULL in fs_entry_create() so the free() is safe on
the newly-created path
Observed via a dtrace leak snapshot on 15.0-RELEASE-p4:
data leaked = 1983, count = 1683
libc.so.7`malloc+0xa8
snmp_hostres.so.6`fs_tbl_process_statfs_entry+0x276
snmp_hostres.so.6`refresh_storage_tbl+0x502
snmp_hostres.so.6`op_hrStorageTable+0x1a
libbsnmp.so.7`0x2a2b1892ba3d
libbsnmp.so.7`snmp_getbulk+0x37f
Reviewed by: sjg, ngie
Differential Revision: https://reviews.freebsd.org/D57604
d.7: Correct a few typos in the manual page
- s/occurance/occurrence/
- s/Univeristy/University/
(cherry picked from commit 8a13adf80cb0dffb9fa7ca515664171c2362ad5e)
linux: implement SO_PASSRIGHTS
We have a native version now, plumb it through to the Linuxolator.
Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D57427
tests: unix: pull a recvfd_payload_cmsg out of recvfd_payload
This is almost a trivial factoring, but it's still a bit of boilerplate
that we don't care to rewrite- the SO_PASSRIGHTS test will still receive
some data, so the iovec construction still saves us a few lines.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D57544
tests: unix: add SCM_RIGHTS tests for SO_PASSRIGHTS
We test both the standard case where we want to reject any SCM_RIGHTS
message, as well as the case where the kernel discards the unwanted file
upon receipt.
Reviewed by: glebius (previous version), markj
Differential Revision: https://reviews.freebsd.org/D57426
sockets: plumb SO_PASSRIGHTS into *sockopt(2)
This is a little different than the others in that it's not valid for
anything but unix(4) sockets. New cases were added that jump into the
more standard case out of a light preference for not taking advantage of
case FALLTHROUGH with the additional logic- it doesn't scale very well
for new cases added that might be slightly special, so we might as well
just add the labels up-front.
Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D57424
socket: remove tautological condition in so_unsplice()
so2rele was introduced in 1000cc4a0d3 and it was necessary there, but
the cleanup in a837d1fe49e0255 rendered it redundant if our own KASSERT
is to be believed: we've asserted that `so2->so_splice_back == sp` and
`sp` has been dereferenced above, so there's no condition left where
we shouldn't release the socket reference at the end. Indeed, the
change in so_splice() to NULL out sp->dst removes that possible state of
a partially constructed splice: if sp->dst is set, it has been ref'd.
Reviewed by: gallatin, markj
Differential Revision: https://reviews.freebsd.org/D57558
unix: implement basic SO_PASSRIGHTS functionality
With exception to sockopt functionality, implement the so_options flag
in unix(4) itself. The general argument for the flag is that SCM_RIGHTS
can be used maliciously for, e.g., a DoS that the receiving side can't
avoid if it is expecting other control messages.
This option gives the receiver a way to disable SCM_RIGHTS on the
sender-side, surfacing an EPERM to them instead. This seems to match
the semantics that Linux offers.
If an SCM_RIGHTS was already sent before we disabled SO_PASSRIGHTS, then
a subsequent recvmsg(2) will silently discard any in-flight files. This
has the downside of punting a file with the potential to hang over to
the deferred-close task, but perhaps usage of the option would
discourage folks from attempting to take advantage of that possibility
anyways.
Various manpages updated to describe the new behavior.
[10 lines not shown]
thunderbolt: do not enable in GENERIC
The thunderbolt implementation is not 100% complete and causes some
suspend/resume issues. Comment out the device until it is better
fleshed out and some of the core issues with it are resolved.
MFC after: 1 week
Requested by: obiwac
Differential Revision: https://reviews.freebsd.org/D57650
stand: Bulk operations on each gfxfb_blt if shadow buffer enabled
Previously, gfxfb_blt flushed the framebuffer on every call. Since a
single drawing operation may invoke gfxfb_blt multiple times, this can
result in unnecessary flushes.
Instead, write updates to the shadow buffer (when present) and mark the
affected area as dirty. Flushing is deferred so multiple gfxfb_blt calls
can be coalesced into a single update. As before, only the dirty region
is flushed.
This fixes the slow bootloader problem in some platforms.
Reviewed by: imp, adrian, obiwac
Tested by: obiwac, jrm
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57373
virtual_oss(8): Make sndstat FD global
There is no reason to have per-profile copies, plus this way we open
/dev/sndstat multiple times if more than 1 profile is created.
Also close the FD on exit to avoid leaking.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: jrm
Pull-Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/41
(cherry picked from commit 93a234a694f37d373acf303a247d129dda28044e)