]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC 350014: Add a test for PT_GET_SC_ARGS.
John Baldwin [Mon, 27 Apr 2020 21:19:46 +0000 (21:19 +0000)]
MFC 350014: Add a test for PT_GET_SC_ARGS.

4 years agoMFC 350013: Don't pass error from syscallenter() to syscallret().
John Baldwin [Mon, 27 Apr 2020 20:37:11 +0000 (20:37 +0000)]
MFC 350013: Don't pass error from syscallenter() to syscallret().

syscallret() doesn't use error anymore.  Fix a few other places to permit
removing the return value from syscallenter() entirely.
- Remove a duplicated assertion from arm's syscall().
- Use td_errno for amd64_syscall_ret_flush_l1d.

4 years agoMFC r359702, r359774: enforce -fno-common for userland/kernel src builds
Kyle Evans [Mon, 27 Apr 2020 19:49:35 +0000 (19:49 +0000)]
MFC r359702, r359774: enforce -fno-common for userland/kernel src builds

r359702:
Add -fno-common to all userland/kernel src builds

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

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

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

r359774:
userland build: replace -fno-common with ${CFCOMMONFLAG}

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

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

4 years agoMFC r359642: adduser: allow standard IFS characters in passwords
Kyle Evans [Mon, 27 Apr 2020 19:29:48 +0000 (19:29 +0000)]
MFC r359642: adduser: allow standard IFS characters in passwords

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

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

PR: 245342

4 years agoMFC r340361, r345804: catch up on systat in head/
Kyle Evans [Mon, 27 Apr 2020 16:11:59 +0000 (16:11 +0000)]
MFC r340361, r345804: catch up on systat in head/

[Neither of these originally mine, but the latter commit referenced
fixes an -fno-common issue and the former is a bugfix]

r340361:
Fix printing of 64-bit counters on 32-bit ppc platforms.

Several statistic counters are uint64_t values and are printed by systat
using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
While there, print variables of size_t using %zd.

r345804:
systat -zarc to display disk activities like -vm

PR: 213310

4 years agodtc: fix the -fno-common build
Kyle Evans [Mon, 27 Apr 2020 16:09:03 +0000 (16:09 +0000)]
dtc: fix the -fno-common build

This is a direct commit to stable/12, as GPL dtc has been removed in head.

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

4 years agoMFC r360123: Allow namespace-id specification where it makes sense.
Alexander Motin [Mon, 27 Apr 2020 14:03:24 +0000 (14:03 +0000)]
MFC r360123: Allow namespace-id specification where it makes sense.

It makes tool more convenient to not require user to explicitly convert
namespace device name into controller device name.  There should be no
changes to already existing syntaxes.

4 years agoMFC r360117: Open device with O_RDONLY when command is non-invasive.
Alexander Motin [Mon, 27 Apr 2020 14:02:24 +0000 (14:02 +0000)]
MFC r360117: Open device with O_RDONLY when command is non-invasive.

This allows to use some of the subcommands against mounted nvd devices.

4 years agoMFC 360284:
Mateusz Piotrowski [Mon, 27 Apr 2020 09:45:19 +0000 (09:45 +0000)]
MFC 360284:

Fix a typo

Reported by: pstef

4 years agoMFC r359815: config(8): use sbuf to manage line buffers
Jason A. Harmening [Mon, 27 Apr 2020 05:35:26 +0000 (05:35 +0000)]
MFC r359815: config(8): use sbuf to manage line buffers

4 years agoMFC 350012: Always set td_errno to the error value of a system call.
John Baldwin [Mon, 27 Apr 2020 04:47:02 +0000 (04:47 +0000)]
MFC 350012: Always set td_errno to the error value of a system call.

Early errors prior to a system call did not set td_errno.  This commit
sets td_errno for all errors during syscallenter().  As a result,
syscallret() can now always use td_errno without checking TDP_NERRNO.

Compared to the original commit, this change preserves the ABI of
struct thread and instead adds explicit zero'ing of td_errno.

4 years agoMFC r360240: Import tzdata 2020a
Philip Paeps [Mon, 27 Apr 2020 03:56:47 +0000 (03:56 +0000)]
MFC r360240: Import tzdata 2020a

4 years agoMFC r359905:
Vladimir Kondratyev [Sun, 26 Apr 2020 19:42:40 +0000 (19:42 +0000)]
MFC r359905:

[evdev] Use proper mutex reference in autorepeat callout initialization.

This fixes panic occuring when evdev key autorepeat is enabled by driver
which initializes evdev with external mutex.

4 years agoMFC r360098:
Kristof Provost [Sun, 26 Apr 2020 16:13:50 +0000 (16:13 +0000)]
MFC r360098:

pf: Improve ioctl() input validation

Both DIOCCHANGEADDR and DIOCADDADDR take a struct pf_pooladdr from
userspace. They failed to validate the dyn pointer contained in its
struct pf_addr_wrap member structure.

This triggered assertion failures under fuzz testing in
pfi_dynaddr_setup(). Happily the dyn variable was overruled there, but
we should verify that it's set to NULL anyway.

Reported-by: syzbot+93e93150bc29f9b4b85f@syzkaller.appspotmail.com

4 years agoMFC r360096:
Kristof Provost [Sun, 26 Apr 2020 16:06:09 +0000 (16:06 +0000)]
MFC r360096:

pfctl: Remove unused variable

Submitted by: Nick Rogers
MFC after: 1 week
Sponsored by: RG Nets

4 years agoAdd casts to work around harmless -Werror warnings from clang 10.0.0,
Dimitry Andric [Sun, 26 Apr 2020 15:50:32 +0000 (15:50 +0000)]
Add casts to work around harmless -Werror warnings from clang 10.0.0,
such as:

usr.sbin/timed/timed/networkdelta.c:160:13: error: implicit conversion from 'long' to 'float' changes value from 9223372036854775807 to 9223372036854775808
      [-Werror,-Wimplicit-int-float-conversion]
        float ap = LONG_MAX;            /* bounds on the median */
              ~~   ^~~~~~~~

Direct commit to stable/{10,11,12}, since timed has been removed from
FreeBSD 13.

4 years agoMFC r360075:
Hans Petter Selasky [Sun, 26 Apr 2020 08:36:54 +0000 (08:36 +0000)]
MFC r360075:
Set the maximum exit latency to 0 for XHCI USB 3.0 devices, because we
don't implement link power management, LPM.

This fixes error code XHCI_TRB_ERROR_BANDWIDTH for isochronous USB 3.0
transactions.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359968:
Hans Petter Selasky [Sun, 26 Apr 2020 08:34:03 +0000 (08:34 +0000)]
MFC r359968:
Cast all ioctl command arguments through uint32_t internally.

Hide debug print showing use of sign extended ioctl command argument
under INVARIANTS. The print is available to all and can easily fill
up the logs.

No functional change intended.

Sponsored by: Mellanox Technologies

4 years agoMFC rr359961 (jkim): Do not attempt to remove backward compatibility
Xin LI [Sat, 25 Apr 2020 23:35:49 +0000 (23:35 +0000)]
MFC rr359961 (jkim): Do not attempt to remove backward compatibility
timezones.

4 years agoMFC r348282 (by lwhsu):
Dimitry Andric [Sat, 25 Apr 2020 22:23:34 +0000 (22:23 +0000)]
MFC r348282 (by lwhsu):

Remove an uneeded indentation introduced in r286196 to silence gcc warnging

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359045 (by brooks):
Dimitry Andric [Sat, 25 Apr 2020 18:23:23 +0000 (18:23 +0000)]
MFC r359045 (by brooks):

Add an internal liblua and use it in flua.

The new liblua will be used in a forthcoming import of kyua.

Reviewed by: kevans
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24090

4 years agoMFC r354057 (by brooks):
Dimitry Andric [Sat, 25 Apr 2020 15:51:30 +0000 (15:51 +0000)]
MFC r354057 (by brooks):

binutils: Fix bugs found by -Wpointer-compare

The MIPS bug was introduced by upstream commit 7403cb630, which failed
to account for the additional indirection introduced and also dropped
one of the checks; change it to the standard "NULL-or-empty" check as
used elsewhere in BFD, which is also what upstream now has.

Submitted by: James Clarke <jrtc27@jrtc27.com>
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21911

4 years agoMFC r354796 (by arichardson):
Dimitry Andric [Sat, 25 Apr 2020 15:45:43 +0000 (15:45 +0000)]
MFC r354796 (by arichardson):

Fix error found by new clang operator precendence warning

error: operator '?:' has lower precedence than '|'; '|' will be evaluated first

I discovered this in CheriBSD after updating our fork of clang to the latest
upstream master.

Reviewed By: ian
Differential Revision: https://reviews.freebsd.org/D22433

4 years agoMFC r359449: correct 'disble' typo in hccontrol
Ed Maste [Sat, 25 Apr 2020 15:43:44 +0000 (15:43 +0000)]
MFC r359449: correct 'disble' typo in hccontrol

PR: 245125
Submitted by: Marc Veldman

4 years agoMFC r359781: hda: if a CODEC is not responding, report which one
Ed Maste [Sat, 25 Apr 2020 15:42:38 +0000 (15:42 +0000)]
MFC r359781: hda: if a CODEC is not responding, report which one

PR: 229190

4 years agoMFC r357926: Upgrade to OpenSSH 7.9p1.
Ed Maste [Sat, 25 Apr 2020 15:38:48 +0000 (15:38 +0000)]
MFC r357926: Upgrade to OpenSSH 7.9p1.

Sponsored by: The FreeBSD Foundation

4 years agoMFC r348284 (by lwhsu):
Dimitry Andric [Sat, 25 Apr 2020 15:36:50 +0000 (15:36 +0000)]
MFC r348284 (by lwhsu):

Remove an uneeded indentation introduced in r223637 to silence gcc warnging

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359777: hdac: show which command timed out
Ed Maste [Sat, 25 Apr 2020 15:29:06 +0000 (15:29 +0000)]
MFC r359777: hdac: show which command timed out

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

PR: 229190
Sponsored by: The FreeBSD Foundation

4 years agoMFC r359626: vt: avoid overrun when stride is not a multiple of bytes per pixel
Ed Maste [Sat, 25 Apr 2020 15:17:43 +0000 (15:17 +0000)]
MFC r359626: vt: avoid overrun when stride is not a multiple of bytes per pixel

PR: 243533
Submitted by: Thomas Skibo

4 years agoMFC r360144: blacklistd.8: fix db file path
Ed Maste [Sat, 25 Apr 2020 15:16:35 +0000 (15:16 +0000)]
MFC r360144: blacklistd.8: fix db file path

PR: 245781
Submitted by: Jose Luis Duran

4 years agoMFC r357146 (partial, by jhb):
Dimitry Andric [Sat, 25 Apr 2020 13:18:29 +0000 (13:18 +0000)]
MFC r357146 (partial, by jhb):

Fix some misleading indentation warnings reported by recent clang.

These should not be any functional change.  While the change in
emul10kx-pcm.c looks like a real bug fix (as opposed to inconsistent
whitespace), the extra statements were not harmful.

Reviewed by: kib
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23363

4 years agoMFC r348445 (by lwhsu):
Dimitry Andric [Sat, 25 Apr 2020 13:14:06 +0000 (13:14 +0000)]
MFC r348445 (by lwhsu):

Add the missing braces to fix the code not guarded by the if clause and has
misleading indentation.  This is found by gcc -Wmisleading-indentation

Approved by: erj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20428

4 years agoFix misleading indentation in sys/dev/drm2/radeon/evergreen.c
Dimitry Andric [Sat, 25 Apr 2020 13:10:17 +0000 (13:10 +0000)]
Fix misleading indentation in sys/dev/drm2/radeon/evergreen.c

This fixes the following warning from recent versions of clang and gcc:

sys/dev/drm2/radeon/evergreen.c:554:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]

Direct commit to stable/{10,11,12}, since this driver has been removed
from FreeBSD 13.

4 years agoMFC r355974 (by rlibby):
Dimitry Andric [Sat, 25 Apr 2020 13:03:37 +0000 (13:03 +0000)]
MFC r355974 (by rlibby):

libdevdctl: g++9 avoid Wdeprecated-copy

g++9 now warns about having defined an assignment operator but using the
default copy constructor, or vice versa.  Avoid the issue in libdevdctl
by just using the default assignment operator too.

Reviewed by: asomers, dim
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D22887

4 years agoMFC r354834 (by jhibbits):
Dimitry Andric [Sat, 25 Apr 2020 12:57:20 +0000 (12:57 +0000)]
MFC r354834 (by jhibbits):

bsnmp: Fix operator precedence in error check in table_check_response

Summary:
The ?: operator has a lower precedence than == and &&, so the result will always
be recorded as true.  Found by gcc8.

Reviewed by: ngie, ae
Differential Revision: https://reviews.freebsd.org/D22427

4 years agoMFC r342022 (by imp):
Dimitry Andric [Sat, 25 Apr 2020 12:50:21 +0000 (12:50 +0000)]
MFC r342022 (by imp):

Correctly implemenet atomic_swap_long for mips64.

MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t.
sizeof(long) == sizeof(ptr) for all platforms, so define
atomic_swap_ptr in terms of atomic_swap_long.

Submitted by: hps@

4 years agoMFC r360068:
Kristof Provost [Sat, 25 Apr 2020 12:49:48 +0000 (12:49 +0000)]
MFC r360068:

ethersubr: Make the mac address generation more robust

If we create two (vnet) jails and create a bridge interface in each we end up
with the same mac address on both bridge interfaces.
These very often conflicts, resulting in same mac address in both jails.

Mitigate this problem by including the jail name in the mac address.

4 years agoMFC r348366 (by lwhsu):
Dimitry Andric [Sat, 25 Apr 2020 12:39:28 +0000 (12:39 +0000)]
MFC r348366 (by lwhsu):

Add the likely missing braces in ips(4).  This is found by gcc warning that
the code is not guarded by the if clause and has misleading indentation.

Approved by: scottl
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20427

4 years agoMFC r359795: Avoid using a variable solely for sizes that are never meant
Xin LI [Sat, 25 Apr 2020 06:42:46 +0000 (06:42 +0000)]
MFC r359795: Avoid using a variable solely for sizes that are never meant
to be modified runtime.

4 years agoMFC 349871: Use 'retval' label for first error in syscallenter().
John Baldwin [Fri, 24 Apr 2020 22:17:13 +0000 (22:17 +0000)]
MFC 349871: Use 'retval' label for first error in syscallenter().

This is more consistent with the rest of the function and lets us
unindent most of the function.

Sponsored by: DARPA

4 years agoMFC: r360175
Jung-uk Kim [Fri, 24 Apr 2020 19:03:18 +0000 (19:03 +0000)]
MFC: r360175

Merge OpenSSL 1.1.1g.

4 years agoMFC r351514: Don't consider PCIe hot-plug command timeout fatal.
Alexander Motin [Fri, 24 Apr 2020 16:39:34 +0000 (16:39 +0000)]
MFC r351514: Don't consider PCIe hot-plug command timeout fatal.

According to my tests and errata to several generations of Intel CPUs,
PCIe hot-plug command completion reporting is not very reliable thing.
At least on my Supermicro X11DPi-NT board I never saw it reported.
Before this change timeout code detached devices and tried to disable
the slot, that in my case resulted in hot-plugged device being detached
just a second after it was successfully detected and attached.  This
change removes that, so in case of timeout it just prints the error and
continue operation.  Linux does the same.

4 years agoMFC r359622 (by mmacy): Update x86 counters
Alexander Motin [Fri, 24 Apr 2020 16:19:03 +0000 (16:19 +0000)]
MFC r359622 (by mmacy): Update x86 counters

4 years agoMFC r360042:
Kristof Provost [Fri, 24 Apr 2020 15:27:55 +0000 (15:27 +0000)]
MFC r360042:

pf: Do not allow negative ps_len in DIOCGETSTATES

Userspace may pass a negative ps_len value to us, which causes an
assertion failure in malloc().
Treat negative values as zero, i.e. return the required size.

Reported-by: syzbot+53370d9d0358ee2a059a@syzkaller.appspotmail.com

4 years agoMFC r359667 (by mw): Add hwpmc support for Intel Atom Goldmont microarchitecture
Alexander Motin [Fri, 24 Apr 2020 15:02:05 +0000 (15:02 +0000)]
MFC r359667 (by mw): Add hwpmc support for Intel Atom Goldmont microarchitecture

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

4 years agoMFC r354470 (by gallatin): hwpmc : fix AMD perf counter MSR access
Alexander Motin [Fri, 24 Apr 2020 14:47:55 +0000 (14:47 +0000)]
MFC r354470 (by gallatin): hwpmc : fix AMD perf counter MSR access

- amd_intr() does not account for the offset (0x200) in the counter
MSR address and ends up accessing invalid regions while reading
counter value after the 4th counter (0xC001000[8,9,..]) and
erroneously updates the counter values for counters [1-4].

- amd_intr() should only check core pmcs for interrupts since
 other types of pmcs (L3,DF) cannot generate interrupts.

- fix pmc NMI's being ignored due to NMI latency on newer AMD processors

Note that this fixes a kernel panic due to GPFs accessing MSRs on
higher core count AMD cpus (seen on both Rome 7502P, and
Threadripper 2990WX 32-core CPUs)

4 years agoFix the build after r360259.
Mark Johnston [Fri, 24 Apr 2020 14:27:23 +0000 (14:27 +0000)]
Fix the build after r360259.

stable/12 is missing r357940.  For some reason this warning wasn't hit
when I compiled locally.

This is a direct commit to stable/12.

Reported by: Jenkins

4 years agoMFC r359280:
Mark Johnston [Fri, 24 Apr 2020 13:49:51 +0000 (13:49 +0000)]
MFC r359280:
Remove the secondary_stacks array in arm64 and riscv kernels.

4 years agoMFC r360051: tty: convert tty_lock_assert to tty_assert_locked
Kyle Evans [Fri, 24 Apr 2020 13:31:22 +0000 (13:31 +0000)]
MFC r360051: tty: convert tty_lock_assert to tty_assert_locked

A later change, currently being iterated on in D24459, will in-fact change
the lock type to an sx so that TTY drivers can sleep on it if they need to.
Committing this ahead of time to make the review in question a little more
palatable.

tty_lock_assert() is unfortunately still needed for now in two places to
make sure that the tty lock has not been recursed upon, for those scenarios
where it's supplied by the TTY driver and possibly a mutex that is allowed
to recurse.

4 years agoMFC r360033, r360108: better precision in kqueue timer tests
Kyle Evans [Fri, 24 Apr 2020 13:29:08 +0000 (13:29 +0000)]
MFC r360033, r360108: better precision in kqueue timer tests

r360033:
tests: kqueue: use a more precise timer for the NOTE_ABSTIME test

Originally noticed while attempting to run the kqueue tests under
qemu-user-static, this apparently just happens sometimes when running in a
jail in general -- the timer will fire off "too early," but it's really just
the result of imprecise measurements (noted by cem).

Kicking this over to NOTE_USECONDS still tests the correct thing while
allowing it to work more consistently; a basic sanity test reveals that we
often end up coming in just less than 200 microseconds after the timer
fired off.

r360108:
tests: kqueue: fix some issues with now() on ILP32 platforms

There were ultimately two separate problems here:
- a 32-bit long cannot represent microseconds since 1970 (noted by ian)
- time_t is 32-bit on i386, so now() was wrong anyways even with the correct
  return type.

For the first, just explicitly use a uint64_t for now() and all of the
callers. For the second, we need to explicitly cast tv_sec to uint64_t
before it gets multiplied in the SEC_TO_US macro. Casting this instance
rather than generally in the macro was arbitrarily chosen simply because all
other uses are converting small relative time values.

The tests now pass on i386, at least; presumably other ILP32 will be fine
now as well.

4 years agoMFC r360140, r360155: kqueue timer/data fixes
Kyle Evans [Fri, 24 Apr 2020 13:25:02 +0000 (13:25 +0000)]
MFC r360140, r360155: kqueue timer/data fixes

r360140:
kqueue: fix conversion of timer data to sbintime

This unbreaks the i386 kqueue timer tests after a recent change switched
NOTE_ABSTIME over to using microseconds. Notably, the data argument (which
holds useconds) is an int64_t, but we were passing it to timer2sbintime
which takes an intptr_t. Perhaps in a previous incarnation, intptr_t would
have made sense, but now it just leads to the timestamp getting truncated
and subsequently rejected when it no longer fits in an intptr_t.

r360155:
kevent32: fix the split of data into data1/data2

The current situation results in intermittent breakage if data gets split up
with the sign bit set on the data1 half of it, as PAIR32TO64 will then:
data1 | (data2 << 32) -> resulting in data1 getting sign-extended when it's
implicitly widened and clobbering the result. AFAICT, there's no compelling
reason for these to be signed.

This was most exposed by flakiness in the kqueue timer tests under compat32
after the ABSTIME test got switched over to using a better clock and
microseconds.

4 years agoMFC r359779:
Mark Johnston [Fri, 24 Apr 2020 13:24:19 +0000 (13:24 +0000)]
MFC r359779:
sbappendcontrol() needs to avoid clearing M_NOTREADY on data mbufs.

4 years agoMFC r360052:
Mark Johnston [Fri, 24 Apr 2020 13:23:16 +0000 (13:23 +0000)]
MFC r360052:
Remove a vestigal reference to kmem_object.

4 years agoMFC r360046:
Mark Johnston [Fri, 24 Apr 2020 13:22:13 +0000 (13:22 +0000)]
MFC r360046:
Always compile minidump_machdep.c on arm.

4 years agoMFC r356675 (by mhorne):
Mark Johnston [Fri, 24 Apr 2020 13:20:37 +0000 (13:20 +0000)]
MFC r356675 (by mhorne):
RISC-V: fix global symbol lookups for mpentry with lld

4 years agoMFC r360165:
Li-Wen Hsu [Fri, 24 Apr 2020 08:31:13 +0000 (08:31 +0000)]
MFC r360165:

Also update est(4) as r360162 and r360164

4 years agoMFC r359758:
Konstantin Belousov [Thu, 23 Apr 2020 09:48:02 +0000 (09:48 +0000)]
MFC r359758:
libc: Fix possible overflow in binuptime().

4 years agoMFC r359118: Fix race condition in catopen(3).
Xin LI [Thu, 23 Apr 2020 04:51:32 +0000 (04:51 +0000)]
MFC r359118: Fix race condition in catopen(3).

4 years agoMFC r359736: Always install backward compatibility timezones, as they
Xin LI [Thu, 23 Apr 2020 04:27:55 +0000 (04:27 +0000)]
MFC r359736: Always install backward compatibility timezones, as they
are installed on all major Linux distributions as well as NetBSD and
OpenBSD.

4 years agoMFC: r359720
Rick Macklem [Wed, 22 Apr 2020 21:08:08 +0000 (21:08 +0000)]
MFC: r359720
Fix an interoperability issue w.r.t. the Linux client and the NFSv4 server.

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

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

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

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

Reported by: luoqi.chen@gmail.com

4 years agoMFC r359938:
Brooks Davis [Wed, 22 Apr 2020 17:14:02 +0000 (17:14 +0000)]
MFC r359938:

Remove bogus use of useracc() in (clock_)nanosleep.

There's no point in pre-checking that we can access the user's rmtp
pointer before we do it in copyout().

While here, improve style(9) compliance.

Reviewed by: imp
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24409

4 years agoMFC 360074:
Mateusz Piotrowski [Wed, 22 Apr 2020 13:52:40 +0000 (13:52 +0000)]
MFC 360074:

Use the Ic macro for find(1) primaries consistently

4 years agoMFC r359897:
Navdeep Parhar [Wed, 22 Apr 2020 07:24:30 +0000 (07:24 +0000)]
MFC r359897:

cxgbe(4): Make sure 'flags' is at the same offset in structs toepcb and
synq_entry.  TAILQ_ENTRY isn't always the same size as two pointers.

Reported by: rmacklem@
Sponsored by: Chelsio Communications

4 years agoMFC r359952:
Navdeep Parhar [Wed, 22 Apr 2020 07:12:18 +0000 (07:12 +0000)]
MFC r359952:

cxgbe/iw_cxgbe: Do not start the EP timer if soaccept fails.

This fixes a panic that would occur when the timer tried to close a
stale socket.

Submitted by: Krishnamraju Eraparaju @ Chelsio
Sponsored by: Chelsio Communications

4 years agoMFC r358988: Remove unneeded checks for prelen.
Xin LI [Wed, 22 Apr 2020 05:54:46 +0000 (05:54 +0000)]
MFC r358988: Remove unneeded checks for prelen.

4 years agoMFC r360104: Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are
Xin LI [Wed, 22 Apr 2020 05:08:42 +0000 (05:08 +0000)]
MFC r360104: Use LIST_FOREACH_SAFE instead of LIST_FOREACH as we are
removing elements in the middle.

This fixes a panic when detaching USB mouse.

PR: 245732
Reviewed by: wulf

4 years agoMFC r348996 (by jtl):
Alexander Motin [Tue, 21 Apr 2020 16:52:56 +0000 (16:52 +0000)]
MFC r348996 (by jtl):
The current IPMI KCS code is waiting 100us for all transitions (roughly
between each byte either sent or received). However, most transitions
actually complete in 2-3 microseconds.

By polling the status register with a delay of 4us with exponential
backoff, the performance of most IPMI operations is significantly
improved:
  - A BMC update on a Supermicro x9 or x11 motherboard goes from ~1 hour
    to ~6-8 minutes.
  - An ipmitool sensor list time improves by a factor of 4.

Testing showed no significant improvements on a modern server by using
a lower delay.

The changes should also generally reduce the total amount of CPU or
I/O bandwidth used for a given IPMI operation.

4 years agoMFC: r360146
Gordon Tetlow [Tue, 21 Apr 2020 15:47:58 +0000 (15:47 +0000)]
MFC: r360146
Fix OpenSSL remote denial of service.

See https://www.openssl.org/news/secadv/20200421.txt for details.

Approved by: so
Security: FreeBSD-SA-20:11.openssl
Security: CVE-2020-1967

4 years agoMFC: r359679
Rick Macklem [Tue, 21 Apr 2020 04:47:42 +0000 (04:47 +0000)]
MFC: r359679
Fix noisy NFSv4 server printf.

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

4 years agoMFC r360053: hdac: update comment to match function name
Ed Maste [Mon, 20 Apr 2020 19:08:45 +0000 (19:08 +0000)]
MFC r360053: hdac: update comment to match function name

snd_hda was rewritten in r230130; one function retained a comment
referencing the previous name.

4 years agoMFC r348629 (by cem): daemon(8): Don't block SIGTERM during restart delay
Alexander Motin [Mon, 20 Apr 2020 16:31:05 +0000 (16:31 +0000)]
MFC r348629 (by cem): daemon(8): Don't block SIGTERM during restart delay

I believe this was introduced in the original '-r' commit, r231911 (2012).
At the time, the scope was limited to a 1 second sleep.  r332518 (2018)
added '-R', which increased the potential duration of the affected interval
(from 1 to N seconds) by permitting arbitrary restart intervals.

Instead, handle SIGTERM normally during restart-sleep, when the monitored
process is not running, and shut down promptly.

(I noticed this behavior when debugging a child process that exited quickly
under the 'daemon -r -R 30' environment.  'kill <daemonpid>' had no
immediate effect and the monitor process slept until the next restart
attempt.  This was annoying.)

4 years agoMFC r359894:
Mark Johnston [Mon, 20 Apr 2020 13:19:23 +0000 (13:19 +0000)]
MFC r359894:
snd_hda(4): Recognize the ALC257 codec.

PR: 245524

4 years agoMFC r359893:
Mark Johnston [Mon, 20 Apr 2020 13:18:36 +0000 (13:18 +0000)]
MFC r359893:
Fix sendto() on unconnected SOCK_STREAM/SEQPACKET unix sockets.

4 years agoMFC r360040: jail(8): improve manual and usage information
Eugene Grosbein [Mon, 20 Apr 2020 08:12:40 +0000 (08:12 +0000)]
MFC r360040: jail(8): improve manual and usage information
with more clear description for "jail -e" mode
to show that it does not take additional jail name argument.

Reported by: David Marec <david.marec@davenulle.org>

4 years agoMFC: r359643
Rick Macklem [Mon, 20 Apr 2020 01:17:00 +0000 (01:17 +0000)]
MFC: r359643
Change the xid for client side krpc over UDP to a global value.

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

PR: 245022

4 years agoMFC r358848:
Michael Reifenberger [Sun, 19 Apr 2020 17:19:29 +0000 (17:19 +0000)]
MFC r358848:

Untangle TPR shadowing and APIC virtualization.
  This speeds up Windows guests tremendously.

  The patch does:
  Add a new tuneable 'hw.vmm.vmx.use_tpr_shadowing' to disable TLP shadowing.
  Also add 'hw.vmm.vmx.cap.tpr_shadowing' to be able to query if TPR shadowing is used.

  Detach the initialization of TPR shadowing from the initialization of APIC virtualization.
  APIC virtualization still needs TPR shadowing, but not vice versa.
  Any CPU that supports APIC virtualization should also support TPR shadowing.

  When TPR shadowing is used, the APIC page of each vCPU is written to the VMCS_VIRTUAL_APIC field of the VMCS
  so that the CPU can write directly to the page without intercept.

  On vm exit, vlapic_update_ppr() is called to update the PPR.

  GeƤnderte Pfade:
     M /head/sys/amd64/vmm/intel/vmx.c M /head/sys/amd64/vmm/io/vlapic.c M
     /head/sys/amd64/vmm/io/vlapic.h

Submitted by: Yamagi Burmeister
Reviewed by: grehan
Differential Revision: https://reviews.freebsd.org/D22942

4 years agoMFC r360025: Alert devd when acpi_video brightness changes
Colin Percival [Sun, 19 Apr 2020 02:49:05 +0000 (02:49 +0000)]
MFC r360025: Alert devd when acpi_video brightness changes

4 years agoMFC r359634:
Konstantin Belousov [Sat, 18 Apr 2020 03:14:16 +0000 (03:14 +0000)]
MFC r359634:
Make p_vaddr % p_align == p_offset % p_align for (some) TLS segments.

4 years agoMFC r359778:
Mark Johnston [Fri, 17 Apr 2020 13:50:26 +0000 (13:50 +0000)]
MFC r359778:
Properly handle disconnected sockets in uipc_ready().

4 years agoMFC 359916:
Mateusz Piotrowski [Fri, 17 Apr 2020 07:40:56 +0000 (07:40 +0000)]
MFC 359916:

Improve manual page formatting

- Use appropriate macros for command arguments.
- Increase option list indentation for better readability.

4 years agoMFC r359766:
Konstantin Belousov [Fri, 17 Apr 2020 01:06:51 +0000 (01:06 +0000)]
MFC r359766:
ufs: apply suspension for non-forced rw unmounts.

4 years agoMFC r359801: wc(1): document SIGINFO handling in the manual page.
Eugene Grosbein [Thu, 16 Apr 2020 11:47:53 +0000 (11:47 +0000)]
MFC r359801: wc(1): document SIGINFO handling in the manual page.

4 years agoMFC r348873: Enable touch and trackpads by default
Niclas Zeising [Wed, 15 Apr 2020 19:47:19 +0000 (19:47 +0000)]
MFC r348873: Enable touch and trackpads by default

Enable synaptics and elantech touchpads, as well as IBM/Lenovo TrackPoints
by default, instead of having users find and toggle a loader tunable.
This makes things like two finger scroll and other modern features work out
of the box with X.  By enabling these settings by default, we get a better
desktop experience in X, since xserver and evdev can make use of the more
advanced synaptics and elantech features.

Approved by: imp

4 years agoMFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
Alexander Motin [Wed, 15 Apr 2020 13:59:51 +0000 (13:59 +0000)]
MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.

JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.

Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

4 years agoMFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.
Alexander Motin [Wed, 15 Apr 2020 13:58:42 +0000 (13:58 +0000)]
MFC r359499: Add ID for JMicron JMB582/JMB585 AHCI controller.

JMB582 has 2 6Gbps SATA ports and PCIe 3.0 x1.
JMB585 has 5 6Gbps SATA ports and PCIe 3.0 x2.

Both chips support AHCI v1.31, Port Multiplier with FBS and 8 MSI vectors.

4 years agoMFC 359125:
Mateusz Piotrowski [Wed, 15 Apr 2020 08:11:19 +0000 (08:11 +0000)]
MFC 359125:

Document geli(8) loader variables conventions

The geli(8) manual page has an example for preloading keyfiles during boot.
There is no detail though on how the lookup of these variables actually
works.

Let's document that the name of a device does not have to be a part
of the variable.

PR: 243261
Submitted by: johannes@jo-t.de
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D24114

4 years agoMFC r359727:
Hans Petter Selasky [Wed, 15 Apr 2020 04:56:27 +0000 (04:56 +0000)]
MFC r359727:
Clone the RCU interface into a sleepable and a non-sleepable part
in the LinuxKPI.

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

Bump the __FreeBSD_version to force recompilation of external kernel modules.

PR: 242272
Sponsored by: Mellanox Technologies

4 years agoMFC r359726:
Hans Petter Selasky [Wed, 15 Apr 2020 04:52:10 +0000 (04:52 +0000)]
MFC r359726:
Some fixes for SRCU in the LinuxKPI.
- Make sure to use READ_ONCE() when deferring variables.
- Remove superfluous zero initializer.

Sponsored by: Mellanox Technologies

4 years agoMFC r359520:
Konstantin Belousov [Wed, 15 Apr 2020 00:36:00 +0000 (00:36 +0000)]
MFC r359520:
x86 tsc: fall back to CPUID if calibration results looks unbelievable.

4 years agoMFC of 359627
Kirk McKusick [Wed, 15 Apr 2020 00:18:19 +0000 (00:18 +0000)]
MFC of 359627

Update dump and restore to compile with -fno-common.

4 years agoadd my (rscheff) mentor relationship
Richard Scheffenegger [Tue, 14 Apr 2020 18:24:59 +0000 (18:24 +0000)]
add my (rscheff) mentor relationship

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

4 years agoMFC: r356618, r357959, r359346
Jung-uk Kim [Tue, 14 Apr 2020 08:34:34 +0000 (08:34 +0000)]
MFC: r356618, r357959, r359346

Merge ACPICA 20200326.

4 years agoDo not claim libbearssl et al are INTERNALLIB
Simon J. Gerraty [Tue, 14 Apr 2020 01:07:58 +0000 (01:07 +0000)]
Do not claim libbearssl et al are INTERNALLIB

If INTERNALLIB is defined we need PIE and bsd.incs.mk is
not included.

MFC of r359502

PR: 245189
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org//D24233

4 years agoInclude ${.CURDIR}/local.init.mk if it exists
Simon J. Gerraty [Tue, 14 Apr 2020 01:05:11 +0000 (01:05 +0000)]
Include ${.CURDIR}/local.init.mk if it exists

This is handy for making local hacks to an app
(eg to build it as tool for non-BSD host)
without making a mess of the code base.

MFC of r359488

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org//D24101

4 years agoImprove interaction of vectx and tftp
Simon J. Gerraty [Tue, 14 Apr 2020 00:57:50 +0000 (00:57 +0000)]
Improve interaction of vectx and tftp

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

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

MFC of r359700

Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D24287

4 years agoMFC r359428:
Vladimir Kondratyev [Mon, 13 Apr 2020 22:18:49 +0000 (22:18 +0000)]
MFC r359428:
evdev: Add COMPAT_FREEBSD32 support for amd64 arch

Incompatibility between i386 and amd64 evdev ABIs was caused by presence of
'struct timeval' in evdev protocol. Replace it with 'struct timeval32' for
32 bit binaries.

Big-endian platforms may require additional work due to bitstr_t (array of
unsigned longs) usage in ioctl interface.

MFC r359429:
evdev: return error rather than zero-length data on blocked read()
if blocked process has been woken up by evdev device destruction.

4 years agoMFC r359903:
Li-Wen Hsu [Mon, 13 Apr 2020 21:23:39 +0000 (21:23 +0000)]
MFC r359903:

Ensure `kyua list` working when there is no /dev/nvme*

Sponsored by: The FreeBSD Foundation

4 years agoMFC r359446:
Hans Petter Selasky [Mon, 13 Apr 2020 16:33:10 +0000 (16:33 +0000)]
MFC r359446:
Add support for multiple playback and recording devices per physical USB audio
device. This requires some structural refactoring inside the driver, mostly
about converting existing audio channel structures into arrays.

The main audio mixer is provided by the first PCM instance.
The non-first audio instances may only have a software mixer for PCM playback.

Tested by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r359440:
Hans Petter Selasky [Mon, 13 Apr 2020 16:31:13 +0000 (16:31 +0000)]
MFC r359440:
Implement new mixer API to return the device pointer based on the mixer pointer.

Sponsored by: Mellanox Technologies

4 years agoMFC r359356:
Hans Petter Selasky [Mon, 13 Apr 2020 16:29:03 +0000 (16:29 +0000)]
MFC r359356:
Change default microphone level from 0 to 25.

Discussed with: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies