]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agozfs: Add option for forcible unmounting dataset while receiving snapshot.
Mariusz Zaborski [Sat, 11 Apr 2020 17:54:35 +0000 (17:54 +0000)]
zfs: Add option for forcible unmounting dataset while receiving snapshot.

Currently when the dataset is in use we can't receive snapshots.

zfs send test/1@asd | zfs recv -FM test/2
cannot unmount '/test/2': Device busy

This commits add option 'M' which attempts to forcibly unmount the
dataset.  Thanks to this we can enforce receiving snapshots in a
single step.

Note that this functionality is not supported on Linux because the
VFS will prevent active mounted filesystems from being unmounted,
even with the force option.  This is the intended VFS behavior.

Discussed-with: Pawel Jakub Dawidek <pjd@FreeBSD.org>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Allan Jude <allanjude@freebsd.org>
Differential Revision: https://reviews.freebsd.org/D22306

openzfs/zfs@a57d3d45d6efdff935421e2ef3f97e3dc089d93d

4 years agodecryptcore: load the nls data
Mariusz Zaborski [Sat, 11 Apr 2020 17:30:33 +0000 (17:30 +0000)]
decryptcore: load the nls data

Load the nls data before the openssl will try to do it in the
capability mode.
On my machine the sa_ossl_private_decrypt is trying to do that.

MFC after: 2 weeks

4 years agoarm: am335x: Honor pmic option ti,pmic-shutdown-controller
Emmanuel Vadot [Sat, 11 Apr 2020 15:52:07 +0000 (15:52 +0000)]
arm: am335x: Honor pmic option ti,pmic-shutdown-controller

Honor ti,pmic-shutdown-controller option in DTS

Tested on stable r359316 @ Sleep mode on custom hw, Power off on BBB and PB

OFF bit [1] in status register control the pmic behaviour when PWR_EN pin
is pulled low.
On most AM335x hardware [beaglebone *] the desired behaviour are in fact
power off due to some hardware designs - read more in the comments around
pmic in sys/gnu/dts/arm/am335x-bone-common.dtsi

This patch let the device-tree decide with ti,pmic-shutdown-controller[2]
the state of off bit in status register.

[1] 8.6.12 table 12 http://www.ti.com/lit/ds/symlink/tps65217.pdf

[2] Documentation/devicetree/bindings/regulator/tps65217.txt

PR: 245159
Submitted by: Oskar Holmlund <oskar.holmlund@ohdata.se>
MFC after: 2 weeks

4 years agogpioctl: Print interrupts capabilities
Emmanuel Vadot [Sat, 11 Apr 2020 15:25:40 +0000 (15:25 +0000)]
gpioctl: Print interrupts capabilities

GPIO drivers who supports interrupts report them in the caps
(obtain via the getcaps method) but gpioctl doesn't know
how to interpret this and print "UNKNOWN" for each one of them.
Even if we don't have userland gpio interrupts support for now
let gpioctl print the supported caps.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24133

4 years agoFix build by adding forgotten header to radix_mpath.c after r359797.
Alexander V. Chernikov [Sat, 11 Apr 2020 09:38:45 +0000 (09:38 +0000)]
Fix build by adding forgotten header to radix_mpath.c after r359797.

4 years agowc(1): document SIGINFO handling in the manual page.
Eugene Grosbein [Sat, 11 Apr 2020 08:16:35 +0000 (08:16 +0000)]
wc(1): document SIGINFO handling in the manual page.

MFC after: 3 days

4 years agoRemove RADIX_MPATH headers, they were unused since r293159.
Alexander V. Chernikov [Sat, 11 Apr 2020 07:56:11 +0000 (07:56 +0000)]
Remove RADIX_MPATH headers, they were unused since r293159.

MFC after: 2 weeks

4 years agoRemove per-AF radix_mpath initializtion functions.
Alexander V. Chernikov [Sat, 11 Apr 2020 07:37:08 +0000 (07:37 +0000)]
Remove per-AF radix_mpath initializtion functions.

Split their functionality by moving random seed allocation
 to SYSINIT and calling (new) generic multipath function from
 standard IPv4/IPv5 RIB init handlers.

Differential Revision: https://reviews.freebsd.org/D24356

4 years agoAvoid using a variable solely for sizes that are never meant to be
Xin LI [Sat, 11 Apr 2020 07:24:57 +0000 (07:24 +0000)]
Avoid using a variable solely for sizes that are never meant to be
modified runtime.

No functional change.

MFC after: 2 weeks

4 years agopowerpc/booke: Use power-of-two mappings in 64-bit pmap_mapdev
Justin Hibbits [Sat, 11 Apr 2020 00:17:55 +0000 (00:17 +0000)]
powerpc/booke: Use power-of-two mappings in 64-bit pmap_mapdev

Summary:
This reduces the precious TLB1 entry consumption (64 possible in
existing 64-bit cores), by adjusting the size and alignment of a device
mapping to a power of 2, to encompass the full mapping and its
surroundings.

One caveat with this: If a mapping really is smaller than a power of 2,
it's possible to get a machine check or hang if the 'missing' physical
space is accessed.  In practice this should not be an issue for users,
as devices overwhelmingly have physical spaces on power-of-two sizes and
alignments, and any design that includes devices which don't follow this
can be addressed by undefining the POW2_MAPPINGS guard.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D24248

4 years agopowerpc/booke: Add pte_find_next() to find the next in-use PTE
Justin Hibbits [Sat, 11 Apr 2020 00:16:50 +0000 (00:16 +0000)]
powerpc/booke: Add pte_find_next() to find the next in-use PTE

Summary:
Iterating over VM_MIN_ADDRESS->VM_MAXUSER_ADDRESS can take a very long
time iterating one page at a time (2**(log_2(SIZE)-12) operations),
yielding possibly several days or even weeks on 64-bit Book-E, even for
a largely empty, which can happen when swapping out a process by
vmdaemon.  Speed this up by instead finding the next PTE at or equal to
the given VA.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D24238

4 years agopowerpc/booke: Change Book-E 64-bit pmap to 4-level table
Justin Hibbits [Sat, 11 Apr 2020 00:12:34 +0000 (00:12 +0000)]
powerpc/booke: Change Book-E 64-bit pmap to 4-level table

Summary:
The existing page table is fraught with errors, since it creates a hole
in the address space bits.  Fix this by taking a cue from the POWER9
radix pmap, and make the page table 4 levels, 52 bits.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D24220

4 years agoInode check-hash errors were being reported after system crashes.
Kirk McKusick [Fri, 10 Apr 2020 23:58:07 +0000 (23:58 +0000)]
Inode check-hash errors were being reported after system crashes.
Trace the cause down to journalled soft updates recovery code in
fsck failing to recompute the check-hash after updating an inode.

As inode check-hash was first introduced to UFS in FreeBSD 13,
there is no need to MFC this commit.

Reported by:  Chuck Silvers
Sponsored by: Netflix

4 years agoAdd an inode check-hash verification when running the journalled
Kirk McKusick [Fri, 10 Apr 2020 23:49:34 +0000 (23:49 +0000)]
Add an inode check-hash verification when running the journalled
soft update recovery code with the debugging (-d) option.

As inode check-hash was first introduced to UFS in FreeBSD 13,
there is no need to MFC this commit.

Reported by:  Chuck Silvers
Sponsored by: Netflix

4 years agoDocument removal of deprecated algorithms for in-kernel GSS.
John Baldwin [Fri, 10 Apr 2020 23:13:29 +0000 (23:13 +0000)]
Document removal of deprecated algorithms for in-kernel GSS.

4 years agoRemove the -o option from gssd(8).
John Baldwin [Fri, 10 Apr 2020 23:10:28 +0000 (23:10 +0000)]
Remove the -o option from gssd(8).

This uses DES and the kernel no longer supports DES for in-kernel GSS.

Reviewed by: kp
Relnotes: yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24345

4 years agoRemove support for Kernel GSS algorithms deprecated in r348875.
John Baldwin [Fri, 10 Apr 2020 23:08:41 +0000 (23:08 +0000)]
Remove support for Kernel GSS algorithms deprecated in r348875.

This removes support for using DES, Triple DES, and RC4.

Reviewed by: cem, kp
Tested by: kp
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24344

4 years agoReplace mbuf macros with the code they would generate in the NFS code.
Rick Macklem [Fri, 10 Apr 2020 22:42:14 +0000 (22:42 +0000)]
Replace mbuf macros with the code they would generate in the NFS code.

When the code was ported to Mac OS/X, mbuf handling functions were
converted to using the Mac OS/X accessor functions. For FreeBSD, they
are a simple set of macros in sys/fs/nfs/nfskpiport.h.
Since porting to Mac OS/X is no longer a consideration, replacement of
these macros with the code generated by them makes the code more
readable.
When support for external page mbufs is added as needed by the KERN_TLS,
the patch becomes simpler if done without the macros.

This patch should not result in any semantic change.
This conversion will be committed one file at a time.

4 years agoUse both crypto engines on a T6.
John Baldwin [Fri, 10 Apr 2020 22:27:45 +0000 (22:27 +0000)]
Use both crypto engines on a T6.

A T6 adapter contains two crypto engines on separate channels.  This
commit distributes sessions between the two engines.  Previously, only
the first engine was used.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D24347

4 years agohda: if a CODEC is not responding, report which one
Ed Maste [Fri, 10 Apr 2020 21:27:49 +0000 (21:27 +0000)]
hda: if a CODEC is not responding, report which one

PR: 229190
MFC after: 1 week

4 years agoReplace mbuf macros with the code they would generate in the NFS code.
Rick Macklem [Fri, 10 Apr 2020 21:25:35 +0000 (21:25 +0000)]
Replace mbuf macros with the code they would generate in the NFS code.

When the code was ported to Mac OS/X, mbuf handling functions were
converted to using the Mac OS/X accessor functions. For FreeBSD, they
are a simple set of macros in sys/fs/nfs/nfskpiport.h.
Since porting to Mac OS/X is no longer a consideration, replacement of
these macros with the code generated by them makes the code more
readable.
When support for external page mbufs is added as needed by the KERN_TLS,
the patch becomes simpler if done without the macros.

This patch should not result in any semantic change.
This conversion will be committed one file at a time.

4 years agosbappendcontrol() needs to avoid clearing M_NOTREADY on data mbufs.
Mark Johnston [Fri, 10 Apr 2020 20:42:11 +0000 (20:42 +0000)]
sbappendcontrol() needs to avoid clearing M_NOTREADY on data mbufs.

If LOCAL_CREDS is set on a unix socket and sendfile() is called,
sendfile will call uipc_send(PRUS_NOTREADY), prepending a control
message to the M_NOTREADY mbufs.  uipc_send() then calls
sbappendcontrol() instead of sbappend(), and sbappendcontrol() would
erroneously clear M_NOTREADY.

Pass send flags to sbappendcontrol(), like we do for sbappend(), to
preserve M_READY when necessary.

Reported by: syzkaller
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24333

4 years agoProperly handle disconnected sockets in uipc_ready().
Mark Johnston [Fri, 10 Apr 2020 20:41:59 +0000 (20:41 +0000)]
Properly handle disconnected sockets in uipc_ready().

When transmitting over a unix socket, data is placed directly into the
receiving socket's receive buffer, instead of the transmitting socket's
send buffer.  This means that when pru_ready is called during
sendfile(), the passed socket does not contain M_NOTREADY mbufs in its
buffers; uipc_ready() must locate the linked socket.

Currently uipc_ready() frees the mbufs if the socket is disconnected,
but this is wrong since the mbufs may still be present in the receiving
socket's buffer after a disconnect.  This can result in a use-after-free
and potentially a double free if the receive buffer is flushed after
uipc_ready() frees the mbufs.

Fix the problem by trying harder to locate the correct socket buffer and
calling sbready(): use the global list of SOCK_STREAM unix sockets to
search for a sockbuf containing the now-ready mbufs.  Only free the
mbufs if we fail this search.

Reviewed by: jah, kib
Reported and tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24332

4 years agohdac: show which command timed out
Ed Maste [Fri, 10 Apr 2020 18:38:42 +0000 (18:38 +0000)]
hdac: show which command timed out

There are several reports of "hdac0: Command timeout on address 2"
messages emitted during playback on a variety of contemporary machines.
Show the command that timed out in case it might provide a clue in
finding the cause.

PR: 229190
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agohdac: update comment on reset duration
Ed Maste [Fri, 10 Apr 2020 18:13:29 +0000 (18:13 +0000)]
hdac: update comment on reset duration

The comment previously stated the delay must be at least 250us but that
was insufficient and so should be doubled, but the delay was actually
1000.  The HDA spec actually says the delay must be 521 us (25 frames)
so update the comment to match.

4 years agoSplit rtrequest1_fib() into smaller manageable chunks.
Alexander V. Chernikov [Fri, 10 Apr 2020 16:27:27 +0000 (16:27 +0000)]
Split rtrequest1_fib() into smaller manageable chunks.

No functional changes.

* Move route addition / route deletion code from rtrequest1_fib()
  to add_route() and del_route() respectively.
* Rename rtrequest1_fib_change() to change_route() for consistency.
* Shrink the scope of ugly info #defines.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24349

4 years agouserland build: replace -fno-common with ${CFCOMMONFLAG}
Kyle Evans [Fri, 10 Apr 2020 14:01:07 +0000 (14:01 +0000)]
userland build: replace -fno-common with ${CFCOMMONFLAG}

This change allows any downstream or otherwise consumer to easily override
the new -fno-common default on a temporary basis without having to hack into
src.sys.mk, and also makes it a bit easier to search for these specific
cases where -fno-common must be overridden with -fcommon or else the build
will fail.

The gdb build, the only program requiring -fcommon on head/, is switched
over as an example usage. It will need it on all branches, so this does not
harm future mergability.

MFC after: 3 days

4 years agoAdd HISTORY section to getc(3)
Sergio Carlavilla Delgado [Fri, 10 Apr 2020 09:37:20 +0000 (09:37 +0000)]
Add HISTORY section to getc(3)

PR: 240269
Submitted by: Gordon Bergling
Differential Revision: https://reviews.freebsd.org/D24295

4 years agoexit(3): Add HISTORY section
Sergio Carlavilla Delgado [Fri, 10 Apr 2020 09:27:18 +0000 (09:27 +0000)]
exit(3): Add HISTORY section

PR: 240259
Submitted by: Gordon Bergling
Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D24146

4 years agoarc4random(3): Expand the SEE ALSO section
Sergio Carlavilla Delgado [Fri, 10 Apr 2020 09:12:41 +0000 (09:12 +0000)]
arc4random(3): Expand the SEE ALSO section

Submitted by: Gordon Bergling
Approved by: brueffer@
Obtained from: NetBSD
Differential Revision: https://reviews.freebsd.org/D23716

4 years agoAdd myself (tagattie) as ports committer
Hiroki Tagato [Fri, 10 Apr 2020 07:44:02 +0000 (07:44 +0000)]
Add myself (tagattie) as ports committer

Approved by: ehaupt (mentor)

4 years agoDo not pass bogus page to mbufs.
Konstantin Belousov [Fri, 10 Apr 2020 01:28:47 +0000 (01:28 +0000)]
Do not pass bogus page to mbufs.

This is a bug in r359473.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 years agoufs: apply suspension for non-forced rw unmounts.
Konstantin Belousov [Fri, 10 Apr 2020 01:24:16 +0000 (01:24 +0000)]
ufs: apply suspension for non-forced rw unmounts.

Forced rw unmounts and remounts from rw to ro already suspend
filesystem, which closes races with writers instantiating new vnodes
while unmount flushes the queue.  Original intent of not including
non-forced unmounts into this regime was to allow such unmounts to
fail if writer was active, but this did not worked well.

Similar change, but causing all unmount, even involving only ro
filesystem, were proposed in D24088, but I believe that suspending ro
is undesirable, and definitely spends CPU time.

Reported by: markj
Discussed with: chs, mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoadd myself (rscheff) as a src committer.
Richard Scheffenegger [Fri, 10 Apr 2020 00:31:52 +0000 (00:31 +0000)]
add myself (rscheff) as a src committer.

Reviewed by: rgrimes (mentor), tuexen (mentor)
Approved by: rgrimes (mentor), tuexen (mentor)
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24318

4 years agoFixing the soft update macros in -r359612 triggered a previously
Kirk McKusick [Thu, 9 Apr 2020 23:51:18 +0000 (23:51 +0000)]
Fixing the soft update macros in -r359612 triggered a previously
hidden bug in the file truncation code. Until that bug is tracked
down and fixed, revert to the old behavior.

Reported by: Peter Holm
Reviewed by: kib, Chuck Silvers

4 years agoWhen running with a kernel compiled with DEBUG_LOCKS, before
Kirk McKusick [Thu, 9 Apr 2020 23:42:13 +0000 (23:42 +0000)]
When running with a kernel compiled with DEBUG_LOCKS, before
panic'ing for recusing on a non-recursive lock, print out the
kernel stack where the lock was originally acquired.

4 years agolibc: Fix possible overflow in binuptime().
Konstantin Belousov [Thu, 9 Apr 2020 23:22:35 +0000 (23:22 +0000)]
libc: Fix possible overflow in binuptime().

This is an application of the kernel overflow fix from r357948 to
userspace, based on the algorithm developed by Bruce Evans. To keep
the ABI of the vds_timekeep stable, instead of adding the large_delta
member, MSB of both multipliers are added to quickly estimate the overflow.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

4 years agoReplace mbuf macros with the code they would generate in the NFS code.
Rick Macklem [Thu, 9 Apr 2020 23:11:19 +0000 (23:11 +0000)]
Replace mbuf macros with the code they would generate in the NFS code.

When the code was ported to Mac OS/X, mbuf handling functions were
converted to using the Mac OS/X accessor functions. For FreeBSD, they
are a simple set of macros in sys/fs/nfs/nfskpiport.h.
Since porting to Mac OS/X is no longer a consideration, replacement of
these macros with the code generated by them makes the code more
readable.
When support for external page mbufs is added as needed by the KERN_TLS,
the patch becomes simpler if done without the macros.

This patch should not result in any semantic change.
This conversion will be committed one file at a time.

4 years agoAdd support for BCM54618SE PHY
Justin Hibbits [Thu, 9 Apr 2020 21:24:17 +0000 (21:24 +0000)]
Add support for BCM54618SE PHY

MFC after: 3 days
Sponsored by: Juniper Networks, Inc

4 years agoRemove extra call to vfs_op_exit() from vfs_write_suspend() when VFS_SYNC() fails.
Konstantin Belousov [Thu, 9 Apr 2020 18:38:00 +0000 (18:38 +0000)]
Remove extra call to vfs_op_exit() from vfs_write_suspend() when VFS_SYNC() fails.

The vfs_write_resume() handler already does vfs_op_exit() for us.

Reported by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation

4 years agoBump version for r359745, since it removed a field from "struct proc" and
Rick Macklem [Thu, 9 Apr 2020 15:33:13 +0000 (15:33 +0000)]
Bump version for r359745, since it removed a field from "struct proc" and
that changed the offsets of fields within it.

4 years agoRemove the old NFS lock device driver that uses Giant.
Rick Macklem [Thu, 9 Apr 2020 14:44:46 +0000 (14:44 +0000)]
Remove the old NFS lock device driver that uses Giant.

This NFS lock device driver was replaced by the kernel NLM around FreeBSD7 and
has not normally been used since then.
To use it, the kernel had to be built without "options NFSLOCKD" and
the nfslockd.ko had to be deleted as well.
Since it uses Giant and is no longer used, this patch removes it.

With this device driver removed, there is now a lot of unused code
in the userland rpc.lockd. That will be removed on a future commit.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22933

4 years agoAlways install backward compatibility timezones, as they are installed
Xin LI [Thu, 9 Apr 2020 05:11:18 +0000 (05:11 +0000)]
Always install backward compatibility timezones, as they are installed
on all major Linux distributions as well as NetBSD and OpenBSD.

Remove the undocumented ZONEINFO_OLD_TIMEZONES_SUPPORT and the deprecated
OLDTIMEZONES knobs as they are now the default.

Reviewed by: ngie, rgrimes
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24306

4 years agoAdd a basic manpage for smbfs(5).
Christian Brueffer [Wed, 8 Apr 2020 20:00:30 +0000 (20:00 +0000)]
Add a basic manpage for smbfs(5).

Submitted by: Gordon Bergling
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23905

4 years agologger: temporarily disable Capsicum when a host is provided
Mariusz Zaborski [Wed, 8 Apr 2020 18:43:00 +0000 (18:43 +0000)]
logger: temporarily disable Capsicum when a host is provided

We don't have a way to send a UDP package.

PR: 245314
Reported by: dch
Discussed with: emaste

4 years agoFix copyright year and eliminate the obsolete all rights reserved line.
Warner Losh [Wed, 8 Apr 2020 17:55:45 +0000 (17:55 +0000)]
Fix copyright year and eliminate the obsolete all rights reserved line.

Reviewed by: rrs@

4 years agoClone the RCU interface into a sleepable and a non-sleepable part
Hans Petter Selasky [Wed, 8 Apr 2020 17:09:45 +0000 (17:09 +0000)]
Clone the RCU interface into a sleepable and a non-sleepable part
in the LinuxKPI.

This allows synchronize RCU to be used inside a SRCU read section.
No functional change intended.

Bump the __FreeBSD_version to force recompilation of external kernel modules.

PR: 242272
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoSome fixes for SRCU in the LinuxKPI.
Hans Petter Selasky [Wed, 8 Apr 2020 16:07:57 +0000 (16:07 +0000)]
Some fixes for SRCU in the LinuxKPI.

- Make sure to use READ_ONCE() when deferring variables.
- Remove superfluous zero initializer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAccount out of buffer as dropped packets in mlx5en(4).
Hans Petter Selasky [Wed, 8 Apr 2020 08:56:27 +0000 (08:56 +0000)]
Account out of buffer as dropped packets in mlx5en(4).

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoRemove obsolete bufring stats in mlx5en(4).
Hans Petter Selasky [Wed, 8 Apr 2020 08:53:31 +0000 (08:53 +0000)]
Remove obsolete bufring stats in mlx5en(4).

Leftover from when DRBR was removed.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix an interoperability issue w.r.t. the Linux client and the NFSv4 server.
Rick Macklem [Wed, 8 Apr 2020 01:12:54 +0000 (01:12 +0000)]
Fix an interoperability issue w.r.t. the Linux client and the NFSv4 server.

Luoqi Chen reported a problem on freebsd-fs@ where a Linux NFSv4 client
was able to open and write to a file when the file's permissions were
not set to allow the owner write access.

Since NFS servers check file permissions on every write RPC, it is standard
practice to allow the owner of the file to do writes, regardless of
file permissions. This provides POSIX like behaviour, since POSIX only
checks permissions upon open(2).
The traditional way NFS clients handle this is to check access via the
Access operation/RPC and use that to determine if an open(2) on the
client is allowed.

It appears that, for NFSv4, the Linux client expects the NFSv4 Open (not a
POSIX open) operation to fail with NFSERR_ACCES if the file is not being
created and file permissions do not allow owner access, unlike NFSv3.
Since both the Linux and OpenSolaris NFSv4 servers seem to exhibit this
behaviour, this patch changes the FreeBSD NFSv4 server to do the same.
A sysctl called vfs.nfsd.v4openaccess can be set to 0 to return the
NFSv4 server to its previous behaviour.

Since both the Linux and FreeBSD NFSv4 clients seem to exhibit correct
behaviour with the access check for file owner in Open enabled, it is enabled
by default.

Reported by: luoqi.chen@gmail.com
MFC after: 2 weeks

4 years agoIn the past changes have been made to smbios->minor without updating the
Rodney W. Grimes [Tue, 7 Apr 2020 23:17:44 +0000 (23:17 +0000)]
In the past changes have been made to smbios->minor without updating the
smbios->bcdrev value.
Correct that by calculating bcdrev from the major/minor values.

Reported by: bcran
Reviewed by: bcran, jhb
Approved by: jhb (maintainer)

4 years agoNow that we don't have special-case geom hacking defined in md_var.h, stop
Warner Losh [Tue, 7 Apr 2020 22:23:22 +0000 (22:23 +0000)]
Now that we don't have special-case geom hacking defined in md_var.h, stop
including it. sparc64 was the last straggler here, but these weren't removed at
the time.

4 years agoAdd a basic test for nvmecontrol
David Bright [Tue, 7 Apr 2020 20:26:42 +0000 (20:26 +0000)]
Add a basic test for nvmecontrol

I recently made some bug fixes in nvmecontrol. It occurred to me that
since nvmecontrol lacks any kyua tests, I should convert the informal
testing I did into a more formal automated test. The test in this
change should be considered just a starting point; it is neither
complete nor thorough. While converting the test to ATF/kyua, I
discovered a small bug in nvmecontrol; the nvmecontrol devlist command
would always exit with an unsuccessful status. So I included the fix
for that, too, so that the test won't fail.

Reviewed by: imp@
MFC after: 3 days
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24269

4 years agoAdd support to MSDOS FS in PPC loader
Leandro Lupori [Tue, 7 Apr 2020 19:46:00 +0000 (19:46 +0000)]
Add support to MSDOS FS in PPC loader

Although PPC OFW loader already had a LOADER_MSDOS_SUPPORT option, a few lines
were missing in conf.c, in order to support FAT filesystems.

This is useful when running FreeBSD under QEMU, to be able to easily change the
kernel and modules when running on hosts without UFS read/write support.

Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D24328

4 years agoNO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.
Bryan Drewery [Tue, 7 Apr 2020 17:07:04 +0000 (17:07 +0000)]
NO_OBJ: Always fix .OBJDIR regardless of AUTO_OBJ.

Sponsored by: Dell EMC
MFC after: 2 weeks

4 years agoAdd VIRTIO_NET_F_MTU flag support for the bhyve virtio-net device.
Aleksandr Fedorov [Tue, 7 Apr 2020 17:06:33 +0000 (17:06 +0000)]
Add VIRTIO_NET_F_MTU flag support for the bhyve virtio-net device.
The flag can be enabled using the new 'mtu' option:
bhyve -s X:Y:Z,virtio-net,[tapN|valeX:N],mtu=9000

Reported by: vmaffione, jhb
Approved by: vmaffione (mentor)
Differential Revision: https://reviews.freebsd.org/D23971

4 years agoAdd -fno-common to all userland/kernel src builds
Kyle Evans [Tue, 7 Apr 2020 17:04:24 +0000 (17:04 +0000)]
Add -fno-common to all userland/kernel src builds

-fno-common will become the default in GCC10/LLVM11. Plenty of work has been
put in to make sure our world builds are no -fno-common clean, so let's slap
the build with this until it becomes the compiler default to ensure we don't
regress.

At this time, we will not be enforcing -fno-common on ports builds. I
suspect most ports will be or quickly become -fno-common clean as they're
naturally built against compilers that default to it, so this will hopefully
become a non-issue in due time. The exception to this, which is actually the
status quo, is that kmods built from ports will continue to build with
-fno-common.

As of the time of writing, I intend to also make stable/12 -fno-common
clean. What's been done will be MFC'd to stable/11 if it's easily applicable
and/or not much work to massage it into being functional, but I anticipate
adding -fcommon to stable/11 builds to maintain its ability to be built with
newer compilers for the rest of its lifetime instead of putting in a third
branch's worth of effort.

4 years agoImprove interaction of vectx and tftp
Simon J. Gerraty [Tue, 7 Apr 2020 16:56:34 +0000 (16:56 +0000)]
Improve interaction of vectx and tftp

On slow platforms, it helps to spread the hashing load
over time so that tftp does not timeout.

Also, some .4th files are too big to fit in cache of pkgfs,
so increase cache size and ensure fully populated.

Reviewed by: stevek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24287

4 years agolibcasper(3): Export functions to C++
Conrad Meyer [Tue, 7 Apr 2020 16:40:41 +0000 (16:40 +0000)]
libcasper(3): Export functions to C++

We must wrap C declarations in __BEGIN / __END_DECLS to avoid C++ name-mangling
of the declaration when including the C header; name-mangling causes the linker
to attempt to locate the wrong (C++ ABI) symbol name.

Reviewed by: markj, oshogbo (earlier version both)
Differential Revision: https://reviews.freebsd.org/D24323

4 years agoAllow the kernel to build with a compiler that sets -fno-common.
Brooks Davis [Tue, 7 Apr 2020 15:32:08 +0000 (15:32 +0000)]
Allow the kernel to build with a compiler that sets -fno-common.

The mechanism that generates assym.inc and offset.inc depends on the
symbols in question being common. For now, simply force the object files
to be created with -fcommon.

-fno-common will be the default in GCC10/LLVM11.

Submitted by: arichardson
Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24322

4 years agoFix port/kernel builds after r359681
Kyle Evans [Tue, 7 Apr 2020 15:10:04 +0000 (15:10 +0000)]
Fix port/kernel builds after r359681

Submitted by: bdrewery
Reported by: bdrewery, sobomax, antoine

4 years agoconfig(8): "fix" a couple of buffer overflows
Kyle Evans [Tue, 7 Apr 2020 14:14:59 +0000 (14:14 +0000)]
config(8): "fix" a couple of buffer overflows

Recently added/changed lines in various kernel configs have caused some
buffer overflows that went undetected. These were detected with a config
built using -fno-common as these line buffers smashed one of our arrays,
then further triaged with ASAN.

Double the sizes; this is really not a great fix, but addresses the
immediate need until someone rewrites config. While here, add some bounds
checking so that we don't need to detect this by random bus errors or other
weird failures.

MFC after: 3 days

4 years agostand: -fno-common fixes for !x86 loaders
Kyle Evans [Tue, 7 Apr 2020 12:57:50 +0000 (12:57 +0000)]
stand: -fno-common fixes for !x86 loaders

- beriloader: archsw is declared extern and defined elsewhere
- ofwloader: ofw_elf{,64} are defined in elf_freebsd.c and
  ppc64_elf_freebsd.c respectively
- ubldr: syscall_ptr is defined in start.S for whichever ubldr platform is
  building

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

4 years ago[PPC] Fix loader call to instantiate-rtas
Leandro Lupori [Tue, 7 Apr 2020 12:46:26 +0000 (12:46 +0000)]
[PPC] Fix loader call to instantiate-rtas

OpenFirmware (OF) method instantiate-rtas was being called with a wrong
rtas-base-address argument. It must use the memory that is already being
allocated to this end instead. This issue was causing QEMU netboot to hang
when building the FDT from OF DT.

Reviewed by: jhibbits
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D24313

4 years agoFix panic on kern.cam.ctl.ha_role change after r333446.
Alexander Motin [Tue, 7 Apr 2020 03:19:00 +0000 (03:19 +0000)]
Fix panic on kern.cam.ctl.ha_role change after r333446.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agoNormalize deployment tools usage and definitions by putting into one place
Maxim Sobolev [Tue, 7 Apr 2020 02:46:22 +0000 (02:46 +0000)]
Normalize deployment tools usage and definitions by putting into one place
instead of sprinkling them out over many disjoint files. This is a follow-up
to achieve the same goal in an incomplete rev.348521.

Approved by: imp
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20520

4 years agoriscv: Add semicolon missing from r359672
Jessica Clarke [Mon, 6 Apr 2020 23:54:50 +0000 (23:54 +0000)]
riscv: Add semicolon missing from r359672

Somehow this got lost between build-testing and submitting to Phabricator.

4 years agoFix compilation with upstream clang builtin headers.
Brooks Davis [Mon, 6 Apr 2020 23:38:46 +0000 (23:38 +0000)]
Fix compilation with upstream clang builtin headers.

By using -nobuiltininc and adding the clang builtin headers resource dir
to the end of the compiler header search path, we can still find headers
such as immintrin.h but find the FreeBSD version of stddef.h/stdarg.h/..
first.

This is a workaround until we are able to settle on and complete a plan
to harmonize guard macros with LLVM.  We've mostly worked out this on
FreeBSD systems by removing select headers from the installed set of
devel/llvm*, but that isn't a good solution for cross build.

Submitted by: arichardson
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17002

4 years agomail/gprof/tip: tap with the ugly stick
Kyle Evans [Mon, 6 Apr 2020 23:28:24 +0000 (23:28 +0000)]
mail/gprof/tip: tap with the ugly stick

The ugly stick here is this bit in the respective headers:

#ifndef EXTERN
#define EXTERN extern
#endif

with a follow-up #define EXTERN in a single .c file to push all of their
definitions into one spot. A pass should be made over these three later to
push these definitions into the correct files instead, but this will suffice
for now and at a more leisurely pace.

MFC after: 3 days

4 years agoFix noisy NFSv4 server printf.
Rick Macklem [Mon, 6 Apr 2020 23:21:39 +0000 (23:21 +0000)]
Fix noisy NFSv4 server printf.

Peter reported that his dmesg was getting cluttered with
nfsrv_cache_session: no session
messages when he rebooted his NFS server and they did not seem useful.
He was correct, in that these messages are "normal" and expected when
NFSv4.1 or NFSv4.2 are mounted and the server is rebooted.
This patch silences the printf() during the grace period after a reboot.
It also adds the client IP address to the printf(), so that the message
is more useful if/when it occurs. If this happens outside of the
server's grace period, it does indicate something is not working correctly.
Instead of adding yet another nd_XXX argument, the arguments for
nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *".

Reported by: pen@lysator.liu.se
MFC after: 2 weeks

4 years agoindent: fix the -fno-common build
Kyle Evans [Mon, 6 Apr 2020 23:20:20 +0000 (23:20 +0000)]
indent: fix the -fno-common build

Spread the globals far and wide, hopefully to the files that make the most
sense.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

4 years agoyp*: fix -fno-common build
Kyle Evans [Mon, 6 Apr 2020 23:16:05 +0000 (23:16 +0000)]
yp*: fix -fno-common build

This is mostly two problems spread out far and wide:
- ypldap_process should be declared properly
- debug is defined differently in many programs

For the latter, just extern it and define it everywhere that actually needs
it. This mostly works out nicely for ^/libexec/ypxfr, which can remove the
assignment at the beginning of main in favor of defining it properly.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

4 years agontpd: fix build with -fno-common
Kyle Evans [Mon, 6 Apr 2020 23:11:43 +0000 (23:11 +0000)]
ntpd: fix build with -fno-common

Only a small nit here: psl should be declared extern and defined exactly
once.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

4 years agokqueue tests: fix -fno-common build
Kyle Evans [Mon, 6 Apr 2020 23:08:07 +0000 (23:08 +0000)]
kqueue tests: fix -fno-common build

vnode_fd and kqfd are both shared among multiple CU; define them exactly
once.

In the case of vnode_fd, it was simply the declaration that needed
correction.

-fno-common will become the default in GCC10/LLVM11.

MFC after: 3 days

4 years agolibcasper: Constify cap_sysctl_limit_mib() mib parameter
Conrad Meyer [Mon, 6 Apr 2020 23:07:56 +0000 (23:07 +0000)]
libcasper: Constify cap_sysctl_limit_mib() mib parameter

No functional change. Minor API change that is nicer for consumers. ABI is
identical; the routine never needed to modify the pointed to value.

Reviewed by: emaste, markj
Differential Revision: https://reviews.freebsd.org/D24319

4 years agoRISC-V: copy the DTB to early KVA
Mitchell Horne [Mon, 6 Apr 2020 22:48:43 +0000 (22:48 +0000)]
RISC-V: copy the DTB to early KVA

The location of the device-tree blob is passed to the kernel by the
previous booting stage (i.e. BBL or OpenSBI). Currently, we leave it
untouched and mark the 1MB of memory holding it as unavailable.

Instead, do what is done by other fake_preload_metadata() routines and
copy to the DTB to KVA space. This is more in line with what loader(8)
will provide us in the future, and it allows us to reclaim the hole in
physical memory.

Reviewed by: markj, kp (earlier version)
Differential Revision: https://reviews.freebsd.org/D24152

4 years agoriscv: Make sure local hart's icache is synced in pmap_sync_icache
Jessica Clarke [Mon, 6 Apr 2020 22:31:30 +0000 (22:31 +0000)]
riscv: Make sure local hart's icache is synced in pmap_sync_icache

The only way to flush the local hart's icache is with a FENCE.I (or an
equivalent SBI call); a normal FENCE is insufficient and, for the
single-hart case, unnecessary.

Reviewed by: jhb (mentor), markj
Approved by: jhb (mentor), markj
Differential Revision: https://reviews.freebsd.org/D24317

4 years agoriscv: Fix pmap_fault_fixup for L3 pages
Jessica Clarke [Mon, 6 Apr 2020 22:29:15 +0000 (22:29 +0000)]
riscv: Fix pmap_fault_fixup for L3 pages

Summary:
The parentheses being in the wrong place means that, for L3 pages,
oldpte has all bits except PTE_V cleared, and so all the subsequent
checks against oldpte will fail, causing us to bail out and not retry
the faulting instruction after an SFENCE.VMA. This causes a WITNESS +
INVARIANTS kernel to fault on the "Chisel P3" (BOOM-based) DARPA SSITH
GFE SoC in pmap_init when writing to pv_table and, being a nofault
entry, subsequently panic with:

  panic: vm_fault_lookup: fault on nofault entry, addr: 0xffffffc004e00000

Reviewed by: markj
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D24315

4 years agoRevert -r359612 as it can cause other panics.
Kirk McKusick [Mon, 6 Apr 2020 20:23:47 +0000 (20:23 +0000)]
Revert -r359612 as it can cause other panics.
An updated version will be made when the issue has been resolved.

Reported by: Peter Holm

4 years agoAdd hwpmc support for Intel Atom Goldmont microarchitecture
Marcin Wojtas [Mon, 6 Apr 2020 19:45:26 +0000 (19:45 +0000)]
Add hwpmc support for Intel Atom Goldmont microarchitecture

Recognize new micro-architecture in hwpmc_intel driver. Based on Intel
document 325462-071US. Tested with tools/test/hwpmc/pmctest.py
on Atom E3930 SoC.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: kib
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D24310

4 years agoRelax too strict SES element descriptors check in r355430.
Alexander Motin [Mon, 6 Apr 2020 18:42:01 +0000 (18:42 +0000)]
Relax too strict SES element descriptors check in r355430.

SES specifications allows the string to be NULL-terminated, while previous
code was considering it as invalid due to incorrectly ordered conditions.

MFC after:  1 week
Sponsored by: iXsystem, Inc.

4 years agoDo more argument validation under INVARIANTS when starting/stopping
Michael Tuexen [Mon, 6 Apr 2020 13:58:13 +0000 (13:58 +0000)]
Do more argument validation under INVARIANTS when starting/stopping
an SCTP timer.

MFC after: 1 week

4 years agoAdd Gordon Bergling to the authors section; remove trailing whitespace.
Christian Brueffer [Mon, 6 Apr 2020 09:59:21 +0000 (09:59 +0000)]
Add Gordon Bergling to the authors section; remove trailing whitespace.

Suggested by: rgrimes
Approved by: Gordon Bergling
X-MFC-with: r359633

4 years agoDon't drop packets having too many TCP option headers in mlx5en(4).
Hans Petter Selasky [Mon, 6 Apr 2020 09:50:20 +0000 (09:50 +0000)]
Don't drop packets having too many TCP option headers in mlx5en(4).

When using SACK it can happen there are multiple option headers.
Don't drop these packets, but instead limit the amount of inlining
to the maximum supported.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoEnsure a minimum inline size of 16 bytes in mlx5en(4).
Hans Petter Selasky [Mon, 6 Apr 2020 09:45:49 +0000 (09:45 +0000)]
Ensure a minimum inline size of 16 bytes in mlx5en(4).

This includes 14 bytes of ethernet header and 2 bytes of VLAN header.

This allows for making assumptions about the inline size limit
in the fast transmit path later on.

Use a signed integer variable to catch underflow.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoCount number of times transmit ring is out of buffers in mlx5en(4).
Hans Petter Selasky [Mon, 6 Apr 2020 09:41:22 +0000 (09:41 +0000)]
Count number of times transmit ring is out of buffers in mlx5en(4).

Differential Revision: https://reviews.freebsd.org/D24273
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoAdd MDIO PHY driver for NS2 ARM64 platform.
Wojciech Macek [Mon, 6 Apr 2020 05:48:58 +0000 (05:48 +0000)]
Add MDIO PHY driver for NS2 ARM64 platform.

Obtained from:         Semihalf
Authored by:           Kornel Duleba <mindal@semihalf.com>
Approved by:           wma
Differential Revision: https://reviews.freebsd.org/D21335

4 years agosrc.conf(5): re-roll after r359644 (LLVM_ASSERTIONS)
Kyle Evans [Mon, 6 Apr 2020 01:28:03 +0000 (01:28 +0000)]
src.conf(5): re-roll after r359644 (LLVM_ASSERTIONS)

4 years agollvm: add a build knob for enabling assertions
Kyle Evans [Mon, 6 Apr 2020 01:27:17 +0000 (01:27 +0000)]
llvm: add a build knob for enabling assertions

For head/, this will remain eternally default-on to maintain the status quo.
For stable/ branches, it should be flipped to default-off to maintain the
status quo.

There's value in being able to flip it one way or the other easily on head
or stable branches, whether you want to gain some performance back on head/
(for machines there's little chance you'll actually hit an assertion) or
potentially diagnose a problem with the version of llvm on an older branch.

Currently, stable branches get the CFLAGS+= -ndebug line uncommented; going
forward, they will instead have the default of LLVM_ASSERTIONS flipped.

Reviewed by: dim, emaste, re (gjb)
MFC after: 1 week
MFC note: flip the default of LLVM_ASSERTIONS
Differential Revision: https://reviews.freebsd.org/D24264

4 years agoChange the xid for client side krpc over UDP to a global value.
Rick Macklem [Sun, 5 Apr 2020 21:08:17 +0000 (21:08 +0000)]
Change the xid for client side krpc over UDP to a global value.

Without this patch, the xid used for the client side krpc requests over
UDP was initialized for each "connection". A "connection" for UDP is
rather sketchy and for the kernel NLM a new one is created every 2minutes.
A problem with client side interoperability with a Netapp server for the NLM
was reported and it is believed to be caused by reuse of the same xid.
Although this was never completely diagnosed by the reporter, I could see
how the same xid might get reused, since it is initialized to a value
based on the TOD clock every two minutes.
I suspect initializing the value for every "connection" was inherited from
userland library code, where having a global xid was not practical.
However, implementing a global "xid" for the kernel rpc is straightforward
and will ensure that an xid value is not reused for a long time. This
patch does that and is hoped it will fix the Netapp interoperability
problem.

PR: 245022
Reported by: danny@cs.huji.ac.il
MFC after: 2 weeks

4 years agoadduser: allow standard IFS characters in passwords
Kyle Evans [Sun, 5 Apr 2020 19:25:46 +0000 (19:25 +0000)]
adduser: allow standard IFS characters in passwords

Notably, the default IFS contains space/tab, thus any leading/trailing
whitespace characters tend to be removed.

Set IFS= for just the read lines to mitigate this, allowing the user to be
less surprised when their leading/trailing spaces weren't actually captured
in the password as they are with other means of setting a user's password.

PR: 245342
Submitted by: dereks_lifeofadishwasher.com
Reviewed by: jilles
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24292

4 years agobridge: Change lists to CK_LIST as a peparation for epochification
Kristof Provost [Sun, 5 Apr 2020 17:15:20 +0000 (17:15 +0000)]
bridge: Change lists to CK_LIST as a peparation for epochification

Prepare the ground for a rework of the bridge locking approach. We will
use an epoch-based approach in the datapath and making it safe to
iterate over the interface, span and rtnode lists without holding the
BRIDGE_LOCK. Replace the relevant lists by their ConcurrencyKit
equivalents.

No functional change in this commit.

Reviewed by: emaste, ae, philip (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24249

4 years agoMake p_vaddr % p_align == p_offset % p_align for (some) TLS segments.
Konstantin Belousov [Sat, 4 Apr 2020 22:37:50 +0000 (22:37 +0000)]
Make p_vaddr % p_align == p_offset % p_align for (some) TLS segments.

See https://sourceware.org/bugzilla/show_bug.cgi?id=24606 for the test case.
See https://reviews.llvm.org/D64930 for the background and more discussion.

Also this fixes another bug in malloc_aligned() where total size of
the allocated memory might be not enough to fit the aligned requested
block after the initial pointer is incremented by the pointer size.

Reviewed by: bdragon
Tested by: antoine (exp-run PR 244866), bdragon, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D21163

4 years agoAdd a manpage for smbios(4).
Christian Brueffer [Sat, 4 Apr 2020 21:38:00 +0000 (21:38 +0000)]
Add a manpage for smbios(4).

Submitted by: Gordon Bergling
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23714

4 years agoRemove extra spaces for the load average of machines that are down.
Yoshihiro Takahashi [Sat, 4 Apr 2020 12:07:36 +0000 (12:07 +0000)]
Remove extra spaces for the load average of machines that are down.

PR: 245296
Submitted by: martin _at_ lispworks.com
MFC after: 1 week

4 years agoFix typo
Sergio Carlavilla Delgado [Sat, 4 Apr 2020 07:43:47 +0000 (07:43 +0000)]
Fix typo

4 years agomac_policy: Remove mac_policy_sx
Jason A. Harmening [Sat, 4 Apr 2020 04:03:10 +0000 (04:03 +0000)]
mac_policy: Remove mac_policy_sx

This lock was made unnecessary by the addition of mac_policy_rms in r356120.

Reviewed by: mjg, kib
Differential Revision: https://reviews.freebsd.org/D24283

4 years agoClean up global variable declarations in the dump and restore
Kirk McKusick [Sat, 4 Apr 2020 00:56:56 +0000 (00:56 +0000)]
Clean up global variable declarations in the dump and restore
utilities so that they will compile with -fno-common.

Started by:  Kyle Evans (kevans)
Reviewed by: Kyle Evans (kevans)
MFC after:   1 week
Differential Revision: https://reviews.freebsd.org/D24210

4 years agovt: avoid overrun when stride is not a multiple of bytes per pixel
Ed Maste [Sat, 4 Apr 2020 00:31:30 +0000 (00:31 +0000)]
vt: avoid overrun when stride is not a multiple of bytes per pixel

The reporter is developing a frame buffer driver for hardware using
3 bytes per pixel, but a stride that's a multiple of 256.  Previously
this resulted in writing beyond the end of each stride.  On the last
row this attempted to write past the end of the frame buffer, triggering
the assertion in vt_fb_mem_wr1().

PR: 243533
MFC after: 2 weeks
Submitted by: Thomas Skibo