]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFC r347265:
hselasky [Thu, 16 May 2019 17:25:01 +0000 (17:25 +0000)]
MFC r347265:
Ticks are integer type in FreeBSD.

Sponsored by: Mellanox Technologies

5 years agoMFC r347264:
hselasky [Thu, 16 May 2019 17:24:21 +0000 (17:24 +0000)]
MFC r347264:
Configure firmware to use RX hash format in mini CQE in mlx5en(4).

When using CQE zipping, one can choose between RX hash and Checksum.
This will indicate the parameter on which a zipping session should be
stopped.

While porting the Linux code, Checksum was chosen. However, the value
of Checksum is not being used anywhere.
For the FreeBSD driver, we prefer to use the RX hash format which will
guarantee the RX hash value for all the mini CQEs.
While at it, make sure to initialize the Checksum value in the
decompressed CQE.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347263:
hselasky [Thu, 16 May 2019 17:23:36 +0000 (17:23 +0000)]
MFC r347263:
Disable CQE zipping by default in mlx5en(4).

After doing performance measurements, it seems like CQE zipping doesn't
have any significant benefit.
Moreover, we know that this feature is disabled by default on other
operating systems (Linux for example).

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347262:
hselasky [Thu, 16 May 2019 17:22:57 +0000 (17:22 +0000)]
MFC r347262:
Split mlx5e_update_stats_work() in mlx5en(4).

Split the function into the mlx5e_update_stats_locked() core and make
mlx5e_update_stats_work() call the _locked helper, similar to many other
places in the kernel. This improves the code structure, making the
locking clean.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347261:
hselasky [Thu, 16 May 2019 17:22:11 +0000 (17:22 +0000)]
MFC r347261:
Implement fast close of RX channel in mlx5en(4).

Instead of waiting for all jobs to be cancelled, simply close the completion
queue to prevent more completion events and let mlx5e_destroy_rq() cleanup
the remaining mbufs.

Sponsored by: Mellanox Technologies

5 years agoMFC r347260 and r347326:
hselasky [Thu, 16 May 2019 17:21:27 +0000 (17:21 +0000)]
MFC r347260 and r347326:
Correct number of elements for priority to traffic class mappings in mlx5en(4).

The number of priorities is always 8, while the number of traffic classes
supported can vary. While at it convert the sysctl node into an array.

Sponsored by: Mellanox Technologies

5 years agoMFC r347259:
hselasky [Thu, 16 May 2019 17:19:48 +0000 (17:19 +0000)]
MFC r347259:
Remove unused module parameter in mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r347258:
hselasky [Thu, 16 May 2019 17:19:03 +0000 (17:19 +0000)]
MFC r347258:
Make sure to error out when arming the CQ fails in mlx4ib and mlx5ib.

Sponsored by: Mellanox Technologies

5 years agoMFC r347257:
hselasky [Thu, 16 May 2019 17:18:29 +0000 (17:18 +0000)]
MFC r347257:
Make sure to error out when arming the CQ fails in ibcore.

Sponsored by: Mellanox Technologies

5 years agoMFC r347256:
hselasky [Thu, 16 May 2019 17:17:52 +0000 (17:17 +0000)]
MFC r347256:
Destroy port stats debug context in correct order in mlx5en(4).
Destroy children nodes before parent nodes.

Sponsored by: Mellanox Technologies

5 years agoMFC r347255:
hselasky [Thu, 16 May 2019 17:17:12 +0000 (17:17 +0000)]
MFC r347255:
Fix tx_jumbo_packets counter in mlx5en(4).

Instead of reading Ethernet RFC 2819 pXtoYoctets counters from
hardware which counts RX octets, count tx_stat_pXtoYoctets from
Ethernet extended counters which counts TX octets.

TX jumbo counters should be accumulated only after the PPCNT
counters were fetched from hardware with their latest value.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347254:
hselasky [Thu, 16 May 2019 17:16:31 +0000 (17:16 +0000)]
MFC r347254:
Update Ethernet extended counters in mlx5en(4).

Expose all Ethernet extended counters those counters via debug_stats
sysctl:
dev.mce.X.debug_stats

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347253:
hselasky [Thu, 16 May 2019 17:15:41 +0000 (17:15 +0000)]
MFC r347253:
Protect from infinite sw-reset loop in mlx5core.

Avoid an infinite software firmware reset loop that may be caused by a
hardware bug by limiting the maximum number of resets.
The counter between resets is reset by request for reset, and not by a
successful reset.
The interval between two resets can be configured via sysctl:
hw.mlx5.sw_reset_timeout
which is global to all mlx5 devices in the system.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347252:
hselasky [Thu, 16 May 2019 17:15:00 +0000 (17:15 +0000)]
MFC r347252:
Disable all MSIX interrupts before shutdown in mlx5.

Make sure the interrupt handlers don't race with the fast unload one
code in the shutdown handler.

Sponsored by: Mellanox Technologies

5 years agoMFC r347251:
hselasky [Thu, 16 May 2019 17:14:08 +0000 (17:14 +0000)]
MFC r347251:
Import Linux code to implement mlx5_ib_disassociate_ucontext() in mlx5ib.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347250:
hselasky [Thu, 16 May 2019 17:13:21 +0000 (17:13 +0000)]
MFC r347250:
Add temperature warning event to log in mlx5core.

Temperature warning event is sent by FW to indicate high temperature
as detected by one of the sensors on the board.
Add handling of this event by writing the numbers of the alert sensors
to the kernel log.

Linux commit:
1865ea9adbfaf341c5cd5d8f7d384f19948b2fe9

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347249:
hselasky [Thu, 16 May 2019 17:12:38 +0000 (17:12 +0000)]
MFC r347249:
Correctly define the interface state bits in mlx5en(4).

While at it remove unused interface state bits. This also fixes and issue
during shutdown:

There is an issue where the firmware fails during mlx5_load_one,
the health_care timer detects the issue and schedules a health_care call.
Then the mlx5_load_one detects the issue, cleans up and quits. Then
the health_care starts and calls mlx5_unload_one to clean up the resources
that no longer exist and causes kernel panic.

The root cause is that the bit MLX5_INTERFACE_STATE_DOWN is not set
after mlx5_load_one fails. The solution is removing the bit
MLX5_INTERFACE_STATE_DOWN and quit mlx5_unload_one if the
bit MLX5_INTERFACE_STATE_UP is not set. The bit MLX5_INTERFACE_STATE_DOWN
is redundant and we can use MLX5_INTERFACE_STATE_UP instead.

Linux commit:
10a8d00707082955b177164d4b4e758ffcbd4017
b3cb5388499c5e219324bfe7da2e46cbad82bfcf

Sponsored by: Mellanox Technologies

5 years agoMFC r347248:
hselasky [Thu, 16 May 2019 17:11:45 +0000 (17:11 +0000)]
MFC r347248:
Enable FPGA and FPGA QP errors for EQ and call the handler in mlx5core.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347247:
hselasky [Thu, 16 May 2019 17:11:02 +0000 (17:11 +0000)]
MFC r347247:
Add MLX5_FPGA_RELOAD IOCTL(2) to mlx5fpga.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r347246:
hselasky [Thu, 16 May 2019 17:09:06 +0000 (17:09 +0000)]
MFC r347246:
Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4).

Add support for DIM based on Linux,
with some minor adaptions specific to FreeBSD.

Linux commit
f97c3dc3c0e8d23a5c4357d182afeef4c67f5c33

Sponsored by: Mellanox Technologies

5 years agoMFC r347190:
hselasky [Thu, 16 May 2019 17:04:15 +0000 (17:04 +0000)]
MFC r347190:
Use PCIV_INVALID in pci_channel_offline() in the LinuxKPI.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347188:
hselasky [Thu, 16 May 2019 17:03:16 +0000 (17:03 +0000)]
MFC r347188:
Disabling a PCI device should only disable busmaster in the LinuxKPI.

As Linux comment for this function point:
Signal to the system that the PCI device is not in use by the system
anymore. This only involves disabling PCI bus-mastering, if active.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347187:
hselasky [Thu, 16 May 2019 17:02:31 +0000 (17:02 +0000)]
MFC r347187:
Implement print_hex_dump_debug() function macro in the LinuxKPI.

Build tested drm-current-kmod prior to commit.

Submitted by: slavash@
Sponsored by: Mellanox Technologies

5 years agoMFC r347185:
hselasky [Thu, 16 May 2019 17:01:39 +0000 (17:01 +0000)]
MFC r347185:
Allow controlling pr_debug at runtime in the LinuxKPI.

Turning on pr_debug at compile time make it non-optional at runtime.
This often means that the amount of the debugging is unbearable.
Allow developer to turn on pr_debug output only when needed.

Build tested drm-current-kmod prior to commit.

Submitted by: kib@
Sponsored by: Mellanox Technologies

5 years agoMFC r346968, r346973
ian [Thu, 16 May 2019 15:32:03 +0000 (15:32 +0000)]
MFC r346968, r346973

r346968:
Update the manpage text to show the output generated by the first-stage
bootloader these days (x86 instead of i386).

r346973:
Add a paragraph that mentions gptboot having an interactive mode, and
direct the user to the boot(8) manpage, which provides the details on that.

5 years agoMFC r347368:
kib [Thu, 16 May 2019 14:48:08 +0000 (14:48 +0000)]
MFC r347368:
x86: Put other CPUs into tight loop when updating Intel microcode from
loaded OS.

5 years agoMFC r343985, r344133, r345273 (by bde):
kib [Thu, 16 May 2019 14:46:21 +0000 (14:46 +0000)]
MFC r343985, r344133, r345273 (by bde):
Prevent overflow for usertime/systime in caclru1().

PR: 76972

5 years agoMFC r337715, r337751, r337754, r337758, r337813, r338354, r338687,
markj [Thu, 16 May 2019 14:42:16 +0000 (14:42 +0000)]
MFC r337715, r337751, r337754, r337758, r337813, r338354, r338687,
    r339124, r341821:
Add support for boot-time Intel microcode loading.

5 years agoMFC r346402:
tuexen [Thu, 16 May 2019 11:20:02 +0000 (11:20 +0000)]
MFC r346402:

When a checksum has to be computed for a received IPv6 packet because it
is requested by the application using the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM on a raw socket, ensure that the packet contains enough
bytes to contain the checksum at the specified offset.

5 years agoMFC r346401:
tuexen [Thu, 16 May 2019 11:18:50 +0000 (11:18 +0000)]
MFC r346401:

Avoid a buffer overwrite in rip6_output() when computing the checksum
as requested by the user via the IPPROTO_IPV6 level socket option
IPV6_CHECKSUM. The check if there are enough bytes in the packet to
store the checksum at the requested offset was wrong by 1.

5 years agoMFC r346400:
tuexen [Thu, 16 May 2019 11:14:08 +0000 (11:14 +0000)]
MFC r346400:

Improve input validation for the socket option IPV6_CHECKSUM.

When using the IPPROTO_IPV6 level socket option IPV6_CHECKSUM on a raw
IPv6 socket, ensure that the value is either -1 or a non-negative even
number.

5 years agoMFC r346182:
tuexen [Thu, 16 May 2019 11:09:53 +0000 (11:09 +0000)]
MFC r346182:

When sending IPv4 packets on a SOCK_RAW socket using the IP_HDRINCL option,
ensure that the ip_hl field is valid. Furthermore, ensure that the complete
IPv4 header is contained in the first mbuf. Finally, move the length checks
before relying on them when accessing fields of the IPv4 header.

5 years agoMFC r347016:
dchagin [Thu, 16 May 2019 10:43:52 +0000 (10:43 +0000)]
MFC r347016:

Remove unneeded includes.

5 years agoMFC r346134:
tuexen [Thu, 16 May 2019 09:33:38 +0000 (09:33 +0000)]
MFC r346134:

Fix an SCTP related locking issue. Don't report that the TCB_SEND_LOCK
is owned, when it is not.

This issue was found by running syzkaller.

5 years agoMFC r345525:
tuexen [Thu, 16 May 2019 09:32:00 +0000 (09:32 +0000)]
MFC r345525:

Fix a double free of an SCTP association in an error path.
This is joint work with rrs@. The issue was found by running
syzkaller.

5 years agoMFC r345505:
tuexen [Thu, 16 May 2019 09:29:49 +0000 (09:29 +0000)]
MFC r345505:

Initialize scheduler specific data for the FCFS scheduler.
This is joint work with rrs@. The issue was reported by using
syzkaller.

5 years agoMFC r345504:
tuexen [Thu, 16 May 2019 09:28:34 +0000 (09:28 +0000)]
MFC r345504:

Improve locking when tearing down an SCTP association.
This is joint work with rrs@ and the issue was found by
syzkaller.

5 years agoMFC r345494:
tuexen [Thu, 16 May 2019 09:27:13 +0000 (09:27 +0000)]
MFC r345494:

Fix the handling of fragmented unordered messages when using DATA chunks
and FORWARD-TSN.

This bug was reported in https://github.com/sctplab/usrsctp/issues/286
for the userland stack.

This is joint work with rrs@.

5 years agoMFC r345467:
tuexen [Thu, 16 May 2019 09:25:49 +0000 (09:25 +0000)]
MFC r345467:

Fix build issue for the userland stack.
Joint work with rrs@.

5 years agoMFC r345466:
tuexen [Thu, 16 May 2019 09:24:11 +0000 (09:24 +0000)]
MFC r345466:

Fix more signed unsigned issues. This time on the send path.
This is joint work with rrs@ and was found by running syzkaller.

5 years agoMFC r345465:
tuexen [Thu, 16 May 2019 09:22:37 +0000 (09:22 +0000)]
MFC r345465:

Fix a signed/unsigned bug when receiving SCTP messages.
This is joint work with rrs@.

5 years agoMFC r345461:
tuexen [Thu, 16 May 2019 09:20:54 +0000 (09:20 +0000)]
MFC r345461:

Limit the size of messages sent on 1-to-many style SCTP sockets with the
SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint.

This fixes an issue found by running syzkaller and is joint work with rrs@.

5 years agoMFC r345460:
tuexen [Thu, 16 May 2019 09:18:59 +0000 (09:18 +0000)]
MFC r345460:

Limit the number of bytes which can be queued for SCTP sockets.
This is joint work with rrs@.

5 years agoMFC r344925:
tuexen [Thu, 16 May 2019 09:16:47 +0000 (09:16 +0000)]
MFC r344925:

Fix locking bug.

5 years agoMFC r344924:
tuexen [Thu, 16 May 2019 09:15:18 +0000 (09:15 +0000)]
MFC r344924:

Some cleanup and consistency improvements.

5 years agoMFC r344872:
tuexen [Thu, 16 May 2019 09:13:41 +0000 (09:13 +0000)]
MFC r344872:

After removing an entry from the stream scheduler list, set the pointers
to NULL, since we are checking for it in case the element gets inserted
again.

This issue was found by running syzkaller.

5 years agoMFC r344742:
tuexen [Thu, 16 May 2019 09:12:13 +0000 (09:12 +0000)]
MFC r344742:

Allocate an assocition id and register the stcb with holding the lock.
This avoids a race where stcbs can be found, which are not completely
initialized.

This was found by running syzkaller.

5 years agoMFC r344726:
tuexen [Thu, 16 May 2019 09:10:14 +0000 (09:10 +0000)]
MFC r344726:

Remove debug output.

5 years agoMFC r344724:
tuexen [Thu, 16 May 2019 09:07:11 +0000 (09:07 +0000)]
MFC r344724:

Allow SCTP stream reconfiguration operations only in ESTABLISHED
state.

This issue was found by running syzkaller.

5 years agoMFC r344723:
tuexen [Thu, 16 May 2019 09:05:15 +0000 (09:05 +0000)]
MFC r344723:

Handle the case when calling the IPPROTO_SCTP level socket option
SCTP_STATUS on an association with no primary path (early state).

This issue was found by running syzkaller.

5 years agoMFC r344722:
tuexen [Thu, 16 May 2019 09:03:48 +0000 (09:03 +0000)]
MFC r344722:

Use correct buffer sizes in sctp_get[lp]addrs().

5 years agoMFC r344721:
tuexen [Thu, 16 May 2019 09:02:30 +0000 (09:02 +0000)]
MFC r344721:

Report the correct length when using the IPPROTO_SCTP level
socket options SCTP_GET_PEER_ADDRESSES and SCTP_GET_LOCAL_ADDRESSES.

5 years agoMFC r344708:
tuexen [Thu, 16 May 2019 08:57:08 +0000 (08:57 +0000)]
MFC r344708:

Honor the memory limits provided when processing the IPPROTO_SCTP
level socket option SCTP_GET_LOCAL_ADDRESSES in a getsockopt() call.

Thanks to Thomas Barabosch for reporting the issue which was found by
running syzkaller.

5 years agoMFC r344704:
tuexen [Thu, 16 May 2019 08:53:55 +0000 (08:53 +0000)]
MFC r344704:

mprove consistency, not functional change.

5 years agoMFC r344048:
tuexen [Thu, 16 May 2019 08:50:25 +0000 (08:50 +0000)]
MFC r344048:

Improve input validation for raw IPv4 socket using the IP_HDRINCL
option.

This issue was found by running syzkaller on OpenBSD.
Greg Steuck made me aware that the problem might also exist on FreeBSD.

5 years agoMFC r343961:
tuexen [Thu, 16 May 2019 08:47:28 +0000 (08:47 +0000)]
MFC r343961:

Fix a locking issue when reporing outbount messages.

5 years agoMFC r343960:
tuexen [Thu, 16 May 2019 08:45:54 +0000 (08:45 +0000)]
MFC r343960:

Fix a locking issue in the IPPROTO_SCTP level SCTP_PEER_ADDR_THLDS socket
option. The problem affects only setsockopt with invalid parameters.

This issue was found by syzkaller.

5 years agoMFC r343954:
tuexen [Thu, 16 May 2019 08:44:12 +0000 (08:44 +0000)]
MFC r343954:

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.

5 years agoMFC r343951:
tuexen [Thu, 16 May 2019 08:42:20 +0000 (08:42 +0000)]
MFC r343951:

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.

5 years agoMFC r343770:
tuexen [Thu, 16 May 2019 08:40:10 +0000 (08:40 +0000)]
MFC r343770:

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.

5 years agoMFC r343769:
tuexen [Thu, 16 May 2019 08:38:20 +0000 (08:38 +0000)]
MFC r343769:

Fix an off-by-one error in the input validation of the SCTP_RESET_STREAMS
socketoption.

This was found by running syzkaller.

5 years agoMFC r339221:
tuexen [Thu, 16 May 2019 08:26:44 +0000 (08:26 +0000)]
MFC r339221:

Avoid truncating unrecognised parameters when reporting them.
This resulted in sending malformed packets.

5 years agoMFC r339219:
tuexen [Thu, 16 May 2019 08:24:53 +0000 (08:24 +0000)]
MFC r339219:

Ensure that the ips_localout counter is incremented for
locally generated SCTP packets sent over IPv4. This make
the behaviour consistent with IPv6.

5 years agoMFC r339040:
tuexen [Thu, 16 May 2019 08:22:50 +0000 (08:22 +0000)]
MFC r339040:

After allocating chunks set the fields in a consistent way.
This removes two assignments for the flags field being done
twice and adds one, which was missing.
Thanks to Felix Weinrank for reporting the issue he found
by using fuzz testing of the userland stack.

5 years agoMFC r339028:
tuexen [Thu, 16 May 2019 08:21:01 +0000 (08:21 +0000)]
MFC r339028:

Plug mbuf leak in the SCTP input path in an error case.

5 years agoMFC r339027:
tuexen [Thu, 16 May 2019 08:19:23 +0000 (08:19 +0000)]
MFC r339027:

Plug mbuf leaks in the SCTP output path in error cases.

5 years agoMFC r339024:
tuexen [Thu, 16 May 2019 08:17:32 +0000 (08:17 +0000)]
MFC r339024:

Fix the handling of ancillary data for SCTP socket. Implement
sctp_process_cmsgs_for_init() and sctp_findassociation_cmsgs()
similar to sctp_find_cmsg() to improve consistency and avoid
the signed/unsigned issues in sctp_process_cmsgs_for_init()
and sctp_findassociation_cmsgs().

Thanks to andrew@ for reporting the problem he found using
syzcaller.

5 years agoMFC r339022:
tuexen [Thu, 16 May 2019 08:15:54 +0000 (08:15 +0000)]
MFC r339022:
Increment the corresponding UDP stats counter (udps_opackets) when
sending UDP encapsulated SCTP packets.
This is consistent with the behaviour that when such packets are received,
the corresponding UDP stats counter (udps_ipackets) is incremented.
Thanks to Peter Lei for making me aware of this inconsistency.

5 years agoMFC r347032 (except for the part about d_off):
asomers [Thu, 16 May 2019 03:30:36 +0000 (03:30 +0000)]
MFC r347032 (except for the part about d_off):

directory.3: add a STANDARDS section

Reviewed by: jilles, ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20111

5 years agoMFC r346847:
asomers [Thu, 16 May 2019 03:24:08 +0000 (03:24 +0000)]
MFC r346847:

fsx: seed more randomly with the -S0 option

When using -S0, seed the PRNG with the current time in nanoseconds, not
seconds, so consecutive runs don't accidentally use the same seed.

Also, rename some variables for clarity.

Reviewed by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20078

5 years agoMFC r345550:
gonzo [Thu, 16 May 2019 00:53:54 +0000 (00:53 +0000)]
MFC r345550:

Change default value of kern.bootfile to reflect reality

In most cases kernel.bootfile is populated from the information
provided by loader(8). There are certain scenarios when loader
is not available, for instance when kernel is loaded by u-boot
or some other BootROM directly. In this case the default value
"/kernel" points to invalid location and breaks some functinality,
like using installkernel on self-hosted system or dtrace's CTF
lookup. This can be fixed by setting the value manually but the
default that reflects correct location is better than default that
points to invalid one.

Current default was set around FreeBSD 1, when "/kernel" was the
actual path. Transition to /boot/kernel/kernel happened circa FreeBSD 3.

PR: 221550
Reviewed by: ian, imp
Differential Revision: https://reviews.freebsd.org/D18902

5 years agoMFC r346647:
gonzo [Thu, 16 May 2019 00:51:30 +0000 (00:51 +0000)]
MFC r346647:

[acpi_ibm] Add support for newer Thinkpad models

Add support for newer Thinkpad models with id LEN0268. Was tested on
Thinkpad T480 and ThinkPad X1 Yoga 2nd gen.

PR: 229120
Submitted by: Ali Abdallah <aliovx@gmail.com>

5 years agoMFC r347422:
ian [Wed, 15 May 2019 17:58:08 +0000 (17:58 +0000)]
MFC r347422:

Allow dcons(4) to be unloaded when loaded as a module.

When the module is unloaded, the tty devices are destroyed.  That requires
implementing the tsw_free callback to avoid a panic.  This driver requires
no particular cleanup to be done from the callback, but the module itself
must remain in memory until the deferred tsw_free callbacks are invoked.
These changes implement that by incrementing a reference count variable in
the detach routine, and decrementing it in the tsw_free callback.  The
MOD_UNLOAD event handler doesn't return until the count drops to zero.

PR: 237758

5 years agoMFC r339046, r339073:
markj [Wed, 15 May 2019 15:49:29 +0000 (15:49 +0000)]
MFC r339046, r339073:
Count bootstrap data as resident in the kernel pmap.

5 years agoDocument EN-19:08 through EN-19:10, SA-19:03 through SA-19:07.
gjb [Wed, 15 May 2019 15:03:55 +0000 (15:03 +0000)]
Document EN-19:08 through EN-19:10, SA-19:03 through SA-19:07.

Sponsored by: The FreeBSD Foundation

5 years agoMFC r337738:
tuexen [Wed, 15 May 2019 08:39:16 +0000 (08:39 +0000)]
MFC r337738:
Use a macro to set the assoc state.

5 years agoMFC r320009,r347075:
ngie [Wed, 15 May 2019 07:51:30 +0000 (07:51 +0000)]
MFC r320009,r347075:

r320009 (by sbruno):

Quiesce clang warning while building lpc.

usr.sbin/lpr/lpc/lpc.c
  Warning
    passing 'char *[20]' to parameter of type 'const char **' discards
    qualifiers in nested pointer types
    [-Wincompatible-pointer-types-discards-qualifiers]
  Fix:
     Explicitly cast the variable "margv" to const char ** only for it's
     use as a parameter to suppress the error

r347075:

Fix `clang -Wcast-qual` issues

Remove unnecessary `char*` casting for arguments passed to `cget*(3)`, and
deconst `_PATH_PRINTCAP` before passing it to `cget*` via the `printcapdb`
variable.

This unblocks ^/projects/runtime-coverage-v2 from building cleanly on
universe13a.freebsd.org. I suspect the issue was introduced through some
changes to `bsd.*.mk` inclusion on the branch, which I will continue to
investigate/isolate.

Tested with: clang 8 (arm64)

5 years agoMFC r347240: Fix dataset name comparison in zfs_compare().
mav [Wed, 15 May 2019 01:40:40 +0000 (01:40 +0000)]
MFC r347240: Fix dataset name comparison in zfs_compare().

The code never returned match comparing two datasets (not snapshots).
As result, uu_avl_find(), called from zfs_callback(), never succeeded,
allowing to add same dataset into the list multiple times, for example:

        # zfs get name pers pers pers@z pers@z
        NAME    PROPERTY  VALUE   SOURCE
        pers    name      pers    -
        pers    name      pers    -
        pers@z  name      pers@z  -

With the patch:

        # zfs get name pers pers pers@z pers@z
        NAME    PROPERTY  VALUE   SOURCE
        pers    name      pers    -
        pers@z  name      pers@z  -

5 years agoMFC r347566:
kib [Tue, 14 May 2019 17:05:02 +0000 (17:05 +0000)]
MFC r347566:
Mitigations for Microarchitectural Data Sampling.

Reference: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html
Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091
Security: FreeBSD-SA-19:07.mds
Reviewed by: jhb
Tested by: emaste, lwhsu
Approved by: so (gtetlow)

5 years agoMFC r344085:
obrien [Tue, 14 May 2019 04:14:31 +0000 (04:14 +0000)]
MFC r344085:
Note that readpassphrase() came into FreeBSD's libc at 4.6.

5 years agoMFC r346028:
ganbold [Tue, 14 May 2019 03:05:06 +0000 (03:05 +0000)]
MFC r346028:
Fix URE_WDT6_SET_MODE value in the register definition.
Both linux and u-boot sources for RTL8152 driver has this value.
RTL8152 USB ethernet is used in NanoPI R1 board as second ethernet.
This fixes RTL8152 USB ethernet not detected problem after
reboot.

5 years agoMFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping
kevans [Tue, 14 May 2019 02:00:12 +0000 (02:00 +0000)]
MFC r347241 (partial), r347392, r347429: ifconfig(8) ifname <-> kld mapping

MFC r347241 (partial): Initial mechanism for mapping ifname <-> kld

if_tun/if_tap mappings have been removed and the vmnet mapping has been
updated to the if_tap module.

MFC r347392: ifconfig(8): Partial revert of r347241

r347241 introduced an ifname <-> kld mapping table, mostly so tun/tap/vmnet
can autoload the correct module on use. It also inadvertently made bogus
some previously valid uses of sizeof().

Revert back to ifkind on the stack for simplicity sake. This reduces the
diff from the previous version of ifmaybeload for easiser auditing.

MFC r347429: ifconfig(8): Add kld mappings for ipsec/enc

Additionally, providing mappings makes the comparison for already loaded
modules a little more strict. This should have been done at initial
introduction, but there was no real reason- however, it proves necessary for
enc which has a standard enc -> if_enc mapping but there also exists an
'enc' module that's actually CAM. The mapping lets us unambiguously
determine the correct module.

5 years agoMFC r347160: Decode some more ATA commands found in ACS-4.
mav [Mon, 13 May 2019 13:30:34 +0000 (13:30 +0000)]
MFC r347160: Decode some more ATA commands found in ACS-4.

5 years agoMFC r346965:
dchagin [Mon, 13 May 2019 11:17:31 +0000 (11:17 +0000)]
MFC r346965:

Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator.
It was first introduced in r163734 and missied by me in r283383.

5 years agoMFC r346885:
ae [Mon, 13 May 2019 08:27:52 +0000 (08:27 +0000)]
MFC r346885:
  Handle HAVE_PROTO flag and print "proto" keyword for O_IP4 and O_IP6
  opcodes when it is needed.
  This should fix the problem, when printed by `ipfw show` rule can not
  be added due to missing "proto" keyword.

5 years agoMFC r346073:
avos [Sun, 12 May 2019 12:30:45 +0000 (12:30 +0000)]
MFC r346073:
urtw(4), otus(4), iwi(4): allow to set non-default MAC address via ifconfig(8)

Was tested with Netgear WG111 v3 (RTL8187B, urtw(4)), STA mode.

5 years agoMFC r347150, r347180:
kib [Sun, 12 May 2019 07:55:25 +0000 (07:55 +0000)]
MFC r347150, r347180:
Do not collapse objects with OBJ_NOSPLIT backing swap or default object.

5 years agoMFC r347243:
dim [Sat, 11 May 2019 09:56:59 +0000 (09:56 +0000)]
MFC r347243:

Pull in r360099 from upstream llvm trunk (by Eli Friedman):

  [ARM] Glue register copies to tail calls.

  This generally follows what other targets do. I don't completely
  understand why the special case for tail calls existed in the first
  place; even when the code was committed in r105413, call lowering
  didn't work in the way described in the comments.

  Stack protector lowering breaks if the register copies are not glued
  to a tail call: we have to insert the stack protector check before
  the tail call, and we choose the location based on the assumption
  that all physical register dependencies of a tail call are adjacent
  to the tail call. (See FindSplitPointForStackProtector.) This is sort
  of fragile, but I don't see any reason to break that assumption.

  I'm guessing nobody has seen this before just because it's hard to
  convince the scheduler to actually schedule the code in a way that
  breaks; even without the glue, the only computation that could
  actually be scheduled after the register copies is the computation of
  the call address, and the scheduler usually prefers to schedule that
  before the copies anyway.

  Fixes https://bugs.llvm.org/show_bug.cgi?id=41417

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

This should fix several instances of "Bad machine code: Using an
undefined physical register", when compiling ports such as
multimedia/vlc, audio/alsa-lib and devel/avro-c for armv6, with
-fstack-protector-strong.

Reported by: jbeich
PR: 237074, 237783, 237784

5 years agoMFC r345986:
asomers [Sat, 11 May 2019 03:41:58 +0000 (03:41 +0000)]
MFC r345986:

fusefs: fix a panic on mount

Don't page fault if the file descriptor provided with "-o fd" is invalid.
This is a merge of r345419 from the projects/fuse2 branch.

Reviewed by: ngie
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19836

5 years agoMFC r346750:
asomers [Sat, 11 May 2019 03:39:34 +0000 (03:39 +0000)]
MFC r346750:

[skip ci] fix typo in comment from r59840

Sponsored by: The FreeBSD Foundation

5 years agoMFC r346078:
asomers [Sat, 11 May 2019 03:38:50 +0000 (03:38 +0000)]
MFC r346078:

fix cache_lookup's documentation

cache_lookup's documentation got dislocated by r324378. Relocate and expand
it.

Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation

5 years agoMFC r345677:
asomers [Sat, 11 May 2019 03:37:43 +0000 (03:37 +0000)]
MFC r345677:

Add man page for VOP_FDATASYNC(9)

Reviewed by:    kib
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D19678

5 years agoMFC r345202:
asomers [Sat, 11 May 2019 03:35:13 +0000 (03:35 +0000)]
MFC r345202:

VOP_INACTIVE(9): clarify wording

Reviewed by: kib, 0mp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19596

5 years agoMFC of 347064, 347066, and 347130
mckusick [Fri, 10 May 2019 23:46:42 +0000 (23:46 +0000)]
MFC of 347064, 347066, and 347130

Avoid leaking kernel stack when creating directory names.

5 years agoComplete the MFC of 345963 after the MFC of 333174.
jhb [Fri, 10 May 2019 16:51:36 +0000 (16:51 +0000)]
Complete the MFC of 345963 after the MFC of 333174.

Suggested by: kib

5 years agoMFC 342944: Fix spelling of identifier
jhb [Fri, 10 May 2019 16:38:48 +0000 (16:38 +0000)]
MFC 342944: Fix spelling of identifier

5 years agoMFC 340707:
jhb [Fri, 10 May 2019 16:36:38 +0000 (16:36 +0000)]
MFC 340707:
Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES
to avoid buffer accessed out of bounds, also switch to snprintf(3).

PR: 200859

5 years agoMFC 338957:
jhb [Fri, 10 May 2019 16:32:44 +0000 (16:32 +0000)]
MFC 338957:
Handle a guest executing a vm instruction by trapping and raising an
undefined instruction exception. Previously we would exit the guest,
however an unprivileged user could execute these.

5 years agoMFC r347234:
cy [Fri, 10 May 2019 01:02:07 +0000 (01:02 +0000)]
MFC r347234:

Improve the legibility of the login.access.5 man page by separating
each argument into its own paragraph.

5 years agoix(4): Move {mod,msf,mbx,fdir,phy,link}_task to lock protected handler
erj [Fri, 10 May 2019 00:46:43 +0000 (00:46 +0000)]
ix(4): Move {mod,msf,mbx,fdir,phy,link}_task to lock protected handler

This patch introduces adapter->task_requests register responsible for recording
requests for mod_task, msf_task, mbx_task, fdir_task, phy_task and link_task
calls. Instead of enqueueing each of these tasks with GROUPTASK_ENQUEUE, new
task is created and all handlers are called from one task while holding
adapter->core_mtx lock.

SIOCGIFXMEDIA ioctl() call reads adapter->media list. The list is deleted and
rewritten in ixgbe_handle_msf() task without holding adapter->core_mtx lock.
This change is needed to maintain data coherency when sharing adapter info via
ioctl() calls.

Since handlers for abovementioned tasks will no longer act as task handlers,
but as regular functions, 'pending' parameter is removed from them.

This patch also removes ixgbe_update_link_status() call from
ixgbe_handle_link() handler. From now on, link status will be updated by
calling ixgbe_update_link_status() periodically from ixgbe_local_timer(). This
fixes problem with link flapping during changing interface state to UP.

Parameter keep_traffic is added to ixgbe_disable_intr(). This enables
ixgbe_handle_admin_task() to not disable and queue interrupts.  Accordingly,
skip_traffic parameter is added to ixgbe_enable_intr() to let
ixgbe_handle_admin_task() skip enabling queues while enabling interrupts.

This patch is a port of r343621. r343621 can't be merged from current since
stable/11 contains ixgbe driver without iflib support.

Patch co-authored by Krzysztof Galazka <krzysztof.galazka@intel.com>.

Submitted by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Reviewed by: #IntelNetworking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D19711