]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r312296 and r323254, which is new a socket option
sobomax [Wed, 12 Sep 2018 18:52:18 +0000 (18:52 +0000)]
MFC r312296 and r323254, which is new a socket option
SO_TS_CLOCK to pick from several different clock sources to
return timestamps when SO_TIMESTAMP is enabled and two
new nanosecond-precision timestamp types. This also fixes
recvmsg32() system call to properly down-convert layout of the
64-bit structures to match what 32-bit app(s) expect.

Bump __FreeBSD_version to indicate presence of a new
functionality.

Differential Revision: https://reviews.freebsd.org/D9171

5 years agoMFC r338491:
hselasky [Wed, 12 Sep 2018 08:56:08 +0000 (08:56 +0000)]
MFC r338491:
ibcore: Fix endless loop in searching for matching VLAN device

In r337943 ifnet's if_pcp was set to the PCP value in use
instead of IFNET_PCP_NONE.
Current ibcore code assumes that if_pcp is IFNET_PCP_NONE with
VLAN interfaces so it can identify prio-tagged traffic.
Fix that by explicitly verifying that that the if_type is IFT_ETHER
and not IFT_L2VLAN.

Approved by:    re (Marius), hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies

5 years agoMFC r338468: Fix "ipfw fwd" to work for incoming IPv4 packets
eugen [Wed, 12 Sep 2018 08:46:49 +0000 (08:46 +0000)]
MFC r338468: Fix "ipfw fwd" to work for incoming IPv4 packets
when ip_tryforward() chooses fast forwarding path, as it already works
for IPv6 and for both of them on old slow path.

PR: 231143
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D17039

5 years agoMFC 338603:
gordon [Wed, 12 Sep 2018 05:02:11 +0000 (05:02 +0000)]
MFC 338603:
Correct ELF header parsing code to prevent invalid ELF sections from
disclosing memory.

Submitted by: markj
Reported by: Thomas Barabosch, Fraunhofer FKIE
Approved by: so
Security: FreeBSD-SA-18:12.elf
Security: CVE-2018-6924
Sponsored by: The FreeBSD Foundation

5 years agoMFC r334856, r338434:
kib [Tue, 11 Sep 2018 18:39:04 +0000 (18:39 +0000)]
MFC r334856, r338434:
Don't bother looking for non-executable pages when a process is
excluded from PTI.

5 years agoMFC r338435:
kib [Tue, 11 Sep 2018 18:35:08 +0000 (18:35 +0000)]
MFC r338435:
Improve error messages from clock_if.m method failures.

5 years agoMFC r338433:
kib [Tue, 11 Sep 2018 18:31:57 +0000 (18:31 +0000)]
MFC r338433:
Normalize use of semicolon with EFI_TIME_LOCK macros.

5 years agoFix compile warning about missing prototype when WANT_FUNCTIONS is defined.
hselasky [Tue, 11 Sep 2018 15:56:06 +0000 (15:56 +0000)]
Fix compile warning about missing prototype when WANT_FUNCTIONS is defined.

This is a direct commit.

Found by: bde @
Sponsored by: Mellanox Technologies

5 years agoFix the port name in the 2018-06-26 errata entry for 11.2-RELEASE.
gjb [Tue, 11 Sep 2018 15:00:16 +0000 (15:00 +0000)]
Fix the port name in the 2018-06-26 errata entry for 11.2-RELEASE.

Submitted by: rkoberman at gmail _dot_ com
Sponsored by: The FreeBSD Foundation

5 years agoMFC r338541:
hselasky [Mon, 10 Sep 2018 08:19:38 +0000 (08:19 +0000)]
MFC r338541:
Introduce and use sgid_index in CM requests in ibcore.

For RoCE, when CM requests are received for RC and UD connections,
netdevice of the incoming request is unavailable. Because of that CM
requests are always forwarded to init_net namespace.

Now that we have the GID index available, introduce SGID index in
incoming CM requests and refer to the netdevice of it.

While at it fix some incorrect uses of init_net and make sure
the rdma_create_id() function stores the VNET it is passed.

Based on linux commit:
cee104334c98dd04e9dd4d9a4fa4784f7f6aada9

Sponsored by: Mellanox Technologies

5 years agoMFC r338526:
hselasky [Mon, 10 Sep 2018 08:17:36 +0000 (08:17 +0000)]
MFC r338526:
Implement get network interface by params function in ipoib.

Also fix the validate_ipv4_net_dev() and validate_ipv6_net_dev() functions
which had source and destination addresses swapped, and didn't set the
scope ID for IPv6 link-local addresses.

This allows applications like krping to work using IPoIB devices.

Sponsored by: Mellanox Technologies

5 years agoMFC r338495:
hselasky [Mon, 10 Sep 2018 08:14:52 +0000 (08:14 +0000)]
MFC r338495:
Add proper support for VIMAGE to krping.

Make sure we pass the correct VNET when allocating the RDMA ID.

Sponsored by: Mellanox Technologies

5 years agoMFC r338493:
hselasky [Mon, 10 Sep 2018 08:13:33 +0000 (08:13 +0000)]
MFC r338493:
Make the MSIX module parameter limit per device, in mlx5en(4).

Sponsored by: Mellanox Technologies

5 years agoMFC r338492:
hselasky [Mon, 10 Sep 2018 08:09:42 +0000 (08:09 +0000)]
MFC r338492:
Add support for receive side scaling stride, RSSS, in mlx5en(4).

The receive side scaling stride parameter is a value which define the interval
between active receive side queues. The traffic for the inactive queues is
redirected to the nearest active queue by use of modulus. The default value
of this parameter is one, which means all receive side queues are used.

The point of this feature is to redirect more traffic to fewer receive side
queues in order to take more advantage of sorted large receive offload,
sorted LRO. The sorted LRO works better when more packets are accumulated
per service interval.

Sponsored by: Mellanox Technologies

5 years agoMFC r338490:
hselasky [Mon, 10 Sep 2018 08:05:36 +0000 (08:05 +0000)]
MFC r338490:
Don't stall transmit queue on drops in mlx5en(4).

When a transmitted packet is dropped don't stall the transmit queue.

Sponsored by: Mellanox Technologies

5 years agoMFC r338489:
hselasky [Mon, 10 Sep 2018 08:02:02 +0000 (08:02 +0000)]
MFC r338489:
Maximum number of mbuf frags is off-by-one for worst case scenario in mlx5en(4).

Inspecting the PRM no more than 0x3F data segments, DS, of size 16 bytes is
allowed.

Worst case scenario summary of DS usage:
Header is fixed: 2 DS
Maximum inlining: 98 => (98 - 2) / 16 = 6 DS
Remainder: 0x3F - 2 - 6 = 55 DS (mbuf frags)

Previously a value of 56 DS was used and this would work in the
normal case because not all inline data area was used up.

Sponsored by: Mellanox Technologies

5 years agoMFC r316623: fix build after incomplete MFC r338544 by me.
eugen [Sun, 9 Sep 2018 18:38:55 +0000 (18:38 +0000)]
MFC r316623: fix build after incomplete MFC r338544 by me.

5 years agoMFC r316615 by sevan: Remove the last vestiges of FDC_DEBUG & FD_DEBUG
eugen [Sun, 9 Sep 2018 18:08:38 +0000 (18:08 +0000)]
MFC r316615 by sevan: Remove the last vestiges of FDC_DEBUG & FD_DEBUG

PR: 105608
Differential Revision: https://reviews.freebsd.org/D10303

5 years agoMFC r338126: MFV r338092: ntp 4.2.8p12.
delphij [Sat, 8 Sep 2018 04:09:30 +0000 (04:09 +0000)]
MFC r338126: MFV r338092: ntp 4.2.8p12.

Relnotes: yes

5 years agoMFC r338459:
kib [Fri, 7 Sep 2018 10:34:27 +0000 (10:34 +0000)]
MFC r338459:
amd64: For non-PTI mode, do not initialize PCPU kcr3 to KPML4phys.

5 years agoMFC 332908: Add two tests for TRAP_* signal codes for SIGTRAP.
jhb [Thu, 6 Sep 2018 22:32:59 +0000 (22:32 +0000)]
MFC 332908: Add two tests for TRAP_* signal codes for SIGTRAP.

- ptrace__breakpoint_siginfo tests that a SIGTRAP for a software breakpoint
  in userland triggers a SIGTRAP with a signal code of TRAP_BRKPT.
- ptrace__step_siginfo tests that a SIGTRAP reported for a step after
  stepping via PT_STEP or PT_SETSTEP has a signal code of TRAP_TRACE.

5 years agoMFC 332909: Report proper signal codes for SIGTRAP traps on MIPS.
jhb [Thu, 6 Sep 2018 22:30:34 +0000 (22:30 +0000)]
MFC 332909: Report proper signal codes for SIGTRAP traps on MIPS.

- Use TRAP_TRACE for traps after stepping via PT_STEP.
- Use TRAP_BRKPT for software breakpoint traps and watchpoint traps.

This was tested via the recently added siginfo ptrace() tests.  PT_STEP on
MIPS has several bugs that prevent it from working yet, but this does fix
the ptrace__breakpoint_siginfo test on MIPS.

5 years agoMFC 332906,332907,332976,333679,336053: Expand testing of breakpoints.
jhb [Thu, 6 Sep 2018 22:23:39 +0000 (22:23 +0000)]
MFC 332906,332907,332976,333679,336053: Expand testing of breakpoints.

332906:
Extend support for ptrace() tests using breakpoints.

- Use a single list of platforms to define HAVE_BREAKPOINT for platforms
  that expose a functional breakpoint() inline to userland.  Replace
  existing lists of platform tests with HAVE_BREAKPOINT instead.
- Add support for advancing PC past a breakpoint inserted via breakpoint()
  to support the existing ptrace__PT_CONTINUE_different_thread test on
  non-x86 platforms (x86 advances the PC past the breakpoint instruction,
  but other platforms do not).  This is implemented by defining a new
  SKIP_BREAK macro which accepts a pointer to a 'struct reg' as its sole
  argument and modifies the contents to advance the PC.  The intention is
  to use it in between PT_GETREGS and PT_SETREGS.

332907:
Expose breakpoint() to userland from <machine/cpufunc.h> on MIPS.

Enable ptrace() tests using breakpoint on MIPS as well.

332976:
Shorten some recently-added lines that are an extra indent over 80 columns.

333679:
Export a breakpoint() function to userland for riscv.

As a result, enable tests using breakpoint() on riscv.

336053:
Export a breakpoint() function to userland for arm and arm64.

Enable ptrace() tests using breakpoint() on these architectures.

5 years agoMFC r338370:
kib [Wed, 5 Sep 2018 21:28:33 +0000 (21:28 +0000)]
MFC r338370:
Remove {max/min}_offset() macros, use vm_map_{max/min}() inlines.

5 years agoMFC r338428:
kib [Wed, 5 Sep 2018 21:24:26 +0000 (21:24 +0000)]
MFC r338428:
Style cleanup.

5 years agoMFC r324856:
kib [Wed, 5 Sep 2018 21:23:40 +0000 (21:23 +0000)]
MFC r324856:
Don't call realpath(3) from libmap rtld code.

5 years agoRegen.
kib [Wed, 5 Sep 2018 21:15:48 +0000 (21:15 +0000)]
Regen.

5 years agoMFC r338357:
kib [Wed, 5 Sep 2018 21:15:23 +0000 (21:15 +0000)]
MFC r338357:
Fix compat32 ftruncate cap mode.

PR: 230120

5 years agoMFC: r338261
marius [Wed, 5 Sep 2018 21:05:16 +0000 (21:05 +0000)]
MFC: r338261

- According to section 2.2.5 of the SDHCI specification version 4.20,
  SDHCI_TRNS_ACMD12 is to be set only for multiple-block read/write
  commands without data length information, so don't unconditionally
  set this bit. The result matches what e. g. Linux does.
- Section 2.2.19 of the SDHCI specification version 4.20 states that
  SDHCI_ACMD12_ERR should be only valid if SDHCI_INT_ACMD12ERR is set
  and hardware may clear SDHCI_ACMD12_ERR when SDHCI_INT_ACMD12ERR is
  cleared (differing silicon behavior is specifically allowed, though).
  Thus, read SDHCI_ACMD12_ERR before clearing SDHCI_INT_ACMD12ERR.
  While at it, use the 16-bit accessor rather than the 32-bit one for
  reading the 16-bit SDHCI_ACMD12_ERR.
- SDHCI_INT_TUNEERR isn't one of the ROC bits in SDHCI_INT_STATUS so
  clear it explicitly.
- Add missing prototypes and sort them.

5 years agoMFC: r338304
marius [Wed, 5 Sep 2018 20:43:46 +0000 (20:43 +0000)]
MFC: r338304

The read accessors generated by __BUS_ACCESSOR() have the problem that
they don't check the result of BUS_READ_IVAR(9) and silently return stack
garbage on failure in case a bus doesn't implement a particular instance
variable for example. With MMC bridges not providing MMCBR_IVAR_RETUNE_REQ,
yet, this in turn can cause mmc(4) to get into a state in which re-tuning
seems to be necessary but is inappropriate, causing mmc_wait_for_request()
to fail. Thus, don't use __BUS_ACCESSOR() for mmcbr_get_retune_req() and
instead provide a version of the latter which returns retune_req_none if
reading MMCBR_IVAR_RETUNE_REQ fails.

5 years agoMFC r314000:
oshogbo [Wed, 5 Sep 2018 20:13:28 +0000 (20:13 +0000)]
MFC r314000:

  Capsicumize traceroute.

  PR:  193973
  Submitted by:  Mikhail <mp39590@gmail.com>
  Reviewed by:  pjd, bapt, emaste, AllanJude
  Differential Revision: https://reviews.freebsd.org/D9303

5 years agoRevert an unintentional change from r338462.
markj [Wed, 5 Sep 2018 14:49:26 +0000 (14:49 +0000)]
Revert an unintentional change from r338462.

Reported by: kib

5 years agoAvoid printing extraneous function names when searching man page
cy [Wed, 5 Sep 2018 01:33:30 +0000 (01:33 +0000)]
Avoid printing extraneous function names when searching man page
database (apropos, man -k). This commit Replaces .SS with .SH,
similar to the man page provided by original heimdal (as in port).

PR: 230573
Submitted by: yuripv@yuripv.net

5 years agoMFC r337974:
markj [Wed, 5 Sep 2018 01:24:13 +0000 (01:24 +0000)]
MFC r337974:
Add INVARIANTS-only fences around lockless vnode refcount updates.

5 years agoMFC r338375:
markj [Wed, 5 Sep 2018 00:30:34 +0000 (00:30 +0000)]
MFC r338375:
sed: Fix -i option behavior with 'q' command.

PR: 230507

5 years agoMFC r338416:
markj [Tue, 4 Sep 2018 16:47:08 +0000 (16:47 +0000)]
MFC r338416:
Re-compute the ARC size before computing the MFU target.

5 years agoMFC r338350:
markj [Tue, 4 Sep 2018 16:45:08 +0000 (16:45 +0000)]
MFC r338350:
Add missing endpwent() and endgrent() calls to nfsuserd(8).

PR: 230937

5 years agoMFC r338353:
philip [Tue, 4 Sep 2018 09:58:13 +0000 (09:58 +0000)]
MFC r338353:
  Add libxo(3) support to lastlogin(8).

5 years agoMFC r319508:
philip [Tue, 4 Sep 2018 09:53:45 +0000 (09:53 +0000)]
MFC r319508:
  Fix a memory leak with last
  free memory allocated to 'buf'

  Submitted by: Thomas Rix <trix@juniper.net>

MFC r338352:
  Add libxo(3) support to last(1).

5 years agoMFC r338406:
kp [Mon, 3 Sep 2018 08:57:09 +0000 (08:57 +0000)]
MFC r338406:

frag6: Fix fragment reassembly

r337776 started hashing the fragments into buckets for faster lookup.

The hashkey is larger than intended. This results in random stack data being
included in the hashed data, which in turn means that fragments of the same
packet might end up in different buckets, causing the reassembly to fail.

Set the correct size for hashkey.

PR: 231045

5 years agoMFC r337522:
delphij [Mon, 3 Sep 2018 06:55:38 +0000 (06:55 +0000)]
MFC r337522:

In read_zones(), check if the file name actually fit in the buffer
and make sure it would terminate with nul with strlcpy().

Reviewed by: imp (earlier revision)
Differential Revision: https://reviews.freebsd.org/D16595

5 years agoMFC r336754: Improve --strip-trailing-cr handling.
delphij [Mon, 3 Sep 2018 06:36:28 +0000 (06:36 +0000)]
MFC r336754: Improve --strip-trailing-cr handling.

5 years agoMFC r338068, r338113:
kib [Sun, 2 Sep 2018 10:51:31 +0000 (10:51 +0000)]
MFC r338068, r338113:
Update L1TF workaround to sustain L1D pollution from NMI.

5 years agoMFC r338365:
markj [Sat, 1 Sep 2018 16:13:56 +0000 (16:13 +0000)]
MFC r338365:
Add a sysctl for the ZFS abd_scatter_enabled setting.

5 years agoMFC r338024:
kib [Sat, 1 Sep 2018 10:03:30 +0000 (10:03 +0000)]
MFC r338024:
Rudimentary AER reading code for ddb(4).

5 years agoMFC r338313:
kib [Sat, 1 Sep 2018 10:01:19 +0000 (10:01 +0000)]
MFC r338313:
Remove dead code in i386 cpu_throw().

5 years agoMFC r338312:
kib [Sat, 1 Sep 2018 09:59:46 +0000 (09:59 +0000)]
MFC r338312:
Unify amd64 and i386 vmspace0 pmap activation.

5 years agoMFC r333063: Update ELF Tool Chain to r3614
emaste [Fri, 31 Aug 2018 17:36:45 +0000 (17:36 +0000)]
MFC r333063: Update ELF Tool Chain to r3614

Sponsored by: The FreeBSD Foundation

5 years agoMFC r336745: elf_common: update ARM ABI flag names
emaste [Fri, 31 Aug 2018 17:35:09 +0000 (17:35 +0000)]
MFC r336745: elf_common: update ARM ABI flag names

In the V5 ABI the flags are EF_ARM_ABI_FLOAT_HARD and
EF_ARM_ABI_FLOAT_SOFT. The flags have the same values as the legacy GCC
flags EF_ARM_VFP_FLOAT and EF_ARM_SOFT_FLOAT respectively.

The legacy names are kept for compatibility.

Reported by: Peter Smith (Linaro)
Sponsored by: The FreeBSD Foundation

5 years agoMFC r333062: elf_common.h: add DT_SUNW_ASLR tag
emaste [Fri, 31 Aug 2018 17:34:18 +0000 (17:34 +0000)]
MFC r333062: elf_common.h: add DT_SUNW_ASLR tag

For upcoming ELF Tool Chain import (readelf).

Sponsored by: The FreeBSD Foundation

5 years agoMFC r337045: libelf: reload section headers after update with ELF_C_WRITE
emaste [Fri, 31 Aug 2018 17:29:24 +0000 (17:29 +0000)]
MFC r337045: libelf: reload section headers after update with ELF_C_WRITE

These issues (PR 218860 and PR 218861) are still undergoing additional
discussion in the upstream context and there may be additional changes
to come.

PR: 218860
Submitted by: Eric McCorkle
Sponsored by: The FreeBSD Foundation (MFC)

5 years agoMFC r337983, r338044:
kib [Fri, 31 Aug 2018 05:21:33 +0000 (05:21 +0000)]
MFC r337983, r338044:
Add pthread_get_name_np(3).

5 years agoMFV r338288: Unblock speculative prefetcher also on pool creation.
mav [Fri, 31 Aug 2018 01:50:40 +0000 (01:50 +0000)]
MFV r338288: Unblock speculative prefetcher also on pool creation.

Fix at r331950 appeared to be incomplete, fixing only case of pool
import, but not pool creation, leaving prefetcher still blocked for
newly created pools.

5 years agoMFC r337926:
markj [Thu, 30 Aug 2018 13:45:14 +0000 (13:45 +0000)]
MFC r337926:
Add partial documentation for dtrace(1)'s -x configuration options.

5 years agoMFC r338183, r338183:
kp [Wed, 29 Aug 2018 20:49:56 +0000 (20:49 +0000)]
MFC r338183, r338183:

pfctl: Improve set skip handling for groups

Rely on the kernel to appropriately mark group members as skipped.
Once a group is skipped we can clear the update flag on all the members.

PR: 229241
Submitted by: Andreas Longwitz <longwitz AT incore.de>

5 years agoMFC r332968:
markj [Wed, 29 Aug 2018 17:58:01 +0000 (17:58 +0000)]
MFC r332968:
Add a UMA zone flag to disable the use of buckets.

5 years agoMFC r333280:
markj [Wed, 29 Aug 2018 17:50:27 +0000 (17:50 +0000)]
MFC r333280:
Style.

5 years agoMFC r337965:
oshogbo [Wed, 29 Aug 2018 08:35:23 +0000 (08:35 +0000)]
MFC r337965:
  capsicum: allow the setproctitle(3) function in capability mode

  Capsicum in past allowed to change the process title.
  This was broken with r335939.

  PR:           230584
  Submitted by: Yuichiro NAITO <naito.yuichiro@gmail.com>
  Reported by:  ian@niw.com.au
  MFC after:    1 week

5 years agoMFC r337505, r337865, r337869: dd status=progress
kevans [Wed, 29 Aug 2018 02:18:13 +0000 (02:18 +0000)]
MFC r337505, r337865, r337869: dd status=progress

r337505:
dd: add status=progress support

This reports the current status on a single line every second, mirroring
similar functionality in GNU dd, and carefully interacts with SIGINFO.

PR: 229615

r337865:
dd: Incorporate some changes from imp for status=progress

Notable changes from what landed in r337505:
- sigalarm handler isn't setup unless we're actually using it
- Humanized versions of the amount of data transferred in the progress
  update

r337869:
dd(1): Kill off duplicate progress definition following r337865

5 years agoMFC r338142:
markj [Tue, 28 Aug 2018 14:33:04 +0000 (14:33 +0000)]
MFC r338142:
Set arc_kmem_cache_reap_retry_ms to 0 and make it configurable.

5 years agoMFC r337736:
ae [Tue, 28 Aug 2018 07:24:09 +0000 (07:24 +0000)]
MFC r337736:
  Restore ability to send ICMP and ICMPv6 redirects.

  It was lost when tryforward appeared. Now ip[6]_tryforward will be enabled
  only when sending redirects for corresponding IP version is disabled via
  sysctl. Otherwise will be used default forwarding function.

  PR: 221137

5 years agoMFC r337714:
kib [Mon, 27 Aug 2018 09:39:34 +0000 (09:39 +0000)]
MFC r337714:
Prevent some parallel swap-ins, rate-limit swapper swap-ins.

5 years agoMFC r336086:
ed [Mon, 27 Aug 2018 07:32:41 +0000 (07:32 +0000)]
MFC r336086:

  Use the FQDN in the newsyslog log message when RFC 5424 is enabled.

  The RFC 5424 spec mentions that logging FQDNs over short hostnames is
  preferred. Alter this code, so that the hostname doesn't get truncated
  on startup. Keep track of the length of the short hostname, so that
  fprintf() can do the truncation where necessary.

5 years agoMFC r338105: Remove extra M_ZERO from NG_MKRESPONSE() argument.
mav [Mon, 27 Aug 2018 03:42:19 +0000 (03:42 +0000)]
MFC r338105: Remove extra M_ZERO from NG_MKRESPONSE() argument.

NG_MKRESPONSE() sets M_ZERO by itself.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

5 years agoMFC r338201: increase heap size during "loader" on sparc64
lidl [Mon, 27 Aug 2018 03:32:40 +0000 (03:32 +0000)]
MFC r338201: increase heap size during "loader" on sparc64

Increase the size of the heap size available on sparc64 during
operation of "loader".  The dramatic increase in size of
SPA_MAXBLOCKSIZE in r304321 causes the heap space to be exhausted,
so malloc() fails, ultimately leading to a memcpy() with a
destination of 0x0.

5 years agoMFC r338038: Extending the delay cycles to give the codec more time to pump ADC data...
avatar [Sun, 26 Aug 2018 13:03:01 +0000 (13:03 +0000)]
MFC r338038: Extending the delay cycles to give the codec more time to pump ADC data across the AC-link.

Without this patch, some CS4614 cards will need users to reload the driver manually or
the hardware won't be initialised properly. Something like:

# kldload snd_csa
# kldunload snd_csa
# kldload snd_csa

Tested with: Terratec SiXPack 5.1+

5 years agoMFC r336420,336433,336593,336621,336622,336624,337394,337401,338141
cperciva [Sun, 26 Aug 2018 04:32:52 +0000 (04:32 +0000)]
MFC r336420,336433,336593,336621,336622,336624,337394,337401,338141

Teach the EC2 AMI upload code to:
* Mark EBS snapshots as public,
* Announce new AMIs to an SNS topic, and
* Place the SVN branch and revision into the AMI "description".

5 years agoMFC 338013: bsnmpd(8): fix and optimize interface description processing
eugen [Sat, 25 Aug 2018 09:48:17 +0000 (09:48 +0000)]
MFC 338013: bsnmpd(8): fix and optimize interface description processing

* correctly prepare a buffer to obtain interface description from a kernel
  and truncate long description instead of dropping it altogether and
  spamming logs;
* skip calling strlen() for each description and each SNMP request
  for MIB-II/ifXTable's ifAlias.
* teach bsnmpd to allocate memory dynamically for interface descriptions
  to decrease memory usage for common case and not to break
  if long description occurs;

PR: 217763
Reviewed by: harti and others
Differential Revision: https://reviews.freebsd.org/D16459

5 years agoMFC: r337438
rmacklem [Fri, 24 Aug 2018 22:41:32 +0000 (22:41 +0000)]
MFC: r337438
Allow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.

The code in newnfs_request() retries RPCs that get a reply of NFSERR_DELAY,
but exempts certain NFSv4 operations. However, for callback RPCs, there
should not be any exemptions at this time. The code would have erroneously
exempted the CBRECALL callback, since it has the same operation number as
the CLOSE operation.
This patch fixes this by checking for a callback RPC (indicated by clp != NULL)
and not checking for exempt operations for callbacks.
This would have only affected the NFSv4 server when delegations are enabled
(they are not enabled by default) and the client replies to CBRECALL with
NFSERR_DELAY. This may never actually happen.
Spotted during code inspection.

5 years agoFix the BEAGLEBONE image build on stable/11.
gjb [Fri, 24 Aug 2018 18:31:12 +0000 (18:31 +0000)]
Fix the BEAGLEBONE image build on stable/11.

r336726 merges r336598, r336599, r336600, and r336721, however
there was a mismerge in the BEAGLEBONE.conf where two references
to UFSMOUNT remained.

This is a direct commit to stable/11, as svn:mergeinfo had already
been recorded.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r337773, r337838, r338112, r338202:
kib [Fri, 24 Aug 2018 18:13:45 +0000 (18:13 +0000)]
MFC r337773, r337838, r338112, r338202:
Fixes for early EFIRT usage on amd64.

Activate vmspace0 pmap, not kernel_pmap.  Use special version of the
pmap activation code, pmap_activate_boot().  Ensure that PCID state for
the vmspace0 pmap is valid early.

5 years agoMFC r337981:
kib [Fri, 24 Aug 2018 18:08:16 +0000 (18:08 +0000)]
MFC r337981:
Reorder alphabetically.

5 years agoMFC r337906: Document KERNCONFDIR
kevans [Fri, 24 Aug 2018 02:23:25 +0000 (02:23 +0000)]
MFC r337906: Document KERNCONFDIR

5 years agoMFC r338020: res_find: Fix fallback logic
kevans [Fri, 24 Aug 2018 02:21:14 +0000 (02:21 +0000)]
MFC r338020: res_find: Fix fallback logic

The fallback logic was broken if hints were found in multiple environments.
If we found a hint in either the loader environment or the static
environment, fallback would be incremented excessively when we returned to
the environment-selection bits. These checks should have also been guarded
by the fbacklvl checks. As a result, fbacklvl could quickly get to a point
where we skip either the static environment and/or the static hints
depending on which environments contained valid hints.

The impact of this bug is minimal, mostly affecting mips boards that use
static hints and may have hints in either the loader environment or the
static environment.

There may be better ways to express the searchable environments and
describing their characteristics (immutable, already searched, etc.) but
this may be revisited after 12 branches.

5 years agoMFC r337500:
markj [Thu, 23 Aug 2018 21:24:22 +0000 (21:24 +0000)]
MFC r337500:
Use the right variable when updating interface routes.

PR: 229807

5 years agoMFC r337536:
ae [Thu, 23 Aug 2018 13:07:22 +0000 (13:07 +0000)]
MFC r337536:
  If -q flag is specified, do not complain when we are trying to delete
  nonexistent NAT instance or nonexistent rule.

  This allows execute batched `delete` commands and do not fail when
  found nonexistent rule.

MFC r337574:
  Restore the behaviour changed in r337536, when bad `ipfw delete` command
  returns error.

  Now -q option only makes it quiet. And when -f flag is specified, the
  command will ignore errors and continue executing with next batched
  command.

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

5 years agoMFC r338120: config(8): Allow escape-quoted empty strings
kevans [Thu, 23 Aug 2018 02:19:00 +0000 (02:19 +0000)]
MFC r338120: config(8): Allow escape-quoted empty strings

For use with things like BOOT_TAG=\"\" -- there are valid reasons to allow
empty strings, especially as these are usually being passed through as
options. The same argument could perhaps be made for the unquoted
variant in things like MODULES_OVERRIDE="", but it's not immediately clear
that this is an issue so I've left it untouched.

5 years agoMFC r337615:
dim [Wed, 22 Aug 2018 17:36:27 +0000 (17:36 +0000)]
MFC r337615:

Pull in r338481 from upstream llvm trunk (by Chandler Carruth):

  [x86] Fix a really subtle miscompile due to a somewhat glaring bug in
  EFLAGS copy lowering.

  If you have a branch of LLVM, you may want to cherrypick this. It is
  extremely unlikely to hit this case empirically, but it will likely
  manifest as an "impossible" branch being taken somewhere, and will be
  ... very hard to debug.

  Hitting this requires complex conditions living across complex
  control flow combined with some interesting memory (non-stack)
  initialized with the results of a comparison. Also, because you have
  to arrange for an EFLAGS copy to be in *just* the right place, almost
  anything you do to the code will hide the bug. I was unable to reduce
  anything remotely resembling a "good" test case from the place where
  I hit it, and so instead I have constructed synthetic MIR testing
  that directly exercises the bug in question (as well as the good
  behavior for completeness).

  The issue is that we would mistakenly assume any SETcc with a valid
  condition and an initial operand that was a register and a virtual
  register at that to be a register *defining* SETcc...

  It isn't though....

  This would in turn cause us to test some other bizarre register,
  typically the base pointer of some memory. Now, testing this register
  and using that to branch on doesn't make any sense. It even fails the
  machine verifier (if you are running it) due to the wrong register
  class. But it will make it through LLVM, assemble, and it *looks*
  fine... But wow do you get a very unsual and surprising branch taken
  in your actual code.

  The fix is to actually check what kind of SETcc instruction we're
  dealing with. Because there are a bunch of them, I just test the
  may-store bit in the instruction. I've also added an assert for
  sanity that ensure we are, in fact, *defining* the register operand.
  =D

Noticed by: kib

5 years agoMFC r338016:
kib [Wed, 22 Aug 2018 13:47:06 +0000 (13:47 +0000)]
MFC r338016:
Print L1D FLUSH feature.

5 years agoMFC r338051:
kib [Wed, 22 Aug 2018 13:45:15 +0000 (13:45 +0000)]
MFC r338051:
Provide set_constraint_handler_s(3) man page.

5 years agoMFC r338049:
kib [Wed, 22 Aug 2018 13:44:24 +0000 (13:44 +0000)]
MFC r338049:
Clarify that memset_s(3) requires __STDC_WANT_LIB_EXT1__ for visibility.
Fix typos and other nits.

5 years agoMFC r338048:
kib [Wed, 22 Aug 2018 13:43:23 +0000 (13:43 +0000)]
MFC r338048:
Use tab for indent.

5 years agoMFC r337728: (committed by jilles)
pfg [Wed, 22 Aug 2018 04:27:33 +0000 (04:27 +0000)]
MFC r337728: (committed by jilles)
printf: Add test for width and precision in %b format

PR:  229641

5 years agoMFC r337456:
pfg [Wed, 22 Aug 2018 04:20:20 +0000 (04:20 +0000)]
MFC r337456:
msdosfs: fixes for Undefined Behavior.

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD (CVS 1.33)

5 years agoMFC r338047:
cy [Wed, 22 Aug 2018 01:43:11 +0000 (01:43 +0000)]
MFC r338047:

The bucket index is subtracted by one at lines 2304 and 2314.  When 0 it
becomes -1, except these are unsigned integers, so they become very large
numbers. Thus are always larger than the maximum bucket; the hash table
insertion fails causing NAT to fail.

This commit ensures that if the index is already zero it is not reduced
prior to insertion into the hash table.

PR: 208566

5 years agoMFC r338046:
cy [Wed, 22 Aug 2018 01:23:11 +0000 (01:23 +0000)]
MFC r338046:

Add handy DTrace probes useful in diagnosing NAT issues. DTrace probes
are situated next to error counters and/or in one instance prior to the
-1 return from various functions. This was useful in diagnosis of
PR/208566 and will be handy in the future diagnosing NAT failures.

PR: 208566

5 years agoMFC r338045:
cy [Wed, 22 Aug 2018 01:04:52 +0000 (01:04 +0000)]
MFC r338045:

Expose np (nat_t - an entry in the nat table structure) in the DTrace
probe when nat fails (label badnat). This is useful in diagnosing
failed NAT issues and was used in PR/208566.

PR: 208566

5 years agoMFC: r336839
rmacklem [Tue, 21 Aug 2018 11:10:49 +0000 (11:10 +0000)]
MFC: r336839
Modify the NFSv4.1 server so that it allows ReclaimComplete as done by ESXi 6.7.

I believe that a ReclaimComplete with rca_one_fs == TRUE is only
to be used after a file system has been transferred to a different
file server.  However, RFC5661 is somewhat vague w.r.t. this and
the ESXi 6.7 client does both a ReclaimComplete with rca_one_fs == TRUE
and one with ReclaimComplete with rca_one_fs == FALSE.
Therefore, just ignore the rca_one_fs == TRUE operation and return
NFS_OK without doing anything instead of replying NFS4ERR_NOTSUPP.
This allows the ESXi 6.7 NFSv4.1 client to do a mount.
After discussion on the NFSv4 IETF working group mailing list, doing this
along with setting a flag to note that a ReclaimComplete with rca_one_fs TRUE
was an appropriate way to handle this.
The flag that indicates that a ReclaimComplete with rca_one_fs == TRUE was
done may be used to disable replies of NFS4ERR_GRACE for non-reclaim
state operations in a future commit.

This patch along with r332790, r334492 and r336357 allow ESXi 6.7 NFSv4.1 mounts
work ok. ESX 6.5 NFSv4.1 mounts do not work well, due to what I believe are
violations of RFC-5661 and should not be used.

5 years agoMFC r337422:
pfg [Tue, 21 Aug 2018 01:17:28 +0000 (01:17 +0000)]
MFC r337422:
libc: fix cases of undefined behavior.

These were found by the Undefined Behavior GsoC project at NetBSD:

Avoid undefined behavior in ftok(3)

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

ftok.c:56:10, left shift of 123456789 by 24 places cannot be represented
in type 'int'
ftok.c:56:10, left shift of 4160 by 24 places cannot be represented in
type 'int'

Avoid undefined behavior in an inet_addr.c

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

inet_addr.c:218:20, left shift of 131 by 24 places cannot be represented
in type 'int'

Detected with micro-UBSan in the user mode.

Obtained from: NetBSD

5 years agoMFC r337410:
cy [Tue, 21 Aug 2018 00:37:48 +0000 (00:37 +0000)]
MFC r337410:

Remove redundant and incorrect default definition of AF_INET6. AF_INET6
is defined in sys/socket.h where it's defined as 28.

A bit of trivia: On NetBSD AF_INET6 is defined as 24. On Solaris it is
defined as 26. This is probably why Darren defaulted to 26, because
ipfilter was originally written for SunOS 4 and Solaris many moons ago.

5 years agoMFC boot tagging support: r337518, r337544-r337546, r337548,
kevans [Mon, 20 Aug 2018 17:27:30 +0000 (17:27 +0000)]
MFC boot tagging support:  r337518, r337544-r337546, r337548,
r337579-r337580, r337952

This is equivalent to what's in head, except the default is an empty boot
tag string so that nothing gets output by default.

r337518:
kern: Add a BOOT_TAG marker at the beginning of boot dmesg

From the "newly licensed to drive" PR department, add a BOOT_TAG marker (by
default, --<<BOOT>>--, to the beginning of each boot's dmesg. This makes it
easier to do textproc magic to locate the start of each boot and, of
particular interest to some, the dmesg of the current boot.

The PR has a dmesg(8) component as well that I've opted not to include for
the moment- it was the more contentious part of this PR.

bde@ also made the statement that this boot tag should be written with an
ordinary printf, which I've- for the moment- declined to change about this
patch to keep it more transparent to observer of the boot process.

PR: 43434
Submitted by: dak <aurelien.nephtali@wanadoo.fr> (basically rewritten)

r337544:
msgbuf: Light detailing (const'ify and bool'itize)

r337545:
BOOT_TAG: Make a config(5) option, expose as sysctl and loader tunable

BOOT_TAG lived shortly in sys/msgbuf.h, but this wasn't necessarily great
for changing it or removing it. Move it into subr_prf.c and add options for
it to opt_printf.h.

One can specify both the BOOT_TAG and BOOT_TAG_SZ (really, size of the
buffer that holds the BOOT_TAG). We expose it as kern.boot_tag and also add
a loader tunable by the same name that we'll fetch upon initialization of
the msgbuf.

This allows for flexibility and also ensures that there's a consistent way
to figure out the boot tag of the running kernel, rather than relying on
headers to be in-sync.

Prodded super-super-lightly by: imp

r337546:
subr_prf: Use "sizeof current_boot_tag" instead

r337548:
subr_prf: style(9) the sizeof

Reported by: jkim, ian

r337579:
boot tagging: minor fixes

msgbufinit may be called multiple times as we initialize the msgbuf into a
progressively larger buffer. This doesn't happen as of now on head, but it
may happen in the future and we generally support this. As such, only print
the boot tag if we've just initialized the buffer for the first time.

The boot tag also now has a newline appended to it for better visibility,
and has been switched to a normal printf, by requesto f bde, after we've
denoted that the msgbuf is mapped.

r337580:
subr_prf: remove think-o that had returned to local patch

Reported by: cognet

r337952:
subr_prf: Don't write kern.boot_tag if it's empty

This change allows one to set kern.boot_tag="" and not get a blank line
preceding other boot messages. While this isn't super critical- blank lines
are easy to filter out both mentally and in processing dmesg later- it
allows for a mode of operation that matches previous behavior.

I intend to MFC this whole series to stable/11 by the end of the month with
boot_tag empty by default to make this effectively a nop in the stable
branch.

5 years agoMFC r337969:
kp [Mon, 20 Aug 2018 14:27:37 +0000 (14:27 +0000)]
MFC r337969:

pf: Limit the maximum number of fragments per packet

Similar to the network stack issue fixed in r337782 pf did not limit the number
of fragments per packet, which could be exploited to generate high CPU loads
with a crafted series of packets.

Limit each packet to no more than 64 fragments. This should be sufficient on
typical networks to allow maximum-sized IP frames.

This addresses the issue for both IPv4 and IPv6.

Security: CVE-2018-5391
Sponsored by: Klara Systems

5 years agoMFC r337867:
jamie [Mon, 20 Aug 2018 05:32:40 +0000 (05:32 +0000)]
MFC r337867:

  Don't let clobber jailparam values when checking for modification of
  init-only parameters.

PR: 230487
Submitted by: Jason Mader

5 years agoMFC r321316, r337860:
loos [Mon, 20 Aug 2018 01:38:48 +0000 (01:38 +0000)]
MFC r321316, r337860:

Fix a few typos in comments.

5 years agoMFC r312770 and r337854:
loos [Mon, 20 Aug 2018 01:01:33 +0000 (01:01 +0000)]
MFC r312770 and r337854:

After the in_control() changes in r257692, an existing address is
(intentionally) deleted first and then completely added again (so all the
events, announces and hooks are given a chance to run).

This cause an issue with CARP where the existing CARP data structure is
removed together with the last address for a given VHID, which will cause
a subsequent fail when the address is later re-added.

This change fixes this issue by adding a new flag to keep the CARP data
structure when an address is not being removed.

There was an additional issue with IPv6 CARP addresses, where the CARP data
structure would never be removed after a change and lead to VHIDs which
cannot be destroyed.

PR: 229384
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoMFC r337696: Use INCS for non-sys/ libnvpair and libzfs_core includes
kevans [Mon, 20 Aug 2018 00:53:38 +0000 (00:53 +0000)]
MFC r337696: Use INCS for non-sys/ libnvpair and libzfs_core includes

While nothing was wrong with libnvpair.h, libzfs_core.h was only guarded by
MK_CDDL rather than MK_CDDL && MK_ZFS. Rather than ugl'if'ying
include/Makefile to impose the extra restriction, just move the non-sys/
includes into INCS with the respect lib builds.

This has the added bonus of allowing third party packagers to try and split
these libs out of the FreeBSD-runtime package, if they are so inclined.

The sys/ include was left alone- generally userland libraries shouldn't
install kernel headers.

5 years agoMFC r337666: getopt_long(3): Document behavior, optstring leading characters
kevans [Mon, 20 Aug 2018 00:51:19 +0000 (00:51 +0000)]
MFC r337666: getopt_long(3): Document behavior, optstring leading characters

Leading '+', '-', and ':' in optstring have special meaning. We briefly
mention that the first two have special meaning in that we say
POSIXLY_CORRECT turns them off, but we don't actually document their
meaning. Add a paragraph to RETURN VALUES explaining how they control
the treatment of non-option arguments.

A leading ':' has no mention; add a note that it suppresses warnings about
missing arguments.

5 years agoMFC r337524: libi386: Fix typo in pxe.h
kevans [Mon, 20 Aug 2018 00:50:11 +0000 (00:50 +0000)]
MFC r337524: libi386: Fix typo in pxe.h

PR: 207337

5 years agoMFC r337523: libsa: exit on EOF in ngets
kevans [Mon, 20 Aug 2018 00:49:06 +0000 (00:49 +0000)]
MFC r337523: libsa: exit on EOF in ngets

It was possible in some rare circumstances for ngets to behave terribly with
bhyveload and some form of redirecting user input over a pipe.

PR: 198706

5 years agoMFC r337665: krb5-config build: Remove gratuitous escaping
kevans [Mon, 20 Aug 2018 00:47:51 +0000 (00:47 +0000)]
MFC r337665: krb5-config build: Remove gratuitous escaping