The CAPFAIL tracepoint was recently extended to report ECAPMODE
capability violations for processes that do not enter capability mode.
This allows developers that are interested in Capsicumizing their
programs to determine where violations are being raised.
Previously, CAPFAIL only produced output for processes using Capsicum(4)
capabilties. Thus, most ktrace users never received log output from the
trace point. With the recent changes, this is no longer the case.
Having this trace point enabled by default will produce output for all
processes that use syscalls that are not permitted in capability mode.
This may lead to confusion for users that are not familiar with the
feature. Remove KTRFAC_CAPFAIL from ktrace's default points to avoid
this.
Approved by: markj (mentor)
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44887
(cherry picked from commit f239db4800ee9e7ff8485f96b7a68e6c38178c3b)
When a Capsicum violation occurs in the kernel, ktrace will now record
detailed information pertaining to the violation.
For example:
- When a namei lookup violation occurs, ktrace will record the path.
- When a signal violation occurs, ktrace will record the signal number.
- When a sendto(2) violation occurs, ktrace will record the recipient
sockaddr.
For all violations, the syscall and ABI is recorded.
kdump is also modified to display this new information to the user.
Reviewed by: oshogbo, markj
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D40676
(cherry picked from commit 9bec84131215ed554f435e208399f36e982246f1)
This was prompted by noticing that '/var/db/portsnap' still exists on
newly-installed machines.
With this change, all mentions of portsnap(8) in the tree are gone,
except for the historical note in the AUTHORS section of manpage
phttpget(8).
locate(1) will thus start indexing again '/var/db/portsnap' on machines
where this directory still exists, which may be a good way to push
administrators to delete it.
Reviewed by: cperciva
Approved by: emaste (mentor)
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45023
(cherry picked from commit 9b30b96c1fa4ee0dfc540878fbb3247bf92d19eb)
ObsoleteFiles.inc: Remove /var/db/portsnap
This is a followup to commit "Remove remnants of portsnap(8)"
(9b30b96c1fa4). I wasn't aware of OLD_DIRS.
Approved by: markj (mentor)
MFC after: 1 day
MFC with: 9b30b96c1fa4
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45023
(cherry picked from commit 54bbcc09a72b5d7a581f51416c9e635a33c2f884)
Approved by: markj (mentor)
Libarchive 3.7.3
New features:
#1941 uudecode filter: support file name and file mode in raw mode
#1943 7-zip reader: translate Windows permissions into UNIX
permissions
#1962 zstd filter now supports the "long" write option
#2012 add trailing letter b to bsdtar(1) substitute pattern
#2031 PCRE2 support
#2054 add support for long options "--group" and "--owner" to tar(1)
Security fixes:
#2101 Fix possible vulnerability in tar error reporting introduced
in f27c173
Important bugfixes:
#1974 ISO9660: preserve the natural order of links
#2105 rar5: fix infinite loop if during rar5 decompression the last
block produced no data
#2027 xz filter: fix incorrect eof at the end of an lzip member
#2043 zip: fix end-of-data marker processing when decompressing zip
archives
(cherry picked from commit b9128a37faafede823eb456aa65a11ac69997284)
Add a -w flag to forward terminal resize events on to the child, which
can be useful in some circumstances to avoid terminal corruption.
Reviewed by: des
Co-authored-by: Xavier Beaudouin <xavier.beaudouin@klarasystems.com>
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
(cherry picked from commit 8ceac8e13dccbe4e177c8f2f443b87b7d2e3edb3)
Fix some nits pointed out by checkstyle9.pl in advance of functional
changes to script(1).
Reviewed by: des
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
(cherry picked from commit 4459abe334eb4dbd416fa8094a64afc065ccd1cc)
Fixes: 4336161cc9c6 ("install: Don't skip syncing in the common case.")
Reviewed by: imp, des
Differential Revision: https://reviews.freebsd.org/D44866
(cherry picked from commit 2f44f86575f9cba5da28b762c359f7a806400744)
Previously, we would only use a temporary file if explicitly asked to
with the `-S` option, and even then, only if the target file already
existed. This meant that an outside observer looking for the target
file might see a partial file, and might see the file disappear and
then reappear.
With this patch, we always use a temporary file, ensuring atomicity.
The downside is slightly increased disk usage. The upside is never
having to worry about, for instance, cron jobs randomly failing if
they happen to run simultaneously with `make installworld`.
The `-S` option is retained, partly for compatibility, and partly
to control the use of `fsync(2)`, which has a non-negligible cost
(approximately 10% increase in wall time for `make installworld`).
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: 0mp, brooks, imp, markj
Differential Revision: https://reviews.freebsd.org/D44742
(cherry picked from commit e5035d08578e372d40b4e2d4c3574b7583549bd6)
install: Simplify path construction.
There's no need to copy the path twice to split it into base and dir.
We simply call `basename()` first, then handle the two trivial cases in
which it isn't safe to call `dirname()`.
While here, add an early check that the destination is not an empty
string. This would always fail eventually, so it may as well fail
right away. Also add a test case for this shortcut.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44743
(cherry picked from commit 17dc7017d7375b3463d65adffe1eb980b0f86795)
install: Don't skip syncing in the common case.
In `copy()`, if no digest was requested (which is the common case), we
use `copy_file_range()` to avoid needlessly copying the contents of the
file into user space and back. When `copy_file_range()` returns
successfully (which, again, is the common case), we simply return, and
therefore never get to the point where we call `fsync()` if the `-S`
option was specified. Fix this.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44756
(cherry picked from commit 4336161cc9c631d40d00adee97dfc8161b6bec9f)
install: Remove the mmap(2) option.
We already removed it from cp(1) over a year ago but never followed up
here. Do so now, for the same reasons: significant complexity for
little to no benefit.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44809
(cherry picked from commit a0439a1b820fa0e742c00d095f5f5c06f5f19432)
install: Assorted nitpickery.
* Use `errc()` instead of manually setting `errno` before calling `err()`.
* Change one warning into a fatal error.
* Drop some unnecessary casts.
* `strlcat()` bounds checks were off-by-one. This does not matter in
practice because the subsequent code renders an overrun harmless.
* We were passing `SSIZE_MAX` to `copy_file_range()` instead of the
requested size. This only matters if we're asked to install a file
which is still being written to while we are copying it.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44810
(cherry picked from commit 000a533e6d1db9878296b32d1cc212e11a2cc718)
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
last commit before the upstream release/18.x branch was created.
PR: 276104
MFC after: 1 month
(cherry picked from commit 7a6dacaca14b62ca4b74406814becb87a3fefac0)
This marks the start of the FreeBSD 14.1 release cycle; the stable/14
tree is now in "code slush".
Developers are encouraged to prioritize fixing bugs (and/or merging bug
fixes from HEAD) over new features at this time. Commit approval from
re@ is not required but if new features introduce problems they may be
removed from the release.
Approved by: re (implicit)
Some leaf directories were missing Makefile.depend files or needed
architecture-specific Makefile.depend.* files.
(cherry picked from commit e5b786625f7f82a1fa91e41823332459ea5550f9)
The "pathlen" variable is the return value of strlen(3) and is then
passed as an argument to malloc(3) and memcpy(3). The size_t type
matches the prototype for these functions. The size_t type is unsigned
so it can fit larger $PATH values than ssize_t. However, in practice
ssize_t should be larger enough so this change is just for clarity.
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1113
(cherry picked from commit 8268a31bcceb9ebe32d380cab792c89c5d897d15)
In 2005, Gnu find deprecated '+' as the leading character for the -perm
argument, instead preferring '/' with the same meaning. Implement that
behavior here, and document it in the man page.
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1060
(cherry picked from commit 2a121b97e9673ff37062c9fa026eee969940d2e2)
This commit reverts 8db56defa766eacdbaf89a37f25b11a57fd9787a,
rolling back the vendor import of xz 5.6.0 and restoring the
package to version 5.4.5.
The revert was not directly due to the attack (CVE-2024-3094):
our import process have removed the test cases and build scripts
that would have enabled the attack. However, reverting would
help to reduce potential confusion and false positives from
security scanners that assess risk based solely on version
numbers.
Another commit will follow to restore binary compatibility with
the liblzma 5.6.0 library by making the previously private
symbol (lzma_mt_block_size) public.
PR: 278127
(cherry picked from commit 2f9cd13d6c1824633251fb4267c9752d3b044a45)
Note that VFS internally interprets a timestamp of -1 as “do not set”,
so this has no effect, but at least touch won't incorrectly reject the
given date / time (1969-12-31 23:59:59 UTC) as invalid.
While here, fix some style issues.
MFC after: 1 week
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44504
(cherry picked from commit aa69e0f212630bd6d4ec1c3c54e117be16653e8a)
touch: Add unit tests.
MFC after: 1 week
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D44505
(cherry picked from commit 74a4aa9b1517d92bfa85b0b1cd7d4c1262bb1ef9)
mkimg may make severe load only to fail in the end
if output is non-seekable pipe, socket or FIFO
unless output format is raw disk image.
Check it out and fail early. Make it clear in the manual.
(cherry picked from commit 7f0dc6e2cdfa0317c9917dd46e9da9d3897a8fbb)
We'll handle these just as we do kevents, one per line with subsequent
lines indented sufficiently to distinguish them from the upcoming
return value.
Sample, with indentation stripped and revents changed to '...' in the
first one to keep the line length down:
CALL poll(0x820610560,0x3,0)
STRU struct pollfd[] = { { fd=0, events=0x1<POLLIN>, revents=0x11<...>
{ fd=1, events=0x4<POLLOUT>, revents=0x4<POLLOUT>}
{ fd=-1, events=0x4<POLLOUT>, revents=0} }
RET poll 2
Reviewed by: bapt, jhb
(cherry picked from commit 02c57f7b48772c5ec4e3a0a3405273b387b9bb08)
I'd forgotten that we have to adjust the stderr tests from
upstream. Remove the OK files. Also remove system-status.*. These
restore the fixes I made in 517e52b6c2 which were lost when I imported
the last version of awk.
Also, force LANG to be C.UTF-8 when testing to ensure that stray lang
settings don't fail tests.
Sponsored by: Netflix
(cherry picked from commit ba7b7f94c239ce43343d7af403734fdc941b7664)
* Properly parse (no) command-line options.
* Ensure that errors go to stderr and result in a non-zero exit.
* Drop the special-case code for a single argument, as it will produce
the wrong outcome if the file does not exist or is corrupted.
* Don't print anything until after we've collected all the data.
* Always create all temporary files before setting the trap. This
ensures that the trap can safely fire at any moment, regardless of any
previous definition of `T`.
* Use a temporary file rather than a pipe between `nm` and `sed` to
ensure proper termination if `nm` fails due to a missing or invalid
input.
* The check for self-referential entries was conditional on testing our
argument list against a regex looking for archives. This was a
needless and unreliable optimization; make the check unconditional.
* Document that lorder will not work properly if any of its inputs have
spaces in their name.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44133
(cherry picked from commit 5c7b986c21ed47545203e8f630fe2281b83112d2)
lorder: Add unit tests.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44134
(cherry picked from commit 96da41b6dbf383436018f11ad8a672faab2d3789)
lorder: Undeprecate.
While lorder is not required by our current toolchain (or any toolchain
we've used in the past decade or two), it still occasionally shows up
in build systems of third party software, including The Open Group's
UNIX conformance test suite, and the maintenance cost is negligible.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: imp, allanjude, emaste
Differential Revision: https://reviews.freebsd.org/D44135
(cherry picked from commit cf4d9bf8b38819da12c6d686d5cf6dbd6353cd61)
lorder: Don't rely on legacy syntax.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44155
(cherry picked from commit aedb37dc49319a7cd1faf34f312a8a9fc01e611d)
lorder: Tweak invalid file test.
Different implementations of `nm` have different ways of telling you
that your file is not a valid object or library, but they all seem to
have “not recognized” as a common substring.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44154
(cherry picked from commit aa80cfadff0bb715ca090cbd1b3561a1619251d5)
* Overhaul column width and padding calculation.
* Rewrite print_space() so it is now a) correct and b) understandable.
* Rewrite tab expansion in fetch() for the same reason.
This brings us in line with GNU diff for all cases I could think of.
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44014
(cherry picked from commit 53de23f4d140becc3166e87665b0064f215a220e)
diff: Bump manual page date.
Sponsored by: Klara, Inc.
(cherry picked from commit 312b1076c6b0aff9bbcaff058b93385eaf607685)
Commit de6feefdb7 limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.
Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.
Reviewed by: emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43839
(cherry picked from commit 73ff7384e025033abc98fd5437a48beb8077a90b)
The specification follows a commentary to the function parse_part()
in the source code and the code itself.
(cherry picked from commit d1797fb5bbaeb212501a72b916d647fb2e021d50)
- Cover all code paths.
- When decoding, check all output files, not just the last one.
- A simple `ferror()` check is not enough as an error may later occur
while flushing whatever remains in the output buffer.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43532
(cherry picked from commit 5cb28f7979773715615cc2131fe40e0c5879ed1d)
bintrans: Fix uninitialized variable.
`prev` may be used uninitialized if `body` starts with a newline.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: bapt, emaste
Differential Revision: https://reviews.freebsd.org/D43534
(cherry picked from commit bce34cba07bcfed9cd519a658e594c9910c8f210)
bintrans: Add base64 to name list in manual page.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: 0mp, pstef
Differential Revision: https://reviews.freebsd.org/D43558
(cherry picked from commit 64028ac3ba9668cff31bfe2c79d85a3b89e10953)
bintrans: Remove unused variable.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43559
(cherry picked from commit bc2913d1736c2b299a265741a779014d001bd108)
I accidentally copied this to the wrong place, or by accident to two
places, during the merge of llvmorg-17-init-19304-gd0b54bb50e51.
Fixes: 06c3fb2749bd
MFC after: 3 days
(cherry picked from commit 4015c064200e643ab110cdf831064c3c73f31b73)
man.sh needs to handle double quotes and sub shell character
as '`' '$' etc.
PR: 275967
Reviewed by: bapt
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D43453
(cherry picked from commit b8a484ec343d163a40f7cf4a6026e880f992c738)
The comparison function had the ordering reversed causing join(1) to
miss some matching lines.
PR: 232405
Submitted by: Martijn van Duren <martijn@openbsd.org>
(cherry picked from commit 95bf75895ddcf17402b1f69dce26cb821c922476)
The globbing function in exists() needs to handle white spaces.
PR: 275978
Reviewed by: kevans, bapt, emaste
Differential Revision: https://reviews.freebsd.org/D43222
MFC after: 1 week
(cherry picked from commit e3c7b76fa8105929ae9a785e5ffc44274b1b0a81)
Add the missing -q option to the nfsstat(1) manpage SYNOPSIS (it is
already documented in DESCRIPTION), and add the missing -E and -q
options to the built-in usage output.
PR: 275912
Pull Request: https://github.com/freebsd/freebsd-src/pull/958
(cherry picked from commit 30ce26cacfd626552c647c9327dd510e7f421d97)
setjmp() requires that any stack variables modified between the setjmp
call and the longjmp() must be volatile. This means that 'saveint' in
grabh() must be volatile, since it's modified after the setjmp().
Otherwise, the signal handler is not properly restored, resulting in a
crash (SIGBUS) if ^C is typed twice while composing.
PR: 276119
Reported by: Christopher Davidson <christopher.davidson@gmail.com>
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd-src/pull/993
(cherry picked from commit 6c951b37170f1fb2ae8b4827070743e61b6eaed2)
These new tests cover more functionality and are easier to extend.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D43381
(cherry picked from commit e762fd81e253d4ae9b9f7d2e65cf448633bbe527)
uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have
to be output. For the basic case, this means output each line as it is
read unless it is identical to the previous one. For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given. The -D and -u cases were already fine.
Add test cases for interactive use with no options and with -d.
Explicitly ignore -d when -D is also specified.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: rew, kevans
Differential Revision: https://reviews.freebsd.org/D43382
(cherry picked from commit 11715600e626cf6cc4b4f564af97f6ae1e5fb0be)
uniq: Clean up and test obsolete options.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43402
(cherry picked from commit e2ec8ee02a33e39b8ff86a56e8a1ef5e84ac7e62)
uniq: Error out if writing to the output failed.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D43407
(cherry picked from commit 899837e8f5741f9a847b63d9e7c8b76ccc033ab5)