stat: fix use of devname(3)
Besides being a little hard to parse through visually, this had its own
bug of inspecting st->st_mode to determine what to pass to devname(3),
which is only correct for st_rdev.
For st_dev, you're likely to be looking at files or directories and
attempting to assess what device they're located on, so the mode is
meaningless- we just have to assume that our filesystems are on
character devices and attempt to resolve st_dev as such.
Reviewed by: des, kib (previous version)
Differential Revision: https://reviews.freebsd.org/D56565
(cherry picked from commit 4d4acdbfc22c84081037f31cff4fb03d18373036)
stat: The devname test case requires root
Fixes: 4d4acdbfc22c ("stat: fix use of devname(3)")
[24 lines not shown]
stat: Nits in stat tests
* Use ourselves as test file instead of /COPYRIGHT, which may or may not
be present in the test environment.
* atf-check understands \n in strings, use it.
* Some file systems don't like creating small holes, so create large ones
instead. This means we need two variables: ps (page size) is the
minimum size of a data region and the alignment for a hole, while hs
(hole size) is the minimum size of the holes we create. This makes no
difference on FreeBSD but makes it easier to port the test to other
platforms.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D56304
(cherry picked from commit 8cbd3949297d56e3960dcde73bd7e2277ac4bee8)
stat: Nits in readlink tests
* The f_flag test may fail if a component of the full path to the
temporary directory is a symbolic link.
* The n_flag test had an empty head; give it a description.
* Use consistent quoting.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D56293
(cherry picked from commit 1c793e7cbe2ecded388fd51fb20274891620a6f4)
net80211: delete the deprecated ieee80211_wepkey struct
This hasn't been used in a long time, and since I am shuffling around
the net80211 crypto API a bunch, let's just delete it instead of
leaving it here and trying to figure out how to support it if it's
used by userland somehow.
Reviewed by: guest-seuros
Differential Revision: https://reviews.freebsd.org/D57312
net80211: create IEEE80211_KEYBUF_128_SIZE / IEEE80211_MICBUF_128_SIZE
The IEEE80211_KEYBUF_SIZE and IEEE80211_MICBUF_SIZE are sprinkled
throughout the net80211 stack, ioctl API and drivers. This makes it
challenging to (eventually) up IEEE80211_KEYBUF_SIZE to support 256 /
384 bit encryption as, well, it'll break every single driver and the
ioctl API in doing so.
So as part of this, let's start to separate out the current key/mic
buffer size from what drivers and the ioctl layer are using.
Drivers especially shouldn't be using these definitions as their
key sizes are hardware / firmware API limits, not net80211 limits.
Ideally drivers would define their own key buffer / mic buffer
sizes and only copy in keys up to that length (and fail keys
that are too large) but the current net80211 API isn't there yet.
This doesn't yet change what defines / buffer sizes are used in the
ioctl layer. I'm going to plan out some subsequent work to
separate out those defines and ioctl APIs so they maintain using
[4 lines not shown]
net80211: add DEFERRED_WORK.md
Describe the ieee80211_task API, why its used and some of
its shortcomings.
Differential Revision: https://reviews.freebsd.org/D57261
rc: Bail if /dev/null is not a device
On startup, check that /dev/null exists and is a character device.
Otherwise, one of two things will happen: either /dev is a writable
directory and we will immediately create /dev/null as a regular file
and dump garbage into it, or it does not and we will spit out a stream
of error messages about failing to create /dev/null.
PR: 295782
MFC after: 1 week
Reviewed by: jhb, emaste
Differential Revision: https://reviews.freebsd.org/D57447
(cherry picked from commit b5a96894f67a92f78f0641763eff1e0a46f2e036)
etcupdate: Make diff -l actually work
While here, remove unnecessary blank lines.
MFC after: 1 week
Fixes: 6d65c91b9a47 ("etcupdate: fix arguments order of diff command")
Reviewed by: Boris Lytochkin <lytboris at gmail.com>
Differential Revision: https://reviews.freebsd.org/D57330
(cherry picked from commit a85e39030f8c7faa3d5a33373389440de6f0fff7)
libarchive: Clean up the build configuration
* Move settings duplicated in libarchive, bsdcat, bsdcpio, bsdtar, and
bsdunzip into libarchive's Makefile.inc.
* Drop some CFLAGS that merely duplicated some of the contents of our
platform configuration header.
MFC after: 1 week
Reviewed by: mm
Differential Revision: https://reviews.freebsd.org/D57307
(cherry picked from commit eb3a0a74a069d0f294e1596504676459282bb308)
libarchive: Fix typo in sed command
MFC after: 1 week
Fixes: eb3a0a74a069 ("libarchive: Clean up the build configuration")
Reported by: Shawn Webb <shawn.webb at hardenedbsd.org>
[2 lines not shown]
rc: Bail if /dev/null is not a device
On startup, check that /dev/null exists and is a character device.
Otherwise, one of two things will happen: either /dev is a writable
directory and we will immediately create /dev/null as a regular file
and dump garbage into it, or it does not and we will spit out a stream
of error messages about failing to create /dev/null.
PR: 295782
MFC after: 1 week
Reviewed by: jhb, emaste
Differential Revision: https://reviews.freebsd.org/D57447
(cherry picked from commit b5a96894f67a92f78f0641763eff1e0a46f2e036)
libarchive: Clean up the build configuration
* Move settings duplicated in libarchive, bsdcat, bsdcpio, bsdtar, and
bsdunzip into libarchive's Makefile.inc.
* Drop some CFLAGS that merely duplicated some of the contents of our
platform configuration header.
MFC after: 1 week
Reviewed by: mm
Differential Revision: https://reviews.freebsd.org/D57307
(cherry picked from commit eb3a0a74a069d0f294e1596504676459282bb308)
libarchive: Fix typo in sed command
MFC after: 1 week
Fixes: eb3a0a74a069 ("libarchive: Clean up the build configuration")
Reported by: Shawn Webb <shawn.webb at hardenedbsd.org>
[2 lines not shown]
etcupdate: Make diff -l actually work
While here, remove unnecessary blank lines.
MFC after: 1 week
Fixes: 6d65c91b9a47 ("etcupdate: fix arguments order of diff command")
Reviewed by: Boris Lytochkin <lytboris at gmail.com>
Differential Revision: https://reviews.freebsd.org/D57330
(cherry picked from commit a85e39030f8c7faa3d5a33373389440de6f0fff7)
libalias: Serialize updates to the global instance list
libalias maintains a global list of all libalias handles. The list was
updated without any locking, but nothing prevents updates from running
concurrently.
MFC after: 1 week
ip6: Drop dead code in ip6_input_hbh()
After commit 069a67374ed9, ip6_input() quickly rejects packets with
plen == 0, before ip6_input_hbh() is called. So, there is no need to
check this condition again in the helper function.
Reviewed by: pouria, zlei, tuexen
Differential Revision: https://reviews.freebsd.org/D57342
auditd: Fix signal handling
Rewrite the main loop to use ppoll() instead of just blocking on read,
blocking the signals we care about when we aren't polling.
I didn't bother replacing alarm() with setitimer(); the alarm code
is dead anyway since there is no way for max_idletime to acquire a
non-zero value.
While here, avoid leaking the pid file and trigger descriptors to the
log child.
PR: 295840
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D57451
mount_udf.8: Alphabetize and align options
While here, remove "The following UDF specific options are available:".
It is unused and does not appear to have ever been used.
MFC after: 3 days
linux: Fix sockopt copyout
The Linux getsockopt did not check the size of the provided buffer when
copying out the value, leading to buffer overflows (e.g., for TCP_INFO).
Fix is to use the smaller of the option value size and the provided
buffer.
MFC after: 1 month
Relnotes: yes
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D55881
nuageinit: Create parent directories in write_files
Currently, 'write_files' does not create parent directories, and
'runcmd' cannot be used here, since those scripts run after the files
have been written. The only workaround is to create the files in an
existing directory, such as '/root' or '/tmp', and then move those
files using 'runcmd', but this is cumbersome when there are many files,
even if they are small.
With this change, nuageinit now creates the parent directories for each
file using the path field, which mimics the same behavior as in
cloud-init.
Permissions and ownership can also be configured using 'runcmd'.
Reviewed by: bapt@
Approved by: bapt@
Differential Revision: https://reviews.freebsd.org/D57395
ipfw nat: Add assertion that mbuf is not a chain
Discarding m_free's return value will result in an mbuf leak if the mbuf
was in a chain.
In general we should use m_freem if the mbuf may be in a chain, or
assert that the return was NULL. There will not be a chain here due to
m_megapullup, so add an assert.
Reviewed by: ae
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57479
acl_id_to_name.c: Fix printing of uids and gids
uid_t and gid_t are uint32_t (unsigned 32bit integers).
They are printed as signed integers when calling getfacl
(and other tools using the acl_to_text() libc function).
This causes uid/gids larger than 2G (214783648) to print
as negative numbers
- which causes problem with setfacl since the acl_from_text()
libc function fails on negative numbers.
(cherry picked from commit 6e7c10c79deac3c6bb6ad3bd12c8e0ad68bb59f0)
exit1(9): do not deadlock if exit is called due to PT_SC_REMOTERQ
The remote syscall is executed in the context where debugger owns a
p_lock hold on the target. Due to this, exit1() waiting for p_lock
going to zero, never happen.
Postpone the exit1() call to ast then, saving the provided rval and
signo in the struct proc. Mark the async-exiting proc with the new
p_flag P_ASYNC_EXIT.
While p_xexit can be reused, p_xsig can be only set by actual exit1(),
otherwise it breaks the ptrace mechanism. Allocate a dedicated p_asig
for it.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57482
procstat binary: do not skip pid if either path or osrel sysctls failed
PR: 295893
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D57493
src.opts.mk: Comment about CTF & DTRACE relationship
WITH_CTF enables building userland components with CTF, and not the ctf*
tools as one might expect. The tools are actually included with the
DTRACE knob. Add a comment where the dependency is handled, as this has
caused confusion.
Reported by: ivy
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56977
(cherry picked from commit f6178451eea5b1ce6802fbb0e6eceb555c7b4841)