]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoSwitch the am335x_pmic driver to using iicdev_readfrom/writeto.
ian [Sat, 10 Aug 2019 17:14:35 +0000 (17:14 +0000)]
Switch the am335x_pmic driver to using iicdev_readfrom/writeto.

PR: 239697
Submitted by: Chuhong Yuan

4 years agotests/sys/opencrypto: enable armv8crypto on aarch64
ngie [Sat, 10 Aug 2019 15:53:42 +0000 (15:53 +0000)]
tests/sys/opencrypto: enable armv8crypto on aarch64

This change makes required modifications in runtests to also only require the
aesni module on Intel (i386/amd64) platforms, as it is an Intel specific
module.

MFC after: 1 month
MFC to: ^/stable/12 (support not present on ^/stable/11)
Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D21018

4 years agoThese are no longer a thing, remove them.
imp [Sat, 10 Aug 2019 04:15:36 +0000 (04:15 +0000)]
These are no longer a thing, remove them.

We don't need to omit ep and ex from LINT since they have been removed from the
tree.

4 years agoDon't add -Wno-class-memaccess with older gcc.
brooks [Fri, 9 Aug 2019 23:50:57 +0000 (23:50 +0000)]
Don't add -Wno-class-memaccess with older gcc.

This is a gcc 8.0+ warning which needed to be silenced on for the riscv
build.  amd64-xtoolchain-gcc still uses gcc 6.4.0 and does not understand
this flag.

Reviewed by: asomers
Feedback from: imp
Differential Revision: https://reviews.freebsd.org/D21195

4 years agoImplement _umtx_op_err.S on powerpc / powerpc64.
bdragon [Fri, 9 Aug 2019 20:16:38 +0000 (20:16 +0000)]
Implement _umtx_op_err.S on powerpc / powerpc64.

As per r177853, we need to avoid using errno inside user mutex code, since
 signal handlers can interfere with it and mess up libthr internal state.

So, implement _umtx_op_err() instead, which makes a raw syscall and
returns the error value directly instead of using errno.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D20946

4 years agoloader: add error check for vdev_indirect calls
tsoome [Fri, 9 Aug 2019 19:09:05 +0000 (19:09 +0000)]
loader: add error check for vdev_indirect calls

We can error out due to memory allocation errors, we can not recover from
those and need to get out.

4 years agoAdd missing new line in several log messages.
ae [Fri, 9 Aug 2019 08:58:09 +0000 (08:58 +0000)]
Add missing new line in several log messages.

PR: 239694
MFC after: 1 week

4 years agoIn m_pulldown(), before trying to prepend bytes to the subsequent mbuf,
jtl [Fri, 9 Aug 2019 05:18:59 +0000 (05:18 +0000)]
In m_pulldown(), before trying to prepend bytes to the subsequent mbuf,
ensure that the subsequent mbuf contains the remainder of the bytes
the caller sought. If this is not the case, fall through to the code
which gathers the bytes in a new mbuf.

This fixes a bug where m_pulldown() could fail to gather all the desired
bytes into consecutive memory.

PR: 238787
Reported by: A reddit user
Discussed with: emaste
Obtained from: NetBSD
MFC after: 3 days

4 years agoautofs: Fix autounmountd's printing of mount time.
jhibbits [Fri, 9 Aug 2019 02:20:26 +0000 (02:20 +0000)]
autofs: Fix autounmountd's printing of mount time.

time_t should be printed as intmax_t.  Even though duration should be short, the
correct way to print is intmax_t, not long.

Reported by: ian,imp

4 years agotools/tools/crypto: cryptokeytest: Fix build with newer OpenSSL
cem [Fri, 9 Aug 2019 02:11:47 +0000 (02:11 +0000)]
tools/tools/crypto: cryptokeytest: Fix build with newer OpenSSL

Also, drag into this decade.

4 years agoFlesh out the STANDARDS and AUTHORS sections in the du(1) man page.
markj [Thu, 8 Aug 2019 21:16:15 +0000 (21:16 +0000)]
Flesh out the STANDARDS and AUTHORS sections in the du(1) man page.

PR: 239722
Submitted by: Gordon Bergling <gbergling@gmail.com>
MFC after: 3 days

4 years agoUpdate RFC references in the whois(1) man page.
markj [Thu, 8 Aug 2019 21:15:02 +0000 (21:15 +0000)]
Update RFC references in the whois(1) man page.

PR: 239720
Submitted by: Gordon Bergling <gbergling@gmail.com>
MFC after: 3 days

4 years agoAdd a reference to the NFSv3 RFC.
markj [Thu, 8 Aug 2019 21:08:13 +0000 (21:08 +0000)]
Add a reference to the NFSv3 RFC.

PR: 239721
Submitted by: Gordon Bergling <gbergling@gmail.com>
MFC after: 3 days

4 years agoFix formatting.
markj [Thu, 8 Aug 2019 20:56:52 +0000 (20:56 +0000)]
Fix formatting.

PR: 239726
Submitted by: Gordon Bergling <gbergling@gmail.com>
MFC after: 3 days

4 years agoStopgap fix for gcc platforms.
imp [Thu, 8 Aug 2019 20:09:36 +0000 (20:09 +0000)]
Stopgap fix for gcc platforms.

Our in-tree gcc doesn't have a no-tree-vectorize optimization knob, so we get a
warning that it's unused. This causes the build to fail on all our gcc platforms.
Add a quick version check as a stop-gap measure to get CI building again.

4 years agoRemove some harmless cruft from vn_generic_copy_file_range().
rmacklem [Thu, 8 Aug 2019 20:07:38 +0000 (20:07 +0000)]
Remove some harmless cruft from vn_generic_copy_file_range().

An earlier version of the patch had code that set "error" between
line#s 2797-2799. When that code was moved, the second check for "error != 0"
could never be true and the check became harmless cruft.
This patch removes the cruft, mainly to make Coverity happy.

Reported by: asomers, cem

4 years agoFix copy_file_range(2) for an unlikely race during hole finding.
rmacklem [Thu, 8 Aug 2019 19:53:07 +0000 (19:53 +0000)]
Fix copy_file_range(2) for an unlikely race during hole finding.

Since the VOP_IOCTL(FIOSEEKDATA/FIOSEEKHOLE) calls are done with the
vnode unlocked, it is possible for another thread to do:
- truncate(), lseek(), write()
between the two calls and create a hole where FIOSEEKDATA returned the
start of data.
For this case, VOP_IOCTL(FIOSEEKHOLE) will return the same offset for
the hole location. This could result in an infinite loop in the copy
code, since copylen is set to 0 and the copy doesn't advance.
Usually, this race is avoided because of the use of rangelocks, but the
NFS server does not do range locking and could do a sequence like the
above to create the hole.

This patch checks for this case and makes the hole search fail, to avoid
the infinite loop.

At this time, it is an open question as to whether or not the NFS server
should do range locking to avoid this race.

4 years agoloader: support com.delphix:removing
tsoome [Thu, 8 Aug 2019 18:08:13 +0000 (18:08 +0000)]
loader: support com.delphix:removing

We should support removing vdev from boot pool. Update loader zfs reader
to support com.delphix:removing.

Reviewed by: allanjude
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18901

4 years agoFirst pass at a LINT for arm64.
imp [Thu, 8 Aug 2019 17:55:19 +0000 (17:55 +0000)]
First pass at a LINT for arm64.

Create a rough and ready NOTES file from GENERIC, remove the duplication from
sys/conf/NOTES and add relevant no* directives to make this compile.

Reviewed by: jhb, manu (earlier versions that differed only in comments)
Differential Revision: https://reviews.freebsd.org/D21184

4 years agoMake arm64 32-bit mode compile with COMPAT_43
imp [Thu, 8 Aug 2019 17:48:07 +0000 (17:48 +0000)]
Make arm64 32-bit mode compile with COMPAT_43

The COMPAT_43 option isn't quite like the other compat options, and arm64 makes
attempts to support it in 64-bit mode. In 32-bit compat mode, however, two
syscall implementations that COMPAT_FREEBSD32 assumes will be there are
missing. Provide implementations for these: ofreebsd32_sigreturn (which we'll
never encounter, so implement it as nosys as is done in kern_sig.c) and
ofreebsd32_getpagesize, where we'll always return 4096 since that's the only
PAGE_SIZE we support, similar to how the ia32 implementation does things.

Reviewed by: manu@
Differential Revision: https://reviews.freebsd.org/D21192

4 years agoVerify files loaded in chain command.
mw [Thu, 8 Aug 2019 17:03:30 +0000 (17:03 +0000)]
Verify files loaded in chain command.

The chain command can be used to chain load another binary.
If veriexec is enabled we should verify it first.
Note that on EFI systems the verification was already done
through firmware, assuming that Secure Boot was enabled there.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Reviewed by: sjg
MFC after: 1 week
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D20952

4 years agoUpdate to Zstandard 1.4.2
cem [Thu, 8 Aug 2019 16:54:22 +0000 (16:54 +0000)]
Update to Zstandard 1.4.2

The full release notes for 1.4.1 (skipped) and 1.4.2 can be found on Github:

  https://github.com/facebook/zstd/releases/tag/v1.4.1
  https://github.com/facebook/zstd/releases/tag/v1.4.2

These are mostly minor updates; 1.4.1 purportedly brings something like 7%
faster decompression speed.

Relnotes: yes

4 years agoFix mac_veriexec_parser build after r347938
mw [Thu, 8 Aug 2019 16:51:49 +0000 (16:51 +0000)]
Fix mac_veriexec_parser build after r347938

In r347938 the definition of mac_veriexec_metadata_add_file
so adjust the argument list accordingly.

Submitted by: Kornel Duleba <mindal@semihalf.com>

4 years agoFix stack grow for init.
kib [Thu, 8 Aug 2019 16:48:19 +0000 (16:48 +0000)]
Fix stack grow for init.

During early stages of kern_exec(), including strings copyout,
p_textvp for init is NULL.  This prevented stack grow from working for
init execution.

Without stack gap enabled, initial stack segment size is enough for
strings passed by kernel to init.  With the gap enabled, the used
address might fall out of the initial segment, which kills init.

Exclude initproc from the check for contexts which should not cause
stack grow in the target map.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoUpdate comment explaining create_init().
kib [Thu, 8 Aug 2019 16:42:53 +0000 (16:42 +0000)]
Update comment explaining create_init().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

4 years agomips: Fix register target for SP setting in libproc
jhibbits [Thu, 8 Aug 2019 16:37:32 +0000 (16:37 +0000)]
mips: Fix register target for SP setting in libproc

Copy-paste-o from r233042
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D21188

4 years agoimport zstd 1.4.2
cem [Thu, 8 Aug 2019 15:37:56 +0000 (15:37 +0000)]
import zstd 1.4.2

4 years agoimport zstd 1.4.1
cem [Thu, 8 Aug 2019 15:30:49 +0000 (15:30 +0000)]
import zstd 1.4.1

4 years agoAdd TCP_RFC7413
imp [Thu, 8 Aug 2019 15:11:37 +0000 (15:11 +0000)]
Add TCP_RFC7413

We should be linting this This isn't enabled on all platforms, but compiles on
them all.

Noticed by: jhb in another review

4 years agoarmv8crypto: add missing unlock for session (after r336439)
emaste [Thu, 8 Aug 2019 14:34:53 +0000 (14:34 +0000)]
armv8crypto: add missing unlock for session (after r336439)

Attempts to use cryptodev (e.g. tests at /usr/src/tests/sys/opencrypto
with armv8crypto added to the module lists) were causing a panic.

Submitted by: Greg V <greg_unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D21012

4 years agoRename IPPROTO 33 from SEP to DCCP
thj [Thu, 8 Aug 2019 11:43:09 +0000 (11:43 +0000)]
Rename IPPROTO 33 from SEP to DCCP

IPPROTO 33 is DCCP in the IANA Registry:
https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

IPPROTO_SEP was added about 20 years ago in r33804. The entries were added
straight from RFC1700, without regard to whether they were used.

The reference in RFC1700 for SEP is '[JC120] <mystery contact>', this is an
indication that the protocol number was probably in use in a private network.

As RFC1700 is no longer the authoritative list of internet numbers and that
IANA assinged 33 to DCCP in RFC4340, change the header to the actual
authoritative source.

Reviewed by: Richard Scheffenegger, bz
Approved by: bz (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21178

4 years agofrag6: move public structure into file local space.
bz [Thu, 8 Aug 2019 10:59:54 +0000 (10:59 +0000)]
frag6: move public structure into file local space.

Move ip6asfrag and the accompanying IP6_REASS_MBUF macro from
ip6_var.h into frag6.c as they are not used outside frag6.c.
Sadly struct ip6q is all over the mac framework so we have to
leave it public.

This reduces the public KPI space.

MFC after: 3 months
X-MFC: possibly MFC the #define only to stable branches
Sponsored by: Netflix

4 years agofrag6.c: cleanup varaibles and return statements.
bz [Thu, 8 Aug 2019 10:15:47 +0000 (10:15 +0000)]
frag6.c: cleanup varaibles and return statements.

Consitently put () around return values.
Do not assign variables at the time of variable declaration.
Sort variables.  Rename ia to ia6, remove/reuse some variables used only
once or twice for temporary calculations.

No functional changes intended.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: initial comment and whitespace cleanup.
bz [Thu, 8 Aug 2019 09:42:57 +0000 (09:42 +0000)]
frag6.c: initial comment and whitespace cleanup.

Cleanup some comments (start with upper case, ends in punctuation,
use width and do not consume vertical space).  Update comments to
RFC8200.  Some whitespace changes.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agoFix a typo.
tuexen [Thu, 8 Aug 2019 08:23:27 +0000 (08:23 +0000)]
Fix a typo.

Submitted by: Thomas Dreibholz
MFC after: 1 week

4 years agoConvert DDB_CTF to use newer version of ZLIB.
delphij [Thu, 8 Aug 2019 07:27:49 +0000 (07:27 +0000)]
Convert DDB_CTF to use newer version of ZLIB.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp>
Differential Revision: https://reviews.freebsd.org/D21176

4 years agoUpdate bxe(4) to use new zlib.
delphij [Thu, 8 Aug 2019 06:30:12 +0000 (06:30 +0000)]
Update bxe(4) to use new zlib.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp>
Differential Revision: https://reviews.freebsd.org/D21175

4 years agoUpdate geom_uzip to use new zlib:
delphij [Thu, 8 Aug 2019 06:27:39 +0000 (06:27 +0000)]
Update geom_uzip to use new zlib:

 - Use new zlib headers;
 - Removed z_alloc and z_free to use the common sys/dev/zlib version.
 - Replace z_compressBound with compressBound from zlib.

While there, limit LZMA CFLAGS to apply only for g_uzip_lzma.c.

PR: 229763
Submitted by: Yoshihiro Ota <ota j email ne jp> (with changes,
bugs are mine)
Differential Revision: https://reviews.freebsd.org/D20271

4 years agoOrdinarily, during a superpage promotion or demotion within a pmap, the
alc [Thu, 8 Aug 2019 06:26:34 +0000 (06:26 +0000)]
Ordinarily, during a superpage promotion or demotion within a pmap, the
pmap's lock ensures that other operations on the pmap don't observe the
old mapping being broken before the new mapping is established.  However,
pmap_kextract() doesn't acquire the kernel pmap's lock, so it may observe
the broken mapping.  And, if it does, it returns an incorrect result.

This revision implements a lock-free solution to this problem in
pmap_update_entry() and pmap_kextract() because pmap_kextract() can't
acquire the kernel pmap's lock.

Reported by: andrew, greg_unrelenting.technology
Reviewed by: andrew, markj
Tested by: greg_unrelenting.technology
X-MFC with: r350579
Differential Revision: https://reviews.freebsd.org/D21169

4 years agor350739 try #2
cem [Thu, 8 Aug 2019 04:29:46 +0000 (04:29 +0000)]
r350739 try #2

For some inexplicable reason, C++ compilers reject the -Wno- flag, and also
(ab)use CWARNFLAGS.

Reported by: imp

4 years agoDisable useless -Wformat-zero-length
cem [Thu, 8 Aug 2019 03:27:46 +0000 (03:27 +0000)]
Disable useless -Wformat-zero-length

It is part of -Wformat, which is enabled by -Wall.  Empty format strings are
well defined and it is perfectly reasonable to expect them in a formatting
interface.

4 years agopowerpc/pmap: Minor optimizations to 64-bit booke pmap
jhibbits [Thu, 8 Aug 2019 03:18:35 +0000 (03:18 +0000)]
powerpc/pmap: Minor optimizations to 64-bit booke pmap

Don't recalculate the VM page of the page table pages, just pass them down
to free.  Also, use the pmap's page zero function instead of bzero().

4 years agoChange autounmountd(8) to use time_t for duration instead of double
jhibbits [Thu, 8 Aug 2019 03:16:32 +0000 (03:16 +0000)]
Change autounmountd(8) to use time_t for duration instead of double

Summary:
autounmountd(8) uses doubles to handle mount time durations.  However,
it must convert to integer types, time_t in particular, to do anything
meaningful.  Additionally, even though it's a floating-point value in
seconds, the sub-seconds component is never used, so it's unnecessary.

Switching type to time_t fixes an assertion on powerpc64, which checks
that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
happens that the value of -1.0 gets loaded as a float (perhaps a bug in
gcc), but gets compared to a double.  This compares as false, so follows
through the 'sleep != -1.0' path, and fails the assert.  Since the
sub-second component isn't used in the double, just drop it and deal
with whole-integer seconds.

Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D21109

4 years agoFix !DDB kernel configurations after r350713
cem [Thu, 8 Aug 2019 01:37:41 +0000 (01:37 +0000)]
Fix !DDB kernel configurations after r350713

KDB is standard and the kdb_active variable is always available.  So,
de-conditionalize inclusion of sys/kdb.h in kern_sysctl.c.

Reported by: Michael Butler <imb AT protected-networks.net>
X-MFC-With: r350713
Sponsored by: Dell EMC Isilon

4 years agoFollow r350693 to add a link for sbuf_nl_terminate(9)
lwhsu [Thu, 8 Aug 2019 00:51:17 +0000 (00:51 +0000)]
Follow r350693 to add a link for sbuf_nl_terminate(9)

Sponsored by: The FreeBSD Foundation

4 years agoddb(4): Add 'sysctl' command
cem [Thu, 8 Aug 2019 00:42:29 +0000 (00:42 +0000)]
ddb(4): Add 'sysctl' command

Implement `sysctl` in `ddb` by overriding `SYSCTL_OUT`.  When handling the
req, we install custom ddb in/out handlers.  The out handler prints straight
to the debugger, while the in handler ignores all input.  This is intended
to allow us to print just about any sysctl.

There is a known issue when used from ddb(4) entered via 'sysctl
debug.kdb.enter=1'.  The DDB mode does not quite prevent all lock
interactions, and it is possible for the recursive Giant lock to be unlocked
when the ddb(4) 'sysctl' command is used.  This may result in a panic on
return from ddb(4) via 'c' (continue).  Obviously, this is not a problem
when debugging already-paniced systems.

Submitted by: Travis Lane (formerly: <travis.lane AT isilon.com>)
Reviewed by: vangyzen (earlier version), Don Morris <dgmorris AT earthlink.net>
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20219

4 years agorc.8: fix a typo in r350701
avg [Wed, 7 Aug 2019 21:20:25 +0000 (21:20 +0000)]
rc.8: fix a typo in r350701

I wronlgy expected that igor(1) checks spelling of all words.

MFC after: 1 week

4 years agorc.8: add a reference to service(8)
avg [Wed, 7 Aug 2019 21:07:59 +0000 (21:07 +0000)]
rc.8: add a reference to service(8)

While here:
- use Xr macro for a reference to sysrc(8)
- clarify that rc.shutdown invokes rc.d scripts with "faststop" argument

MFC after: 1 week

4 years agoGet configuration variable with default value for not breaking default setting
lwhsu [Wed, 7 Aug 2019 21:02:23 +0000 (21:02 +0000)]
Get configuration variable with default value for not breaking default setting

Reported by: markj
Sponsored by: The FreeBSD Foundation

4 years agoRemove the fuse.ko -> fusefs.ko symlink
asomers [Wed, 7 Aug 2019 20:28:27 +0000 (20:28 +0000)]
Remove the fuse.ko -> fusefs.ko symlink

On FreeBSD 13.0, the fuse driver will always be known as fusefs. The
backwards compatibility symlink will still be used for stable/12 and
stable/11, though.

Reported by: jhibbits
Reviewed by: rgrimes, imp, cem
MFC after: Never
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21181

4 years agoFix a possible segfault in wcsxfrm(3) and wcsxfrm_l(3).
dim [Wed, 7 Aug 2019 20:13:43 +0000 (20:13 +0000)]
Fix a possible segfault in wcsxfrm(3) and wcsxfrm_l(3).

If the length of the source wide character string, passed in via the
"size_t n" parameter, is set to zero, the function should only return
the required length for the destination wide character string.  In this
case, it should *not* attempt to write to the destination, so the "dst"
parameter is permitted to be NULL.

However, when the internally called _collate_wxfrm() function returns an
error, such as when using the "C" locale, as a fallback wcscpy(3) or
wcsncpy(3) are used.  But if the input length is zero, wcsncpy(3) will
be called with a length of -1!  If the "dst" parameter is NULL, this
will immediately result in a segfault, or if "dst" is a valid pointer,
it will most likely result in unexpectedly overwritten memory.

Fix this by explicitly checking for an input length greater than zero,
before calling wcsncpy(3).

Note that a similar situation does not occur in strxfrm(3), the plain
character version of this function, as it uses strlcpy(3) for the error
case.  The strlcpy(3) function does not write to the destination if the
input length is zero.

MFC after: 1 week

4 years agoUse designated initializers for vmm_ops.
markj [Wed, 7 Aug 2019 19:45:44 +0000 (19:45 +0000)]
Use designated initializers for vmm_ops.

MFC after: 3 days

4 years agocap_filergs: limit size of the file name
oshogbo [Wed, 7 Aug 2019 19:30:33 +0000 (19:30 +0000)]
cap_filergs: limit size of the file name

The limit of the name in fileargs is twice the size of the MAXPATH.
The nvlist will not add an element with the longer name.
We can detect at this point that the path is too big, and simple return
the same error as open(2) would.

PR: 239700
Reported by: markj
Tested by: markj
MFC after: 2 weeks

4 years agoGEOM: Reduce unnecessary log interleaving with sbufs
cem [Wed, 7 Aug 2019 19:28:35 +0000 (19:28 +0000)]
GEOM: Reduce unnecessary log interleaving with sbufs

Similar to what was done for device_printfs in r347229.

Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an
sbuf; documented in g_bio.9.

Reviewed by: markj
Discussed with: rlibby
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21165

4 years agosbuf(9): Add sbuf_nl_terminate() API
cem [Wed, 7 Aug 2019 19:27:14 +0000 (19:27 +0000)]
sbuf(9): Add sbuf_nl_terminate() API

The API is used to gracefully terminate text line(s) with a single \n.  If
the formatted buffer was empty or already ended in \n, it is unmodified.
Otherwise, a newline character is appended to it.  The API, like other
sbuf-modifying routines, is only valid while the sbuf is not FINISHED.

Reviewed by: rlibby
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21030

4 years agosbuf(9): Refactor sbuf_newbuf into sbuf_new
cem [Wed, 7 Aug 2019 19:25:56 +0000 (19:25 +0000)]
sbuf(9): Refactor sbuf_newbuf into sbuf_new

Code flow was somewhat difficult to read due to the combination of
multiple return sites and the 4x possible dynamic constructions of an
sbuf.  (Future consideration: do we need all 4?)  Refactored slightly to
improve legibility.

No functional change.

Sponsored by: Dell EMC Isilon

4 years agosbuf(9): Add NOWAIT dynamic buffer extension mode
cem [Wed, 7 Aug 2019 19:23:07 +0000 (19:23 +0000)]
sbuf(9): Add NOWAIT dynamic buffer extension mode

The goal is to avoid some kinds of low-memory deadlock when formatting
heap-allocated buffers.

Reviewed by: vangyzen
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D21015

4 years agoresource.h is sufficient here, no need for resoursevar.h.
glebius [Wed, 7 Aug 2019 18:32:01 +0000 (18:32 +0000)]
resource.h is sufficient here, no need for resoursevar.h.

4 years agoAdd cdceem(4) driver, for virtual ethernet devices compliant
trasz [Wed, 7 Aug 2019 18:14:45 +0000 (18:14 +0000)]
Add cdceem(4) driver, for virtual ethernet devices compliant
with Communication Device Class Ethernet Emulation Model (CDC EEM).
The driver supports both the device, and host side operation; there
is a new USB template (#11) for the former.

This enables communication with virtual USB NIC provided by iLO 5,
as found in new HPE Proliant servers.

Reviewed by: hselasky
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Hewlett Packard Enterprise

4 years agoMore places to clarify the robustness guarantees.
kib [Wed, 7 Aug 2019 17:51:40 +0000 (17:51 +0000)]
More places to clarify the robustness guarantees.

Wording submitted by: Martin Simmons <martin@lispworks.com>
MFC after: 3 days

4 years agoClarify the robustness guarantees.
kib [Wed, 7 Aug 2019 17:46:07 +0000 (17:46 +0000)]
Clarify the robustness guarantees.

Wording submitted by: Martin Simmons <martin@lispworks.com>
MFC after: 3 days

4 years agoCorrect the location of the first backup superblock in fsck_ffs.8.
mckusick [Wed, 7 Aug 2019 16:56:00 +0000 (16:56 +0000)]
Correct the location of the first backup superblock in fsck_ffs.8.
Make a note in the newfs.8 manual page to update the first backup
superblock location when changing the default fragment size for
the filesystem.

Reported by:  O. Hartmann

4 years agoUpdate RELNOTES for the fusefs rewrite
asomers [Wed, 7 Aug 2019 16:42:34 +0000 (16:42 +0000)]
Update RELNOTES for the fusefs rewrite

MFC after: Never
Sponsored by: The FreeBSD Foundation

4 years agoRELNOTES: fix formatting from r350482
asomers [Wed, 7 Aug 2019 16:24:08 +0000 (16:24 +0000)]
RELNOTES: fix formatting from r350482

MFC after: Never
Sponsored by: The FreeBSD Foundation

4 years agoMerge r3780 from elftoolchain.
markj [Wed, 7 Aug 2019 16:22:25 +0000 (16:22 +0000)]
Merge r3780 from elftoolchain.

Adjust argc and argv by optind before using them.  This slightly
simplifies the code.  No functional change intended.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21079

4 years agoEnable nvme on aarch64
imp [Wed, 7 Aug 2019 16:19:06 +0000 (16:19 +0000)]
Enable nvme on aarch64

Don't mark nvme as broken on aarch64. It compiles, at least, and people are
testing it out. This only enables the userland parts of the nvme stack.

Submitted by: greg at unrelenting technologies
Differential Revision: https://reviews.freebsd.org/D21168

4 years agoMake GCC happy about math in r350676.
mav [Wed, 7 Aug 2019 15:05:08 +0000 (15:05 +0000)]
Make GCC happy about math in r350676.

MFC after: 1 week

4 years agoMake `camcontrol modepage` support block descriptors.
mav [Wed, 7 Aug 2019 14:45:10 +0000 (14:45 +0000)]
Make `camcontrol modepage` support block descriptors.

It allows to read and write block descriptors alike to mode page parameters.
It allows to change block size or short-stroke HDDs or overprovision SSDs.
Depenting on -P parameter the change can be either persistent or till reset.
In case of block size change device may need reformat after the setting.
In case of SSD overprovisioning format or sanitize may be needed to really
free the flash.

During implementation appeared that csio_encode_visit() can not handle
integers of more then 4 bytes, that makes 8-byte LBA handling awkward.
I had to split it into two 4-byte halves now.

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

4 years agoCorrect PCI device ID for XHCI USB controller.
hselasky [Wed, 7 Aug 2019 13:35:13 +0000 (13:35 +0000)]
Correct PCI device ID for XHCI USB controller.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoofw: ofw_reg_to_paddr: Use a 256 static array for the cell
manu [Wed, 7 Aug 2019 13:13:16 +0000 (13:13 +0000)]
ofw: ofw_reg_to_paddr: Use a 256 static array for the cell

Some hardware needs more than 32, bump this value.

We cannot use the _alloc for of getencprop as this function is called
too early in the boot before pmap is initialized and we only have
2k of stack when cninit is called.

Discussed with:     ian

4 years agoarm: dts: am33xx: Fix the region for uart0
manu [Wed, 7 Aug 2019 13:11:53 +0000 (13:11 +0000)]
arm: dts: am33xx: Fix the region for uart0

The region for uart0 is declared to be 0x2000 in size but the parent
node only declare 0x1000.
As the parent only declare a size of 0x1000 in the ranges for it's children
this cause the device to not be mappable.

https://patchwork.kernel.org/patch/11056769/

4 years agoreadelf: Close input files when done with them.
markj [Wed, 7 Aug 2019 03:14:45 +0000 (03:14 +0000)]
readelf: Close input files when done with them.

The low fd limit used by poudriere exposed an odd failure mode in
cap_fileargs (used by readelf as of r350516).  In particular, when
the limit was hit, both the main process and casper service would
block on their shared socket, waiting forever for the other to send a
message.

Reported by: zeising
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoExpose zlib's utility functions in Z_SOLO library when building kernel.
delphij [Wed, 7 Aug 2019 01:41:17 +0000 (01:41 +0000)]
Expose zlib's utility functions in Z_SOLO library when building kernel.
This allows kernel code to reuse zlib's implementation.

PR: 229763
Reviewed by: Yoshihiro Ota <ota j email ne jp>
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21156

4 years agoTidy up the list of auth and encryption algorithms for IPsec stats.
jhb [Wed, 7 Aug 2019 00:53:27 +0000 (00:53 +0000)]
Tidy up the list of auth and encryption algorithms for IPsec stats.

- Use keyed-md5 and keyed_sha1 instead of md5 and sha1 to match
  the names accepted by setkey and to also avoid confusion since
  these are not "plain" MD5 or SHA1.
- Remove always-true #ifdef's to make the source a bit easier to
  read.
- Add missing mappings for tcp-md5, camellia-cbc, and aes-gmac.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

4 years agofusefs: merge from projects/fuse2
asomers [Wed, 7 Aug 2019 00:38:26 +0000 (00:38 +0000)]
fusefs: merge from projects/fuse2

This commit imports the new fusefs driver. It raises the protocol level
from 7.8 to 7.23, fixes many bugs, adds a test suite for the driver, and
adds many new features. New features include:

* Optional kernel-side permissions checks (-o default_permissions)
* Implement VOP_MKNOD, VOP_BMAP, and VOP_ADVLOCK
* Allow interrupting FUSE operations
* Support named pipes and unix-domain sockets in fusefs file systems
* Forward UTIME_NOW during utimensat(2) to the daemon
* kqueue support for /dev/fuse
* Allow updating mounts with "mount -u"
* Allow exporting fusefs file systems over NFS
* Server-initiated invalidation of the name cache or data cache
* Respect RLIMIT_FSIZE
* Try to support servers as old as protocol 7.4

Performance enhancements include:

* Implement FUSE's FOPEN_KEEP_CACHE and FUSE_ASYNC_READ flags
* Cache file attributes
* Cache lookup entries, both positive and negative
* Server-selectable cache modes: writethrough, writeback, or uncached
* Write clustering
* Readahead
* Use counter(9) for statistical reporting

PR: 199934 216391 233783 234581 235773 235774 235775
PR: 236226 236231 236236 236291 236329 236381 236405
PR: 236327 236466 236472 236473 236474 236530 236557
PR: 236560 236844 237052 237181 237588 238565
Reviewed by: bcr (man pages)
Reviewed by: cem, ngie, rpokala, glebius, kib, bde, emaste (post-commit
review on project branch)
MFC after: 3 weeks
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Pull Request: https://reviews.freebsd.org/D21110

4 years agoFix LOCAL_MODULES and improve the make output.
jhb [Tue, 6 Aug 2019 23:22:25 +0000 (23:22 +0000)]
Fix LOCAL_MODULES and improve the make output.

The exists() check guarding the invocation of ls was not working
correctly as it was expanding '$L' to determine the path of the local
modules directory.  Fix by using {} around the variable name.

Inline some of the logic from bsd.subdir.mk when invoking local module
builds.  This gives output in 'make buildkernel' the same as if there
was a Makefile in /usr/local/sys/modules with SUBDIR =
${LOCAL_MODULES}.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20991

4 years agoCache kernel stacks in UMA. This gives us NUMA support, better concurrency,
jeff [Tue, 6 Aug 2019 23:15:34 +0000 (23:15 +0000)]
Cache kernel stacks in UMA.  This gives us NUMA support, better concurrency,
and more statistics.

Reviewed by: kib, markj
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20931

4 years agoDetect invalid PCI devices more correctly in PCI interrupt router drivers.
jhb [Tue, 6 Aug 2019 23:15:04 +0000 (23:15 +0000)]
Detect invalid PCI devices more correctly in PCI interrupt router drivers.

- Check for an invalid device (vendor is invalid) before reading the
  header type register when examining function 0 of a possible device.
- When iterating over functions of a device, reject any device whose
  16-bit vendor is invalid rather than requiring the full 32-bit
  vendor+device to be all 1's.  In practice the latter check is
  probably fine, but checking the vendor is what the PCI spec
  recommends.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21147

4 years agoImplement a MINBUCKET zone flag so we can use minimal caching on zones that
jeff [Tue, 6 Aug 2019 23:04:59 +0000 (23:04 +0000)]
Implement a MINBUCKET zone flag so we can use minimal caching on zones that
may be expensive to cache.

Reviewed by: markj, kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20930

4 years agoAdd two new kernel options to control memory locality on NUMA hardware.
jeff [Tue, 6 Aug 2019 21:50:34 +0000 (21:50 +0000)]
Add two new kernel options to control memory locality on NUMA hardware.
 - UMA_XDOMAIN enables an additional per-cpu bucket for freed memory that
   was freed on a different domain from where it was allocated.  This is
   only used for UMA_ZONE_NUMA (first-touch) zones.
 - UMA_FIRSTTOUCH sets the default UMA policy to be first-touch for all
   zones.  This tries to maintain locality for kernel memory.

Reviewed by: gallatin, alc, kib
Tested by: pho, gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20929

4 years agoAdd a test for kill() on a zombie
jilles [Tue, 6 Aug 2019 21:17:22 +0000 (21:17 +0000)]
Add a test for kill() on a zombie

4 years agoral: rt2860: fix wcid2ni access/size issue
kevans [Tue, 6 Aug 2019 20:21:57 +0000 (20:21 +0000)]
ral: rt2860: fix wcid2ni access/size issue

RT2860_WCID_MAX is supposed to describe the max STA index for wcid2ni, and
was instead being used as the size -- off-by-one.

rt2860_drain_stats_fifo was range-checking wcid only after accessing
out-of-bounds potentially.

Submitted by: Augustin Cavalier <waddlesplash@gmail.com> (basically)
Obtained from: Haiku (58d16d9fe2d5a209cf22823359a8407d138e1a87)
Differential Revision: 3 days

4 years agoloader.efi: efilib.h and libefi.c were left out of 350654
tsoome [Tue, 6 Aug 2019 20:13:28 +0000 (20:13 +0000)]
loader.efi: efilib.h and libefi.c were left out of 350654

And this is second followup for 350654

4 years agoloader.efi: boot1.c was left out of 350654
tsoome [Tue, 6 Aug 2019 20:08:01 +0000 (20:08 +0000)]
loader.efi: boot1.c was left out of 350654

Followup for 350654.

4 years agoloader.efi: replace HandleProtocol() with OpenProtocol()
tsoome [Tue, 6 Aug 2019 19:27:27 +0000 (19:27 +0000)]
loader.efi: replace HandleProtocol() with OpenProtocol()

The HandleProtocol() is deprecated interface and we should use OpenProtocol()
instead. Moreover, in some firmware implementation(s), the HandleProtocol()
does return device path using static storage, so we can not keep the value
returned there. With same firmware, the OpenProtocol() does return data we
do not need to clone.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D21162

4 years agoIgnore UFS/FFS superblock check hash failures so as to allow a higher
mckusick [Tue, 6 Aug 2019 18:28:44 +0000 (18:28 +0000)]
Ignore UFS/FFS superblock check hash failures so as to allow a higher
level in the filesystem stack to decide what to do about them.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: Netflix

4 years agoFix mismerge.
imp [Tue, 6 Aug 2019 18:15:26 +0000 (18:15 +0000)]
Fix mismerge.

I merged passthru.c from the wrong branch (it was a branch that went further in
a direction I wound up not taking). Fix the mismerge and turn passthru on.

4 years agoA race condition existed between the time a UFS/FFS superblock check
mckusick [Tue, 6 Aug 2019 18:10:34 +0000 (18:10 +0000)]
A race condition existed between the time a UFS/FFS superblock check
hash was computed and the time that the superblock was copied to a
buffer to be written to disk. The result was a failed superblock
check hash the next time that the superblock was read.

The fix is to compute the check hash after the superblock has been
copied to a buffer to be written.

PR:           236504
Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: Netflix

4 years agoCorrect ICMPv6/MLDv2 out-of-bounds memory access
emaste [Tue, 6 Aug 2019 17:11:30 +0000 (17:11 +0000)]
Correct ICMPv6/MLDv2 out-of-bounds memory access

Previously the ICMPv6 input path incorrectly handled cases where an
MLDv2 listener query packet was internally fragmented across multiple
mbufs.

admbugs: 921
Submitted by: jtl
Reported by: CJD of Apple
Approved by: so
MFC after: 0 minutes
Security: CVE-2019-5608

4 years agoProvide the list of knobs related to mitigations.
kib [Tue, 6 Aug 2019 17:05:58 +0000 (17:05 +0000)]
Provide the list of knobs related to mitigations.

Discussed with: bjk, emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21087

4 years agoamd64: prevents speculations over swapgs reload of %gs base.
kib [Tue, 6 Aug 2019 16:53:25 +0000 (16:53 +0000)]
amd64: prevents speculations over swapgs reload of %gs base.

Such speculations could use user-controlled %gs base, esp. since
FreeBSD supports WRGSBASE instructions.

Place LFENCEs on entry for each basic block after the test for
previous kernel/user mode on the kernel entry, which prevents the
speculation.  Code accesses %gs-based PCPU before any serialization
instructions are executed, like %cr3 reload for KPTI.

With pti disabled, on haswell i7-4770S machine, "syscall_timings getppid"
shows when no lfence is added to syscall path:
test loop time iterations periteration
getppid 0 1.040918865 4643611 0.000000224
getppid 1 1.004985962 4481816 0.000000224
getppid 2 1.005196483 4482363 0.000000224
with lfence:
getppid 0 1.043701091 4554779 0.000000229
getppid 1 1.016930328 4438094 0.000000229
getppid 2 1.023223117 4466640 0.000000229
and ministat reports 'No difference proven at 95.0% confidence.'

Security: CVE-2019-1125
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoSince r350426 this KASSERT doesn't serve any useful purpose.
glebius [Tue, 6 Aug 2019 16:11:00 +0000 (16:11 +0000)]
Since r350426 this KASSERT doesn't serve any useful purpose.

4 years agobsnmp: add asn1 message length validation
emaste [Tue, 6 Aug 2019 16:09:06 +0000 (16:09 +0000)]
bsnmp: add asn1 message length validation

admbugs: 780
Submitted by: Guido Vranken, bz
Reported by: Guido Vranken
Security: CVE-2019-5610

4 years agooce(4): potential out of bounds access before vector validation
kevans [Tue, 6 Aug 2019 13:09:20 +0000 (13:09 +0000)]
oce(4): potential out of bounds access before vector validation

Submitted by: Augustin Cavalier <waddlesplash@gmail.com>
Obtained from: Haiku (ec2b89264cfc63e05e611cce82cc449197403aa4)
MFC after: 3 days

4 years agoReference the RFC instead of the internet draft.
tuexen [Tue, 6 Aug 2019 11:26:30 +0000 (11:26 +0000)]
Reference the RFC instead of the internet draft.

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

4 years agoFix a locking issue in sctp_accept.
tuexen [Tue, 6 Aug 2019 10:29:19 +0000 (10:29 +0000)]
Fix a locking issue in sctp_accept.

PR: 238520
Reported by: pho@
MFC after: 1 week

4 years agoFix build issues for the userland stack on Raspbian.
tuexen [Tue, 6 Aug 2019 08:33:21 +0000 (08:33 +0000)]
Fix build issues for the userland stack on Raspbian.

4 years agoamdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges
cem [Tue, 6 Aug 2019 03:54:27 +0000 (03:54 +0000)]
amdtemp(4), amdsmn(4): Attach to Ryzen 3 (Zen 2) hostbridges

PR: 239607
Reported by: "drclaw" <drclaw AT gmail.com>

4 years agoFix build from r350622
jhibbits [Tue, 6 Aug 2019 03:49:40 +0000 (03:49 +0000)]
Fix build from r350622

It helps if my local kernel build has INVARIANTS.

4 years agopowerpc/pmap: Simplify Book-E 64-bit page table management
jhibbits [Tue, 6 Aug 2019 03:16:06 +0000 (03:16 +0000)]
powerpc/pmap: Simplify Book-E 64-bit page table management

There is no need for the 64-bit pmap to have a fixed number of page table
buffers.  Since the 64-bit pmap has a DMAP, we can effectively have user
page tables limited only by total RAM size.