ee9b37ae mjg Feb. 21, 2021, 9:05 p.m.
Noted by: Michael Butler <imb protected-networks.net>
cgit
f7496dca jamie Feb. 21, 2021, 6:55 p.m.
Require both the prison mutex and allprison_lock when pr_ref or
pr_uref go to/from zero.  Adding a non-first or removing a non-last
reference remain lock-free.  This means that a shared hold on
allprison_lock is sufficient for prison_isalive() to be useful, which
removes a number of cases of lock/check/unlock on the prison mutex.

Expand the locking in kern_jail_set() to keep allprison_lock held
exclusive until the new prison is valid, thus making invalid prisons
invisible to any thread holding allprison_lock (except of course the
one creating or destroying the prison).  This renders prison_isvalid()
nearly redundant, now used only in asserts.

Differential Revision:	https://reviews.freebsd.org/D28419
Differential Revision:	https://reviews.freebsd.org/D28458
cgit
b963ce45 tuexen Feb. 21, 2021, 4:13 p.m.
Espeially handle the case where the net passed in is about to
be deleted and therefore not in the list of nets anymore.

MFC after:	3 days
Reported by:	syzbot+9756917a7c8381adf5e8@syzkaller.appspotmail.com
cgit
5ac83902 tuexen Feb. 21, 2021, 12:06 p.m.
MFC after:	3 days
cgit
8b723968 kib Feb. 21, 2021, 9:38 a.m.
Reviewed by:	fsu, mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28679
cgit
2bfd8992 kib Feb. 21, 2021, 9:38 a.m.
The data is only needed by filesystems that
1. use buffer cache
2. utilize clustering write support.

Requested by:	mjg
Reviewed by:	asomers (previous version), fsu (ext2 parts), mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28679
cgit
d485c77f kib Feb. 21, 2021, 9:38 a.m.
Make sys/buf.h, sys/pipe.h, sys/fs/devfs/devfs*.h headers usable in
userspace, assuming that the consumer has an idea what it is for.
Unhide more material from sys/mount.h and sys/ufs/ufs/inode.h,
sys/ufs/ufs/ufsmount.h for consumption of userspace tools, with the
same caveat.

Remove unacceptable hack from usr.sbin/makefs which relied on sys/buf.h
being unusable in userspace, where it override struct buf with its own
definition.  Instead, provide struct m_buf and struct m_vnode and adapt
code to use local variants.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D28679
cgit
750ea20d kib Feb. 21, 2021, 9:38 a.m.
Reviewed by:	mckusick
Tested by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28679
cgit
e6bb49f1 bapt Feb. 21, 2021, 5:09 a.m.
c9cb66f0 bapt Feb. 21, 2021, 5:06 a.m.
MFC after:	3 days
cgit
81174cd8 mjg Feb. 21, 2021, 12:43 a.m.
Avoids locking and unlocking the vnode.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D28695
cgit
a15f787a mjg Feb. 21, 2021, 12:43 a.m.
This generalizes what vop_stdgetwritemount used to be doing.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D28695
cgit
5fa12fe0 mjg Feb. 21, 2021, 12:43 a.m.
Tested with glibc test suite.

The C variant in libkern performs excessive branching to find the zero
byte instead of using the bsfq instruction. The same code patched to use
it is still slower than the routine implemented here as the compiler
keeps neglecting to perform certain optimizations (like using leaq).

On top of that the routine can be used as a starting point for copyinstr
which operates on words intead of bytes.

The previous attempt had an instance of swapped operands to andq when
dealing with fully aligned case, which had a side effect of breaking the
code for certain corner cases. Noted by jrtc27.

Sample results:

$(perl -e "print 'A' x 3"):
stock:  211198039
patched:338626619
asm:    465609618

$(perl -e "print 'A' x 100"):
stock:   83151997
patched: 98285919
asm:    120719888

Reviewed by:	jhb, kib
Differential Revision:	https://reviews.freebsd.org/D28779
cgit
6e1d1bfc jamie Feb. 20, 2021, 10:38 p.m.
Change the flow of prison_deref() so it doesn't let go of allprison_lock
until it's completely done using it (except for a possible drop as part
of an upgrade on its first try).

Differential Revision:	https://reviews.freebsd.org/D28458
MFC after:	3 days
cgit
a8e431e1 rscheff Feb. 20, 2021, 7:11 p.m.
Reviewed By: #transport, tuexen
MFC after:   2 weeks
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D28816
cgit