]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoFix the first couple of AddressSanitizer violations in usr.bin/top.
dim [Sun, 10 Feb 2019 13:44:36 +0000 (13:44 +0000)]
Fix the first couple of AddressSanitizer violations in usr.bin/top.

Avoid setting zero bytes beyond the length of the 'thisline' parameters
in i_process() and u_process(), and don't attempt to memset a negative
number of bytes.

MFC after: 1 week

5 years agoFix multiple warnings in usr.bin/top about variables shadowing global
dim [Sun, 10 Feb 2019 13:34:21 +0000 (13:34 +0000)]
Fix multiple warnings in usr.bin/top about variables shadowing global
declarations from base gcc, by renaming those variables.

MFC after: 1 week

5 years agoFix multiple warnings in usr.bin/top about discarded qualifiers from
dim [Sun, 10 Feb 2019 13:31:08 +0000 (13:31 +0000)]
Fix multiple warnings in usr.bin/top about discarded qualifiers from
both clang and gcc, by either constifying variables, or when that is not
possible, using __DECONST.

MFC after: 1 week

5 years agoFix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option.
tuexen [Sun, 10 Feb 2019 10:42:16 +0000 (10:42 +0000)]
Fix a locking bug in the IPPROTO_SCTP level SCTP_EVENT socket option.
This occurs when call setsockopt() with invalid parameters.

This issue was found by syzkaller.

MFC after: 3 days

5 years agoReplace calls to sin(x) and cos(x) with a single call to sincos().
peterj [Sun, 10 Feb 2019 08:46:07 +0000 (08:46 +0000)]
Replace calls to sin(x) and cos(x) with a single call to sincos().
Replace calls to sinf(x) and cosf(x) with a single call to sincosf().

Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
Reviewed by: bde
Approved by: grog
MFC after: 3 days

5 years agoEnable necessary bits when activating interrupts. This allows
ganbold [Sun, 10 Feb 2019 08:41:52 +0000 (08:41 +0000)]
Enable necessary bits when activating interrupts. This allows
reading some events from the interrupt status registers. These events
are reported to devd via system "PMU" and subsystem "Battery", "AC"
and "USB" such as plugged/unplugged, absent, charged and charging.

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

5 years agoFix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option.
tuexen [Sun, 10 Feb 2019 08:28:56 +0000 (08:28 +0000)]
Fix locking for IPPROTO_SCTP level SCTP_DEFAULT_PRINFO socket option.
This problem occurred when calling setsockopt() will invalid parameters.

This issue was found by running syzkaller.

MFC after: 3 days

5 years agoarm64: Fix compile when removing SOC_ROCKCHIP_* options
manu [Sun, 10 Feb 2019 08:14:06 +0000 (08:14 +0000)]
arm64: Fix compile when removing SOC_ROCKCHIP_* options

Make every rockchip file depend on the multiple soc_rockchip options
While here make rk_i2c and rk_gpio depend on their device options.

Reported by: sbruno

5 years agoRevert r343713 temporarily
cem [Sun, 10 Feb 2019 07:54:46 +0000 (07:54 +0000)]
Revert r343713 temporarily

The COVERAGE option breaks xtoolchain-gcc GENERIC kernel early boot
extremely badly and hasn't been fixed for the ~week since it was committed.
Please enable for GENERIC only when it doesn't do that.

Related fallout reported by: lwhsu, tuexen (pr 235611)

5 years agopowerpc: Fix AIM build
jhibbits [Sat, 9 Feb 2019 23:19:33 +0000 (23:19 +0000)]
powerpc: Fix AIM build

cpu_idle_e500mc is only used in booke, so ignore it completely in AIM.

MFC after: 2 weeks
MFC with: r343944

5 years agoDocument the ENOBUFS errno in setsockopt(2).
pluknet [Sat, 9 Feb 2019 21:33:32 +0000 (21:33 +0000)]
Document the ENOBUFS errno in setsockopt(2).

In particular, it is the case if SO_SNDBUF/SO_RCVBUF would exceed sb_max_adj.

PR: 200649
MFC after: 1 week

5 years agopowerpc: Split out the e500mc idling from rest of Book-E
jhibbits [Sat, 9 Feb 2019 21:19:53 +0000 (21:19 +0000)]
powerpc: Split out the e500mc idling from rest of Book-E

The e500v2 and e500mc (and derivatives) have different idling procedures, so
make them different functions.

MFC after: 2 weeks

5 years agoddb: Print the thread's pcb in 'show thread'
jhibbits [Sat, 9 Feb 2019 21:08:19 +0000 (21:08 +0000)]
ddb: Print the thread's pcb in 'show thread'

This can aid with debugging when a thread is running and has no backtrace.
State can be estimated based on the pcb, and refined from there, for
example, to get a rough idea of the stack pointer.

5 years agoAdd myself to committers-src.dot and calendar.freebsd
johalun [Sat, 9 Feb 2019 16:53:39 +0000 (16:53 +0000)]
Add myself to committers-src.dot and calendar.freebsd

Reviewed by: imp (mentor)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D19101

5 years ago- Remove the redundant device disabled hint handling; ever since
marius [Sat, 9 Feb 2019 11:58:40 +0000 (11:58 +0000)]
- Remove the redundant device disabled hint handling; ever since
  r241119 that's performed globally by device_attach(9).
- As for the EM-class of devices, em(4) supports multiple queues
  and MSI-X respectively only with 82574 devices. However, since
  the conversion to iflib(4), em(4) relies on the interrupt type
  fallback mechanism, i. e. MSI-X -> MSI -> INTx, of iflib(4) to
  figure out the interrupt type to use for the EM-class (as well
  as the IGB-class) of MACs. Moreover, despite the datasheet for
  82583V not mentioning any support of MSI-X, there actually are
  82583V devices out there that report a varying number of MSI-X
  messages as supported. The interrupt type fallback of iflib(4)
  is causing two failure modes depending on the actual number of
  MSI-X messages supported for such instances of 82583V:
  1) With only one MSI-X message supported, none is left for the
     RX/TX queues as that one message gets assigned to the admin
     interrupt. Worse, later on - which will be addressed with a
     separate fix - iflib(4) interprets that one messages as MSI
     or INTx to be set up, but fails to actually do so as it has
     previously called pci_alloc_msix(9). [1, 2]
  2) With more message supported, their distribution is okay but
     then em_if_msix_intr_assign() doesn't work for 82583V, with
     the interface being left in a non-working state, too. [3]
  Thus, let em_if_attach_pre() indicate to iflib(4) to try MSI-X
  with 82574 only, and at most MSI for the remainder of EM-class
  devices.
  While at it, remove "try_second_bar" as it's polarity inverted
  and not actually needed.
- Remove code from em_if_timer() that effectively is a NOP since
  the conversion to iflib(4) ("trigger" is no longer read).
  While at it, let the comment for em_if_timer() reflect reality
  after said conversion.
- Implement an ifdi_watchdog_reset method which only updates the
  em(4) "watchdog_events" counter but doesn't perform any reset,
  so that the em(4) "watchdog_timeouts" SYSCTL (iflib(4) doesn't
  provide a counterpart) reflects reality and these timeouts add
  to IFCOUNTER_OERRORS again after the iflib(4) conversion.
- Remove the "mbuf_defrag_fail" and "tx_dma_fail" SYSCTLS; since
  the iflib(4) conversion, associated counters are disconnected,
  but iflib(4) provides "mbuf_defrag_failed" and "tx_map_failed"
  respectively as equivalents.
- Move the description preceding lem_smartspeed() to the correct
  spot before em_reset() and bring back appropriate comments for
  {igb,em}_initialize_rss_mapping() and lem_smartspeed() lost in
  the iflib(4) conversion.
- Adapt some other function descriptions and INIT_DEBUGOUT() use
  to match reality after the iflib(4) conversion.
- Put the debugging message of em_enable_vectors_82574() (missed
  in r343578) under bootverbose, too.

PR: 219428 [1], 235246 [2], 235147 [3]
Reviewed by: erj (previous version)
Differential Revision: https://reviews.freebsd.org/D19108

5 years agoRemove -R option which was added to sysctl(8) man page per r244106, but it is not...
ygy [Sat, 9 Feb 2019 04:36:02 +0000 (04:36 +0000)]
Remove -R option which was added to sysctl(8) man page per r244106, but it is not implemented.

MFC after: 3 days
Submitted by: Alfonso Siciliano <alfix86@gmail.com>
Reviewed by: 0mp, imp
Differential Revision:  https://reviews.freebsd.org/D19012

5 years agoi386: honor kern.elf32.read_exec for ommap(2) and break(2), as already
kib [Sat, 9 Feb 2019 03:56:48 +0000 (03:56 +0000)]
i386: honor kern.elf32.read_exec for ommap(2) and break(2), as already
done on amd64.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoNormalize the declaration of i386_read_exec variable.
kib [Sat, 9 Feb 2019 03:51:51 +0000 (03:51 +0000)]
Normalize the declaration of i386_read_exec variable.

It is currently re-declared in sys/sysent.h which is a wrong place for
MD variable.  Which causes redeclaration error with gcc when
sys/sysent.h and machine/md_var.h are included both.

Remove it from sys/sysent.h and instead include machine/md_var.h when
needed, under #ifdef for both i386 and amd64.

Reported and tested by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoRemove remnants of byte order manipulation, back when FreeBSD stack
glebius [Sat, 9 Feb 2019 03:00:00 +0000 (03:00 +0000)]
Remove remnants of byte order manipulation, back when FreeBSD stack
stored packets in host byte order.

5 years agoCorrect the CPU target for powerpcspe
jhibbits [Sat, 9 Feb 2019 02:04:27 +0000 (02:04 +0000)]
Correct the CPU target for powerpcspe

The MPC8540 is actually e500v1, which doesn't have double-precision floating
point support.  The 8548 does, so use that as the CPU target.

MFC after: 2 weeks

5 years agocxgbe(4): Delay the panic due to a fatal error by 30s.
np [Sat, 9 Feb 2019 01:49:53 +0000 (01:49 +0000)]
cxgbe(4): Delay the panic due to a fatal error by 30s.

This lets information logged by the interrupt handler reach the system
log before the system goes down.

5 years agodhclient: Return non-zero status when script exits due to a signal
jilles [Fri, 8 Feb 2019 23:03:28 +0000 (23:03 +0000)]
dhclient: Return non-zero status when script exits due to a signal

r343896 made it such that a non-zero exit status was passed through, but was
still wrong if the script exits on a signal. POSIX does not say what the
WEXITSTATUS macro returns in this case and in practice 0 is a common value.

Instead, translate the wait status into 8 bits the same way as the shell
calculates $?.

Reviewed by: kib, Nash Kaminski
MFC after: 1 week

5 years agoAdd an example to pw.8 about how to add an existing user to a group.
bcr [Fri, 8 Feb 2019 22:10:40 +0000 (22:10 +0000)]
Add an example to pw.8 about how to add an existing user to a group.

Instead of using pw to modify group membership, users often edit
/etc/group by hand, which is discouraged.  Provide an example of
adding a user to the wheel group, which is a common use case.
I'm using a different user here as in the previous example as that
deleted the user (although the examples don't necessarily have to
be followed in order).

Reviewed by: rgrimes,0mp
Approved by: 0mp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D19123

5 years agoEnsure that when using the TCP CDG congestion control and setting the
tuexen [Fri, 8 Feb 2019 20:42:49 +0000 (20:42 +0000)]
Ensure that when using the TCP CDG congestion control and setting the
sysctl variable net.inet.tcp.cc.cdg.smoothing_factor to 0, the smoothing
is disabled. Without this patch, a division by zero orrurs.

PR: 193762
Reviewed by: lstewart@, rrs@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D19071

5 years agoFix em(4) interrupt routing
pkelsey [Fri, 8 Feb 2019 20:34:47 +0000 (20:34 +0000)]
Fix em(4) interrupt routing

When configured with more tx queues than rx queues,
em_if_msix_intr_assign() was incorrectly routing the tx event
interrupts.

Reviewed by: erj, marius
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19070

5 years agoTeach /etc/rc.d/growfs how to handle systems running ZFS.
cperciva [Fri, 8 Feb 2019 19:19:31 +0000 (19:19 +0000)]
Teach /etc/rc.d/growfs how to handle systems running ZFS.

There are many cases which this code does not handle (e.g. ZFS mirrors)
but the code can handle the single-disk case -- so it's enough to take
care of the "disk image which gets booted into a VM with a larger than
expected disk" case for which this firstboot script was created.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19095

5 years agoAmend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
dim [Fri, 8 Feb 2019 18:31:54 +0000 (18:31 +0000)]
Amend r343442, by only expecting the lib.msun.cbrt_test.cbrtl_powl and
trig_test.reduction test cases to fail, if the fixes from r343916 have
not yet been applied to the base compiler.

Reported by:    lwhsu
PR: 234040
Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after: 1 week

5 years agoPull in r352607 from upstream llvm trunk (by Craig Topper):
dim [Fri, 8 Feb 2019 18:24:53 +0000 (18:24 +0000)]
Pull in r352607 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPSW as a Def on some FP instructions that were missing it.

Pull in r353141 from upstream llvm trunk (by Craig Topper):

  [X86] Connect the default fpsr and dirflag clobbers in inline
  assembly to the registers we have defined for them.

  Summary:
  We don't currently map these constraints to physical register numbers
  so they don't make it to the MachineIR representation of inline
  assembly.

  This could have problems for proper dependency tracking in the
  machine schedulers though I don't have a test case that shows that.

  Reviewers: rnk

  Reviewed By: rnk

  Subscribers: eraman, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57641

Pull in r353489 from upstream llvm trunk (by Craig Topper):

  [X86] Add FPCW as a register and start using it as an implicit use on
  floating point instructions.

  Summary:
  FPCW contains the rounding mode control which we manipulate to
  implement fp to integer conversion by changing the roudning mode,
  storing the value to the stack, and then changing the rounding mode
  back. Because we didn't model FPCW and its dependency chain, other
  instructions could be scheduled into the middle of the sequence.

  This patch introduces the register and adds it as an implciit def of
  FLDCW and implicit use of the FP binary arithmetic instructions and
  store instructions. There are more instructions that need to be
  updated, but this is a good start. I believe this fixes at least the
  reduced test case from PR40529.

  Reviewers: RKSimon, spatel, rnk, efriedma, andrew.w.kaylor

  Subscribers: dim, llvm-commits

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57735

These should fix a problem in clang 7.0 where it would sometimes emit
long double floating point instructions in a slightly wrong order,
leading to failures in our libm tests.  In particular, the cbrt_test
test case 'cbrtl_powl' and the trig_test test case 'reduction'.

Also bump __FreeBSD_cc_version, to be able to detect this in our test
suite.

Reported by:    lwhsu
PR: 234040
Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40206
MFC after: 1 week

5 years agoAdd myself to committers-ports.dot and calendar.freebsd
kai [Fri, 8 Feb 2019 17:57:39 +0000 (17:57 +0000)]
Add myself to committers-ports.dot and calendar.freebsd

Reviewed by: miwi (mentor)
Approved by: miwi (mentor)
Differential Revision: https://reviews.freebsd.org/D19119

5 years agoFix the spelling of cov_unregister_pc.
andrew [Fri, 8 Feb 2019 16:18:17 +0000 (16:18 +0000)]
Fix the spelling of cov_unregister_pc.

When unregistering kcov from the coverage interface we should use the
unregister function, not the register function.

Sponsored by: DARPA, AFRL

5 years agopms(4) should use bus_get_dma_tag() to get parent tag.
tychon [Fri, 8 Feb 2019 16:05:38 +0000 (16:05 +0000)]
pms(4) should use bus_get_dma_tag() to get parent tag.

Reviewed by: imp
Sponsored by: Dell EMC Isilon

5 years agoAllow reading the UEFI variable size
mw [Fri, 8 Feb 2019 14:56:28 +0000 (14:56 +0000)]
Allow reading the UEFI variable size

When loading bigger variables form UEFI it is necessary to know their
size beforehand, so that an appropriate amount of memory can be
allocated. The easiest way to do this is to try to read the variable
with buffer size equal 0, expecting EFI_BUFFER_TOO_SMALL error to be
returned. Allow such possible approach in efi_getenv routine.

Extracted from a bigger patch as suggested by imp.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield

5 years agonewkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
avos [Fri, 8 Feb 2019 14:31:44 +0000 (14:31 +0000)]
newkey(8): fix 'tmpname' memory leak (always) and input file descriptor leak
when output file cannot be opened

PR: 201732
Reported by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoFix several Coverity-detected issues in newsyslog.
dab [Fri, 8 Feb 2019 13:54:16 +0000 (13:54 +0000)]
Fix several Coverity-detected issues in newsyslog.

- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007454, CID 1007453: Resource leak - The result of a strdup()
  was stored in a global variable and not freed before program exit.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR: 158794
Reported by: Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)
Reviewed by: cem, markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon

5 years agoImprove Bluetooth device discovery support for Android and Microsoft devices.
hselasky [Fri, 8 Feb 2019 13:10:45 +0000 (13:10 +0000)]
Improve Bluetooth device discovery support for Android and Microsoft devices.

Tested using the virtual_bt_speaker(8) tool from the virtual_oss(8)
project at github.com.

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

5 years agoAdd macOS 10.14.
pluknet [Fri, 8 Feb 2019 11:49:59 +0000 (11:49 +0000)]
Add macOS 10.14.

5 years agoUn null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.
kib [Fri, 8 Feb 2019 08:20:18 +0000 (08:20 +0000)]
Un null_vptocnp(), cache vp->v_mount and use it for null_nodeget() call.

The vp vnode is unlocked during the execution of the VOP method and
can be reclaimed, zeroing vp->v_data.  Caching allows to use the
correct mount point.

Reported and tested by: pho
PR: 235549
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoBefore using VTONULL(), check that the covered vnode belongs to nullfs.
kib [Fri, 8 Feb 2019 08:17:31 +0000 (08:17 +0000)]
Before using VTONULL(), check that the covered vnode belongs to nullfs.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoSome style for nullfs_mount(). Also use bool type for isvnunlocked.
kib [Fri, 8 Feb 2019 08:15:29 +0000 (08:15 +0000)]
Some style for nullfs_mount().  Also use bool type for isvnunlocked.

Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoCorrectly return exit status from the exited process.
kib [Fri, 8 Feb 2019 07:36:08 +0000 (07:36 +0000)]
Correctly return exit status from the exited process.

This is also OpenBSD rev. 1.117, as pointed out by
Ryan Moeller <ryan@ixsystems.com>.

Submitted by: Nash Kaminski <nashkaminski@gmail.com>
MFC after: 1 week

5 years agoAllow some nesting of ng_iface(4) interfaces and add a configuration knob.
glebius [Fri, 8 Feb 2019 06:19:28 +0000 (06:19 +0000)]
Allow some nesting of ng_iface(4) interfaces and add a configuration knob.

PR: 235500
MFC after: 1 week

5 years agoFix renameat(2) for CAPABILITIES kernels.
kib [Fri, 8 Feb 2019 04:18:17 +0000 (04:18 +0000)]
Fix renameat(2) for CAPABILITIES kernels.

When renameat(2) is used with:
- absolute path for to;
- tofd not set to AT_FDCWD;
- the target exists
kern_renameat() requires CAP_UNLINK capability on tofd, but
corresponding namei ni_filecap is not initialized at all because the
lookup is absolute.  As result, the check was done against empty filecap
and syscall fails erronously.

Fix it by creating a return flags namei member and reporting if the
lookup was absolute, then do not touch to.ni_filecaps at all.

PR: 222258
Reviewed by: jilles, ngie
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-MFC-note: KBI breakage
Differential revision: https://reviews.freebsd.org/D19096

5 years agodo_execve(): lock vnode when needed.
kib [Fri, 8 Feb 2019 04:06:48 +0000 (04:06 +0000)]
do_execve(): lock vnode when needed.

Code after exec_fail_dealloc label expects that the image vnode is
locked if present.  When copyout() of the strings or auxv vectors fails,
goto to the error handling did not relocked the vnode as required.

The copyout() can be made failing e.g. by creating an ELF image with
PT_GNU_STACK segment disabling the write.

Reported by: Jonathan Stuart <n0t.jcs@gmail.com> (found by fuzzing)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agocxgbev(4): Initialize debug_flags from the environment like in the PF driver.
np [Fri, 8 Feb 2019 03:31:38 +0000 (03:31 +0000)]
cxgbev(4): Initialize debug_flags from the environment like in the PF driver.

5 years agoGC a historical artifact.
brooks [Thu, 7 Feb 2019 23:17:44 +0000 (23:17 +0000)]
GC a historical artifact.

Back in 1993, the fgetln (then fgetline) interface was changed to not
return a C string.  The change was accomplished by ifdefing out the code
that did the termination.  Changing the interface would violate our API
stability rules so remove the old implementation.

Sponsored by: DARPA, AFRL

5 years agor343881 had an uninitialized error. This fixes that.
sef [Thu, 7 Feb 2019 22:10:20 +0000 (22:10 +0000)]
r343881 had an uninitialized error.  This fixes that.

PR:             233849
Reported by:    Andre Albsmeier
MFC after:      1 month
Sponsored by:   iXsystems Inc
Differential Revision:  https://reviews.freebsd.org/D18785

5 years agor339008 broke repquota for UFS. This rectifies that.
sef [Thu, 7 Feb 2019 21:51:39 +0000 (21:51 +0000)]
r339008 broke repquota for UFS.  This rectifies that.

Refactor the function calls and tests so that, on UFS, the proper fields
are filled out.

PR: 233849
Reported by: Andre Albsmeier
Reviewed by: mav, delphij
MFC after: 1 month
Sponsored by: iXsystems Inc
Differential Revision: https://reviews.freebsd.org/D18785

5 years agoFix build of r343877
bdrewery [Thu, 7 Feb 2019 21:41:27 +0000 (21:41 +0000)]
Fix build of r343877

MFC after: 2 weeks
X-MFC-with: r343877
Pointyhat to: bdrewery

5 years agoipfw table list: Fix showing header outside of 'all'.
bdrewery [Thu, 7 Feb 2019 21:05:44 +0000 (21:05 +0000)]
ipfw table list: Fix showing header outside of 'all'.

Properly pass down is_all to table_show_list().  This restores the behavior
before r272840 so that only 'ipfw table all list' shows the headers.

MFC after: 2 weeks
Relnotes: yes

5 years agoAdd missing data barriers after storeing a new valid pagetable entry.
andrew [Thu, 7 Feb 2019 20:58:45 +0000 (20:58 +0000)]
Add missing data barriers after storeing a new valid pagetable entry.

When moving from an invalid to a valid entry we don't need to invalidate
the tlb, however we do need to ensure the store is ordered before later
memory accesses. This is because this later access may be to a virtual
address within the newly mapped region.

Add the needed barriers to places where we don't later invalidate the
tlb. When we do invalidate the tlb there will be a barrier to correctly
order this.

This fixes a panic on boot on ThunderX2 when INVARIANTS is turned off:
panic: vm_fault_hold: fault on nofault entry, addr: 0xffff000040c11000

Reported by: jchandra
Tested by: jchandra
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19097

5 years agoAdd a missing data barrier to the start of arm64_tlb_flushID.
andrew [Thu, 7 Feb 2019 20:50:39 +0000 (20:50 +0000)]
Add a missing data barrier to the start of arm64_tlb_flushID.

We need to ensure the page table store has happened before the tlbi.

Reported by: jchandra
Tested by: jchandra
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D19097

5 years agomtree: Add dtb subdir to the mtree file
manu [Thu, 7 Feb 2019 18:54:25 +0000 (18:54 +0000)]
mtree: Add dtb subdir to the mtree file

makefs will fails otherwise

Reported by: emaste
MFC after: 1 week

5 years agoarm64: dtb: allwinner: Add the new pine64-lts dtb file to the build
manu [Thu, 7 Feb 2019 18:07:17 +0000 (18:07 +0000)]
arm64: dtb: allwinner: Add the new pine64-lts dtb file to the build

MFC after: 1 month
X-MFC-With: r342936

5 years ago[ppc64] fix /dev/kmem
luporl [Thu, 7 Feb 2019 17:30:44 +0000 (17:30 +0000)]
[ppc64] fix /dev/kmem

For direct mapped kernel addresses, ppc64 function was not
performing the dmap to physical conversion, before jumping
to the code that fetched the value from physical memory.

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

5 years agorecoverdisk(1): fclose() file supplied via '-r readlist' parameter when
avos [Thu, 7 Feb 2019 14:40:28 +0000 (14:40 +0000)]
recoverdisk(1): fclose() file supplied via '-r readlist' parameter when
it's no longer needed

PR: 204952
Reported by: David Binderman <dcb314@hotmail.com>
MFC after: 5 days

5 years agoipcs(1): drop obsolete error checking
avos [Thu, 7 Feb 2019 14:29:45 +0000 (14:29 +0000)]
ipcs(1): drop obsolete error checking

This code is not reached since r77551.

PR: 201728
MFC after: 5 days

5 years agoMention clang-format in WITH_CLANG_EXTRAS
emaste [Thu, 7 Feb 2019 14:05:21 +0000 (14:05 +0000)]
Mention clang-format in WITH_CLANG_EXTRAS

It's a useful tool and gives a further hint at the types of additional
binaries enabled by the option.

5 years agoCorrect ypldap(8) install path in OptionalObsoleteFiles.inc
avos [Thu, 7 Feb 2019 13:12:43 +0000 (13:12 +0000)]
Correct ypldap(8) install path in OptionalObsoleteFiles.inc

It's installed to /usr/sbin, not to /usr/bin (and was always here).

While here, add missing manpages and /var/yp directory to the list.

MFC after: 1 week

5 years agonetmap: revert netmap_attach_ext() to pre-r343772
vmaffione [Thu, 7 Feb 2019 11:28:53 +0000 (11:28 +0000)]
netmap: revert netmap_attach_ext() to pre-r343772

Reported by: marius
MFC after: 1 week

5 years agocxgbe(4): Auto-dump the CIM block's logic analyzer on a TIMER0 interrupt.
np [Thu, 7 Feb 2019 05:40:51 +0000 (05:40 +0000)]
cxgbe(4): Auto-dump the CIM block's logic analyzer on a TIMER0 interrupt.

Sponsored by: Chelsio Communications

5 years agocxgbe(4): Auto-dump the device log on a mailbox timeout or when the
np [Thu, 7 Feb 2019 05:06:29 +0000 (05:06 +0000)]
cxgbe(4): Auto-dump the device log on a mailbox timeout or when the
firmware reports an error in pcie_fw.

Sponsored by: Chelsio Communications

5 years agopci_host_generic_acpi: use IORT data for MSI/MSI-X
jchandra [Thu, 7 Feb 2019 04:50:16 +0000 (04:50 +0000)]
pci_host_generic_acpi: use IORT data for MSI/MSI-X

Use the information from IORT parsing to translate the PCI RID to
GIC ITS device ID. And similarly, use the information to find the
PIC XREF identifier to be used for PCI devices.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18004

5 years agoAdd comment noting that the strange spelling of GenuineIntel is for reason.
kib [Thu, 7 Feb 2019 03:58:29 +0000 (03:58 +0000)]
Add comment noting that the strange spelling of GenuineIntel is for reason.

Requested by: rpokala
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoNow that there is only one way to allocate a slab, remove uz_slab method.
glebius [Thu, 7 Feb 2019 03:55:05 +0000 (03:55 +0000)]
Now that there is only one way to allocate a slab, remove uz_slab method.

Discussed with: jeff

5 years agoReport cache zones in UMA stats sysctl, that 'vmstat -z' uses. This
glebius [Thu, 7 Feb 2019 03:32:45 +0000 (03:32 +0000)]
Report cache zones in UMA stats sysctl, that 'vmstat -z' uses. This
should had been part of r251826.

5 years agoarm64 gicv3: add IORT and NUMA support
jchandra [Thu, 7 Feb 2019 03:01:54 +0000 (03:01 +0000)]
arm64 gicv3: add IORT and NUMA support

acpi_iort.c has added support to query GIC proximity and MSI XREF
ID for GIC ITS blocks. Use this when GIC ITS blocks are initialized
from ACPI.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18003

5 years agoUse ifunc to select the barrier instruction for RDTSC.
kib [Thu, 7 Feb 2019 02:56:10 +0000 (02:56 +0000)]
Use ifunc to select the barrier instruction for RDTSC.

This optimizes out runtime switch and removes yet another cpuid from
libc.

Note that this is the first use of ifunc in i386 libc, so
ifunc-capable toolchain is required for building runnable userspace on
i386, same as on amd64.

Discussed with: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoarm64 acpi: Add support for IORT table
jchandra [Thu, 7 Feb 2019 02:30:33 +0000 (02:30 +0000)]
arm64 acpi: Add support for IORT table

Add new file arm64/acpica/acpi_iort.c to support the "IO Remapping
Table" (IORT). The table is specified in ARM document "ARM DEN 0049D"
titled "IO Remapping Table Platform Design Document".  The IORT table
has information on the associations between PCI root complexes, SMMU
blocks and GIC ITS blocks in the system.

The changes are to parse and save the information in the IORT table.
The API to use this information is added to sys/dev/acpica/acpivar.h.

The acpi_iort.c also has code to check the GIC ITS nodes seen in the
IORT table with corresponding entries in MADT table (for validity)
and with entries in SRAT table (for proximity information).

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18002

5 years agoPort sysctl kern.elf32.read_exec from amd64 to i386.
kib [Thu, 7 Feb 2019 02:17:34 +0000 (02:17 +0000)]
Port sysctl kern.elf32.read_exec from amd64 to i386.

Make it more comprehensive on i386, by not setting nx bit for any
mapping, not just adding PF_X to all kernel-loaded ELF segments.  This
is needed for the compatibility with older i386 programs that assume
that read access implies exec, e.g. old X servers with hand-rolled
module loader.

Reported and tested by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoFix resume on i386 PAE.
kib [Thu, 7 Feb 2019 02:09:34 +0000 (02:09 +0000)]
Fix resume on i386 PAE.

It was broken before PAE/no-PAE merge, but since now PAE is the
default, resume is apparently becomes for all machines.

The corrected issues:
- the trampoline page is not mapped executable, so machine faults when
  paging is on;
- MSR.EFER and %cr4 both should be loaded before paging is enabled,
  otherwise paging structures are invalid (cr4.PAE and EFER.NX).
- MSR.EFER and %cr4 should be only loaded if present.  I attempt to handle
  this by not touching the registers if the value is zero.

There are some more bits still not quite correct, e.g. unconditional
access to %cr4 in resumectx.

Reported and debugging help by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agocontigmalloc: handle M_EXEC.
kib [Thu, 7 Feb 2019 02:00:23 +0000 (02:00 +0000)]
contigmalloc: handle M_EXEC.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19092

5 years agoClean up all directories created by `make hier`
ngie [Wed, 6 Feb 2019 21:24:44 +0000 (21:24 +0000)]
Clean up all directories created by `make hier`

The logic I introduced in r322511 unfortunately left chflags schg'ed
directories behind created by `make hier` (in the stock /etc/mtree
files, this is limited to /var/empty).

The proposed change calls `chflags -R 0` and `rm -Rf ...` to clean all
of the directories that could not be removed by `${MAKE} clean`.
`${MAKE} clean` in bsd.obj.mk calls `cleandir`/`cleanobj`, which handles
the first directory tree walk/removal.

Approved by: emaste (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18641

5 years agoSupport the Lenovo OneLink in ure(4).
gavin [Wed, 6 Feb 2019 20:18:22 +0000 (20:18 +0000)]
Support the Lenovo OneLink in ure(4).

MFC after: 1 week

5 years agoriscv: default to non-executable stack
emaste [Wed, 6 Feb 2019 19:22:15 +0000 (19:22 +0000)]
riscv: default to non-executable stack

There's no need to worry about potential backwards compatibility issues
in a brand-new architecture, so avoid stack PROT_EXEC as with arm64.

Discussed with: br

5 years agovtfontcvt: whitespace cleanup
emaste [Wed, 6 Feb 2019 18:50:48 +0000 (18:50 +0000)]
vtfontcvt: whitespace cleanup

PR: 205707
Submitted by: Dmitry Wagin

5 years agoRetire SPX_HACK option unused after r342244
emaste [Wed, 6 Feb 2019 17:21:25 +0000 (17:21 +0000)]
Retire SPX_HACK option unused after r342244

5 years agoRetire CTM option after r342126
emaste [Wed, 6 Feb 2019 16:30:08 +0000 (16:30 +0000)]
Retire CTM option after r342126

5 years agonet80211(4): validate supplied roam:rate values from ifconfig(8)
avos [Wed, 6 Feb 2019 13:01:21 +0000 (13:01 +0000)]
net80211(4): validate supplied roam:rate values from ifconfig(8)

MFC after: 4 days

5 years agoAdapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
mmel [Wed, 6 Feb 2019 06:03:44 +0000 (06:03 +0000)]
Adapt FreeBSD specific DT stub for Jetson TK1 board to be consistent with
update of devicetree to 4.19 in r340337.
Our build system doesn't provide dependencies for included DTS files, so
nobody noticed this issue for long time.

PR: 235362
MFC after: 1 week

5 years agor341692 changed cap_syslog(3) to preserve the stdio descriptors inherited
jah [Wed, 6 Feb 2019 04:36:28 +0000 (04:36 +0000)]
r341692 changed cap_syslog(3) to preserve the stdio descriptors inherited
from its parent so that LOG_PERROR would work.  However, this caused
dhclient(8)'s stdio streams to remain open across daemonization, breaking
the ability to capture its foreground output as done in netconfig_ipv4.

Fix this by reverting r341692 and instead passing the parent's stderr
descriptor as an argument to cap_openlog() only when LOG_PERROR is specified
in logopt.

PR: 234514
Suggested by: markj
Reported by: Shawn Webb
Reviewed by: markj, oshogbo
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18989

5 years agopwm.8: fix markup in synopsis, add -f description
yuripv [Wed, 6 Feb 2019 04:00:37 +0000 (04:00 +0000)]
pwm.8: fix markup in synopsis, add -f description

Reviewed by: bcr, manu
Differential revision: https://reviews.freebsd.org/D18829

5 years agopwm.9: fix markup in interfaces description
yuripv [Wed, 6 Feb 2019 03:57:51 +0000 (03:57 +0000)]
pwm.9: fix markup in interfaces description

Reviewed by: manu
Differential revision: https://reviews.freebsd.org/D18830

5 years agopowerpc: Bind IRQs to only one interrupt on QorIQ SoCs
jhibbits [Wed, 6 Feb 2019 03:52:14 +0000 (03:52 +0000)]
powerpc: Bind IRQs to only one interrupt on QorIQ SoCs

The QorIQ SoCs don't actually support multicast interrupts, and the
references state explicitly that multicast is undefined behavior.  Avoid the
undefined behavior by binding to only a single CPU, using a quirk to
determine if this is necessary.

MFC after: 3 weeks

5 years agoiwn(4): plug initialization path vs interrupt handler races
avos [Wed, 6 Feb 2019 01:34:14 +0000 (01:34 +0000)]
iwn(4): plug initialization path vs interrupt handler races

There are few places in interrupt handler where the driver
lock is dropped; ensure that device is still running before
processing remaining ring entries.

PR: 192641
MFC after: 5 days

5 years agoAdd quirk for Sansisk X400 drives
imp [Tue, 5 Feb 2019 22:53:36 +0000 (22:53 +0000)]
Add quirk for Sansisk X400 drives

Certain versions of Sandisk x400 firmware can hang under extremely
heavly load of large I/Os for prolonged periods of time. Newer /
current versions work fine, and should be used where possible. Where
not possible, this quirk ensures that I/O requests are limited to 128k
to avoids the bug, even under extreme load. Since MAXPHYS is 128k,
only users with custom kernels are at risk on the older firmware.
Once all known users of the older firmware have upgraded, this quirk
will be removed.

Sponsored by: Netflix, Inc.

5 years agoRemove obsolete controller
imp [Tue, 5 Feb 2019 21:37:45 +0000 (21:37 +0000)]
Remove obsolete controller

We removed support for the super-old samsung s3xxxx parts, but this is
a straggler. Remove it too.

5 years agoRemove All Rights Reserved
imp [Tue, 5 Feb 2019 21:37:34 +0000 (21:37 +0000)]
Remove All Rights Reserved

Remove the all rights reserved clause from my copyright, and make
other minor tweaks needed where that might have created ambiguity.

5 years agoRemove a few stray "All Rights Reserved." declarations on stuff I've
imp [Tue, 5 Feb 2019 21:28:29 +0000 (21:28 +0000)]
Remove a few stray "All Rights Reserved." declarations on stuff I've
written.

5 years agoMake it possible to override PAE mode on boot.
kib [Tue, 5 Feb 2019 20:09:31 +0000 (20:09 +0000)]
Make it possible to override PAE mode on boot.

Initialize the static kenv in pmap_cold() and fetch user opinion on
vm.pmap.pae_mode tunable if hardware is capable.  Note that the static
environment is reinitilized in init386() later when paging is enabled.

Reviewed by: bde
Discussed with: kevans
Sponsored by: The FreeBSD Foundation
MFC after: 2 months

5 years agoRemove pointless initial value for i386 vm.pmap.pat_works sysctl definition.
kib [Tue, 5 Feb 2019 20:02:16 +0000 (20:02 +0000)]
Remove pointless initial value for i386 vm.pmap.pat_works sysctl definition.

The OID is served by external data.

Submitted by: bde
MFC after: 3 days

5 years ago[ppc64] llan: fix fatal kernel trap when system is low on memory
luporl [Tue, 5 Feb 2019 18:16:14 +0000 (18:16 +0000)]
[ppc64] llan: fix fatal kernel trap when system is low on memory

When running several builders in parallel, on QEMU, with 8GB of
memory, a fatal kernel trap (0x300 (data storage interrupt))
caused by llan driver is sometimes observed, when the system
starts to run out of swap space.

This happens because, at llan_intr(), a phyp call to add a
logical LAN buffer is always made when llan_add_rxbuf() fails,
even if it fails to allocate a new buffer.

PR: 235489
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D19084

5 years agoAvoid leaking fp references when truncating SCM_RIGHTS control messages.
markj [Tue, 5 Feb 2019 17:55:08 +0000 (17:55 +0000)]
Avoid leaking fp references when truncating SCM_RIGHTS control messages.

Reported by: pho
Approved by: so
MFC after: 0 minutes
Security: CVE-2019-5596
Sponsored by: The FreeBSD Foundation

5 years agoamd64: clear callee-preserved registers on syscall exit.
kib [Tue, 5 Feb 2019 17:49:27 +0000 (17:49 +0000)]
amd64: clear callee-preserved registers on syscall exit.

%r8, %r10, and on non-KPTI configuration %r9 were not restored on fast
return from a syscall.

Reviewed by: markj
Approved by: so
Security: CVE-2019-5595
Sponsored by: The FreeBSD Foundation
MFC after: 0 minutes

5 years agoFix missing translation of old ioctls for KDSETMODE, KDSBORDER and
bde [Tue, 5 Feb 2019 17:17:12 +0000 (17:17 +0000)]
Fix missing translation of old ioctls for KDSETMODE, KDSBORDER and
CONS_SETWINORG.  After translation, the last 2 are not supported, but
the first one has incomplete support that is enough to run old versions
of X.

5 years agoMy recent fix for programmable function keys in syscons only worked
bde [Tue, 5 Feb 2019 16:59:29 +0000 (16:59 +0000)]
My recent fix for programmable function keys in syscons only worked
when TEKEN_CONS25 is configured.  Fix this by adding a function to
set the flag that enables the fix and always calling this function
for syscons.

Expand the man page for teken_set_cons25().  This function is not
very useful since it can only set but not clear 1 flag.  In practice,
it is only used when TEKEN_CONS25 is configured and all that does is
choose the the default emulation for syscons at compile time.

5 years agoFix zapping of static hints and env in init_static_kenv(). Environments
bde [Tue, 5 Feb 2019 15:34:55 +0000 (15:34 +0000)]
Fix zapping of static hints and env in init_static_kenv().  Environments
are terminated by 2 NULs, but only 1 NUL was zapped.  Zapping only 1
NUL just splits the first string into an empty string and a corrupted
string.  All other strings in static hints and env remained live early
in the boot when they were supposed to be disabled.

Support calling init_static_kenv() very early in the boot, so as to
use the env very early in the boot.  Then the pointer to the loader
env may change after the first call due to enabling paging or otherwise
remapping the pointer.  Another call is needed to register the change.
Don't use the previous pointer in this (or any) later call.

Reviewed by: kib

5 years agonetmap: refactor logging macros and pipes
vmaffione [Tue, 5 Feb 2019 12:10:48 +0000 (12:10 +0000)]
netmap: refactor logging macros and pipes

Changelist:
    - Replace ND, D and RD macros with nm_prdis, nm_prinf, nm_prerr
      and nm_prlim, to avoid possible naming conflicts.
    - Add netmap_krings_mode_commit() helper function and use that
      to reduce code duplication.
    - Refactor pipes control code to export some functions that
      can be reused by the veth driver (on Linux) and epair(4).
    - Add check to reject API requests with version less than 11.
    - Small code refactoring for the null adapter.

MFC after: 1 week

5 years agoOnly reduce the PMTU after the send call. The only way to increase it, is
tuexen [Tue, 5 Feb 2019 10:29:31 +0000 (10:29 +0000)]
Only reduce the PMTU after the send call. The only way to increase it, is
via PMTUD.

This fixes an MTU issue reported by Timo Voelker.

MFC after: 3 days

5 years agoFix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
tuexen [Tue, 5 Feb 2019 10:13:51 +0000 (10:13 +0000)]
Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
socketoption.

This was found by running syzkaller.

MFC after: 3 days

5 years agoarm, acpi: increase size of memory region arrays
jchandra [Tue, 5 Feb 2019 06:25:35 +0000 (06:25 +0000)]
arm, acpi: increase size of memory region arrays

Bump up MAX_HWCNT and MAX_EXCNT to 32 when ACPI is enabled. These are
the sizes of the hwregions and exregions arrays respectively. ACPI
firmware typically has more memory regions and the current value of
16 is not sufficient for some platforms.

This commit fixes a failure seen with AMI firmware on Cavium's Sabre
ThunderX2 reference platform. This platform needs 21 physical memory
regions and 18 excluded regions to boot correctly with the current
firmware release.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D19073