History log of /freebsd-current/sys/fs/tarfs/tarfs_vfsops.c
Revision Date Author Comments
# 91eca185 04-Apr-2024 Mark Johnston <markj@FreeBSD.org>

tarfs: Inherit mnt_iosize_max from the lower vnode

There is no obvious reason to use a value smaller than that.

Reviewed by: des, kib
MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D44627


# 0238d371 03-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix 32-bit build.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D44613


# 584e1c35 03-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Ignore global extended headers.

Previously, we would error out if we encountered a global extended
header, because we don't know what it means. This doesn't really
matter though, and traditionally, tar implementations have either
ignored them or treated them as plain files, so just ignore them.
This allows tarfs to mount tar files created by `git archive`.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44600


# b1fd95c9 03-Apr-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Support paths that spill into exthdrs.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D44599


# cbddb2f0 07-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix checksum on 32-bit platforms.

MFC after: 3 days
Fixes: b56872332e47786afc09515a4daaf1388da4d73c
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D44261


# 0118b0c8 06-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix checksum calculation.

The checksum code assumed that struct ustar_header filled an entire
block and calculcated the checksum based on the size of the structure.
The header is in fact only 500 bytes long while the checksum covers
the entire block (“logical record” in POSIX terms). Add padding and
an assertion, and clean up the checksum code.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D44226


# e212f0c0 06-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Remove unnecessary hack and obsolete comment.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D44203


# c291b791 06-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Avoid overflow in exthdr calculation.

MFC after: 3 days
PR: 277420
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D44202


# 8427d94c 06-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Improve validation of numeric fields.

MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: sjg, allanjude
Differential Revision: https://reviews.freebsd.org/D44166


# 38b36835 06-Mar-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix two input validation issues.

* Reject hard or soft links with an empty target path. Currently, a
debugging kernel will hit an assertion in tarfs_lookup_path() while
a non-debugging kernel will happily create a link to the mount root.

* Use a temporary variable to store the result of the link target path,
and copy it to tnp->other only once we have found it to be valid.
Otherwise we error out after creating a reference to the target but
before incrementing the target's reference count, which results in a
use-after-free situation in the cleanup code.

* Correctly return ENOENT from tarfs_lookup_path() if the requested
path was not found and create_dirs is false. Luckily, existing
callers did not rely solely on the return value.

MFC after: 3 days
PR: 277360
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D44161


# a02d9cad 28-Mar-2023 Simon J. Gerraty <sjg@FreeBSD.org>

tarfs_mount allow control of vfs_mountedfrom

We default to passing the path of the tar file to vfs_mountedfrom
so we can tell where a filesystem was mounted from.
However this can make the output of mount(8) hard to read.

Allow things like:

mount -t tarfs -o as=`basename $tar` $tar /mnt

so "as" is recorded instead of $tar

Reviewed by: des
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D39273


# ef184e98 16-Mar-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix backtracking during node creation.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39082


# e81d55b4 16-Mar-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Support tar files which include file modes with permissions.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39020


# fd8c98a5 16-Mar-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Correctly track link count.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39019


# b1218349 07-Mar-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Set mountedfrom correctly.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: sjg, kib
Differential Revision: https://reviews.freebsd.org/D38930


# d481dcee 20-Feb-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Really prevent descending into a non-directory.

The previous fix was incorrect: we need to verify that the current node, if it exists, is not a directory, but we were checking the parent node instead. Address this, add more tests, and fix the test cleanup routines.

PR: 269519, 269561
Fixes: ae6cff89738b
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38645


# ae6cff89 14-Feb-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Don't panic if the parent of a new node is not a directory.

PR: 269519
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38587


# ce6a0c77 09-Feb-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix issues revealed by static analysis and testing.

* tarfs_alloc_mount(): Remove an unnecessary null check (CID 1504505) and an unused variable.

* tarfs_alloc_one(): Verify that the file size is not negative (CID 1504506). While there, also validate the mode, owner and group.

* tarfs_vget(), tarfs_zio_init(): Explicitly ignore return value from getnewvnode(), which cannot fail (CID 1504508)

* tarfs_lookup_path(): Fix a case where a specially-crafted tarball could trigger a null pointer dereference by first descending into, and then backing out of, a previously unknown directory. (CID 1504515)

* mktar: Construct a tarball that triggers the aforementioned null pointer dereference.

Reported by: Coverity
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D38463


# fb53e7ad 02-Feb-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

tarfs: Fix 32-bit build.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.


# 69d94f4c 02-Feb-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

Add tarfs, a filesystem backed by tarballs.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: pauamma, imp
Differential Revision: https://reviews.freebsd.org/D37753