HardenedBSD/src d3306c9contrib/libarchive/libarchive archive_read_support_filter_lz4.c, contrib/libarchive/libarchive/test test_compat_lz4_skippable_frames_B4.tar.lz4.uu

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+6,739-0contrib/libarchive/libarchive/test/test_compat_lz4_skippable_frames_B4.tar.lz4.uu
+64-114usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+52-51usr.sbin/makefs/tests/makefs_zfs_tests.sh
+70-14contrib/libarchive/libarchive/archive_read_support_filter_lz4.c
+33-49usr.sbin/makefs/tests/makefs_ffs_tests.sh
+43-39usr.sbin/makefs/tests/makefs_tests_common.sh
+7,001-26755 files not shown
+7,438-44161 files

HardenedBSD/src db3b39flib/libjail jail.c

libjail: extend struct handlers to included MAC labels

MAC label handling is a little special; to avoid being too disruptive,
we allocate a `mac_t *` here for the value so that we can mac_prepare()
or mac_from_text() into.  As a result, we need:

 - A custom free() handler to avoid leaking the *jp_value
 - A custom jailparam_get() handler to mac_prepare() the mac_t and
    populate the iove properly, so that the kernel doesn't have to
    do something funky like copyin, dereference, copyin again.
 - A custom jailparam_set() handler to similarly populate the iovec
    properly.

Reviewed by:    jamie
Differential Revision:  https://reviews.freebsd.org/D53960
DeltaFile
+189-3lib/libjail/jail.c
+189-31 files

HardenedBSD/src 1af8d56lib/libjail jail.c

libjail: start refactoring struct ioctl support

Instead of ad-hoc comparisons against the struct type in a few places,
start to abstract out an interface for dealing with struct types.  For
now, this just means that we have some special jailparam_import and
jailparam_export handling for the ip addr types, but in the next commit
we'll extend it further to support MAC labels.

Reviewed by:    jamie
Differential Revision:  https://reviews.freebsd.org/D53959
DeltaFile
+149-57lib/libjail/jail.c
+149-571 files

HardenedBSD/src 1e8c287share/man/man4 mac.4, usr.sbin/jail jail.8

jail: document the mac.label parameter

In particular, we should provide a hint about mac.conf(5), since libjail
will just use the mac_prepare_type(3) API to provide a reasonably sane
interface for system administrators.  Progammers wanting to fetch an
arbitrary MAC label would need to bypass libjail and use jail_get(2)
directly with their own prepared `struct mac`.

Differential Revision:  https://reviews.freebsd.org/D54067
DeltaFile
+12-1usr.sbin/jail/jail.8
+3-1share/man/man4/mac.4
+15-22 files

HardenedBSD/src 31c2728sys/security/mac mac_syscalls.c mac_prison.c, sys/security/mac_stub mac_stub.c

mac_set_fd(3): add support for jail descriptors

We'll still add an old-fashioned jail param to configure jail MAC
labels, but for testing it's really easy to grab a jaildesc and use
that.

Reviewed by:    jamie, olce
Differential Revision:  https://reviews.freebsd.org/D53956
DeltaFile
+44-0sys/security/mac/mac_syscalls.c
+26-2sys/security/mac/mac_prison.c
+11-0sys/security/mac_test/mac_test.c
+5-0sys/security/mac/mac_internal.h
+3-0sys/security/mac/mac_policy.h
+1-0sys/security/mac_stub/mac_stub.c
+90-26 files

HardenedBSD/src 8254b0dsys/kern kern_jail.c, sys/security/mac mac_prison.c mac_policy.h

kern: mac: add various jail MAC hooks

This adds the following hooks:
 - mpo_prison_check_attach: check for subject capability to attach to
    a given jail
 - mpo_prison_check_create: check for subject capability to create a
    jail with the given option set
 - mpo_prison_check_get: check for subject capability to fetch the
    given parameters for a jail
 - mpo_prison_check_set: check for subject capability to set the
    given parameters for a jail
 - mpo_prison_check_remove: check for subject capability to remove the
    jail

check_get wouldn't typically be a privileged operation, but is included
to give MAC policies a wider range of capabilities at a relatively low
cost.  We also add two more for the purpose of label propagation:
 - mpo_prison_created: surface the creation of a jail so that one can
    do propagation to, e.g., the root vnode or any mounts

    [28 lines not shown]
DeltaFile
+161-0sys/security/mac_test/mac_test.c
+104-22sys/kern/kern_jail.c
+87-0sys/security/mac/mac_prison.c
+83-0sys/security/mac_stub/mac_stub.c
+25-0sys/security/mac/mac_policy.h
+12-0sys/security/mac/mac_framework.h
+472-221 files not shown
+474-227 files

HardenedBSD/src 11d6ea4sys/kern kern_jail.c, sys/security/mac mac_prison.c mac_policy.h

kern: mac: add a MAC label to struct prison

Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D53953
DeltaFile
+144-0sys/security/mac/mac_prison.c
+26-0sys/kern/kern_jail.c
+20-0sys/security/mac/mac_policy.h
+9-0sys/security/mac/mac_internal.h
+6-0sys/security/mac/mac_framework.h
+1-0sys/security/mac/mac_framework.c
+206-02 files not shown
+208-08 files

HardenedBSD/src 626fe12sys/security/mac mac_syscalls.c

kern: mac: pull mac_label_copyin_string out

A future commit to the area will further our jail integration and add
a use for this: the struct mac itself was already copied in as part of
vfs_buildopts(), so we only need to copyin the strings.

We add an explicit flag argument because the jail operation will need to
do it while holding the prison lock.

Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D53957
DeltaFile
+30-18sys/security/mac/mac_syscalls.c
+30-181 files

HardenedBSD/src bd55cbbsys/kern kern_jail.c, sys/security/mac mac_syscalls.c mac_syscalls.h

kern: add a mac.label jail parameter

Have it take a `struct mac` and we'll paper over the difference for
jail(8)/jls(8) in libjail(3).  The mac_syscalls.h model is taken from
mac_set_proc_*() that were previously done.

Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D53958
DeltaFile
+154-0sys/security/mac/mac_syscalls.c
+51-1sys/kern/kern_jail.c
+10-0sys/security/mac/mac_syscalls.h
+215-13 files

HardenedBSD/src 92b7366sys/security/mac mac_internal.h

mac: add macros for 5-argument SDT probes

A last-minute change to the jail MAC entry points in D53954 is going to
pass the jail_[gs]et(2) flags to mac_prison_check_[gs]et() so that a
policy can, e.g., reject or allow a change if the intent is to
immediately attach, or disallow some fetching of dying jails.

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D54658
DeltaFile
+13-5sys/security/mac/mac_internal.h
+13-51 files

HardenedBSD/src d7a517esys/kern kern_jaildesc.c, sys/sys jaildesc.h

jaildesc: add an accessor for the struct prison in a jaildesc

We'll subsequently use this in the MAC framework to get a struct prison
when we already have the struct file in question, rather than an fd.

Reviewed by:    jamie, olce
Differential Revision:  https://reviews.freebsd.org/D53955
DeltaFile
+56-21sys/kern/kern_jaildesc.c
+1-0sys/sys/jaildesc.h
+57-212 files

HardenedBSD/src 4fc11c9sys/fs/nfs nfs.h nfs_var.h, sys/fs/nfsserver nfs_nfsdport.c nfs_nfsdserv.c

nfsd: Fix handling of attributes during Open/Create/Exclusive_41

When an NFSv4.n client specifies settings for attributes other
mode during a Open/Create/Exclusive_41, these other attributes
were not being set.

This patch resolves the problem by calling nfsrv_fixsattr()
after the VOP_CREATE() call in nfsvno_open() for this case.

There is no extant NFSv4.n client that currently does this,
as far as I know.

MFC after:      2 weeks
DeltaFile
+38-8sys/fs/nfsserver/nfs_nfsdport.c
+8-5sys/fs/nfsserver/nfs_nfsdserv.c
+3-3sys/fs/nfsserver/nfs_nfsdsubs.c
+5-0sys/fs/nfs/nfs.h
+1-1sys/fs/nfs/nfs_var.h
+2-0sys/fs/nfs/nfsdport.h
+57-176 files

HardenedBSD/src 51786cdsys/kern uipc_domain.c

sockets: remove unused pr_sosend_notsupp(), pr_soreceive_notsupp()
DeltaFile
+0-16sys/kern/uipc_domain.c
+0-161 files

HardenedBSD/src 77f453etests/sys/net/if_ovpn if_ovpn.sh

tests/if_ovpn: add missing cleanup to the multihome6 test

Fixes:  0bfcfb3cb1cbfa383cbd24eff39d39f143eb63ba
DeltaFile
+2-0tests/sys/net/if_ovpn/if_ovpn.sh
+2-01 files

HardenedBSD/src f9ae08asys/compat/linux linux_if.c

linux: on vnet detach call clean_unrhdr(9) always

The assumption was incorrect, and the current VIMAGE implementation leaves
a possibility for some interfaces still exist in a jail that is going
away.

Fixes:  607f11055d2d421770963162a4d9a99cdd136152
DeltaFile
+6-5sys/compat/linux/linux_if.c
+6-51 files

HardenedBSD/src b9bf082contrib/libarchive NEWS, contrib/libarchive/libarchive archive_read_disk_posix.c archive_write_set_format_xar.c

libarchive: merge from vendor branch

libarchive 3.8.4

Important bugfixes:
     #2787 bsdtar: Fix zero-length pattern issue
     #2797 lib: Fix regression introduced in libarchive 3.8.2
                when walking enterable but unreadable directories

Obtained from:  libarchive
Vendor commit:  d114ceee6de08a7a60ff1209492ba38bf9436f79
MFC after:      1 week

(cherry picked from commit c1e033c33e8b290cd40f4069249c879efcbae6a6)
DeltaFile
+11-14contrib/libarchive/libarchive/archive_read_disk_posix.c
+12-7contrib/libarchive/tar/subst.c
+6-6contrib/libarchive/libarchive/archive_write_set_format_xar.c
+7-1contrib/libarchive/tar/test/test_option_s.c
+5-3contrib/libarchive/NEWS
+3-3contrib/libarchive/libarchive/archive_write_disk_posix.c
+44-3411 files not shown
+63-5317 files

HardenedBSD/src df4e99bcontrib/libarchive/libarchive archive_read_support_format_mtree.c archive_read_support_filter_uu.c, contrib/libarchive/tar subst.c

libarchive: merge from vendor branch

libarchive 3.8.5

Important bugfixes:
 #2809 bsdtar: fix regression from 3.8.4 zero-length pattern issue bugfix

Obtained from:  libarchive
Vendor commit:  dd897a78c662a2c7a003e7ec158cea7909557bee
MFC after:      1 week

(cherry picked from commit 4b047c3af3fec1607ba1cfe04e1d442a17fc1cf6)
DeltaFile
+16-3contrib/libarchive/test_utils/test_main.c
+8-8contrib/libarchive/tar/subst.c
+6-6contrib/libarchive/libarchive/archive_read_support_format_mtree.c
+4-4contrib/libarchive/libarchive/archive_read_support_filter_uu.c
+1-5contrib/libarchive/libarchive/archive_write_open_memory.c
+3-3contrib/libarchive/libarchive/archive_read_support_format_cpio.c
+38-2918 files not shown
+67-6024 files

HardenedBSD/src ca5d4e7contrib/libarchive/libarchive archive_read_support_filter_lz4.c archive_read_support_filter_zstd.c, contrib/libarchive/libarchive/test test_compat_lz4_skippable_frames_B4.tar.lz4.uu test_read_format_7zip_issue2765.c

libarchive: merge from vendor branch

libarchive 3.8.3

Important bugfixes:
 #2753 lib: Create temporary files in the target directory
 #2768 lha: Fix for an out-of-bounds buffer overrun when using
       p[H_LEVEL_OFFSET]
 #2769 7-zip: Fix a buffer overrun when reading truncated 7zip headers
 #2771 lz4 and zstd: Support both lz4 and zstd data with leading
       skippable frames

Obtained from:  libarchive
Vendor commit:  1368b08875351df8aa268237b882c8f4ceb0882d
MFC after:      1 week

(cherry picked from commit 007679a138089676aadc9a712277f4004403b905)
DeltaFile
+6,739-0contrib/libarchive/libarchive/test/test_compat_lz4_skippable_frames_B4.tar.lz4.uu
+70-14contrib/libarchive/libarchive/archive_read_support_filter_lz4.c
+55-12contrib/libarchive/libarchive/archive_read_support_filter_zstd.c
+51-0contrib/libarchive/libarchive/test/test_read_format_7zip_issue2765.c
+38-0contrib/libarchive/libarchive/test/test_archive_string.c
+34-0contrib/libarchive/libarchive/module.modulemap
+6,987-2620 files not shown
+7,110-6126 files

HardenedBSD/src 5f53e65usr.sbin/makefs makefs.8

makefs.8: Cleanup man page

Reviewed by:    ziaee
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54538

(cherry picked from commit 12c51484188f88bcabc5b38ca8523fcde76830a6)
DeltaFile
+5-4usr.sbin/makefs/makefs.8
+5-41 files

HardenedBSD/src 2bcc556usr.sbin/makefs/msdos msdosfs_vfsops.c

makefs: Fix typo 's/mirrorring/mirroring/'

MFC after:      1 week

(cherry picked from commit 73af599fb7be6806b553ac6f470d76711b74286c)
DeltaFile
+1-1usr.sbin/makefs/msdos/msdosfs_vfsops.c
+1-11 files

HardenedBSD/src 99d4a01usr.sbin/makefs/tests makefs_msdos_tests.sh makefs_ffs_tests.sh

makefs: tests: Fix timestamp-related tests

Use a variable for mtree that includes the DEFAULT_MTREE_KEYWORDS, in
order to avoid missing the important "time" keyword or passing an
unimplemented "nlink" keyword.

Unskip the "failing" tests, and comment out the specific failing checks,
these will be addressed (or at least discussed) in a different revision.

For MS-DOS tests, use an even value timestamp, as precision is 2s.

For ZFS tests, use import_image instead of mount_image consistently.

Reviewed by:    bnovkov, markj
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54429

(cherry picked from commit 93b15dbc1fbc3c33c9bd53091b28c3b629d0abe1)
DeltaFile
+8-11usr.sbin/makefs/tests/makefs_msdos_tests.sh
+6-9usr.sbin/makefs/tests/makefs_ffs_tests.sh
+5-7usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+5-7usr.sbin/makefs/tests/makefs_zfs_tests.sh
+1-0usr.sbin/makefs/tests/makefs_tests_common.sh
+25-345 files

HardenedBSD/src b10369dusr.sbin/makefs/tests makefs_cd9660_tests.sh makefs_ffs_tests.sh

makefs: tests: Fix -D flag test

As stated in the manual page:

-F is almost certainly not the option you are looking for.  To
create an image from a list of files in an mtree format manifest,
specify it as the last argument on the command line, not as the
argument to -F.

This change does exactly that.  Also bug #192839 has already been fixed.

Reviewed by:    ngie
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54428

(cherry picked from commit 96efda9cd55689ef3fa067281d8b0a42a7122536)
DeltaFile
+13-11usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+13-11usr.sbin/makefs/tests/makefs_ffs_tests.sh
+8-0usr.sbin/makefs/tests/makefs_tests_common.sh
+34-223 files

HardenedBSD/src c0b56dbusr.sbin/makefs/tests makefs_cd9660_tests.sh makefs_tests_common.sh

makefs: tests: Cleanup and remove default flags

Cleanup and remove default atf_check flags for clarity.  The following
two lines are equivalent:

    atf_check $cmd
    atf_check -s exit:0 -e empty -o empty $cmd

Update the links to the reference documents.

Remove the D_flag_cleanup function, as common_cleanup() for these
particular set of tests does two things:

1. Unmount the md(4) device.
2. Destroy the md(4) device.

Essentially, one should only call common_cleanup() if the test body
invokes mount_image().  This is not the case for D_flag_body().


    [7 lines not shown]
DeltaFile
+58-89usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+34-39usr.sbin/makefs/tests/makefs_tests_common.sh
+28-41usr.sbin/makefs/tests/makefs_zfs_tests.sh
+27-42usr.sbin/makefs/tests/makefs_ffs_tests.sh
+7-7usr.sbin/makefs/tests/makefs_msdos_tests.sh
+154-2185 files

HardenedBSD/src 463c0b8usr.sbin/makefs/tests makefs_zfs_tests.sh

makefs: tests: Double the timeout of ZFS file_extend test

The test makefs_zfs_tests:file_extend is timing out on ci.freebsd.org.
Double the default timeout to allow it to finish.

Reported by:    Jenkins
Reviewed by:    asomers
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54425

(cherry picked from commit 065f02174f76a49fbf537ee51ed8068d3d398b08)
DeltaFile
+6-0usr.sbin/makefs/tests/makefs_zfs_tests.sh
+6-01 files

HardenedBSD/src f8b5a8ausr.sbin/makefs/tests makefs_zfs_tests.sh

makefs: tests: Double the timeout of ZFS compression test

The test makefs_zfs_tests:compression is timing out on ci.freebsd.org.
Double the default timeout to allow it to finish.

While here, check if the file exists before cleaning up, otherwise, cat
may fail.

Reported by:    Jenkins
Reviewed by:    asomers
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D54424

(cherry picked from commit 9f28e92637e9a29124f407b74d7665a921865a53)
DeltaFile
+16-6usr.sbin/makefs/tests/makefs_zfs_tests.sh
+16-61 files

HardenedBSD/src 10a4af9usr.sbin/makefs/tests makefs_cd9660_tests.sh makefs_msdos_tests.sh

makefs/tests: Use require.kmods property instead of ad-hoc checks

Signed-off-by:  Siva Mahadevan <me at svmhdvn.name>
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1870

(cherry picked from commit 2cd31bd8fa687922d2a571ae53456ecd2e9ba095)
DeltaFile
+0-19usr.sbin/makefs/tests/makefs_cd9660_tests.sh
+0-8usr.sbin/makefs/tests/makefs_msdos_tests.sh
+2-0usr.sbin/makefs/tests/Makefile
+2-273 files

HardenedBSD/src ce8cd5detc/mtree BSD.debug.dist

mtree: debug: Add missing krb5 entries

Reviewed by:    ivy
Differential Revision:  https://reviews.freebsd.org/D54681
DeltaFile
+4-0etc/mtree/BSD.debug.dist
+4-01 files

HardenedBSD/src 03bdda6lib/libc/stdlib strtonum.3 strtonum.c, sys/dev/acpica acpi.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+57-17lib/libc/stdlib/strtonum.3
+32-0sys/net/if_ovpn.c
+21-6lib/libc/stdlib/strtonum.c
+25-0tests/sys/net/if_ovpn/if_ovpn.sh
+20-1sys/dev/nvme/nvme_private.h
+15-0sys/dev/acpica/acpi.c
+170-2422 files not shown
+206-6528 files

HardenedBSD/src 8d1a473share/mk bsd.man.mk

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+3-3share/mk/bsd.man.mk
+3-31 files

HardenedBSD/src 32dd4b3share/mk bsd.man.mk

bsd.man.mk fix and simplify staging

The STAGE_SETS need to match STAGE_DIR.

For each STAGE_SET we have STAGE_DIR.${STAGE_SET}
and create a target stage_files.${STAGE_SET},
the settings all need to be self consistent to work.

We actually only need the high level targets stage_files and stage_links
meta.stage.mk will take care of the details.

(cherry picked from commit 9cd89fc5aa3c0e76375732788fe9d4282d65224f)
(cherry picked from commit 9fed072b44223f061a0dbf604741091b3bc09aee)
DeltaFile
+3-3share/mk/bsd.man.mk
+3-31 files