]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoRevert r325808 (MFC r322401) to re-MFC with larger set
bdrewery [Wed, 8 Aug 2018 19:32:28 +0000 (19:32 +0000)]
Revert r325808 (MFC r322401) to re-MFC with larger set

5 years agoMFC r320274:
bdrewery [Wed, 8 Aug 2018 19:21:08 +0000 (19:21 +0000)]
MFC r320274:

  Set compiler metadata for stageworld/distributeworld.

PR: 212877

5 years agoMFC r320191:
bdrewery [Wed, 8 Aug 2018 19:03:06 +0000 (19:03 +0000)]
MFC r320191:

  objwarn should be .PHONY.

5 years agoMFC r320286:
bdrewery [Wed, 8 Aug 2018 19:00:53 +0000 (19:00 +0000)]
MFC r320286:

  compiler-metadata: Properly handle cross-build OBJDIR.

5 years agoMFC r321333:
bdrewery [Wed, 8 Aug 2018 18:59:22 +0000 (18:59 +0000)]
MFC r321333:

  Properly set userid for truncate_test.

5 years agoMFC r321491:
bdrewery [Wed, 8 Aug 2018 18:58:09 +0000 (18:58 +0000)]
MFC r321491:

  Remove unneeded dependency for libzfs.

5 years agoMFC r321492:
bdrewery [Wed, 8 Aug 2018 18:56:34 +0000 (18:56 +0000)]
MFC r321492:

  Only build libzfs_core in 'make libraries' if needed.

5 years agoMFC r322565,r323323:
bdrewery [Wed, 8 Aug 2018 18:55:32 +0000 (18:55 +0000)]
MFC r322565,r323323:

  r322565:
    Use -S for library installations except for -DNO_ROOT builds.
  r323323:
    Tweak comment for install -S usage since it does not impact the build.

5 years agoMFC r323620:
bdrewery [Wed, 8 Aug 2018 18:53:34 +0000 (18:53 +0000)]
MFC r323620:

  Fix the raise tests.

5 years agoMFC r324103:
bdrewery [Wed, 8 Aug 2018 18:52:37 +0000 (18:52 +0000)]
MFC r324103:

  __setrunelocale: Fix asprintf(3) failure not returning an error.

5 years agoMFC r337055:
kib [Wed, 8 Aug 2018 18:51:39 +0000 (18:51 +0000)]
MFC r337055:
Avoid assertion in /dev/ufssuspend when the suspend ioctl is
(incorrectly) called while another suspension is already active.

PR: 230220

5 years agoMFC r326552:
bdrewery [Wed, 8 Aug 2018 18:50:32 +0000 (18:50 +0000)]
MFC r326552:

  Fix DPSRCS not getting .depend.* files.

5 years agoMFC r335922:
bdrewery [Wed, 8 Aug 2018 18:48:40 +0000 (18:48 +0000)]
MFC r335922:

  Use OBJS_DEPEND_GUESS for forced opt_global.h dependency.

5 years agoMFC r335912:
bdrewery [Wed, 8 Aug 2018 18:46:03 +0000 (18:46 +0000)]
MFC r335912:

  Fix .depend.foo.o tracking for sys/conf/files defined compilations.

5 years agoMFC r335923:
bdrewery [Wed, 8 Aug 2018 18:41:27 +0000 (18:41 +0000)]
MFC r335923:

  META_MODE: Fix wanting a meta file in source tree.

5 years agoMFC r335733:
bdrewery [Wed, 8 Aug 2018 18:05:14 +0000 (18:05 +0000)]
MFC r335733:

  Don't use CCACHE for linking.

5 years agoMFC r310789,r314901:
bdrewery [Wed, 8 Aug 2018 18:03:57 +0000 (18:03 +0000)]
MFC r310789,r314901:

  r310789:
    Use compiler driver to build relocatable object
  r314901:
    Use LDFLAGS rather than CFLAGS when linking.

5 years agoMFC r335709:
bdrewery [Wed, 8 Aug 2018 17:59:33 +0000 (17:59 +0000)]
MFC r335709:

  CCACHE_BUILD: Avoid ccache when looking up compiler metadata.

5 years agoMFC r335708:
bdrewery [Wed, 8 Aug 2018 17:58:38 +0000 (17:58 +0000)]
MFC r335708:

  tinderbox: Give details about kernel builds.

5 years agoMFC r335704:
bdrewery [Wed, 8 Aug 2018 17:57:45 +0000 (17:57 +0000)]
MFC r335704:

  Rework check for libclang_rt to see if the needed library exists.

5 years agoMFC r335244:
bdrewery [Wed, 8 Aug 2018 17:50:43 +0000 (17:50 +0000)]
MFC r335244:

  Assert that a build is done before an install.

5 years agoMFC r335183:
bdrewery [Wed, 8 Aug 2018 17:48:02 +0000 (17:48 +0000)]
MFC r335183:

  proc0_post: Fix some locking issues

5 years agoMFC r337265:
markj [Wed, 8 Aug 2018 17:22:41 +0000 (17:22 +0000)]
MFC r337265:
Add the required page accounting to kmem_bootstrap_free().

5 years agoMFC r336714:
markj [Wed, 8 Aug 2018 17:12:06 +0000 (17:12 +0000)]
MFC r336714:
Simplify the arm64 implementation of pmap_mincore().

5 years agoMFC r337031:
markj [Wed, 8 Aug 2018 17:11:07 +0000 (17:11 +0000)]
MFC r337031:
Require that MAC label buffers be able to store a non-empty string.

5 years agoMFC r337059:
markj [Wed, 8 Aug 2018 17:10:32 +0000 (17:10 +0000)]
MFC r337059:
Fix some nits in the unix_passfd tests.

5 years agoMFC r331098 (by melifaro):
ae [Wed, 8 Aug 2018 16:17:50 +0000 (16:17 +0000)]
MFC r331098 (by melifaro):
  Fix outgoing TCP/UDP packet drop on arp/ndp entry expiration.

  Current arp/nd code relies on the feedback from the datapath indicating
   that the entry is still used. This mechanism is incorporated into the
   arpresolve()/nd6_resolve() routines. After the inpcb route cache
   introduction, the packet path for the locally-originated packets changed,
   passing cached lle pointer to the ether_output() directly. This resulted
   in the arp/ndp entry expire each time exactly after the configured max_age
   interval. During the small window between the ARP/NDP request and reply
   from the router, most of the packets got lost.

  Fix this behaviour by plugging datapath notification code to the packet
   path used by route cache. Unify the notification code by using single
   inlined function with the per-AF callbacks.

5 years agoMFC r336132:
ae [Wed, 8 Aug 2018 16:11:46 +0000 (16:11 +0000)]
MFC r336132:
  Add "record-state", "set-limit" and "defer-action" rule options to ipfw.

  "record-state" is similar to "keep-state", but it doesn't produce implicit
  O_PROBE_STATE opcode in a rule. "set-limit" is like "limit", but it has the
  same feature as "record-state", it is single opcode without implicit
  O_PROBE_STATE opcode. "defer-action" is targeted to be used with dynamic
  states. When rule with this opcode is matched, the rule's action will
  not be executed, instead dynamic state will be created. And when this
  state will be matched by "check-state", then rule action will be executed.
  This allows create a more complicated rulesets.

  Submitted by: lev

5 years agoMFC r336405:
ae [Wed, 8 Aug 2018 16:09:28 +0000 (16:09 +0000)]
MFC r336405:
  Move invoking of callout_stop(&lle->lle_timer) into llentry_free().

  This deduplicates the code a bit, and also implicitly adds missing
  callout_stop() to in[6]_lltable_delete_entry() functions.

  PR: 209682, 225927

5 years agoMFC r336987:
kib [Tue, 7 Aug 2018 17:45:49 +0000 (17:45 +0000)]
MFC r336987:
For compat32, emulate the same wraparound check as occurs on the real
ILP32 system.

PR: 230162

5 years agoRegen.
kib [Tue, 7 Aug 2018 17:44:36 +0000 (17:44 +0000)]
Regen.

5 years agoMFC r336980:
kib [Tue, 7 Aug 2018 17:44:13 +0000 (17:44 +0000)]
MFC r336980:
Provide compat32 shims for sched_rr_get_interval(2).

PR: 230175

5 years agoMFC r336957:
markj [Tue, 7 Aug 2018 15:04:53 +0000 (15:04 +0000)]
MFC r336957:
Add a regression test related to PR 131876.

PR: 131876

5 years agoDocument SA-18:08.
gjb [Tue, 7 Aug 2018 15:03:11 +0000 (15:03 +0000)]
Document SA-18:08.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r336761 & r336781:
dab [Tue, 7 Aug 2018 14:39:00 +0000 (14:39 +0000)]
MFC r336761 & r336781:

Allow a EVFILT_TIMER kevent to be updated.

If a timer is updated (re-added) with a different time period
(specified in the .data field of the kevent), the new time period has
no effect; the timer will not expire until the original time has
elapsed. This violates the documented behavior as the kqueue(2) man
page says (in part) "Re-adding an existing event will modify the
parameters of the original event, and not result in a duplicate
entry."

This modification, adapted from a patch submitted by cem@ to PR214987,
fixes the kqueue system to allow updating a timer entry. The kevent
timer behavior is changed to:

  * When a timer is re-added, update the timer parameters to and
    re-start the timer using the new parameters.
  * Allow updating both active and already expired timers.
  * When the timer has already expired, dequeue any undelivered events
    and clear the count of expirations.

All of these changes address the original PR and also bring the
FreeBSD and macOS kevent timer behaviors into agreement.

A few other changes were made along the way:

  * Update the kqueue(2) man page to reflect the new timer behavior.
  * Fix man page style issues in kqueue(2) diagnosed by igor.
  * Update the timer libkqueue system test to test for the updated
    timer behavior.
  * Fix the (test) libkqueue common.h file so that it includes
    config.h which defines various HAVE_* feature defines, before the
    #if tests for such variables in common.h. This enables the use of
    the actual err(3) family of functions.
  * Fix the usages of the err(3) functions in the tests for incorrect
    type of variables. Those were formerly undiagnosed due to the
    disablement of the err(3) functions (see previous bullet point).

PR: 214987
Relnotes: yes
Sponsored by: Dell EMC

5 years agoMFC r337323:
markj [Tue, 7 Aug 2018 14:09:29 +0000 (14:09 +0000)]
MFC r337323:
Fix a flag collision introduced in r327451.

PR: 230350

5 years agoMFC r337390: Bump date after r337384.
jtl [Mon, 6 Aug 2018 18:46:09 +0000 (18:46 +0000)]
MFC r337390: Bump date after r337384.

5 years agoMFC r337384:
jtl [Mon, 6 Aug 2018 17:41:53 +0000 (17:41 +0000)]
MFC r337384:

Address concerns about CPU usage while doing TCP reassembly.

Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Reviewed by: jhb
Approved by: so
Security: FreeBSD-SA-18:08.tcp
Security: CVE-2018-6922

5 years agoMFC r336919, r336924
kevans [Mon, 6 Aug 2018 03:58:56 +0000 (03:58 +0000)]
MFC r336919, r336924

r336919:
efirt: Add tunable to allow disabling EFI Runtime Services

Leading up to enabling EFIRT in GENERIC, allow runtime services to be
disabled with a new tunable: efi.rt_disabled. This makes it so that EFIRT
can be disabled easily in case we run into some buggy UEFI implementation
and fail to boot.

r336924:
Follow up to r336919 and r336921: s/efi.rt_disabled/efi.rt.disabled/

The latter matches the rest of the tree better [0]. The UPDATING entry has
been updated to reflect this, and the new tunable is now documented in
loader(8) [1].

Reported by: imp [0], Shawn Webb [1]

5 years agoMFC r336926:
pfg [Mon, 6 Aug 2018 02:09:14 +0000 (02:09 +0000)]
MFC r336926:
sed: unsign some indexes to fix sign-compare warnings.

Hinted by: OpenBSD (CVS 1.32)

5 years agoMFH r336801,r336854:
mm [Sun, 5 Aug 2018 14:35:30 +0000 (14:35 +0000)]
MFH r336801,r336854:

MFH r336801 (cem):
Cherry-pick upstream 2c8c83b9

Relevant vendor changes:
  Fix issue #948: out-of-bounds read in lha_read_data_none()

MFH r336854:
Sync libarchive with vendor.

Important vendor changes:
  PR #993: Chdir to -C directory for metalog processing
  OSS-Fuzz #4969: Check size of the extended time field in zip archives
  PR #973: Record informational compression level in gzip header

amdbugs: 877
Security: CVE-2017-14503

5 years agoMFC r336152-r336154, r336157
kevans [Sat, 4 Aug 2018 22:15:05 +0000 (22:15 +0000)]
MFC r336152-r336154, r336157

r336152:
subr_hints: Use goto/label instead of series of conditionals

r336153:
subr_hints: Convert some bool-like ints to bools

r336154:
subr_hints: Skip static_env and static_hints if they don't contain hints

This is possible because, well, they're static. Both the dynamic environment
and the MD-environment (generally loader(8) environment) can potentially
have room for new variables to be set, and thus do not receive this
treatment.

r336157:
kern_environment: bool'itize dynamic_kenv; fix small style(9) nit

5 years agoMFC r336973-r336975
kevans [Sat, 4 Aug 2018 22:12:12 +0000 (22:12 +0000)]
MFC r336973-r336975

r336973:
config(8): Strip comments from env lines

Consolidates the small bits of logic required for preprocessing a line
before inclusion into a file or nvlist.

r336974:
Re-insert variable disappeared during mis-application of r336973

r336975:
Remove variable re-inserted during mis-application of r336973

5 years agokenv MFC: r335998, r336019, r336026, r336036, r336217, r336335, r336337,
kevans [Sat, 4 Aug 2018 21:57:17 +0000 (21:57 +0000)]
kenv MFC: r335998, r336019, r336026, r336036, r336217, r336335, r336337,
r336415-r336416, r336419

As an aside- this has been slightly altered from the version in head to keep
the MD and config-static environments mutually exclusive by default.

This difference is a one-line change in init_static_kenv to setup the MD
environment if the config-static environment is empty or if
loader_env.disabled is explicitly set to 0.

r335998:
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
  the chain of environments (or dynamic environment) without relying on
  global state
- All three environments will be searched if they actually have valid hints
  to use, rather than just choosing the first environment that actually had
  a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

r336019:
config(8): De-dupe hint/env vars within a single file

r335653 flipped the order in which hints/env files are concatenated to match
the order in which vars are processed by the kernel. This is the other
hammer to drop.

Use nv(9) to de-dupe entries within a single `hint` or `env` file, using the
latest value specified for a key. This leaves some duplicates if a variable
is specified in multiple hint/env files or via `envvar` in a kernel config,
but the reversed order of concatenation (from r335653) makes this a
non-issue as the latest-specified version will be seen first.

This change also silently rewrote hint bits to use the same sanitization
process that ian@ wrote for r335642. To the kernel, hints and env vars are
basically the same thing through early boot, then get merged into the
dynamic environment once kmem becomes available and the dynamic environment
is created. They should be subjected to the same restrictions.

libnv has been added to -legacy for the time being to support the build of
config(8) with the new cnvlist API.

r336026:
config(8): Fix broken ABI

r336019 introduced ${SRCTOP}/sys to the include paths in order to pull in a
new sys/{c,}nv.h. This is wrong, because the build tree's ABI isn't
guaranteed to match what's running on the host system.

Fix instead by removing -I${SRCTOP}/sys and installing the libnv headers
with `make -C lib/libnv includes`... this may or may not get re-worked in
the future so that a userland lib isn't installing includes from sys/.

r336036:
kern_environment: Fix SYSINIT ordering

The dynamic environment was being initialized at SI_SUB_KMEM, SI_ORDER_ANY.
I added the hint-merging at SI_SUB_KMEM, SI_ORDER_ANY as well in r335998 -
this can only work by coincidence.

Re-do both to operate at SI_SUB_KMEM + 1, SI_ORDER_FIRST and SI_ORDER_SECOND
respectively to be safe. It's sufficiently obfuscated away as to when in
SU_SUB_KMEM malloc will be available, and the dynamic environment cannot be
relied upon there anyways since it's initialized at SI_ORDER_ANY.

r336217:
kern_environment: Give the static environment a chance to disable MD env

This variable has been given the name "loader_env.disabled" as it's the
primary way most people will have an MD environment. This restores the
previously-default behavior of ignoring the loader(8) environment, which may
be useful for vendor distributions or other scenarios where inheriting the
loader environment may be considered a security issue or potentially
breaking of a more locked-down environment.

As the change to config(5) indicates, disabling the loader environment
should not be a choice made lightly since it may provide ACPI hints and
other useful things that the system can rely on to boot.

An UPDATING entry has been added to mention an upgrade path for those that
may have relied on the previous behavior.

r336335 by arichardson:
No longer install sys/nv.h and sys/cnv.h in lib/libnv/Makefile

Use tools/build/Makefile to install the headers into ${WORLDTMP}/legacy
instead. Compared to r336026 this has the minor advantage that it avoids
unncessary header installation when building the non-bootstrap libnv.

r336337:
Unconditionally build libnv in legacy

Rather than using a config(8) built from new tree linking libnv built on
host.

r336415:
config(8): Add compatibility shims for r335998

Plumb the %VERSREQ from Makefile.<arch> through to the rest of config(8).
We've recorded the config(8) version that we're calling "the end of
envmode and hintmode," and we'll write them out for earlier versions. Later
kernel version bumps will remove envmode/hintmode from the kernel as needed,
which is OK since the current kernel does not use them at all.

These compatibility shims really need to go away when the major version
rolls over...

r336416:
Fix GCC 4.2 build after r336415, proper declaration and prototype

r336419:
config(8): Invert checks; envmode/hintmode reflect "env provided"

Relnotes: yes (maybe) [The loader environment may now be used with
the config-static environment by specifying loader_env.disabled=0 in the
config-static environment]

5 years agoMFC r336577:
wulf [Sat, 4 Aug 2018 12:45:37 +0000 (12:45 +0000)]
MFC r336577:

Raise "Report Count" value limit in HID descriptor parser.

This fixes usage/report size calculation of Microsoft`s "Touch Hardware
Quality Assurance" certificate blob found in many touchscreens.

While here, join several "c->flags = dval" lines in to single line.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D16357

5 years agoMFC r334555:
wulf [Sat, 4 Aug 2018 12:40:59 +0000 (12:40 +0000)]
MFC r334555:

[evdev] Sync event codes with Linux kernel 4.16

5 years agoMFC r336590:
mav [Sat, 4 Aug 2018 00:34:15 +0000 (00:34 +0000)]
MFC r336590:
Stop further SCSI recovery attempts after one has failed.

We've got a set of probably damaged hard disks, reporting 0x04,0x02
("Logical unit not ready, initializing command required") in response
to READ CAPACITY(16), where attempts to use START STOP UNIT for recovery
results in 0x44,0x00 ("Internal target failure") after ~1 second delay.
As result of all recovery retries, device open attempt took ~3 seconds
before finally reporting to GEOM that device is opened, but has no media.
If the open was for writing and since it hasn't formally failed, following
close triggered GEOM retaste, opening device few more times with respective
delays.

This change reduces whole time of this cycle from ~12 seconds to ~3 by
giving up on recovery after the first failure.

5 years agoMFC r336997:
manu [Fri, 3 Aug 2018 21:59:01 +0000 (21:59 +0000)]
MFC r336997:

release: Restore copy of boot.scr for some board

This is not a problem for 12-CURRENT as EFI boot works but it doesn't
for 11.
While here some board arm_install_uboot also copy ubldr.bin et create
firstboot files but it's already done in arm_install_boot

Reviewed by: gjb
Differential Revision: https://reviews.freebsd.org/D16481

5 years agoFix a mismerge in r337262.
markj [Fri, 3 Aug 2018 17:14:52 +0000 (17:14 +0000)]
Fix a mismerge in r337262.

This is a direct commit to stable/11.

5 years agoMFC r337015:
markj [Fri, 3 Aug 2018 15:43:37 +0000 (15:43 +0000)]
MFC r337015:
COMPAT_LINUX32 has not depended on COMPAT_43 in some time.

5 years agoMFC r336505, r336764
markj [Fri, 3 Aug 2018 15:42:39 +0000 (15:42 +0000)]
MFC r336505, r336764
Have preload_delete_name() free pages backing preloaded data.

5 years agoMFC r336319:
asomers [Fri, 3 Aug 2018 14:06:08 +0000 (14:06 +0000)]
MFC r336319:

auditon(2): fix A_SETPOLICY with 64-bit values

A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a
typo the 64-bit version has never worked correctly.

Submitted by: aniketp
Reviewed by: asomers, cem
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16222

5 years agoMFC r336205:
asomers [Fri, 3 Aug 2018 14:05:22 +0000 (14:05 +0000)]
MFC r336205:

Don't acquire evclass_lock with a spinlock held

When the "pc" audit class is enabled and auditd is running, witness will
panic during thread exit because au_event_class tries to lock an rwlock
while holding a spinlock acquired upstack by thread_exit.

To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is
acquired. Of thread_exit's 16 callers, it's only necessary to call
AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit
(for exiting threads). The other callers are all kernel threads, which
needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls
there will be nothing to audit.  And exit1 already does call
AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that
case.

PR: 228444
Reported by: aniketp
Reviewed by: aniketp, kib
Differential Revision: https://reviews.freebsd.org/D16210

5 years agoMFC r335899:
asomers [Fri, 3 Aug 2018 14:03:50 +0000 (14:03 +0000)]
MFC r335899:

auditd(8): register signal handlers interrutibly

auditd_wait_for_events() relies on read(2) being interrupted by signals,
but it registers signal handlers with signal(3), which sets SA_RESTART.
That breaks asynchronous signal handling. It means that signals don't
actually get handled until after an audit(8) trigger is received.
Symptoms include:

* Sending SIGTERM to auditd doesn't kill it right away; you must send
  SIGTERM and then send a trigger with auditon(2).
* Same with SIGHUP
* Zombie child processes don't get reaped until auditd receives a trigger
  sent by auditon. This includes children created by expiring audit trails
  at auditd startup.

Fix by using sigaction(2) instead of signal(3).

Cherry pick https://github.com/openbsm/openbsm/commit/d060887

PR: 229381
Reviewed by: cem
Obtained from: OpenBSM
Differential Revision: https://github.com/openbsm/openbsm/pull/36

5 years agoMFC r332631:
asomers [Fri, 3 Aug 2018 14:01:32 +0000 (14:01 +0000)]
MFC r332631:

lio_listio: return EAGAIN instead of EIO when out of resources

This behavior is already documented by the man page, and suggested by POSIX.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D15099

5 years agoMFC r336763:
kib [Fri, 3 Aug 2018 11:36:37 +0000 (11:36 +0000)]
MFC r336763:
Add workarounds for several Ryzen erratas, on amd64.

5 years agoMFC r336922:
markj [Thu, 2 Aug 2018 15:16:59 +0000 (15:16 +0000)]
MFC r336922:
Remove a redundant check.

5 years agoMFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check
avg [Thu, 2 Aug 2018 09:31:50 +0000 (09:31 +0000)]
MFC r336641: fix incorrect operator in the AUDITPIPE_SET_QLIMIT bounds check

5 years agoMFC r335934: remove unneeded inclusion of sys/interrupt.h from several files
avg [Thu, 2 Aug 2018 09:29:39 +0000 (09:29 +0000)]
MFC r335934: remove unneeded inclusion of sys/interrupt.h from several files

5 years agoMFC r337056:
hselasky [Thu, 2 Aug 2018 09:03:08 +0000 (09:03 +0000)]
MFC r337056:
Don't refer to non-existing atomic functions, even though not compiled,
in the LinuxKPI.

Found by: rpokala @
Sponsored by: Mellanox Technologies

5 years agoMFC r336453:
hselasky [Thu, 2 Aug 2018 09:02:19 +0000 (09:02 +0000)]
MFC r336453:
Use unspecified address family when connecting as a client in
libibverbs example utilities.

This allows connecting to both IPv4 and IPv6 and reverts
some FreeBSD only patches.

Sponsored by: Mellanox Technologies

5 years agoMFC r334786: x86: reorganize code that deals with unexpected NMI-s
avg [Thu, 2 Aug 2018 09:00:09 +0000 (09:00 +0000)]
MFC r334786: x86: reorganize code that deals with unexpected NMI-s

5 years agoMFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts
avg [Thu, 2 Aug 2018 08:58:33 +0000 (08:58 +0000)]
MFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts

5 years agoMFC r336452:
hselasky [Thu, 2 Aug 2018 08:57:40 +0000 (08:57 +0000)]
MFC r336452:
Add ability to parse sysfs paths under FreeBSD in libibumad.

Add the ability to to parse sysfs paths to sysctl nodes by replacing '/' with '.'

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r336451:
hselasky [Thu, 2 Aug 2018 08:56:27 +0000 (08:56 +0000)]
MFC r336451:
Update version information for the mlx5 and mlx5en(4) modules.

While at it bump some copyright dates.

Sponsored by: Mellanox Technologies

5 years agoMFC r336450:
hselasky [Thu, 2 Aug 2018 08:55:19 +0000 (08:55 +0000)]
MFC r336450:
Do not inline transmit headers and use HW VLAN tagging if supported by mlx5en(4).

Query the minimal inline mode supported by the card.
When creating a send queue, cache the queried mode and optimize the transmit
if no inlining is required.  In this case, we can avoid touching the headers
cache line and avoid dirtying several more lines by copying headers into
the send WQEs.  Also, if no inline headers are used, hardware assists in
the VLAN tag framing.

Submitted by: kib@, slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r336411:
hselasky [Thu, 2 Aug 2018 08:52:49 +0000 (08:52 +0000)]
MFC r336411:
Use a mbuf header instead of a mbuf cluster for debugging interrupts in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336410:
hselasky [Thu, 2 Aug 2018 08:51:55 +0000 (08:51 +0000)]
MFC r336410:
Add module parameter to limit number of MSIX EQ vectors in mlx5en(4).

For setups having a large amount of PCI devices, it makes sense to limit the
number of MSIX vectors per PCI device, in order to avoid running out of IRQ
vectors.

Sponsored by: Mellanox Technologies

5 years agoMFC r336407:
hselasky [Thu, 2 Aug 2018 08:49:35 +0000 (08:49 +0000)]
MFC r336407:
Handle jumbo frames without requiring big clusters in mlx5en(4).

The scatter list is formed by the chunks of MCLBYTES each, and larger
than default packets are returned to the stack as the mbuf chain.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r336404:
hselasky [Thu, 2 Aug 2018 08:48:27 +0000 (08:48 +0000)]
MFC r336404:
Enable both receive and transmit pauseframes by default in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336403:
hselasky [Thu, 2 Aug 2018 08:47:24 +0000 (08:47 +0000)]
MFC r336403:
Add context numbers for HW elements in mlx5en(4).

To access the data, set sysctl dev.mce.N.conf.debug_stats to 1.
This enables the sysctl node dev.mce.N.hw_ctx_debug.  Its content is
the mapping of each channel' number to used receive queue and associated
completion queue, set of the transmit queues numbers and corresponding
completion queues.

Trimmed example output:
channel 30 rq 188 cq 1085
channel 30 tc 0 sq 187 cq 1084
channel 31 rq 191 cq 1087
channel 31 tc 0 sq 190 cq 1086

Sponsored by: Mellanox Technologies

5 years agoMFC r336402:
hselasky [Thu, 2 Aug 2018 08:46:27 +0000 (08:46 +0000)]
MFC r336402:
Do not hint about 'trust both' mode when the mlx5en(4) hardware does not support it.

Sponsored by: Mellanox Technologies

5 years agoMFC r336401:
hselasky [Thu, 2 Aug 2018 08:45:32 +0000 (08:45 +0000)]
MFC r336401:
Correctly write atomic variable in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r336399:
hselasky [Thu, 2 Aug 2018 08:44:40 +0000 (08:44 +0000)]
MFC r336399:
Remove redundant call to mlx5_vsc_find_cap() in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r336398:
hselasky [Thu, 2 Aug 2018 08:43:54 +0000 (08:43 +0000)]
MFC r336398:
Make sure the state variable is set atomically instead of using a mutex in mlx5core.

Device detach and setting error state may deadlock over the interface mutex
like this:

a) Detach code in mlx5en waits until error state is set while the interface
mutex is locked.
b) The set error handler needs to lock the interface mutex before it can
set the error state.

The solution is to use atomics to set the error state.

Sponsored by: Mellanox Technologies

5 years agoMFC r336397:
hselasky [Thu, 2 Aug 2018 08:42:40 +0000 (08:42 +0000)]
MFC r336397:
Refactor access to CR-space into using VSC APIs in mlx5core.

Remove no longer used files and APIs.

Sponsored by: Mellanox Technologies

5 years agoMFC r336396:
hselasky [Thu, 2 Aug 2018 08:40:46 +0000 (08:40 +0000)]
MFC r336396:
Remove redundant newline character in mlx5core.

Sponsored by: Mellanox Technologies

5 years agoMFC r336395:
hselasky [Thu, 2 Aug 2018 08:39:48 +0000 (08:39 +0000)]
MFC r336395:
Update version information for the mlx5ib module.

Sponsored by: Mellanox Technologies

5 years agoMFC r336394:
hselasky [Thu, 2 Aug 2018 08:38:37 +0000 (08:38 +0000)]
MFC r336394:
Don't pass unsupported events to ibcore from mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r336393:
hselasky [Thu, 2 Aug 2018 08:37:44 +0000 (08:37 +0000)]
MFC r336393:
Use static device naming instead of dynamic one in mlx5ib.

When resetting mlx5core instances it can happen that the order of attach and
detach for mlx5ib instances is changed. Take the unit number for mlx5_%d from
the parent PCI device, similarly to what is done in mlx5en(4), so that there
is a direct relationship between mce<N> and mlx5_<N>.

Sponsored by: Mellanox Technologies

5 years agoMFC r336392:
hselasky [Thu, 2 Aug 2018 08:36:51 +0000 (08:36 +0000)]
MFC r336392:
Implement support for Differentiated Service Code Point, DSCP, in mlx5en(4).

The DSCP feature is controlled using a set of sysctl(8) fields under
the qos sysctl directory entry for mlx5en(4).

For Routable RoCE QPs, the DSCP should be set in the QP's address path.
The DSCP's value is derived from the traffic class.

Linux commit:
ed88451e1f2d400fd6a743d0a481631cf9f97550

Sponsored by: Mellanox Technologies

5 years agoMFC r336964:
hselasky [Thu, 2 Aug 2018 08:35:32 +0000 (08:35 +0000)]
MFC r336964:
Only NULL check the VNET pointer when VIMAGE is enabled in ibcore.
Else a NULL VNET pointer should be ignored. This fixes address resolving
when VIMAGE is disabled.

Sponsored by: Mellanox Technologies

5 years agoMFC r336391:
hselasky [Thu, 2 Aug 2018 08:33:51 +0000 (08:33 +0000)]
MFC r336391:
Use __FBSDID() for RCS tags in ibcore.

Sponsored by: Mellanox Technologies

5 years agoMFC r336389:
hselasky [Thu, 2 Aug 2018 08:31:34 +0000 (08:31 +0000)]
MFC r336389:
Add support for IPv6 multicast in ibcore.

This change allows us to join IPv6 multicast networks.

Sponsored by: Mellanox Technologies

5 years agoMFC r336388:
hselasky [Thu, 2 Aug 2018 08:30:44 +0000 (08:30 +0000)]
MFC r336388:
Add support for RoCEv2 multicast in ibcore.

When creating address handle from multicast GID, set MAC according to
the appropriate formula instead of searching for it in the GID table:
- For IPv4 multicast GID use ip_eth_mc_map().
- For IPv6 multicast GID use ipv6_eth_mc_map().

Linux commit:
9636a56fa864464896bf7d1272c701f2b9a57737

Sponsored by: Mellanox Technologies

5 years agoMFC r336387:
hselasky [Thu, 2 Aug 2018 08:29:40 +0000 (08:29 +0000)]
MFC r336387:
Honor return status of ib_init_ah_from_mcmember() in ibcore.

The return status of ib_init_ah_from_mcmember() is ignored by
cma_ib_mc_handler().  Honor it and return error event if ah attribute
initialization failed.

Linux commit:
6d337179f28cc50ddd7e224f677b4cda70b275fc

Sponsored by: Mellanox Technologies

5 years agoMFC r336386:
hselasky [Thu, 2 Aug 2018 08:28:49 +0000 (08:28 +0000)]
MFC r336386:
Honor port_num while resolving GID for IB link layer in ibcore.

ah_attr contains the port number to which cm_id is bound. However, while
searching for GID table for matching GID entry, the port number is
ignored.

This could cause the wrong GID to be used when the ah_attr is converted to
an AH.

Linux commit:
563c4ba3bd2b8b0b21c65669ec2226b1cfa1138b

Sponsored by: Mellanox Technologies

5 years agoMFC r336385:
hselasky [Thu, 2 Aug 2018 08:27:49 +0000 (08:27 +0000)]
MFC r336385:
Set IPv4 TOS and IPv6 traffic class field for RoCEv2 traffic in ibcore.

The current implementation assumes a static mapping between
the TOS bits and the priority code point, PCP bits.

Sponsored by: Mellanox Technologies

5 years agoMFC r336384:
hselasky [Thu, 2 Aug 2018 08:26:56 +0000 (08:26 +0000)]
MFC r336384:
Fix for loopback detection in address resolve logic in ibcore.

When a loopback address is detected use the network interface which
has the loopback flag set to trigger loopback logic in address resolve.

Sponsored by: Mellanox Technologies

5 years agoMFC r336383:
hselasky [Thu, 2 Aug 2018 08:25:48 +0000 (08:25 +0000)]
MFC r336383:
Check port number supplied by user verbs cmds in ibcore.

The ib_uverbs_create_ah() ind ib_uverbs_modify_qp() calls receive
the port number from user input as part of its attributes and assumes
it is valid. Down on the stack, that parameter is used to access kernel
data structures.  If the value is invalid, the kernel accesses memory
it should not.  To prevent this, verify the port number before using it.

Linux commit:
5ecce4c9b17bed4dc9cb58bfb10447307569b77b
a62ab66b13a0f9bcb17b7b761f6670941ed5cd62
5a7a88f1b488e4ee49eb3d5b82612d4d9ffdf2c3

Sponsored by: Mellanox Technologies

5 years agoMFC r336382:
hselasky [Thu, 2 Aug 2018 08:24:45 +0000 (08:24 +0000)]
MFC r336382:
Depend on IPv6 stack to resolve link local address for RoCEv2 in ibcore.

RoCEv1 does not use the IPv6 stack to resolve the link local DGID since it
uses GID address. It forms the DMAC directly from the DGID.

Linux commit:
56d0a7d9a0f045ee27a001762deac28c7d28e2e4

Sponsored by: Mellanox Technologies

5 years agoMFC r336381:
hselasky [Thu, 2 Aug 2018 08:23:54 +0000 (08:23 +0000)]
MFC r336381:
Fix kernel crash during fail to initialize device in ibcore.

This patch fixes the kernel crash that occurs during ib_dealloc_device()
called due to provider driver fails with an error after
ib_alloc_device() and before it can register using ib_register_device().

This crashed seen in tha lab as below which can occur with any IB device
which fails to perform its device initialization before invoking
ib_register_device().

This patch avoids touching cache and port immutable structures if device
is not yet initialized.
It also releases related memory when cache and port immutable data
structure initialization fails during register_device() state.

Linux commit:
4be3a4fa51f432ef045546d16f25c68a1ab525b9

Sponsored by: Mellanox Technologies

5 years agoMFC r336380:
hselasky [Thu, 2 Aug 2018 08:22:53 +0000 (08:22 +0000)]
MFC r336380:
Check AF family prior resolving address and introduce safer rdma_addr_size() variants in ibcore.

Garbage supplied by user will cause to UCMA module provide zero
memory size for memcpy(), because it wasn't checked, it will
produce unpredictable results in rdma_resolve_addr().

There are several places in the ucma ABI where userspace can pass in a
sockaddr but set the address family to AF_IB.  When that happens,
rdma_addr_size() will return a size bigger than sizeof struct sockaddr_in6,
and the ucma kernel code might end up copying past the end of a buffer
not sized for a struct sockaddr_ib.

Fix this by introducing new variants
    int rdma_addr_size_in6(struct sockaddr_in6 *addr);
    int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);

that are type-safe for the types used in the ucma ABI and return 0 if the
size computed is bigger than the size of the type passed in.  We can use
these new variants to check what size userspace has passed in before
copying any addresses.

Linux commit:
2975d5de6428ff6d9317e9948f0968f7d42e5d74
09abfe7b5b2f442a85f4c4d59ecf582ad76088d7
84652aefb347297aa08e91e283adf7b18f77c2d5

Sponsored by: Mellanox Technologies

5 years agoMFC r336379:
hselasky [Thu, 2 Aug 2018 08:21:55 +0000 (08:21 +0000)]
MFC r336379:
Check for a cm_id->device in all user calls that need it in ibcore.

This was done by auditing all callers of ucma_get_ctx and switching the
ones that unconditionally touch ->device to ucma_get_ctx_dev. This covers
a little less than  half of the call sites.

The 11 remaining call sites to ucma_get_ctx() were manually audited.

Linux commit:
4b658d1bbc16605330694bb3ef2570c465ef383d
8b77586bd8fe600d97f922c79f7222c46f37c118

Sponsored by: Mellanox Technologies

5 years agoMFC r336377:
hselasky [Thu, 2 Aug 2018 08:21:04 +0000 (08:21 +0000)]
MFC r336377:
Fix kernel panic while using XRC_TGT QP type in ibcore.

Attempt to modify XRC_TGT QP type from the user space (ibv_xsrq_pingpong
invocation) will trigger the following kernel panic. It is caused by the
fact that such QPs missed uobject initialization.

Linux commit:
f45765872e7aae7b81feb3044aaf9886b21885ef

Sponsored by: Mellanox Technologies

5 years agoMFC r336376:
hselasky [Thu, 2 Aug 2018 08:20:11 +0000 (08:20 +0000)]
MFC r336376:
Fix NULL pointer dereference during device removal in ibcore.

As part of ib_uverbs_remove_one which might be triggered upon
reset flow, we trigger IB_EVENT_DEVICE_FATAL event to userspace
application.
If device was removed after uverbs fd was opened but before
ib_uverbs_get_context was called, the event file will be accessed
before it was allocated, result in NULL pointer dereference:

Linux commit:
870201f95fcbd19538aef630393fe9d583eff82e

Sponsored by: Mellanox Technologies

5 years agoMFC r336375:
hselasky [Thu, 2 Aug 2018 08:19:08 +0000 (08:19 +0000)]
MFC r336375:
Fix access to non-initialized CM_ID object in ibcore.

The attempt to join multicast group without ensuring that CMA device
exists will lead to the following crash reported by syzkaller.

Linux commit:
7688f2c3bbf55e52388e37ac5d63ca471a7712e1

Sponsored by: Mellanox Technologies

5 years agoMFC r336374:
hselasky [Thu, 2 Aug 2018 08:18:11 +0000 (08:18 +0000)]
MFC r336374:
Avoid that ib_drain_qp() triggers an out-of-bounds stack access in ibcore.

Linux commit:
a1ae7d0345edd593d6725d3218434d903a0af95d

Sponsored by: Mellanox Technologies

5 years agoMFC r336373:
hselasky [Thu, 2 Aug 2018 08:17:09 +0000 (08:17 +0000)]
MFC r336373:
Ensure that CM_ID exists prior to access it in ibcore.

Prior to access UCMA commands, the context should be initialized
and connected to CM_ID with ucma_create_id(). In case user skips
this step, he can provide non-valid ctx without CM_ID and cause
to multiple NULL dereferences.

Also there are situations where the create_id can be raced with
other user access, ensure that the context is only shared to
other threads once it is fully initialized to avoid the races.

Linux commit:
e8980d67d6017c8eee8f9c35f782c4bd68e004c9

Sponsored by: Mellanox Technologies

5 years agoMFC r336372:
hselasky [Thu, 2 Aug 2018 08:15:05 +0000 (08:15 +0000)]
MFC r336372:
Add support for prio-tagged traffic for RDMA in ibcore.

When receiving a PCP change all GID entries are reloaded.
This ensures the relevant GID entries use prio tagging,
by setting VLAN present and VLAN ID to zero.

The priority for prio tagged traffic is set using the regular
rdma_set_service_type() function.

Fake the real network device to have a VLAN ID of zero
when prio tagging is enabled. This is logic is hidden inside
the rdma_vlan_dev_vlan_id() function which must always be used
to retrieve the VLAN ID throughout all of ibcore and the
infiniband network drivers.

The VLAN presence information then propagates through all
of ibcore and so incoming connections will have the VLAN
bit set. The incoming VLAN ID is then checked against the
return value of rdma_vlan_dev_vlan_id().

Sponsored by: Mellanox Technologies