PC-BSD/trueos abeb80bsys/fs/ext2fs ext2_balloc.c

MFC r349800,r349801:

Fix misc fs fuzzing issues.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc)
                FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc)
DeltaFile
+15-72sys/fs/ext2fs/ext2_balloc.c
+15-721 files

PC-BSD/trueos 0466549sys/fs/ext2fs ext2_vfsops.c

Add additional check for 'blocks per group' and 'fragments per group' superblock fields.

These fields will not be equal only in case if bigalloc filesystem feature is turned on.
This feature is not supported for now.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-27-EXT2-12: Denial of Service in openat-0 (vm_fault_hold/ext2_clusteracct)

MFC after:      2 weeks
DeltaFile
+5-0sys/fs/ext2fs/ext2_vfsops.c
+5-01 files

PC-BSD/trueos 089a21bsys/fs/ext2fs ext2_balloc.c

Remove ufs fragments logic.

The ext2fs fragments are different from ufs fragments.
In case of ext2fs the fragment should be equal or more then block size.
The values more than block size are used only in case of bigalloc feature, which is does not supported for now.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc)

MFC after:      2 weeks
DeltaFile
+15-71sys/fs/ext2fs/ext2_balloc.c
+15-711 files

PC-BSD/trueos 37919d6sys/fs/ext2fs ext2_balloc.c

Remove unneeded mount point unlock call.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc)

MFC after:      2 weeks
DeltaFile
+0-1sys/fs/ext2fs/ext2_balloc.c
+0-11 files

PC-BSD/trueos 5e24991sys/fs/ext2fs ext2_vfsops.c ext2_alloc.c

MFC r346267, 346269:
ext2fs: Initial version of DTrace support.

Reviewed by:    pfg, gnn

Differential Revision:    https://reviews.freebsd.org/D19848
DeltaFile
+64-39sys/fs/ext2fs/ext2_vfsops.c
+41-49sys/fs/ext2fs/ext2_alloc.c
+23-13sys/fs/ext2fs/ext2_extents.c
+20-9sys/fs/ext2fs/ext2_lookup.c
+15-11sys/fs/ext2fs/ext2_csum.c
+16-7sys/fs/ext2fs/ext2_inode_cnv.c
+179-1289 files not shown
+227-13715 files

PC-BSD/trueos 147d386sys/fs/ext2fs ext2_extents.c

ext2fs: Initial version of DTrace support.

Commit forgotten file.

Reviewed by:    pfg, gnn
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19848
DeltaFile
+23-13sys/fs/ext2fs/ext2_extents.c
+23-131 files

PC-BSD/trueos c3ee715sys/fs/ext2fs ext2_vfsops.c ext2_alloc.c

ext2fs: Initial version of DTrace support.

Reviewed by:    pfg, gnn
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19848
DeltaFile
+64-39sys/fs/ext2fs/ext2_vfsops.c
+41-49sys/fs/ext2fs/ext2_alloc.c
+20-9sys/fs/ext2fs/ext2_lookup.c
+15-11sys/fs/ext2fs/ext2_csum.c
+16-7sys/fs/ext2fs/ext2_inode_cnv.c
+11-3sys/fs/ext2fs/ext2_extattr.c
+167-1188 files not shown
+204-12414 files

PC-BSD/trueos 6b0855esys/fs/ext2fs ext2_vfsops.c

MFC: r344757:
Fix double free in case of mount error.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-9-EXT3-2: Denial Of Service in nmount-5 (vm_fault_hold)
Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19385
DeltaFile
+6-2sys/fs/ext2fs/ext2_vfsops.c
+6-21 files

PC-BSD/trueos 647a592sys/fs/ext2fs ext2_inode_cnv.c ext2_vfsops.c

MFC: r344752:
Add additional on-disk inode checks.

Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19323
DeltaFile
+23-1sys/fs/ext2fs/ext2_inode_cnv.c
+8-3sys/fs/ext2fs/ext2_vfsops.c
+7-0sys/fs/ext2fs/ext2fs.h
+2-0sys/fs/ext2fs/ext2_csum.c
+40-44 files

PC-BSD/trueos d58ea76sys/fs/ext2fs ext2_alloc.c

MFC: r344754:
Do not panic if inode bitmap is corrupted.

admbug:         804
Reported by:    Ilja Van Sprundel
Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19325
DeltaFile
+5-3sys/fs/ext2fs/ext2_alloc.c
+5-31 files

PC-BSD/trueos 682e1b9sys/fs/ext2fs ext2_alloc.c

MFC: r344756, r345179:
Do not read the on-disk inode in case of vnode allocation.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-6-EXT2-4: Denial Of Service in mkdir-0 (ext2_mkdir/vn_rdwr)
Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19327
DeltaFile
+53-21sys/fs/ext2fs/ext2_alloc.c
+53-211 files

PC-BSD/trueos 66bedc8sys/fs/ext2fs ext2_vfsops.c

MFC: r344755:
Fix integer overflow possibility.

Reported by:    Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:    FS-2-EXT2-1: Out-of-Bounds Write in nmount (ext2_vget)
Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19326
DeltaFile
+2-2sys/fs/ext2fs/ext2_vfsops.c
+2-21 files

PC-BSD/trueos 28329d4sys/fs/ext2fs ext2_alloc.c

MFC: r344753:
Validate block bitmaps.

Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19324
DeltaFile
+75-29sys/fs/ext2fs/ext2_alloc.c
+75-291 files

PC-BSD/trueos ec03032sys/fs/ext2fs ext2_vfsops.c ext2_alloc.c

MFC r344751:
Make superblock reading logic more strict.

Add more on-disk superblock consistency checks to ext2_compute_sb_data() function.
It should decrease the probability of mounting filesystems with corrupted superblock data.

Reviewed by:    pfg

Differential Revision:    https://reviews.freebsd.org/D19322
DeltaFile
+207-59sys/fs/ext2fs/ext2_vfsops.c
+5-5sys/fs/ext2fs/ext2_alloc.c
+3-2sys/fs/ext2fs/ext2fs.h
+3-0sys/fs/ext2fs/ext2_extern.h
+218-664 files

PC-BSD/trueos d3433b6sys/fs/ext2fs ext2_alloc.c

Remove unneeded mount point unlock function calls.

The ext2_nodealloccg() function unlocks the mount point
in case of successful node allocation.
The additional unlocks are not required and should be removed.

PR:             236452
Reported by:    pho
MFC after:      3 days
DeltaFile
+1-7sys/fs/ext2fs/ext2_alloc.c
+1-71 files

PC-BSD/trueos 4358ffasys/fs/ext2fs ext2_vfsops.c

Fix double free in case of mount error.

Reported by:    Christopher Krah <krah at protonmail.com>
Reported as:    FS-9-EXT3-2: Denial Of Service in nmount-5 (vm_fault_hold)
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19385
DeltaFile
+6-2sys/fs/ext2fs/ext2_vfsops.c
+6-21 files

PC-BSD/trueos c9ceddcsys/fs/ext2fs ext2_alloc.c

Do not read the on-disk inode in case of vnode allocation.

Reported by:    Christopher Krah <krah at protonmail.com>
Reported as:    FS-6-EXT2-4: Denial Of Service in mkdir-0 (ext2_mkdir/vn_rdwr)
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19327
DeltaFile
+59-21sys/fs/ext2fs/ext2_alloc.c
+59-211 files

PC-BSD/trueos fce090esys/fs/ext2fs ext2_vfsops.c

Fix integer overflow possibility.

Reported by:    Christopher Krah <krah at protonmail.com>
Reported as:    FS-2-EXT2-1: Out-of-Bounds Write in nmount (ext2_vget)
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19326
DeltaFile
+2-2sys/fs/ext2fs/ext2_vfsops.c
+2-21 files

PC-BSD/trueos 8035567sys/fs/ext2fs ext2_alloc.c

Do not panic if inode bitmap is corrupted.

admbug:         804
Reported by:    Ilja Van Sprundel <ivansprundel at ioactive.com>
Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19325
DeltaFile
+5-3sys/fs/ext2fs/ext2_alloc.c
+5-31 files

PC-BSD/trueos 02f81ecsys/fs/ext2fs ext2_alloc.c

Validate block bitmaps.

Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19324
DeltaFile
+75-29sys/fs/ext2fs/ext2_alloc.c
+75-291 files

PC-BSD/trueos db81a20sys/fs/ext2fs ext2_inode_cnv.c ext2_vfsops.c

Add additional on-disk inode checks.

Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19323
DeltaFile
+23-1sys/fs/ext2fs/ext2_inode_cnv.c
+8-3sys/fs/ext2fs/ext2_vfsops.c
+7-0sys/fs/ext2fs/ext2fs.h
+2-0sys/fs/ext2fs/ext2_csum.c
+40-44 files

PC-BSD/trueos d3ae4easys/fs/ext2fs ext2_vfsops.c ext2_alloc.c

Make superblock reading logic more strict.

Add more on-disk superblock consistency checks to ext2_compute_sb_data() function.
It should decrease the probability of mounting filesystems with corrupted superblock data.

Reviewed by:    pfg
MFC after:      1 week

Differential Revision:    https://reviews.freebsd.org/D19322
DeltaFile
+207-59sys/fs/ext2fs/ext2_vfsops.c
+5-5sys/fs/ext2fs/ext2_alloc.c
+3-2sys/fs/ext2fs/ext2fs.h
+3-0sys/fs/ext2fs/ext2_extern.h
+218-664 files

PC-BSD/trueos 77623easys/amd64/linux linux_dummy.c, sys/amd64/linux32 linux32_dummy.c

MFC r342933:
Fix errno values returned from DUMMY_XATTR linuxulator calls

Reported by: weiss at uni-mainz.de
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D18812
DeltaFile
+1-1sys/amd64/linux32/linux32_dummy.c
+1-1sys/amd64/linux/linux_dummy.c
+1-1sys/arm64/linux/linux_dummy.c
+1-1sys/i386/linux/linux_dummy.c
+4-44 files

PC-BSD/trueos 8aa0301sys/amd64/linux linux_dummy.c, sys/amd64/linux32 linux32_dummy.c

Fix errno values returned from DUMMY_XATTR linuxulator calls

Reported by: weiss at uni-mainz.de
Reviewed by: markj
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D18812
DeltaFile
+1-1sys/amd64/linux/linux_dummy.c
+1-1sys/amd64/linux32/linux32_dummy.c
+1-1sys/arm64/linux/linux_dummy.c
+1-1sys/i386/linux/linux_dummy.c
+4-44 files

PC-BSD/trueos faaf1afsys/fs/fuse fuse_vnops.c

FUSE extattrs: fix issue when neither uio nor size were not passed to VOP_* (cosmetic only).

Reviewed by:    cem, pfg
MFC after:      2 weeks

Differential Revision:  https://reviews.freebsd.org/D13737
DeltaFile
+21-22sys/fs/fuse/fuse_vnops.c
+21-221 files

PC-BSD/trueos ad936besys/fs/fuse fuse_vnops.c fuse_kernel.h

FUSE extattrs: fix issue when neither uio nor size were not passed to VOP_*.

The requested size was returned incorrectly in case uio == NULL from listextattr because the
nameprefix/name conversion was not applied.
Also, make a_size/uio returning logic more unified with other filesystems.

Reviewed by:    cem, pfg
MFC after:      2 weeks

Differential Revision:  https://reviews.freebsd.org/D13528
DeltaFile
+51-48sys/fs/fuse/fuse_vnops.c
+11-1sys/fs/fuse/fuse_kernel.h
+62-492 files

PC-BSD/trueos 81d29c0sys/fs/ext2fs ext2_alloc.c

Change unused inodes counters behavior in the cylinder groups.
Make it more close to native ext4 implementation to avoid fsck errors.
DeltaFile
+7-8sys/fs/ext2fs/ext2_alloc.c
+7-81 files

PC-BSD/trueos cbae90dsys/fs/ext2fs ext2_csum.c ext2_lookup.c

Fix directory blocks checksum updating logic.

Count dirent tail in the searchslot logic in case of directory block search.
Add htree root csum update function call in case of rename.
DeltaFile
+24-8sys/fs/ext2fs/ext2_csum.c
+6-9sys/fs/ext2fs/ext2_lookup.c
+6-0sys/fs/ext2fs/ext2_vnops.c
+1-0sys/fs/ext2fs/ext2_extern.h
+37-174 files

PC-BSD/trueos 81f6e0bsys/fs/ext2fs ext2_vnops.c ext2_dir.h

Split the dir_index and dir_nlink features.

Do not allow to create more that EXT4_LINK_MAX links to directory in case
if the dir_nlink is not set, like it is done in the fresh e2fsprogs updates.

MFC after:      3 months
DeltaFile
+13-22sys/fs/ext2fs/ext2_vnops.c
+0-1sys/fs/ext2fs/ext2_dir.h
+13-232 files

PC-BSD/trueos 81cc204sys/fs/ext2fs ext2_lookup.c ext2_htree.c

Fix directory blocks checksum updating logic.

The checksum updating functions were not called in case of dir index inode splitting
and in case of dir entry removing, when the entry was first in the block.
Fix and move the dir entry adding logic when i_count == 0 to new function.

MFC after:      3 months
DeltaFile
+71-30sys/fs/ext2fs/ext2_lookup.c
+1-1sys/fs/ext2fs/ext2_htree.c
+72-312 files