]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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.

4 years agofusefs: remove superfluous counter_u64_zero
asomers [Tue, 6 Aug 2019 00:50:25 +0000 (00:50 +0000)]
fusefs: remove superfluous counter_u64_zero

Reported by: glebius
Sponsored by: The FreeBSD Foundation

4 years agoRelax time constraint in pthread_cond_timedwait unit test
vangyzen [Mon, 5 Aug 2019 22:59:35 +0000 (22:59 +0000)]
Relax time constraint in pthread_cond_timedwait unit test

pthread_cond_timedwait() should wait _at least_ until the timeout,
but it might appear to wait longer due to system activity and
scheduling.  The test ignored fractional seconds when comparing the
actual and expected timeouts, so it allowed anywhere between zero
and one extra second of wait time.  Zero is a bit unreasonable.
Compare fractional seconds so we always allow up to one extra second.

Reviewed by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon

4 years agoValidate guest-supplied length of headers for TSO transmit requests.
jhb [Mon, 5 Aug 2019 21:39:55 +0000 (21:39 +0000)]
Validate guest-supplied length of headers for TSO transmit requests.

When transmitting a large TCP packet, the final transmit descriptor
includes the length of the protocol headers to be duplicated on each
segment.  The device model was trusting the guest-supplied value
without validating it.  A value of zero would result in the guest
being able to indirect a garbage pointer on the stack to overwrite
arbitrary memory in the bhyve process.  A value that was non-zero but
too small for the requested parameters resulted in the device model
reading and writing values beyond the end of the on-stack buffer used
to hold the template header.

To fix, validate the supplied length and drop requests to transmit
packets that would overflow the header buffer.  While here, initialize
the header pointer to NULL as a preventive measure so that any access
to an unallocated template header crashes they hypervisor
deterministically.

While here, only read the TCP sequence number if the packet being
split is a TCP packet.  The e1000 logic supports a segmentation of UDP
frames, and while UDP segmentation requires this part of the header to
be valid (so there is no buffer overflow), only reading the field when
needed is cleaner.

admbugs: 918
Reported by: Reno Robert <renorobert@gmail.com>
Reviewed by: markj
Approved by: so
Security: CVE-2019-5609

4 years agoprocdesc: fix the function name
oshogbo [Mon, 5 Aug 2019 20:31:17 +0000 (20:31 +0000)]
procdesc: fix the function name

I changed name of the function r350429 and forgot to update
the r350612 patch.

Reported by: jenkins
MFC after: 1 month

4 years agoprocess: style
oshogbo [Mon, 5 Aug 2019 20:26:01 +0000 (20:26 +0000)]
process: style

We don't need to check if the parent is already set.
This is done already in the proc_reparent.

No functional behaviour changes intended.

MFC after: 1 month

4 years agoexit1: fix style nits
oshogbo [Mon, 5 Aug 2019 20:20:14 +0000 (20:20 +0000)]
exit1: fix style nits

MFC after: 1 month

4 years agoprocdesc: fix reparenting when the debugger is attached
oshogbo [Mon, 5 Aug 2019 20:15:46 +0000 (20:15 +0000)]
procdesc: fix reparenting when the debugger is attached

The process is reparented to the debugger while it is attached.
  B          B
 /   ---->   |
A          A D

Every time when the process is reparented, it is added to the orphan list
of the previous parent:

A->orphan = B
D->orphan = NULL

When the A process will close the process descriptor to the B process,
the B process will be reparented to the init process.
  B            B - init
  |   ---->
A D          A   D

A->orphan = B
D->orphan = B

In this scenario, the B process is in the orphan list of A and D.

When the last process descriptor is closed instead of reparenting
it to the reaper let it stay with the debugger process and set
our previews parent to the reaper.

Add test case for this situation.
Notice that without this patch the kernel will crash with this test case:
panic: orphan 0xfffff8000e990530 of 0xfffff8000e990000 has unexpected oppid 1

Reviewed by: markj, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D20361

4 years agoproc: introduce the proc_add_orphan function
oshogbo [Mon, 5 Aug 2019 20:11:57 +0000 (20:11 +0000)]
proc: introduce the proc_add_orphan function

This API allows adding the process to its parent orphan list.

Reviewed by: kib, markj
MFC after: 1 month

4 years agoexit1: postpone clearing P_TRACED flag until the proctree lock is acquired
oshogbo [Mon, 5 Aug 2019 19:59:23 +0000 (19:59 +0000)]
exit1: postpone clearing P_TRACED flag until the proctree lock is acquired

In case of the process being debugged. The P_TRACED is cleared very early,
which would make procdesc_close() not calling proc_clear_orphan().
That would result in the debugged process can not be able to collect
status of the process with process descriptor.

Reviewed by: markj, kib
Tested by: pho
MFC after: 1 month

4 years agoFix alignment issue r350599.
mav [Mon, 5 Aug 2019 19:30:28 +0000 (19:30 +0000)]
Fix alignment issue r350599.

MFC after: 10 days

4 years agoFix mis-merge.
kib [Mon, 5 Aug 2019 19:19:25 +0000 (19:19 +0000)]
Fix mis-merge.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix mis-merge
kib [Mon, 5 Aug 2019 19:16:33 +0000 (19:16 +0000)]
Fix mis-merge

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoAdd `nvmecontrol resv` to handle NVMe reservations.
mav [Mon, 5 Aug 2019 17:36:00 +0000 (17:36 +0000)]
Add `nvmecontrol resv` to handle NVMe reservations.

NVMe reservations are quite alike to SCSI persistent reservations and
can be used in clustered setups with shared multiport storage.

MFC after: 10 days
Relnotes: yes
Sponsored by: iXsystems, Inc.

4 years agoAdd a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips.
ian [Mon, 5 Aug 2019 15:56:44 +0000 (15:56 +0000)]
Add a driver for Texas Instruments ADS101x/ADS111x i2c ADC chips.

Instances of the device can be configured using hints or FDT data.

Interfaces to reconfigure the chip and extract voltage measurements from
it are available via sysctl(8).

4 years ago[PPC64] Don't mark ld.bfd as obsolete
luporl [Mon, 5 Aug 2019 13:28:21 +0000 (13:28 +0000)]
[PPC64] Don't mark ld.bfd as obsolete

PowerPC64 still needs ld.bfd for 32-bit binaries/libraries.

This will be needed when ELFv2 becomes default, but there is no harm in
committing it already.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D21136

4 years agoImprove consistency. No functional change.
tuexen [Mon, 5 Aug 2019 13:22:15 +0000 (13:22 +0000)]
Improve consistency. No functional change.

MFC after: 3 days

4 years ago[PPC64] Fix rtld direct exec mode
luporl [Mon, 5 Aug 2019 13:22:02 +0000 (13:22 +0000)]
[PPC64] Fix rtld direct exec mode

Instead of restoring the saved values of argc, argv and envp,
these must be loaded from the stack that _rtld() modifies.

This fixes rtld direct exec mode.
E.g.: /libexec/ld-elf.so.1 /bin/ls

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D21131

4 years agoAdd common firewall test suite
thj [Mon, 5 Aug 2019 11:47:34 +0000 (11:47 +0000)]
Add common firewall test suite

Add a common test suite for the firewalls included in the base system. The test
suite allows common test infrastructure to test pf, ipfw and ipf firewalls from
test files containing the setup for all three firewalls.

Add the pass block test for pf, ipfw and ipf. The pass block test checks the
allow/deny functionality of the firewalls tested.

Submitted by:   Ahsan Barkati
Sponsored by:   Google, Inc. (GSoC 2019)
Reviewed by:    kp
Approved by:    bz (co-mentor)
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D21065

4 years agofrag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket"
bz [Mon, 5 Aug 2019 11:01:12 +0000 (11:01 +0000)]
frag6.c: rename ip6q[] to ipq6b[] and consistently use "bucket"

The hash buckets array is called ip6q.  The data structure ip6q is a
description of different object, the one the array holds these days
(since r337776).  To clear some of this confusion, rename the array
to ip6qb.

When iterating over all buckets or addressing them directly, we
use at least the variables i, hash, and bucket.  To keep the
terminology consistent use the variable name "bucket" and always
make it an uint32_t and not sometimes an int.

No functional behaviour changes intended.

MFC after: 3 months
Sponsored by: Netflix

4 years agofrag6.c: re-order functions within file
bz [Mon, 5 Aug 2019 09:49:24 +0000 (09:49 +0000)]
frag6.c: re-order functions within file

Re-order functions within the file in preparation for an upcoming
code simplification.

No functional changes.

MFC after: 3 months
Sponsored by: Netflix

4 years agoRemove obsolete header file.
delphij [Mon, 5 Aug 2019 06:01:29 +0000 (06:01 +0000)]
Remove obsolete header file.

4 years agoEnable superpage promotion within the kernel pmap.
alc [Mon, 5 Aug 2019 02:44:04 +0000 (02:44 +0000)]
Enable superpage promotion within the kernel pmap.

Reviewed by: markj
X-MFC after: r350004
Differential Revision: https://reviews.freebsd.org/D21149

4 years agopowerpc: Get 32-bit AIM building with secure-PLT
jhibbits [Mon, 5 Aug 2019 01:37:18 +0000 (01:37 +0000)]
powerpc:  Get 32-bit AIM building with secure-PLT

The last few changes needed before 32-bit AIM builds with secure-PLT with
base GCC.  Because ofwcall32.S and swtch32.S were branching to the GOT it
could not use secure PLT.

4 years agoipfw: fix jail option after r348215
kevans [Mon, 5 Aug 2019 00:08:25 +0000 (00:08 +0000)]
ipfw: fix jail option after r348215

r348215 changed jail_getid(3) to validate passed-in jids as active jails
(as the function is documented to return -1 if the jail does not exist).
This broke the jail option (in some cases?) as the jail historically hasn't
needed to exist at the time of rule parsing; jids will get stored and later
applied.

Fix this caller to attempt to parse *av as a number first and just use it
as-is to match historical behavior. jail_getid(3) must still be used in
order for name arguments to work, but it's strictly a fallback in case we
weren't given a number.

Reported and tested by: Ari Suutari <ari stonepile fi>
Reviewed by: ae
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21128

4 years agortld-elf: Remove x86 elf_rtld.x linker scripts.
kib [Sun, 4 Aug 2019 21:43:34 +0000 (21:43 +0000)]
rtld-elf: Remove x86 elf_rtld.x linker scripts.

First, amd64 version of the script cannot work at least due to the
wrong architecture specification.  Second, kernel can activate shared
objects for long time, due to PIE support.

It seems the intent was to allow ld-elf.so.1 to be build and used as
an executable.  Since we have direct exec mode implemented for dso
ld-elf.so.1, the non-functional and commented out scripts can be
finally removed.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix 32-bit build again, post r350570.
jhibbits [Sun, 4 Aug 2019 20:00:39 +0000 (20:00 +0000)]
Fix 32-bit build again, post r350570.

Missed this part with my testing as well.  Pass the right type to
BUS_TRANSLATE_RESOURCE().

4 years agoFix 32-bit build post-r350570
jhibbits [Sun, 4 Aug 2019 19:55:43 +0000 (19:55 +0000)]
Fix 32-bit build post-r350570

The error message prints a rman_res_t, which is an uintmax_t.  Explicitly
cast, just for future-proofing, and use the correct format.

4 years agoFix the build after r350570.
jhibbits [Sun, 4 Aug 2019 19:47:02 +0000 (19:47 +0000)]
Fix the build after r350570.

Signed char cannot compare to values above 0x7f.  Use unsigned instead.

4 years agoAdd necessary bits for Linux KPI to work correctly on powerpc
jhibbits [Sun, 4 Aug 2019 19:28:10 +0000 (19:28 +0000)]
Add necessary bits for Linux KPI to work correctly on powerpc

PowerPC, and possibly other architectures, use different address ranges for
PCI space vs physical address space, which is only mapped at resource
activation time, when the BAR gets written.  The DRM kernel modules do not
activate the rman resources, soas not to waste KVA, instead only mapping
parts of the PCI memory at a time.  This introduces a
BUS_TRANSLATE_RESOURCE() method, implemented in the Open Firmware/FDT PCI
driver, to perform this necessary translation without activating the
resource.

In addition to system KPI changes, LinuxKPI is updated to handle a
big-endian host, by adding proper endian swaps to the I/O functions.

Submitted by: mmacy
Reported by: hselasky
Differential Revision: https://reviews.freebsd.org/D21096

4 years agopowerpc: Enable the BUS_DMA_NOCACHE flag handling
jhibbits [Sun, 4 Aug 2019 19:25:23 +0000 (19:25 +0000)]
powerpc: Enable the BUS_DMA_NOCACHE flag handling

The flag handling was committed commented out 7 years ago.  It works, and is
needed for LinuxKPI-based DRM drivers.

Also mark a local as potentially unusable, as it's only really used when KTR
is enabled.

Submitted by: mmacy

4 years agoResolve ipfilter kld unload issues related to VNET jails.
cy [Sun, 4 Aug 2019 12:47:38 +0000 (12:47 +0000)]
Resolve ipfilter kld unload issues related to VNET jails.

When the ipfilter kld is loaded, used within VNET jail, and unloaded,
then subsequent loading, use, and unloading of another packet filters
will cause the subsequently loaded netpfil kld's to panic.

The scenario is as follows:

cd /usr/tests/sys/netpfil/common

kldunload ipl
kldunload pfsync
kldunload ipfw

kyua test pass_block

kldload ipl
kyua test pass_block
kldunload ipl

kldload pfsync
kyua test pass_block
kldunload pfsync
-- page fault panic occurs here --

Reported by: "Ahsan Barkati" <ahsanbarkati@g.....com> via kp@
Discussed with: kp@
Tested by: kp@
MFC after: 3 days

4 years agoReturning an uninitialized error is a bad thing.
cy [Sun, 4 Aug 2019 12:47:35 +0000 (12:47 +0000)]
Returning an uninitialized error is a bad thing.

MFC after: 3 days

4 years agoThere is no need to explicitly add zlib, we already have it in
delphij [Sun, 4 Aug 2019 04:51:32 +0000 (04:51 +0000)]
There is no need to explicitly add zlib, we already have it in
sys/conf/files.

4 years agoAdd `nvmecontrol sanitize` command.
mav [Sat, 3 Aug 2019 19:24:56 +0000 (19:24 +0000)]
Add `nvmecontrol sanitize` command.

It allows to delete all user data from NVM subsystem in one of 3 methods.
It is a close equivalent of SCSI SANITIZE command of `camcontrol sanitize`,
so I tried to keep arguments as close as possible.

While there, fix supported sanitize methods reporting in `identify`.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.