]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r353100:
Baptiste Daroussin [Wed, 19 Feb 2020 14:24:05 +0000 (14:24 +0000)]
MFC r353100:

Do not remove the locale directory when building a system without locales

This directory is actually needed during make installworld and will prevent
to reinstall a system after make delete-old is done.

PR: 226137
Reported by: rakuco

4 years agoMFC r356212,r356366,r356416,r357785
Martin Matuska [Wed, 19 Feb 2020 01:46:43 +0000 (01:46 +0000)]
MFC r356212,r356366,r356416,r357785
Update libarchive to version 3.4.2

Relevant vendor changes (r356212):
  Issue #351: Refactor and implement private state logic for write filters
  PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482)
  PR #1255: zip writer - don't append unused NUL for directories
  PR #1260: Fix sparse file offset overflow on 32-bit systems
  PR #1263: UNICODE filename support for reading lha/lzh format
  Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs()
  PR #1288: Add the "xattrhdr" option to pax write options
  PR #1295: 7z reader - fix reading archives with digests in PackInfo
  PR #1296: RAR5 reader - verify window size for multivolume archives
  PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files
  Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs()
  OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error
  Fix possible off-by-one when dealing with readlink(2)

Relevant vendor changes (r356366):
  Issue #1302: Plug memory leak on failure of archive_write_client_open()

Relevant vendor changes (r356416):
  Issue #1302: Re-do fix for archive_write_client_open()

Relevant vendor changes (r357785):
  PR #1289: atomic extraction support (bsdtar -x --safe-writes)
  PR #1308: big endian fix for UTF16 support in LHA reader
  PR #1326: reject RAR5 files that declare invalid header flags
  Issue #987: fix support 7z archive entries with Delta filter
  Issue #1317: fix compression output buffer handling in XAR writer
  Issue #1319: fix uname or gname longer than 32 characters in pax writer
  Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
  Use localtime_r() and gmtime_r() instead of localtime() and gmtime()

4 years agoMFC r357788:
Brooks Davis [Tue, 18 Feb 2020 21:36:54 +0000 (21:36 +0000)]
MFC r357788:

Mark hme(4) as deprecated.

It was saved from the initial purge of drivers in fcp-101 due to being
the onboard Ethernet device on a number of sparc64 machines.  Now that
sparc64 is gone, it serves little purpose (PCI cards exist, but are rare
and are unlikely to have been deployed outside Sun systems).

4 years agoMFC r357976:
Dimitry Andric [Tue, 18 Feb 2020 18:17:03 +0000 (18:17 +0000)]
MFC r357976:

Merge r357970 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in hptmv(4):

sys/dev/hptmv/ioctl.c:240:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        _vbus_p=pArray->pVBus;
                        ^
sys/dev/hptmv/ioctl.c:237:10: note: previous statement is here
                if(!mIsArray(pArray))
                ^

This is because the return statement after the if statement was not
indented.  (Note that this file has been idented assuming 4-space tabs.)

4 years agoMFC r357873:
Dimitry Andric [Tue, 18 Feb 2020 18:15:33 +0000 (18:15 +0000)]
MFC r357873:

Merge r357864 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in sconfig:

sbin/sconfig/sconfig.c:909:5: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                                exit (-1);
                                ^
sbin/sconfig/sconfig.c:907:6: note: previous statement is here
                        } else
                          ^

The intent was to group the exit() call with the previous fprintf()
call.

4 years agoMFC r357874:
Dimitry Andric [Tue, 18 Feb 2020 18:13:08 +0000 (18:13 +0000)]
MFC r357874:

Merge r357872 from the clang1000-import branch:

Disable new clang 10.0.0 warnings about misleading indentation in ce(4)
and cp(4).

These are false positives, since some of the driver source has been
deliberately obfuscated.

4 years agoMFC r357661:
Dimitry Andric [Tue, 18 Feb 2020 18:03:04 +0000 (18:03 +0000)]
MFC r357661:

Correctly recognize linker versions greater than 10.0.

4 years agoMFC r357502: Few microoptimizations to dbuf layer.
Alexander Motin [Tue, 18 Feb 2020 01:21:56 +0000 (01:21 +0000)]
MFC r357502: Few microoptimizations to dbuf layer.

Move db_link into the same cache line as db_blkid and db_level.
It allows significantly reduce avl_add() time in dbuf_create() on
systems with large RAM and huge number of dbufs per dnode.

Avoid few accesses to dbuf_caches[].size, which is highly congested
under high IOPS and never stays in cache for a long time.  Use local
value we are receiving from zfs_refcount_add_many() any way.

Remove cache_size_bytes_max bump from dbuf_evict_one().  I don't see
a point to do it on dbuf eviction after we done it on insertion in
dbuf_rele_and_unlock().

4 years agoMFC r357453: Unblock kstat.zfs.misc.dbufstats sysctls.
Alexander Motin [Tue, 18 Feb 2020 01:19:32 +0000 (01:19 +0000)]
MFC r357453: Unblock kstat.zfs.misc.dbufstats sysctls.

It is not so much broken to hide it after we wasted time to collect it.

4 years agoMFC r357850:
Ryan Moeller [Tue, 18 Feb 2020 00:01:18 +0000 (00:01 +0000)]
MFC r357850:
Add myself (freqlabs) as a src committer

Approved by:    mav (mentor)

4 years agoMFC: r357149
Rick Macklem [Mon, 17 Feb 2020 19:32:54 +0000 (19:32 +0000)]
MFC: r357149
Fix a crash in the NFSv4 server.

The PR reported a crash that occurred when a file was removed while
client(s) were actively doing lock operations on it.
Since nfsvno_getvp() will return NULL when the file does not exist,
the bug was obvious and easy to fix via this patch. It is a little
surprising that this wasn't found sooner, but I guess the above
case rarely occurs.

PR: 242768

4 years agoMFC r357450, r357462:
Mark Johnston [Mon, 17 Feb 2020 18:40:00 +0000 (18:40 +0000)]
MFC r357450, r357462:
addr2line: Cache CU DIEs upon a successful address lookup.

4 years agoMFC r350515:
Mark Johnston [Mon, 17 Feb 2020 18:39:38 +0000 (18:39 +0000)]
MFC r350515:
Capsicumize addr2line(1).

4 years agoMFC r356597:
Hans Petter Selasky [Mon, 17 Feb 2020 09:58:55 +0000 (09:58 +0000)]
MFC r356597:
Define the XHCI endpoint states.

Sponsored by: Mellanox Technologies

4 years agoMFC r357726:
Hans Petter Selasky [Mon, 17 Feb 2020 09:57:03 +0000 (09:57 +0000)]
MFC r357726:
Add USB host controller PCI ID's for Hygon.

Differential Revision: https://reviews.freebsd.org/D23564
Sponsored by: Mellanox Technologies

4 years agoMFC r357801:
Hans Petter Selasky [Mon, 17 Feb 2020 09:53:23 +0000 (09:53 +0000)]
MFC r357801:
Add support for disabling and polling MSIX interrupts in mlx5core.

Sponsored by: Mellanox Technologies

4 years agoSkip sys.geom.class.multipath.misc.fail_on_error on stable/12
Li-Wen Hsu [Sun, 16 Feb 2020 09:13:05 +0000 (09:13 +0000)]
Skip sys.geom.class.multipath.misc.fail_on_error on stable/12

The required feature is not in stable/12 yet.

PR: 244158
Sponsored by: The FreeBSD Foundation

4 years agoMFC r356000: Remove unused includes.
Xin LI [Sun, 16 Feb 2020 07:06:25 +0000 (07:06 +0000)]
MFC r356000: Remove unused includes.

4 years agoMFC r357420: Remove unused include.
Xin LI [Sun, 16 Feb 2020 06:34:45 +0000 (06:34 +0000)]
MFC r357420: Remove unused include.

4 years agoMFC r357663
Vincenzo Maffione [Sat, 15 Feb 2020 11:42:13 +0000 (11:42 +0000)]
MFC r357663

netmap: improve netmap(4) and vale(4) man pages

Clean up obsolete sysctl descriptions and add missing ones.

PR:             243838
Reviewed by:    bcr
Differential Revision:  https://reviews.freebsd.org/D23546

4 years agoMFC r357813:
Konstantin Belousov [Sat, 15 Feb 2020 00:48:44 +0000 (00:48 +0000)]
MFC r357813:
Fix indent.

4 years agoMFC r357670:
Konstantin Belousov [Fri, 14 Feb 2020 13:26:45 +0000 (13:26 +0000)]
MFC r357670:
pmc: Add Hygon Dhyana support.

4 years agoMFC r357669:
Konstantin Belousov [Fri, 14 Feb 2020 13:25:37 +0000 (13:25 +0000)]
MFC r357669:
acpi_hpet: Add Hygon Dhyana support.

4 years agoMFC r357668:
Konstantin Belousov [Fri, 14 Feb 2020 13:10:52 +0000 (13:10 +0000)]
MFC r357668:
linux futex_put(): do not touch futex after dropping our reference.

4 years agoMFC r353022:
Colin Percival [Fri, 14 Feb 2020 02:31:20 +0000 (02:31 +0000)]
MFC r353022:

Switch EC2 AMIs from using the dual-dhclient script to using the new
dual-dhclient-daemon daemon. This makes it possible to stop/restart
the dhclients.

4 years agoMFC r357756: backup-passwd: mask out all passwords in the diff
Kyle Evans [Fri, 14 Feb 2020 02:27:01 +0000 (02:27 +0000)]
MFC r357756: backup-passwd: mask out all passwords in the diff

The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

4 years agoMFC r357235:
Alan Somers [Thu, 13 Feb 2020 20:49:45 +0000 (20:49 +0000)]
MFC r357235:

Speed up "zpool import" in the presence of many zvols

By default, zpools may not be backed by zvols (that can be changed with the
"vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel
does not attempt to read zvols when looking for vdevs. But the zpool command
still does. This change brings the zpool command into line with the kernel's
behavior. It speeds "zpool import" when an already imported pool has many
zvols, or a zvol with many snapshots.

PR: 241083
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>
Reviewed by: mav, Ryan Moeller <ryan@freqlabs.com>
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22077

4 years agoMFC r357211:
Alan Somers [Thu, 13 Feb 2020 20:46:05 +0000 (20:46 +0000)]
MFC r357211:

geli: add a test case for attaching multiple providers with 1 command

Reviewed by: cem
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D23400

4 years agoMFC r356809:
Alan Somers [Thu, 13 Feb 2020 20:45:32 +0000 (20:45 +0000)]
MFC r356809:

setextattr: Increase stdin buffer size to 4096

Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23211

4 years agoMFC r355488-r355489
Alan Somers [Thu, 13 Feb 2020 20:41:20 +0000 (20:41 +0000)]
MFC r355488-r355489

r355488:
lio_listio(2): add a HISTORY section

r355489:
clock_gettime(2): add a HISTORY section

4 years agoMFC r355430:
Alan Somers [Thu, 13 Feb 2020 20:40:36 +0000 (20:40 +0000)]
MFC r355430:

ses: sanitize illegal strings in SES element descriptors

The SES4r3 standard requires that element descriptors may only contain ASCII
characters in the range 0x20 to 0x7e.  Some SuperMicro expanders violate
that rule.  This patch adds a sanity check to ses(4).  Descriptors in
violation will be replaced by "<invalid>".

This patch fixes "sesutil --libxo xml" on such systems.  Previously it would
generate non-well-formed XML output.

PR: 241929
Reviewed by: allanjude
Sponsored by: Axcient

4 years agoMFC r355431:
Alan Somers [Thu, 13 Feb 2020 20:32:05 +0000 (20:32 +0000)]
MFC r355431:

gmultipath: add ATF tests

Add ATF tests for most gmultipath operations. Add some dtrace probes too,
primarily for configuration changes that happen in response to provider
errors.

PR: 178473
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22235

4 years agoMFC r354234:
Alan Somers [Thu, 13 Feb 2020 18:26:07 +0000 (18:26 +0000)]
MFC r354234:

geli: raise WARNS to 6

Sponsored by: Axcient

4 years agoMFC r357284, r357419: stdio unlocked
Kyle Evans [Thu, 13 Feb 2020 03:13:29 +0000 (03:13 +0000)]
MFC r357284, r357419: stdio unlocked

r357284:
stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite

fflush_unlocked is currently desired in ports by sysutils/metalog, and
redefined as the locked fflush.

fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
currently desired in ports by devel/elfutils, and redefined as the locked
fputs, fread, and fwrite respectively.

r357419:
libc: provide fputc_unlocked

Among the same justification as the other stdio _unlocked; in addition to an
inline version in <stdio.h>, we must provide a function in libc as well for
the functionality. This fixes the lang/gcc* builds, which want to use the
symbol from libc.

4 years agoMFC r356942:
Brooks Davis [Wed, 12 Feb 2020 18:40:29 +0000 (18:40 +0000)]
MFC r356942:

Correct a misleading indent.

This dates to before the beginning of our repo and was found by clang 10.

Sponsored by: DARPA

4 years agoMFC r357575:
Mark Johnston [Wed, 12 Feb 2020 15:51:29 +0000 (15:51 +0000)]
MFC r357575:
Improve validation of the sockaddr length in iruserok_sa().

PR: 243747

4 years agoMFC r357573:
Mark Johnston [Wed, 12 Feb 2020 15:46:33 +0000 (15:46 +0000)]
MFC r357573:
Fix map locking in the CLEAR_PKRU sysarch(2) handler.

4 years agoMFC r357665: geli taste: allow GELIBOOT tagged providers as well
Kyle Evans [Wed, 12 Feb 2020 02:17:20 +0000 (02:17 +0000)]
MFC r357665: geli taste: allow GELIBOOT tagged providers as well

Currently the installer will tag geliboot partitions with both BOOT and
GELIBOOT; the former allows the kernel to taste it at boot, while the latter
is what loaders keys off of.

However, it seems reasonable to assume that if a provider's been tagged with
GELIBOOT that the kernel should also take that as a hint to taste/attach at
boot. This would allow us to stop tagging GELIBOOT partitions with BOOT in
bsdinstall, but I'm not sure that there's a compelling reason to do so any
time soon.

4 years agoMFC r357563: env(1): grow -L user/class and -U user/class options
Kyle Evans [Wed, 12 Feb 2020 02:09:12 +0000 (02:09 +0000)]
MFC r357563: env(1): grow -L user/class and -U user/class options

This allows one to set the environment of the specified user either from
login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U).

This is a supporting feature to allow service(8) to pull in the environment
of the "daemon" class before invoking the rc script.

4 years agoMFC r354450: Add -0 option to ENV(1)
Kyle Evans [Wed, 12 Feb 2020 02:07:37 +0000 (02:07 +0000)]
MFC r354450: Add -0 option to ENV(1)

With the -0 option added to ENV(1), some ports will no longer require genv
from sysutils/coreutils.

4 years agoMFC r357560, r357707: login.conf(5) mail capability
Kyle Evans [Wed, 12 Feb 2020 02:04:03 +0000 (02:04 +0000)]
MFC r357560, r357707: login.conf(5) mail capability

r357560:
login.conf(5): split MAIL env var out into a "mail" capability

This allows it to be easily suppressed in, e.g., the "daemon" class where it
will not be properly expanded.

This is a part of D21481.

Submitted by: Andrew Gierth <andrew_tao173.riddles.org.uk>

r357707:
login.conf(5): update commented-out standard, too

MAIL now has a mail capability, instead, as of r357560.

4 years agoMFC r357512:
Konstantin Belousov [Tue, 11 Feb 2020 12:14:22 +0000 (12:14 +0000)]
MFC r357512:
Add sys/systm.h to several places that use vm headers.

4 years agoMFC r357511:
Konstantin Belousov [Tue, 11 Feb 2020 12:13:21 +0000 (12:13 +0000)]
MFC r357511:
tmpfs_mount update: simplify, cache the value of VFS_TO_TMPFS() calculation.

4 years agoMFC r357678:
Konstantin Belousov [Tue, 11 Feb 2020 12:05:59 +0000 (12:05 +0000)]
MFC r357678:
Correct the function name in the comment.

4 years agoMFC r357537, r357538:
Mark Johnston [Tue, 11 Feb 2020 05:15:35 +0000 (05:15 +0000)]
MFC r357537, r357538:
elfcopy: Coverity fixups.

4 years agoMFC r357531, r357532, r357533, r357534:
Mark Johnston [Tue, 11 Feb 2020 05:14:36 +0000 (05:14 +0000)]
MFC r357531, r357532, r357533, r357534:
libdwarf: Coverity fixups.

4 years agoMFC r357542:
Mark Johnston [Tue, 11 Feb 2020 05:13:35 +0000 (05:13 +0000)]
MFC r357542:
readelf: Don't leak memory when dwarf_get_fde_info_for_all_regs() fails.

4 years agoMFC r357539:
Mark Johnston [Tue, 11 Feb 2020 05:11:52 +0000 (05:11 +0000)]
MFC r357539:
size: Avoid returning a stack pointer from xlatetom().

4 years agoMFC r357535, r357536:
Mark Johnston [Tue, 11 Feb 2020 05:11:27 +0000 (05:11 +0000)]
MFC r357535, r357536:
libelftc: Fix memory leaks in the C++ demanglers.

4 years agoMFC r357525:
Mark Johnston [Tue, 11 Feb 2020 03:37:42 +0000 (03:37 +0000)]
MFC r357525:
Correct the malloc tag used when freeing the temporary semop(2) buffer.

4 years agoMFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688
Kyle Evans [Sun, 9 Feb 2020 22:15:35 +0000 (22:15 +0000)]
MFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688

r357412:
Provide O_SEARCH

O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping
permissions checks on the directory itself after the initial open(). This is
close to the semantics we've historically applied for O_EXEC on a directory,
which is UB according to POSIX. Conveniently, O_SEARCH on a file is also
explicitly undefined behavior according to POSIX, so O_EXEC would be a fine
choice. The spec goes on to state that O_SEARCH and O_EXEC need not be
distinct values, but they're not defined to be the same value.

This was pointed out as an incompatibility with other systems that had made
its way into libarchive, which had assumed that O_EXEC was an alias for
O_SEARCH.

This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC
respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a
directory is checked in vn_open_vnode already, so for completeness we add a
NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not
re-check that when descending in namei.

[0] https://pubs.opengroup.org/onlinepubs/9699919799/

r357461:
namei: preserve errors from fget_cap_locked

Most notably, we want to make sure we don't clobber any capabilities-related
errors. This is a regression from r357412 (O_SEARCH) that was picked up by
the capsicum tests.

r357580:
O_SEARCH test: drop O_SEARCH|O_RDWR local diff

In FreeBSD's O_SEARCH implementation, O_SEARCH in conjunction with O_RDWR or
O_WRONLY is explicitly rejected. In this case, O_RDWR was not necessary
anyways as the file will get created with or without it.

This was submitted upstream as misc/54940 and committed in rev 1.8 of the
file.

r357584:
Record-only MFV of r357583: netbsd-tests: import upstreamed changes

The changes in question originated in FreeBSD/head; no further action is
required.

r357636:
MFV r357635: imnport v1.9 of the O_SEARCH tests

The RCSID data was wrong, so this is effectively a record-only merge
with correction of said data. No further changes should be needed in this
area, as we've now upstreamed our local changes to this specific test.

r357671:
O_SEARCH test: mark revokex an expected fail on NFS

The revokex test does not work when the scratch directory is created on NFS.
Given the nature of NFS, it likely can never work without looking like a
security hole since O_SEARCH would rely on the server knowing that the
directory did have +x at the time of open and that it's OK for it to have
been revoked based on POSIX specification for O_SEARCH.

This does mean that O_SEARCH is only partially functional on NFS in general,
but I suspect the execute bit getting revoked in the process is likely not
common.

r357688:
MFV r357687: Import NFS fix for O_SEARCH tests

The version that ended upstream was ultimately slightly different than the
version committed here; notably, statvfs() is used but it's redefined
appropriately to statfs() on FreeBSD since we don't provide the fstypename
for the former interface.

4 years agoMFC r357572: wc(1): account for possibility of file == NULL
Kyle Evans [Sun, 9 Feb 2020 19:20:20 +0000 (19:20 +0000)]
MFC r357572: wc(1): account for possibility of file == NULL

file could reasonably be NULL here if we we're using stdin. Albeit less
likely in normal usage, one could actually hit either of these warnings on
stdin.

4 years agoMFC r353678 (by avg):
Alexander Motin [Sat, 8 Feb 2020 21:55:56 +0000 (21:55 +0000)]
MFC r353678 (by avg):
provide a way to assign taskqueue threads to a kernel process

This can be used to group all threads belonging to a single logical
entity under a common kernel process.
I am planning to use the new interface for ZFS threads.

4 years agoMFC r357067: Drop "All Rights Reserved" from all libbe/bectl files
Kyle Evans [Fri, 7 Feb 2020 21:57:27 +0000 (21:57 +0000)]
MFC r357067: Drop "All Rights Reserved" from all libbe/bectl files

4 years agoMFC r357509-r357510: small psm cleanup
Kyle Evans [Fri, 7 Feb 2020 21:55:45 +0000 (21:55 +0000)]
MFC r357509-r357510: small psm cleanup

r357509:
psm: release resources on attach failure

In exactly 1/3 cases we'll release resources on failure; touch up the other
two to do so as well.

r357510:
psm: use make_dev_s instead of make_dev

This most importantly reduces duplication, but it also removes any potential
race with usage of dev->si_drv1 since it's now set prior to the device being
constructed enough to be accessible.

4 years agoMFC r355248: tty: implement TIOCNOTTY
Kyle Evans [Fri, 7 Feb 2020 19:00:43 +0000 (19:00 +0000)]
MFC r355248: tty: implement TIOCNOTTY

Generally, it's preferred that an application fork/setsid if it doesn't want
to keep its controlling TTY, but it could be that a debugger is trying to
steal it instead -- so it would hook in, drop the controlling TTY, then do
some magic to set things up again. In this case, TIOCNOTTY is quite handy
and still respected by at least OpenBSD, NetBSD, and Linux as far as I can
tell.

I've dropped the note about obsoletion, as I intend to support TIOCNOTTY as
long as it doesn't impose a major burden.

4 years agoMFC r357195, r357556: O_SEARCH test fixes
Kyle Evans [Thu, 6 Feb 2020 18:40:37 +0000 (18:40 +0000)]
MFC r357195, r357556: O_SEARCH test fixes

r357195:
netbsd-tests: libc: use correct modes in O_SEARCH tests

The current code clearly intended for these to be octal based on the values
used, but the octal prefix was forgotten. Add it now for correctness, but
note that we don't currently execute these tests.

This has been submitted upstream as misc/54902, so I've omitted the standard
FreeBSD markers that we tend to put into netbsd-tests for upstream-candidate
identification.

r357556:
O_SEARCH tests: plug trivial fd leak

Coverity correctly reports this as a resource leak. It's an admittedly minor
one, but plug it anyways.

This has been submitted upstream as misc/54939.

4 years agoMFC r357193: caroot: blacklisted: automatically pick up *.pem in the tree
Kyle Evans [Thu, 6 Feb 2020 18:37:38 +0000 (18:37 +0000)]
MFC r357193: caroot: blacklisted: automatically pick up *.pem in the tree

This kind of automagica got picked up in trusted/ prior to the initial
commit, but never got applied over in blacklisted. Ideally no one will be
using blacklisted/ to store arbitrary certs that they don't intend to
blacklist, so we should just install anything that's in here rather than
force consumer to first copy cert into place and then modify the file
listing in the Makefile.

Wise man once say: "it is better to restrict too much, than not enough.
sometimes."

4 years agoMFC r357393
Warner Losh [Thu, 6 Feb 2020 16:22:16 +0000 (16:22 +0000)]
MFC r357393

However, fix the wording to match the same that we used elsewhere in the NIC
deprecation efforts. It was bogus when I committed to to -current.

4 years agoBump FreeBSD version due to recent LinuxKPI changes.
Hans Petter Selasky [Thu, 6 Feb 2020 10:10:42 +0000 (10:10 +0000)]
Bump FreeBSD version due to recent LinuxKPI changes.

This is a direct commit.

Sponsored by: Mellanox Technologies

4 years agoMFC r357410-r357411: Avoid duplicating VEXEC checks in VOP_CACHEDLOOKUP
Kyle Evans [Wed, 5 Feb 2020 21:30:31 +0000 (21:30 +0000)]
MFC r357410-r357411: Avoid duplicating VEXEC checks in VOP_CACHEDLOOKUP

r357410: pseudofs: don't do VEXEC check in VOP_CACHEDLOOKUP

VOP_CACHEDLOOKUP should assume that the appropriate VEXEC check has been
done in the caller (vfs_cache_lookup), so it does not belong here.

r357411: zfs: light refactor to indicate cachedlookup in zfs_lookup

If we come from VOP_CACHEDLOOKUP, we must skip the VEXEC check as it will
have been done in the caller (vfs_cache_lookup). This is a part of D23247,
which may skip the earlier VEXEC check as well if the root fd was opened
with O_SEARCH.

This one required slightly more work as zfs_lookup may also be called
indirectly as VOP_LOOKUP or a couple of other places where we must do the
check.

4 years agoMFCr356928:
Mariusz Zaborski [Wed, 5 Feb 2020 21:11:40 +0000 (21:11 +0000)]
MFCr356928:
  When MK_CASPER=no is set remove files which are not needed to run system.

  PR:           242971

4 years agoMFCr356926:
Mariusz Zaborski [Wed, 5 Feb 2020 21:10:42 +0000 (21:10 +0000)]
MFCr356926:
  Even when the MK_CASPER is set to "no" we still want to install man pages
  and the headers. If the user decides to install the system without Casper
  support, then the Casper functions are mocked, but they still exist in
  the system.

  PR:           242971

4 years agoMFCr356925:
Mariusz Zaborski [Wed, 5 Feb 2020 21:05:52 +0000 (21:05 +0000)]
MFCr356925:
  Those files are already removed in ObsoleteFiles.
  There is no need to remove them twice.

  PR:           242971

4 years agoMFC r356949:
Cy Schubert [Wed, 5 Feb 2020 20:55:59 +0000 (20:55 +0000)]
MFC r356949:

Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.

The build failure was discoved by Michael Dexter's recent Build Options
Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.

Reported by: Michael Dexter <editor@callfortesting.org> via emaste

4 years agoMFC r354399: blacklist: update to NetBSD snapshot on 20191106
Ed Maste [Wed, 5 Feb 2020 18:24:28 +0000 (18:24 +0000)]
MFC r354399: blacklist: update to NetBSD snapshot on 20191106

Sponsored by: The FreeBSD Foundation

4 years agoMFC r356249-r356250, r356313, r356434, r356657, r357421
Xin LI [Wed, 5 Feb 2020 08:55:19 +0000 (08:55 +0000)]
MFC r356249-r356250, r356313, r356434, r356657, r357421

r356249-r356250, r356313:
Reduce memory footprint of fsck_msdosfs.

This utility was initially written for FAT12/16, which were inherently
small. When FAT32 support was added, the old data structure and
algorithms remain used with minimal changes.

With growing size of FAT32 media, the current data structure that
requires 4 32-bit variables per each FAT32 table entry would consume up
to 4 GiB of RAM, which can be too big for systems with limited RAM
available.

Address this by taking a different approach of validating the FAT.

The FAT is essentially a set of linked lists of chains that was
referenced by directory entries, and the checker needs to make sure that
the linked chains of clusters do not have cross-linked chains, and every
chain were referenced by one and only one directory entry.  Instead of
keeping track of the chain's 'head' cluster number, the size of the
chain, the used status of the chain and the "next" pointer which is
content of the FAT table, we create accessors for the FAT table data
for the "next" pointer, and keep only one bit to indicate if the
current cluster is a 'head' node of a cluster chain, in a bitmap.

We further overhaul the FAT checker to find out the possible head nodes
by excluding ones that are not (in other words, nodes that have some
other nodes claiming them as the next node) instead of marking the head
nodes for each node on the chain.  This approach greatly reduced the
complexiety of computation from O(N^2) worst case, to an O(N) scan for
worst case.  The file (cluster chain) length is not useful for the FAT
checker, so don't bother to calculate them in the FAT checker and
instead leave the task to the directory structure check, at which point
we would have non-crossed cluster chains, and we are guaranteed that
each cluster will be visited for at most one time.

When checking the directory structures, we use the head node indicator
to as the visited (used) flag: every cluster chain can only be
referenced by one directory entry, so we clear them when calculating
the length of the chain, and we can immediately tell if there are
anomalies in the directory entry.

As a result, the required RAM size is now 1 bit per each entry of
the FAT table, plus memory needed to hold the FAT table in memory,
instead of 16 bytes (=128 bits) per each entry.  For FAT12 and FAT16,
we will load the whole FAT table into memory as they are smaller than
128KiB, and for FAT32, we first attempt to mmap() it into memory, and
when that fails, we would fall back to a simple LRU cache of 4 MiB of
RAM.

sbin/fsck_msdosfs/boot.c:

 - Added additional sanity checks for valid FAT32/FAT16/FAT12 cluster
   number.
 - FAT32: check if root directory starts with a valid cluster number,
   moved from dir.c.  There is no point to proceed if the filesystem
   is already damaged beyond repair.

sbin/fsck_msdosfs/check.c:

 - Combine phase 1 and phase 2, now that the readfat() is able to
   detect cross chains.

sbin/fsck_msdosfs/dir.c:

 - Refactor code to use FAT accessor instead of accessing the internal
   representation of FAT table.
 - Make use of the cluster chain head bitmap.
 - Clarify and simplify directory entry check, remove unnecessary
   checks that are would be done at a later time (for example, whether
   the directory's second cluster is a valid one, which is examined
   more throughly in a later checkchain() and does not prevent us
   from proceeding further).

sbin/fsck_msdosfs/dosfs.h:

 - Remove internal representation of FAT table, which is replaced by
   the head bitmap that is opaque to other code.
 - Added a special CLUST_DEAD cluster type to indicate errors.

sbin/fsck_msdosfs/ext.h:

 - Added a flag that overrides mmap(2) setting.  The corresponding
   command line option, -M is intentionally undocumented as we do not
   expect users to need it.
 - Added accessors for FAT table and convert existing interface to use
   it.

sbin/fsck_msdosfs/fat.c:

 - Added head bitmap to represent whether a cluster is a head cluster.
 - Converted FAT internal representation to accessors.
 - Implemented a LRU cache for FAT32 when mmap(2) should not or can not
   be used.
 - _readfat: Attempt a mmap(2) and fall back to regular read for
   non-FAT32 file systems; use the LRU cache for FAT32 and prepopulate
   the cache with the first 4MiB of the entries.
 - readfat: Added support of head bitmap and use the population scan to
   detect bogus chains.
 - clusterdiff: removed, FATs are copied from the checked copy via
   writefat()/copyfat().
 - checkchain: calculates the length of a cluster chain and make sure
   that it ends with a valid EOF marker.
 - clearchain: follow and clear a chain and maintain the free cluster
   count.
 - checklost: convert to use head bitmap. At the end of all other scans,
   the remaining 'head' nodes are leaders of lost cluster chains.

sbin/fsck_msdosfs/fat.c:

 - Added a new -M option which is intentionally undocumented, to disable
   the use of mmap().

r356434:
fsck_msdosfs.8: document -M.

r356657:
Tighten FAT checks and fix off-by-one error in corner case.

sbin/fsck_msdosfs/fat.c:
 - readfat:
    * Only truncate out-of-range cluster pointers (1, or greater than
      NumClusters but smaller than CLUST_RSRVD), as the current cluster
      may contain some data. We can't fix reserved cluster pointers at
      this pass, because we do no know the potential cluster preceding
      it.
    * Accept valid cluster for head bitmap. This is a no-op, and mainly
      to improve code readability, because the 1 is already handled in
      the previous else if block.
 - truncate_at: absorbed into checkchain.
 - checkchain: save the previous node we have traversed in case that we
   have a chain that ends with a special (>= CLUST_RSRVD) cluster, or is
   free. In these cases, we need to truncate at the cluster preceding the
   current cluster, as the current cluster contains a marker instead of
   a next pointer and can not be changed to CLUST_EOF (the else case can
   happen if the user answered "no" at some point in readfat()).
 - clearchain: correct the iterator for next cluster so that we don't
   stop after clearing the first cluster.
 - checklost: If checkchain() thinks the chain have no cluster, it
   doesn't make sense to reconnect it, so don't bother asking.

r357421:
Diff reduction against NetBSD, no functional change.

Relnotes: yes

4 years agoMFC r356993: Update route MTUs for bridge, lagg and vlan interfaces.
Alexander Motin [Wed, 5 Feb 2020 00:47:03 +0000 (00:47 +0000)]
MFC r356993: Update route MTUs for bridge, lagg and vlan interfaces.

Those interfaces may implicitly change their MTU on addition of parent
interface in addition to normal SIOCSIFMTU ioctl path, where the route
MTUs are updated normally.

4 years agoMFC r357349:
Dimitry Andric [Tue, 4 Feb 2020 20:09:25 +0000 (20:09 +0000)]
MFC r357349:

Merge r357348 from the clang 10.0.0 import branch:

Disable new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4):

sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
        WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
                                      ^
sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
#define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
                                        ^
sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
#define BIT(x) (1 << (x))
                  ^

Such warnings can be useful in C++ contexts, but not so much in kernel
drivers, where this type of bit twiddling is commonplace.  So disable it
for this case.

MFC r357366:

Revert r357349, since the clang 10.0.0 warning was actually correct, and
the ! operator should have been a ~ instead:

  Merge r357348 from the clang 10.0.0 import branch:

  Disable new clang 10.0.0 warnings about converting the result of
  shift operations to a boolean in tpm(4):

  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
^
  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
  #define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
  ^
  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
  #define BIT(x) (1 << (x))
    ^

  Such warnings can be useful in C++ contexts, but not so much in kernel
  drivers, where this type of bit twiddling is commonplace.  So disable
  it for this case.

Noticed by: cem

MFC r357367:

Fix new clang 10.0.0 warnings about converting the result of shift
operations to a boolean in tpm(4):

  sys/dev/tpm/tpm_crb.c:301:32: error: converting the result of '<<' to a boolean; did you mean '(1 << (0)) != 0'? [-Werror,-Wint-in-bool-context]
  WR4(sc, TPM_CRB_CTRL_CANCEL, !TPM_CRB_CTRL_CANCEL_CMD);
^
  sys/dev/tpm/tpm_crb.c:73:34: note: expanded from macro 'TPM_CRB_CTRL_CANCEL_CMD'
  #define TPM_CRB_CTRL_CANCEL_CMD         BIT(0)
  ^
  sys/dev/tpm/tpm20.h:60:19: note: expanded from macro 'BIT'
  #define BIT(x) (1 << (x))
    ^

In this case, the intent was to clear the zeroth bit, and leave the rest
unaffected.  Therefore, the ~ operator should be used instead.

Noticed by: cem

MFC r357388:

Amend r357367 by using register values from the TPM datasheet.

As Ian Lepore noted, writing ~1 to a register might have a completely
different effect than doing a regular read-modify-write operation.

Follow the TCG_PC_Client_Platform_TPM_Profile_PTP_2.0_r1.03_v22
datasheet instead, and use the actual values mentioned there:
(uint32_t)1 to cancel the command, (uint32_t)0 to clear the field.

MFC r357391 (by kib):

Fix build.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r357346:
Dimitry Andric [Tue, 4 Feb 2020 19:51:26 +0000 (19:51 +0000)]
MFC r357346:

Merge r357342 from the clang1000-import branch:

Work around two -Werror warning issues in googletest, which have been
solved upstream in the mean time.

The first issue is because one of googletest's generated headers contain
classes with a user-declared copy assignment operator, but rely on the
generation by the compiler of an implicit copy constructor, which is now
deprecated:

/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/internal/gtest-param-util-generated.h:5284:8: error: definition of implicit copy constructor for 'CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  void operator=(const CartesianProductHolder3& other);
       ^
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/private/gtest/gtest-param-test.h:1277:10: note: in implicit copy constructor for 'testing::internal::CartesianProductHolder3<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' first required here
  return internal::CartesianProductHolder3<Generator1, Generator2, Generator3>(
         ^
/usr/src/tests/sys/fs/fusefs/io.cc:534:2: note: in instantiation of function template specialization 'testing::Combine<testing::internal::ParamGenerator<bool>, testing::internal::ValueArray3<int, int, int>, testing::internal::ValueArray4<cache_mode, cache_mode, cache_mode, cache_mode> >' requested here
        Combine(Bool(),                                 /* async read */
        ^

For now, silence the warning using -Wno-deprecated-copy.

The second issue is because one of the googlemock test programs attempts
to use "unsigned wchar_t" and "signed wchar_t", which are non-standard
and at best, hazily defined:

contrib/googletest/googlemock/test/gmock-actions_test.cc:111:37: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0U, BuiltInDefaultValue<unsigned wchar_t>::Get());
                                    ^
contrib/googletest/googlemock/test/gmock-actions_test.cc:112:36: error: 'wchar_t' cannot be signed or unsigned [-Wsigned-unsigned-wchar]
  EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
                                   ^

For now, silence the warning using -Wno-signed-unsigned-wchar.

4 years agoMFC r357340:
Dimitry Andric [Tue, 4 Feb 2020 19:46:29 +0000 (19:46 +0000)]
MFC r357340:

Merge r357339 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1661:4: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                        return (-1);
                        ^
usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c:1658:5: note: previous statement is here
                } else
                  ^

The intent was to group the return statement with the previous syslog()
call.

4 years agoMFC r357347:
Dimitry Andric [Tue, 4 Feb 2020 19:42:57 +0000 (19:42 +0000)]
MFC r357347:

Merge r357345 from the clang1000-import branch:

Disable new clang 10.0.0 warnings about misleading indentation in flex.

As this is contributed code with very messy indentation, which will
almost certainly never be upgraded, just disable the warning.

4 years agoMFC r357272:
Dimitry Andric [Tue, 4 Feb 2020 19:35:40 +0000 (19:35 +0000)]
MFC r357272:

Merge r357271 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in bsnmpd:

usr.sbin/bsnmpd/modules/snmp_bridge/bridge_port.c:1235:43: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
                            begemotBridgeStpPortEnable_enabled ||
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~

Work around it by casting the enum values to the type of val->v.integer.

4 years agoMFC r357268:
Dimitry Andric [Tue, 4 Feb 2020 19:31:01 +0000 (19:31 +0000)]
MFC r357268:

Merge r357260 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in procstat:

usr.bin/procstat/procstat_sigs.c:79:3: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                xo_close_container(name);
                ^
usr.bin/procstat/procstat_sigs.c:77:4: note: previous statement is here
        } else
          ^

The intent was to group the xo_close_container() call to the previous
snprintf() call.

4 years agoMFC r357269:
Dimitry Andric [Tue, 4 Feb 2020 19:24:10 +0000 (19:24 +0000)]
MFC r357269:

Merge r357267 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in tip:

usr.bin/tip/tip/tip.c:428:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        if (gch == EOF)
                        ^
usr.bin/tip/tip/tip.c:426:5: note: previous statement is here
                } else if (!cumode && gch == character(value(FORCE)))
                  ^

The intent was to have the EOF check grouped with the getchar() call
just above it.  This was accidentally introduced in r354624.

4 years agoMFC r357223:
Dimitry Andric [Tue, 4 Feb 2020 19:19:48 +0000 (19:19 +0000)]
MFC r357223:

Merge r357222 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in rbootd:

libexec/rbootd/rmpproto.c:335:49: error: multiple unsequenced modifications to 'filename' [-Werror,-Wunsequenced]
        filename = (filename = strrchr(filepath,'/'))? ++filename: filepath;
                 ~                                     ^

4 years agoMFC r357227:
Dimitry Andric [Tue, 4 Feb 2020 19:01:17 +0000 (19:01 +0000)]
MFC r357227:

Merge r357225 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in newfs_msdos:

sbin/newfs_msdos/newfs_msdos.c:181:2: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
        if (o.align) {
        ^
sbin/newfs_msdos/newfs_msdos.c:179:5: note: previous statement is here
    if (argc < 1 || argc > 2)
    ^

4 years agoMFC r357199, r357306:
Konstantin Belousov [Tue, 4 Feb 2020 17:12:09 +0000 (17:12 +0000)]
MFC r357199, r357306:
Save lower root vnode in nullfs mnt data instead of upper.

4 years agoMFC r357198:
Konstantin Belousov [Tue, 4 Feb 2020 17:08:00 +0000 (17:08 +0000)]
MFC r357198:
Provide support for fdevname(3) on linuxkpi-backed devices.

For merge, compat32 support was left out.  It is not yet present for
FIODGNAME over native cdevs yet.

Sponsored by: Mellanox Technologies

4 years agoMFC r357442:
Toomas Soome [Tue, 4 Feb 2020 07:15:33 +0000 (07:15 +0000)]
MFC r357442:

loader: bc_add can not use any other probes than ah=0x4b

CD boot is broken for some systems since bioscd and biosdisk merge. The issue is that we can not use anything else than int 13 ah=0x4b to query cd information.

The patch does restore the same probe as was originally used in bioscd.c. Additionally extra buffer padding is used to avoid memory corruption caused by some systems.

PR: 234031
Reported by: ultramage and others

4 years agoMFC r357234, r357365, r357375:
Kristof Provost [Tue, 4 Feb 2020 04:29:54 +0000 (04:29 +0000)]
MFC r357234, r357365, r357375:

tests: Test for an epair panic

if_epair abused the ifr_data field to insert its second interface in
IFC_IFLIST. If userspace provides a value for ifr_data it would get
dereferenced by the kernel leading to a panic.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

4 years agoMFC 356913
George V. Neville-Neil [Tue, 4 Feb 2020 03:31:28 +0000 (03:31 +0000)]
MFC 356913

Add support for latest Intel I219 device, supported in Lenovo Carbon X1 v7

4 years agoMFC r356947:
Mark Johnston [Tue, 4 Feb 2020 02:06:21 +0000 (02:06 +0000)]
MFC r356947:
Add relocation handling required for -zifunc-noplt to work on arm64.

4 years agoMFC r357298:
Hans Petter Selasky [Mon, 3 Feb 2020 11:04:18 +0000 (11:04 +0000)]
MFC r357298:
Add missing mutex unlock in failure case.

Differential Revision: https://reviews.freebsd.org/D23430
Submitted by: cem
Reported by: Coverity
Coverity CID: 1368773
Sponsored by: Mellanox Technologies

4 years agoMFC r357077:
Hans Petter Selasky [Mon, 3 Feb 2020 10:59:27 +0000 (10:59 +0000)]
MFC r357077:
Implement mmget_not_zero() in the LinuxKPI.

Submitted by: Austin Shafer <ashafer@badland.io>
Sponsored by: Mellanox Technologies

4 years agoMFC r357041:
Hans Petter Selasky [Mon, 3 Feb 2020 10:53:03 +0000 (10:53 +0000)]
MFC r357041:
Fix build of stand/usb .

Sponsored by: Mellanox Technologies

4 years agoMFC r356952:
Hans Petter Selasky [Mon, 3 Feb 2020 10:49:18 +0000 (10:49 +0000)]
MFC r356952:
Add new USB ID to uslcom(4).

Submitted by: Oleg Sharoyko <osharoiko@gmail.com>
PR: 243494
Sponsored by: Mellanox Technologies

4 years agoMFC r356633:
Hans Petter Selasky [Mon, 3 Feb 2020 10:45:09 +0000 (10:45 +0000)]
MFC r356633:
Make sure the VNET is properly set when reaping mbufs in ipoib.
Else the following panic may happen:

panic()
icmp_error()
ipoib_cm_mb_reap()
linux_work_fn()
taskqueue_run_locked()
taskqueue_thread_loop()
fork_exit()
fork_trampoline()

Submitted by: Andreas Kempe <kempe@lysator.liu.se>
Sponsored by: Mellanox Technologies

4 years agoMFC r357292:
Philip Paeps [Sun, 2 Feb 2020 08:46:29 +0000 (08:46 +0000)]
MFC r357292:

  acpi_ibm: add support for ThinkPad PrivacyGuard

  ThinkPad PrivacyGuard is a built-in toggleable privacy filter that
  restricts viewing angles when on. It is an available on some new
  ThinkPad models such as the X1 Carbon 7th gen (as an optional HW
  upgrade).

  The privacy filter can be enabled/disabled via an ACPI call. This commit
  adds a sysctl under dev.acpi_ibm that allows for getting and setting the
  PrivacyGuard state.

Submitted by:   Kamila Součková <kamila@ksp.sk>
Reviewed By:    cem, philip
Differential Revision: https://reviews.freebsd.org/D23370

4 years agoMFC r357232:
Dimitry Andric [Fri, 31 Jan 2020 21:20:22 +0000 (21:20 +0000)]
MFC r357232:

Merge r357231 from the clang1000-import branch:

Work around assembler error from clang 10.0.0 in gptboot:

stand/i386/gptboot/gptldr.S:141:3: error: value of 36878 is too large for field of 2 bytes.
  jmp MEM_JMP # Start BTX
  ^

Use the same construct as in stand/i386/boot2/boot1.S, which ensures the
jump distance does not become too large.

4 years agoMFC r357226:
Dimitry Andric [Fri, 31 Jan 2020 20:04:32 +0000 (20:04 +0000)]
MFC r357226:

Merge r357224 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in binutils:

contrib/binutils/bfd/peicode.h:1356:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (efi)
                ^
contrib/binutils/bfd/peicode.h:1353:8: note: previous statement is here
              if (pe_arch (bfd_target_efi_arch (*target_ptr)) != arch)
              ^
contrib/binutils/bfd/peicode.h:1370:3: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                if (!efi)
                ^
contrib/binutils/bfd/peicode.h:1367:8: note: previous statement is here
              if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
              ^

4 years agoMFC r354922
Warner Losh [Fri, 31 Jan 2020 13:18:25 +0000 (13:18 +0000)]
MFC r354922

> Author: imp <imp@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
> Date:   Wed Nov 20 23:45:31 2019 +0000
>
>    Create /etc/os-release file.
>
>    Each boot, regenerate /var/run/os-release based on the currently running
>    system. Create a /etc/os-release symlink pointing to this file (so that this
>    doesn't create a new reason /etc can not be mounted read-only).
>
>    This is compatible with what other systems do and is what the sysutil/os-release
>    port attempted to do, but in an incomplete way. Linux, Solaris and DragonFly all
>    implement this natively as well. The complete standard can be found at
>    https://www.freedesktop.org/software/systemd/man/os-release.html
>
>    Moving this to the base solves both the non-standard location problem with the
>    port, as well as the lack of update of this file on system update.
>
>    Bump __FreeBSD_version to 1300060
>
>    PR: 238953
>    Differential Revision:  https://reviews.freebsd.org/D22271

Execpt bump __FreeBSD_version to 1201511

4 years agoMFC r357043: Fix kernel-tags target.
Yoshihiro Takahashi [Fri, 31 Jan 2020 12:38:53 +0000 (12:38 +0000)]
MFC r357043: Fix kernel-tags target.

>  - A depend-file is broken up into .depend.*.o files. [1]
>  - Fix an assembly file support.
>
>  PR:           241746
>  Submitted by: leres [1]

4 years agoMFC r357233:
Kristof Provost [Fri, 31 Jan 2020 10:34:36 +0000 (10:34 +0000)]
MFC r357233:

epair: Do not abuse params to register the second interface

if_epair used the 'params' argument to pass a pointer to the b interface
through if_clone_create().
This pointer can be controlled by userspace, which means it could be abused to
trigger a panic. While this requires PRIV_NET_IFCREATE
privileges those are assigned to vnet jails, which means that vnet jails
could panic the system.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>

4 years agoMFC r356707: Map ECKSUM and EFRAGS from ZFS onto real errnos.
Alexander Motin [Thu, 30 Jan 2020 16:38:40 +0000 (16:38 +0000)]
MFC r356707: Map ECKSUM and EFRAGS from ZFS onto real errnos.

Make it less confusing when, for example, stat sets errno to 122 because a
checksum failed in ZFS:

Before: getfacl: /foo/bar: stat() failed: Unknown error: 122
After: getfacl: /foo/bar: stat() failed: Integrity check failed

Submitted by: Ryan Moeller <ryan@ixsystems.com>

4 years agoMFC r343111,343113-343115 (by mckusick):
Alexander Motin [Thu, 30 Jan 2020 16:11:19 +0000 (16:11 +0000)]
MFC r343111,343113-343115 (by mckusick):
Create new EINTEGRITY error with message "Integrity check failed".

An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Approved by: mckusick

4 years agoMFC r357048:
Mark Johnston [Thu, 30 Jan 2020 15:00:41 +0000 (15:00 +0000)]
MFC r357048:
arm64: Don't enable interrupts in init_secondary().

4 years agoMFC r356816:
Kristof Provost [Thu, 30 Jan 2020 09:56:56 +0000 (09:56 +0000)]
MFC r356816:

Fix pfdenied not returning any results

When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR: 224415
Submitted by: sigsys AT gmail.com

4 years agoMFC r357159
Vincenzo Maffione [Wed, 29 Jan 2020 22:55:59 +0000 (22:55 +0000)]
MFC r357159

netmap_mem_unmap: fix NULL pointer dereference

4 years agoMFC r354637:
Roger Pau Monné [Wed, 29 Jan 2020 09:33:40 +0000 (09:33 +0000)]
MFC r354637:

xen: fix dispatching of NMIs