]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoAdd SECURITY section to loader(8).
trasz [Wed, 15 Aug 2018 08:45:05 +0000 (08:45 +0000)]
Add SECURITY section to loader(8).

Reviewed by: bcr, jilles, imp (earlier version)
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16700

5 years agocd9660 pointer sign issues and missing __packed attribute
tsoome [Wed, 15 Aug 2018 06:42:31 +0000 (06:42 +0000)]
cd9660 pointer sign issues and missing __packed attribute

The isonum_* functions are defined to take unsigend char* as an argument,
but the structure fields are defined as char. Change to u_char where needed.

Probably the full structure should be changed, but I'm not sure about the
side affects.

While there, add __packed attribute.

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

5 years agocxgbe(4): Use two hashes instead of a table to keep track of
np [Wed, 15 Aug 2018 03:03:01 +0000 (03:03 +0000)]
cxgbe(4): Use two hashes instead of a table to keep track of
hashfilters.  Two because the driver needs to look up a hashfilter by
its 4-tuple or tid.

A couple of fixes while here:
- Reject attempts to add duplicate hashfilters.
- Do not assume that any part of the 4-tuple that isn't specified is 0.
  This makes it consistent with all other mandatory parameters that
  already require explicit user input.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

5 years agoFlesh out a comment about what we're doing with read bias and trims.
imp [Wed, 15 Aug 2018 00:15:40 +0000 (00:15 +0000)]
Flesh out a comment about what we're doing with read bias and trims.

Sponsored by: Netflix

5 years agoarm/ralink cleanup
imp [Tue, 14 Aug 2018 20:45:43 +0000 (20:45 +0000)]
arm/ralink cleanup

Remove the non-INTRNG code.
Remove left over cut and paste code from the lpc code that was the start for the port.
Set KERNPHYSADDR and KERNVIRTADDR

Tested on Buffalo_WZR2-G300N

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

5 years agoFix a broken "SEE ALSO" section of hlfsd(8).
0mp [Tue, 14 Aug 2018 20:33:48 +0000 (20:33 +0000)]
Fix a broken "SEE ALSO" section of hlfsd(8).

While here pet mandoc and igor.

Reviewed by: bcr, eadler, krion, mat
Approved by: krion (mentor), mat (mentor)
Differential Revision: https://reviews.freebsd.org/D16376

5 years agoFix a couple whitespace errors in r337814.
dab [Tue, 14 Aug 2018 20:26:54 +0000 (20:26 +0000)]
Fix a couple whitespace errors in r337814.

Reported by: Renato Botelho <garga.bsd@gmail.com>
MFC after: 3 days
X-MFC-with: r337814
Sponsored by: Dell EMC

5 years agoMFV r337818:
cy [Tue, 14 Aug 2018 20:24:10 +0000 (20:24 +0000)]
MFV r337818:

WPA: Ignore unauthenticated encrypted EAPOL-Key data

Ignore unauthenticated encrypted EAPOL-Key data in supplicant
processing. When using WPA2, these are frames that have the Encrypted
flag set, but not the MIC flag.

When using WPA2, EAPOL-Key frames that had the Encrypted flag set but
not the MIC flag, had their data field decrypted without first verifying
the MIC. In case the data field was encrypted using RC4 (i.e., when
negotiating TKIP as the pairwise cipher), this meant that
unauthenticated but decrypted data would then be processed. An adversary
could abuse this as a decryption oracle to recover sensitive information
in the data field of EAPOL-Key messages (e.g., the group key).
(CVE-2018-14526)

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
Obtained from:  git://w1.fi/hostap.git
MFC after:      1 day
Security:       CVE-2018-14526
Security:       VuXML: 6bedc863-9fbe-11e8-945f-206a8a720317

5 years agoFix several (more) memory leaks.
dab [Tue, 14 Aug 2018 19:31:06 +0000 (19:31 +0000)]
Fix several (more) memory leaks.

A follow-up to r337812 to catch a couple more memory leaks that should
have been included in that change.

Reported by: Coverity
CID: 12960641296067 (for real this time)
MFC after: 3 days
X-MFC-with: r337812
Sponsored by: Dell EMC

5 years agoHelp ensure that the copy loop doesn't get converted to a memcpy() call.
markj [Tue, 14 Aug 2018 19:21:31 +0000 (19:21 +0000)]
Help ensure that the copy loop doesn't get converted to a memcpy() call.

Reported and reviewed by: kib
X-MFC with: r337715
Sponsored by: The FreeBSD Foundation

5 years agoFix several memory leaks.
dab [Tue, 14 Aug 2018 19:12:45 +0000 (19:12 +0000)]
Fix several memory leaks.

The libkqueue tests have several places that leak memory by using an
idiom like:

puts(kevent_to_str(kevp));

Rework to save the pointer returned from kevent_to_str() and then
free() it after it has been used.

Reported by: asomers (pointer to Coverity), Coverity
CID: 1296063129606412960651296066129606713502871394960
Sponsored by: Dell EMC

5 years agoDisable the auto negotiation if the port is set to fixed-link.
loos [Tue, 14 Aug 2018 18:58:16 +0000 (18:58 +0000)]
Disable the auto negotiation if the port is set to fixed-link.

Tested on SG-3100 (ARMADA38X) and Espresso.bin (A37x0).  Fixes the network
on espresso.bin.

Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoMFV r337586: lua: Update to 5.3.5
kevans [Tue, 14 Aug 2018 18:58:01 +0000 (18:58 +0000)]
MFV r337586: lua: Update to 5.3.5

Bugfix release, nothing too major.

Tested with: lualoader via userboot, lualoader live
Differential Revision: https://reviews.freebsd.org/D16665

5 years agoFor our INT64 implementation, we can compare integers and numbers
imp [Tue, 14 Aug 2018 18:45:25 +0000 (18:45 +0000)]
For our INT64 implementation, we can compare integers and numbers
directly because they are the same thing.

Reviewed by: kevans@

5 years agoWhen the LUA floating point model is INT64, we don't need to do the
imp [Tue, 14 Aug 2018 18:45:20 +0000 (18:45 +0000)]
When the LUA floating point model is INT64, we don't need to do the
overflow dance. This avoids compile errors on latter-day gcc compilers
as well as simplifies the generated code.

Reviewed by: kevans@

5 years agoPrevent a wanring about checkdp being unused. It's not needed when we
imp [Tue, 14 Aug 2018 18:45:16 +0000 (18:45 +0000)]
Prevent a wanring about checkdp being unused. It's not needed when we
have INT64 floats and somehow snuck through unused until now.

Reviewed by: kevans@

5 years agoCreate a loader for each interpreter for x86 BIOS and all EFI
imp [Tue, 14 Aug 2018 18:44:41 +0000 (18:44 +0000)]
Create a loader for each interpreter for x86 BIOS and all EFI

Create loader_{4th,lua,simp}{,.efi}. All of these are installed by
default. Create LOADER_DEFAULT_INTERP to specify the default
interpreter when no other is specified. LOADER_INTERP is the current
interpreter language building. Turn building of lua on by default to
match 4th. simploader is a simplified loader build w/o any interpreter
language (but with a simple loader).  This is the historic behavir you
got with WITHOUT_FORTH. Make a hard link to the default loader. This
has to be a hard link rather than the more desirable soft link because
older zfsboot blocks don't support symlinks.

RelNotes: Yes
Differential Revision: https://reviews.freebsd.org/D16705

5 years agobectl(8): Check jailparam_* return values
kevans [Tue, 14 Aug 2018 18:35:33 +0000 (18:35 +0000)]
bectl(8): Check jailparam_* return values

Previous iteration of this assumed that these won't fail because we've
already setup the jail param to this point, but the allocations could still
fail in pretty bad conditions.

Admit that it's possible and return (ENOENT, EINVAL, ENOMEM, or 0) when
deleting arguments. EINVAL shouldn't happen since we're passing optarg;
which may satisfy *optarg == '\0' but never optarg == NULL.

CID: 13948851394901

5 years agolibbe(3): Fix leaky faucets
kevans [Tue, 14 Aug 2018 18:11:06 +0000 (18:11 +0000)]
libbe(3): Fix leaky faucets

Amongst them:
- Resource leaks
- Logically dead code
- Unused values
- Null termination issues

Reported by: asomers (pointer to Coverity), Coverity
CID: 139477713947911394830139484413948721394894,
CID: 1394900139490713949501394965

5 years agoMerge OpenSSL 1.0.2p.
jkim [Tue, 14 Aug 2018 17:48:02 +0000 (17:48 +0000)]
Merge OpenSSL 1.0.2p.

5 years agoUpdate the inet(4) and inet6(4) man pages to reflect the changes made
jtl [Tue, 14 Aug 2018 17:36:21 +0000 (17:36 +0000)]
Update the inet(4) and inet6(4) man pages to reflect the changes made
to the reassembly code in r337778, r337780, r337781, r337782, and
r337783.

Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoLower the default limits on the IPv6 reassembly queue.
jtl [Tue, 14 Aug 2018 17:32:07 +0000 (17:32 +0000)]
Lower the default limits on the IPv6 reassembly queue.

Currently, the limits are quite high. On machines with millions of
mbuf clusters, the reassembly queue limits can also run into
the millions. Lower these values.

Also, try to ensure that no bucket will have a reassembly
queue larger than approximately 100 items. This limits the cost to
find the correct reassembly queue when processing an incoming
fragment.

Due to the low limits on each bucket's length, increase the size of
the hash table from 64 to 1024.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoLower the default limits on the IPv4 reassembly queue.
jtl [Tue, 14 Aug 2018 17:30:46 +0000 (17:30 +0000)]
Lower the default limits on the IPv4 reassembly queue.

In particular, try to ensure that no bucket will have a reassembly
queue larger than approximately 100 items. This limits the cost to
find the correct reassembly queue when processing an incoming
fragment.

Due to the low limits on each bucket's length, increase the size of
the hash table from 64 to 1024.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoProvide part of the mitigation for L1TF-VMM.
kib [Tue, 14 Aug 2018 17:29:41 +0000 (17:29 +0000)]
Provide part of the mitigation for L1TF-VMM.

On the guest entry in bhyve, flush L1 data cache, using either L1D
flush command MSR if available, or by reading enough uninteresting
data to fill whole cache.

Flush is automatically enabled on CPUs which do not report RDCL_NO,
and can be disabled with the hw.vmm.l1d_flush tunable/kenv.

Security: CVE-2018-3646
Reviewed by: emaste. jhb, Tony Luck <tony.luck@intel.com>
Sponsored by: The FreeBSD Foundation

5 years agoDrop 0-byte IPv6 fragments.
jtl [Tue, 14 Aug 2018 17:29:22 +0000 (17:29 +0000)]
Drop 0-byte IPv6 fragments.

Currently, we process IPv6 fragments with 0 bytes of payload, add them
to the reassembly queue, and do not recognize them as duplicating or
overlapping with adjacent 0-byte fragments. An attacker can exploit this
to create long fragment queues.

There is no legitimate reason for a fragment with no payload. However,
because IPv6 packets with an empty payload are acceptable, allow an
"atomic" fragment with no payload.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoImplement a limit on on the number of IPv6 reassembly queues per bucket.
jtl [Tue, 14 Aug 2018 17:27:41 +0000 (17:27 +0000)]
Implement a limit on on the number of IPv6 reassembly queues per bucket.

There is a hashing algorithm which should distribute IPv6 reassembly
queues across the available buckets in a relatively even way. However,
if there is a flaw in the hashing algorithm which allows a large number
of IPv6 fragment reassembly queues to end up in a single bucket, a per-
bucket limit could help mitigate the performance impact of this flaw.

Implement such a limit, with a default of twice the maximum number of
reassembly queues divided by the number of buckets. Recalculate the
limit any time the maximum number of reassembly queues changes.
However, allow the user to override the value using a sysctl
(net.inet6.ip6.maxfragbucketsize).

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoAdd a limit of the number of fragments per IPv6 packet.
jtl [Tue, 14 Aug 2018 17:26:07 +0000 (17:26 +0000)]
Add a limit of the number of fragments per IPv6 packet.

The IPv4 fragment reassembly code supports a limit on the number of
fragments per packet. The default limit is currently 17 fragments.
Among other things, this limit serves to limit the number of fragments
the code must parse when trying to reassembly a packet.

Add a limit to the IPv6 reassembly code. By default, limit a packet
to 65 fragments (64 on the queue, plus one final fragment to complete
the packet). This allows an average fragment size of 1,008 bytes, which
should be sufficient to hold a fragment. (Recall that the IPv6 minimum
MTU is 1280 bytes. Therefore, this configuration allows a full-size
IPv6 packet to be fragmented on a link with the minimum MTU and still
carry approximately 272 bytes of headers before the fragmented portion
of the packet.)

Users can adjust this limit using the net.inet6.ip6.maxfragsperpacket
sysctl.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoMake the IPv6 fragment limits be global, rather than per-VNET, limits.
jtl [Tue, 14 Aug 2018 17:24:26 +0000 (17:24 +0000)]
Make the IPv6 fragment limits be global, rather than per-VNET, limits.

The IPv6 reassembly fragment limit is based on the number of mbuf clusters,
which are a global resource. However, the limit is currently applied
on a per-VNET basis. Given enough VNETs (or given sufficient customization
on enough VNETs), it is possible that the sum of all the VNET fragment
limits will exceed the number of mbuf clusters available in the system.

Given the fact that the fragment limits are intended (at least in part) to
regulate access to a global resource, the IPv6 fragment limit should
be applied on a global basis.

Note that it is still possible to disable fragmentation for a particular
VNET by setting the net.inet6.ip6.maxfragpackets sysctl to 0 for that
VNET. In addition, it is now possible to disable fragmentation globally
by setting the net.inet6.ip6.maxfrags sysctl to 0.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoImplement a limit on on the number of IPv4 reassembly queues per bucket.
jtl [Tue, 14 Aug 2018 17:23:05 +0000 (17:23 +0000)]
Implement a limit on on the number of IPv4 reassembly queues per bucket.

There is a hashing algorithm which should distribute IPv4 reassembly
queues across the available buckets in a relatively even way. However,
if there is a flaw in the hashing algorithm which allows a large number
of IPv4 fragment reassembly queues to end up in a single bucket, a per-
bucket limit could help mitigate the performance impact of this flaw.

Implement such a limit, with a default of twice the maximum number of
reassembly queues divided by the number of buckets. Recalculate the
limit any time the maximum number of reassembly queues changes.
However, allow the user to override the value using a sysctl
(net.inet.ip.maxfragbucketsize).

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agotftp: Close a resource leak when putting files
asomers [Tue, 14 Aug 2018 17:20:31 +0000 (17:20 +0000)]
tftp: Close a resource leak when putting files

Reported by: Coverity
CID: 1394842
MFC after: 2 weeks

5 years agoAdd a global limit on the number of IPv4 fragments.
jtl [Tue, 14 Aug 2018 17:19:49 +0000 (17:19 +0000)]
Add a global limit on the number of IPv4 fragments.

The IP reassembly fragment limit is based on the number of mbuf clusters,
which are a global resource. However, the limit is currently applied
on a per-VNET basis. Given enough VNETs (or given sufficient customization
of enough VNETs), it is possible that the sum of all the VNET limits
will exceed the number of mbuf clusters available in the system.

Given the fact that the fragment limit is intended (at least in part) to
regulate access to a global resource, the fragment limit should
be applied on a global basis.

VNET-specific limits can be adjusted by modifying the
net.inet.ip.maxfragpackets and net.inet.ip.maxfragsperpacket
sysctls.

To disable fragment reassembly globally, set net.inet.ip.maxfrags to 0.
To disable fragment reassembly for a particular VNET, set
net.inet.ip.maxfragpackets to 0.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoAdd definitions related to the L1D flush operation capability and MSR.
kib [Tue, 14 Aug 2018 17:19:11 +0000 (17:19 +0000)]
Add definitions related to the L1D flush operation capability and MSR.

Sponsored by: The FreeBSD Foundation

5 years agoImprove IPv6 reassembly performance by hashing fragments into buckets.
jtl [Tue, 14 Aug 2018 17:17:37 +0000 (17:17 +0000)]
Improve IPv6 reassembly performance by hashing fragments into buckets.

Currently, all IPv6 fragment reassembly queues are kept in a flat
linked list. This has a number of implications. Two significant
implications are: all reassembly operations share a common lock,
and it is possible for the linked list to grow quite large.

Improve IPv6 reassembly performance by hashing fragments into buckets,
each of which has its own lock. Calculate the hash key using a Jenkins
hash with a random seed.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoImprove hashing of IPv4 fragments.
jtl [Tue, 14 Aug 2018 17:15:47 +0000 (17:15 +0000)]
Improve hashing of IPv4 fragments.

Currently, IPv4 fragments are hashed into buckets based on a 32-bit
key which is calculated by (src_ip ^ ip_id) and combined with a random
seed. However, because an attacker can control the values of src_ip
and ip_id, it is possible to construct an attack which causes very
deep chains to form in a given bucket.

To ensure more uniform distribution (and lower predictability for
an attacker), calculate the hash based on a key which includes all
the fields we use to identify a reassembly queue (dst_ip, src_ip,
ip_id, and the ip protocol) as well as a random seed.

Reviewed by: jhb
Security: FreeBSD-SA-18:10.ip
Security: CVE-2018-6923

5 years agoReserve page at the physical address zero on amd64.
kib [Tue, 14 Aug 2018 17:14:33 +0000 (17:14 +0000)]
Reserve page at the physical address zero on amd64.

We always zero the invalidated PTE/PDE for superpage, which means that
L1TF CPU vulnerability (CVE-2018-3620) can be only used for reading
from the page at zero.

Note that both i386 and amd64 exclude the page from phys_avail[]
array, so this change is redundant, but I think that phys_avail[] on
UEFI-boot does not need to do that.  Eventually the blacklisting
should be made conditional on CPUs which report that they are not
vulnerable to L1TF.

Reviewed by: emaste. jhb
Sponsored by: The FreeBSD Foundation

5 years agoamd64: ensure that curproc->p_vmspace pmap always matches PCPU
kib [Tue, 14 Aug 2018 16:37:14 +0000 (16:37 +0000)]
amd64: ensure that curproc->p_vmspace pmap always matches PCPU
curpmap.

When performing context switch on a machine without PCID, if current
%cr3 equals to the new pmap %cr3, which is typical for kernel_pmap
vs. kernel process, I overlooked to update PCPU curpmap value.  Remove
check for %cr3 not equal to pm_cr3 for doing the update.  It is
believed that this case cannot happen at all, due to other changes in
this revision.

Also, do not set the very first curpmap to kernel_pmap, it should be
vmspace0 pmap instead to match curproc.

Move the common code to activate the initial pmap both on BSP and APs
into pmap_activate_boot() helper.

Reported by: eadler, ambrisko
Discussed with: kevans
Reviewed by: alc, markj (previous version)
Tested by: ambrisko (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16618

5 years agoAdd support to the Marvell Xenon SDHCI controller.
loos [Tue, 14 Aug 2018 16:33:30 +0000 (16:33 +0000)]
Add support to the Marvell Xenon SDHCI controller.

Tested on Espresso.bin (37x0) and Macchiato.bin (8k) with SD cards and
eMMCs.

Obtained from: pfSense
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoQuery MVPConf0.PVPE for number of CPUs.
br [Tue, 14 Aug 2018 16:29:10 +0000 (16:29 +0000)]
Query MVPConf0.PVPE for number of CPUs.

Rather than hard-coding the number of CPUs to 2, look up the PVPE field
in MVPConf0, as the valid VPE numbers are from 0 to PVPE inclusive.

Submitted by: "James Clarke" <jrtc4@cam.ac.uk>
Reviewed by: br
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16644

5 years agoFix typo.
kib [Tue, 14 Aug 2018 16:27:17 +0000 (16:27 +0000)]
Fix typo.

Noted by: alc
MFC after: 3 days

5 years agoAvoid repeated address calculation for malta_ap_boot.
br [Tue, 14 Aug 2018 16:26:44 +0000 (16:26 +0000)]
Avoid repeated address calculation for malta_ap_boot.

Submitted by: "James Clarke" <jrtc4@cam.ac.uk>
Reviewed by: br, arichardson
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16655

5 years agoRemove unused code.
br [Tue, 14 Aug 2018 16:22:14 +0000 (16:22 +0000)]
Remove unused code.

Sponsored by: DARPA, AFRL

5 years agoImport OpenSSL 1.0.2p.
jkim [Tue, 14 Aug 2018 16:18:14 +0000 (16:18 +0000)]
Import OpenSSL 1.0.2p.

5 years agoRewrite RISC-V disassembler:
br [Tue, 14 Aug 2018 16:03:03 +0000 (16:03 +0000)]
Rewrite RISC-V disassembler:
- Use macroses from encoding.h generated by riscv-opcodes.
- Add support for C-compressed ISA extension.

Sponsored by: DARPA, AFRL

5 years agoRemove cpu_pfr from arm. It's unused.
andrew [Tue, 14 Aug 2018 16:01:25 +0000 (16:01 +0000)]
Remove cpu_pfr from arm. It's unused.

5 years agoRemove an old comment now the code it references has been removed.
andrew [Tue, 14 Aug 2018 15:48:13 +0000 (15:48 +0000)]
Remove an old comment now the code it references has been removed.

5 years agoFix the spelling of armv4_idcache_inv_all in an END macro.
andrew [Tue, 14 Aug 2018 15:42:27 +0000 (15:42 +0000)]
Fix the spelling of armv4_idcache_inv_all in an END macro.

5 years agoUse the correct PTE when changing the attribute of multiple pages.
loos [Tue, 14 Aug 2018 15:27:50 +0000 (15:27 +0000)]
Use the correct PTE when changing the attribute of multiple pages.

Submitted by: andrew (long time ago)
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoExplain why we aren't using memcpy().
markj [Tue, 14 Aug 2018 14:50:06 +0000 (14:50 +0000)]
Explain why we aren't using memcpy().

Reported by: jmg
X-MFC with: r337715
Sponsored by: The FreeBSD Foundation

5 years agoDon't use memcpy() in the early microcode loading code.
markj [Tue, 14 Aug 2018 14:02:53 +0000 (14:02 +0000)]
Don't use memcpy() in the early microcode loading code.

At some point memcpy() may be an ifunc, ifunc resolution cannot be done
until CPU identification has been performed, and CPU identification must
be done after loading any microcode updates.

X-MFC with: r337715
Sponsored by: The FreeBSD Foundation

5 years agoFix a typo on the PSCI smc call wrapper.
loos [Tue, 14 Aug 2018 13:56:49 +0000 (13:56 +0000)]
Fix a typo on the PSCI smc call wrapper.

Looks good from: andrew
Sponsored by: Rubicon Communications, LLC (Netgate)

5 years agoFix the !SMP x86 build.
markj [Tue, 14 Aug 2018 13:56:42 +0000 (13:56 +0000)]
Fix the !SMP x86 build.

Reported by: Michael Butler <imb@protected-networks.net>
X-MFC with: r337715
Sponsored by: The FreeBSD Foundation

5 years agoAdd good description of init and lock devices from sio to uart.
imp [Tue, 14 Aug 2018 13:52:10 +0000 (13:52 +0000)]
Add good description of init and lock devices from sio to uart.

5 years agoAdd the "autoro" flag to /media. This makes it attempt to mount
trasz [Tue, 14 Aug 2018 13:52:08 +0000 (13:52 +0000)]
Add the "autoro" flag to /media.  This makes it attempt to mount
it read-only instead of just failing if the media is write-protected.

The /net doesn't seem to require the flag.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: DARPA, AFRL

5 years agoMFV r337744:
mm [Tue, 14 Aug 2018 11:42:32 +0000 (11:42 +0000)]
MFV r337744:
Sync libarchive with vendor..

Vendor changes:
  PR #1042: validate iso9660 directory record length

MFC after: 3 days
Security: CVE-2017-14501

5 years agoAdd init_exec kenv(1) variable, to make init(8) execute a file
trasz [Tue, 14 Aug 2018 11:01:52 +0000 (11:01 +0000)]
Add init_exec kenv(1) variable, to make init(8) execute a file
after opening the console, replacing init as PID 1.

From the user point of view, it makes it possible to run eg the
shell as PID 1, using 'set init_exec=/bin/sh' at the loader(8)
prompt.

Reviewed by: kib
MFC after: 2 weeks
Relnotes: yes
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16625

5 years agoSupport reading from the arm64 ID registers from userspace.
andrew [Tue, 14 Aug 2018 11:00:54 +0000 (11:00 +0000)]
Support reading from the arm64 ID registers from userspace.

Trap reads to the arm64 ID registers and write a safe value into them. This
will allow us to put more useful values in these later and have userland
check them to find what features the hardware supports.

These are currently safe defaults, but will later be populated with better
values from the hardware.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16533

5 years agoUse a macro to set the assoc state. I missed this in r337706.
tuexen [Tue, 14 Aug 2018 08:33:47 +0000 (08:33 +0000)]
Use a macro to set the assoc state. I missed this in r337706.

5 years agoRemove a set but not used warning showing up in usrsctp.
tuexen [Tue, 14 Aug 2018 08:32:33 +0000 (08:32 +0000)]
Remove a set but not used warning showing up in usrsctp.

5 years agoRestore ability to send ICMP and ICMPv6 redirects.
ae [Tue, 14 Aug 2018 07:54:14 +0000 (07:54 +0000)]
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
Submitted by: mckay@
MFC after: 2 weeks

5 years agoAdd library and kernel support for AMD Family 17h counters
mmacy [Tue, 14 Aug 2018 05:18:43 +0000 (05:18 +0000)]
Add library and kernel support for AMD Family 17h counters

NB: lacks default sample rate for most counters

5 years agoAdd support for Linux-PAM's badly named expose_authtok option.
des [Tue, 14 Aug 2018 00:14:17 +0000 (00:14 +0000)]
Add support for Linux-PAM's badly named expose_authtok option.

Submitted by: Thomas Munro <munro@ip9.org>
MFC after: 1 week
Differential Revision: D16171

5 years agoExport the eeprom device size via readonly sysctl. Also export the write
ian [Mon, 13 Aug 2018 23:53:11 +0000 (23:53 +0000)]
Export the eeprom device size via readonly sysctl.  Also export the write
page size and address size, although they are likely to be inherently
less-interesting values outside of the driver.

5 years agopmc amd17h: fix inputs to jevents
mmacy [Mon, 13 Aug 2018 23:46:44 +0000 (23:46 +0000)]
pmc amd17h: fix inputs to jevents

5 years agoAdd PMC support for AMD Family CPUs
mmacy [Mon, 13 Aug 2018 22:34:57 +0000 (22:34 +0000)]
Add PMC support for AMD Family CPUs

5 years agoprintf: Add test for width and precision in %b format
jilles [Mon, 13 Aug 2018 21:54:27 +0000 (21:54 +0000)]
printf: Add test for width and precision in %b format

PR: 229641
Submitted by: pfg

5 years agoCopy out from kernel to data, not the other way around.
brooks [Mon, 13 Aug 2018 21:53:18 +0000 (21:53 +0000)]
Copy out from kernel to data, not the other way around.

MFC after: 3 days
Sponsored by: DARPA, AFRL

5 years agoRemove the duplicated CSUM_IP6_TCP introduced in r311849 from the TX
marius [Mon, 13 Aug 2018 20:29:39 +0000 (20:29 +0000)]
Remove the duplicated CSUM_IP6_TCP introduced in r311849 from the TX
checksum capabilities of IGB-class MACs. While at it, fix the line
wrapping.

PR: 230571

5 years agoPort the mps panic-safe shutdown_final handling to mpr
imp [Mon, 13 Aug 2018 19:59:42 +0000 (19:59 +0000)]
Port the mps panic-safe shutdown_final handling to mpr

r330951 by smh fixed the mps driver to avoid deadlocks when panicing.
The same code is needed for mpr, so port it here, along with the fix
which allows the CCBs scheduled to complete avoiding at least a scary
message and likely other unintended consequences.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16663

5 years agoCall xpt_sim_poll in shutdown_final handler.
imp [Mon, 13 Aug 2018 19:59:37 +0000 (19:59 +0000)]
Call xpt_sim_poll in shutdown_final handler.

When we're shutting down, we send a number of start/stop commands to
the known targets. We have to wait for them to complete. During a
panic, the interrupts are off, and using pause to wait for them to
fire and complete won't work: we have to poll after pause returns so
the completion routines of the CCBs run so we decrement work
outstanding counts.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16663

5 years agoCreate xpt_sim_poll and refactor a bit using it.
imp [Mon, 13 Aug 2018 19:59:32 +0000 (19:59 +0000)]
Create xpt_sim_poll and refactor a bit using it.

xpt_sim_poll takes the sim to poll as an argument. It will do the
proper locking protocol, call the SIM polling routine, and then call
camisr_runqueue to process completions on any CCBs the SIM's poll
routine completed. It will be used during late shutdown when a SIM is
waiting for CCBs it sent during shutdown to finish and the scheduler
isn't running because we've panic'd.

This sequence was used twice in cam_xpt, so refactor those to use this
new function.

Sponsored by: Netflix
Differential Review: https://reviews.freebsd.org/D16663

5 years agoWhitespace nit in t4_tom.h
np [Mon, 13 Aug 2018 19:21:28 +0000 (19:21 +0000)]
Whitespace nit in t4_tom.h

5 years agoevdev: Remove evdev.ko linkage dependency on kbd driver
wulf [Mon, 13 Aug 2018 19:05:53 +0000 (19:05 +0000)]
evdev: Remove evdev.ko linkage dependency on kbd driver

Move evdev_ev_kbd_event() helper from evdev to kbd.c as otherwise evdev
unconditionally requires all keyboard and console stuff to be compiled
into the kernel. This dependency happens as evdev_ev_kbd_event() helper
references kbdsw global variable defined in kbd.c through use of
kbdd_ioctl() macro.

While here make all keyboard drivers respect evdev_rcpt_mask while setting
typematic rate and LEDs with evdev interface.

Requested by: Milan Obuch <bsd@dino.sk>
Reviewed by: hselasky, gonzo
Differential Revision: https://reviews.freebsd.org/D16614

5 years agoevdev: remove soft context from evdev methods parameter list.
wulf [Mon, 13 Aug 2018 19:00:42 +0000 (19:00 +0000)]
evdev: remove soft context from evdev methods parameter list.

Now softc should be retrieved from struct edvev * pointer
with evdev_get_softc() helper.

wmt(4) is a sample of driver that support both KPI.

Reviewed by: hselasky, gonzo
Differential Revision: https://reviews.freebsd.org/D16614

5 years ago[ig4] Fix initialization sequence for newer ig4 chips
gonzo [Mon, 13 Aug 2018 18:53:14 +0000 (18:53 +0000)]
[ig4] Fix initialization sequence for newer ig4 chips

Newer chips may require assert/deassert after power down for proper
startup. Check respective flag in DEVIDLE_CTRL and perform operation
if neccesssary.

PR: 221777
Submitted by: marc.priggemeyer@gmail.com
Obtained from: DragonFly BSD
Tested on: Thinkpad T470

5 years agoAdd a space between a variable and escaped new line.
gjb [Mon, 13 Aug 2018 17:24:31 +0000 (17:24 +0000)]
Add a space between a variable and escaped new line.

MFC after: 3 days
MFC with: r337717
Sponsored by: The FreeBSD Foundation

5 years agoAdd lang/python2, lang/python3, and lang/python to GCE images
gjb [Mon, 13 Aug 2018 17:23:43 +0000 (17:23 +0000)]
Add lang/python2, lang/python3, and lang/python to GCE images
to help avoid hard-coding 'python<MAJOR>.<MINOR>' in several
scripts in the client-side scripts.

PR: 230248
MFC after: 3 days
Submitted by: gustavo.scalet@collabora.com
Sponsored by: The FreeBSD Foundation

5 years agoAdd microcode update configuration to the default loader.conf.
markj [Mon, 13 Aug 2018 17:14:06 +0000 (17:14 +0000)]
Add microcode update configuration to the default loader.conf.

MFC after: 6 weeks
Sponsored by: The FreeBSD Foundation

5 years agoImplement kernel support for early loading of Intel microcode updates.
markj [Mon, 13 Aug 2018 17:13:09 +0000 (17:13 +0000)]
Implement kernel support for early loading of Intel microcode updates.

Updates in the format described in section 9.11 of the Intel SDM can
now be applied as one of the first steps in booting the kernel.  Updates
that are loaded this way are automatically re-applied upon exit from
ACPI sleep states, in contrast with the existing cpucontrol(8)-based
method.  For the time being only Intel updates are supported.

Microcode update files are passed to the kernel via loader(8).  The
file type must be "cpu_microcode" in order for the file to be recognized
as a candidate microcode update.  Updates for multiple CPU types may be
concatenated together into a single file, in which case the kernel
will select and apply a matching update.  Memory used to store the
update file will be freed back to the system once the update is applied,
so this approach will not consume more memory than required.

Reviewed by: kib
MFC after: 6 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16370

5 years agoPrevent some parallel swap-ins, rate-limit swapper swap-ins.
kib [Mon, 13 Aug 2018 16:48:46 +0000 (16:48 +0000)]
Prevent some parallel swap-ins, rate-limit swapper swap-ins.

If faultin() was called outside swapper (from PHOLD()), do not allow
swapper to initiate additional swap-ins.  Swapper' initiated swap-ins
are serialized because they are synchronous and executed in the
context of the thread0.  With the added limitation, we only allow
parallel swap-ins from PHOLD(), which is up to PHOLD() users to
manage, usually they do not need to.

Rate-limit swapper' swap-ins to one in the MAXSLP / 2 seconds
interval, counting faultin() swapins.

Suggested by: alc
Reviewed by: alc, markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16610

5 years agoMerge ACPICA 20180810.
jkim [Mon, 13 Aug 2018 16:26:26 +0000 (16:26 +0000)]
Merge ACPICA 20180810.

5 years agoAdd RISC-V instructions encoding.
br [Mon, 13 Aug 2018 16:07:18 +0000 (16:07 +0000)]
Add RISC-V instructions encoding.

This is the output of
$ cat opcodes opcodes-rvc-pseudo opcodes-rvc opcodes-custom |
    ./parse-opcodes -c

It is confirmed by author that the output of parse-opcodes is
in the public domain.

This will be required for DDB disassembler.

Discussed with: Andrew Waterman <waterman@eecs.berkeley.edu>
Obtained from: https://github.com/riscv/riscv-opcodes
Sponsored by: DARPA, AFRL

5 years agolualoader: Fix parsing of negative number loader.conf(5) variables
kevans [Mon, 13 Aug 2018 14:49:07 +0000 (14:49 +0000)]
lualoader: Fix parsing of negative number loader.conf(5) variables

They would previously cause errors, as the regex for these did not tolerate
a leading negative sign, and the variable would simply not parse.

5 years agolagg: allow lacp to manage the link state
gallatin [Mon, 13 Aug 2018 14:13:25 +0000 (14:13 +0000)]
lagg: allow lacp to manage the link state

Lacp needs to manage the link state itself. Unlike other
lagg protocols, the ability of lacp to pass traffic
depends not only on the lagg members having link, but also
on the lacp protocol converging to a distributing state with the
link partner.

If we prematurely mark the link as up, then we will send a
gratuitous arp (via arp_handle_ifllchange()) before the lacp
interface is capable of passing traffic. When this happens,
the gratuitous arp is lost, and our link partner may cache
a stale mac address (eg, when the base mac address for the
lagg bundle changes, due to a BIOS change re-ordering NIC
unit numbers)

Reviewed by: jtl, hselasky
Sponsored by: Netflix

5 years agoUse the stacb instead of the asoc in state macros.
tuexen [Mon, 13 Aug 2018 13:58:45 +0000 (13:58 +0000)]
Use the stacb instead of the asoc in state macros.

This is not a functional change. Just a preparation for upcoming
dtrace state change provider support.

5 years agoMove around text in loader(8), in particular stuff related to ZFS,
trasz [Mon, 13 Aug 2018 11:56:23 +0000 (11:56 +0000)]
Move around text in loader(8), in particular stuff related to ZFS,
to restore the usual section order.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUse consistently the macors to modify the assoc state.
tuexen [Mon, 13 Aug 2018 11:56:21 +0000 (11:56 +0000)]
Use consistently the macors to modify the assoc state.

No functional change.

5 years agoAdd USB ID for rebranded RTL8153 found on NVIDIA Jetson TX1 board.
mmel [Mon, 13 Aug 2018 07:28:25 +0000 (07:28 +0000)]
Add USB ID for rebranded RTL8153 found on NVIDIA Jetson TX1 board.

MFC after: 3 days

5 years agoImport DTS files from Linux 4.18
manu [Mon, 13 Aug 2018 06:40:20 +0000 (06:40 +0000)]
Import DTS files from Linux 4.18

5 years agoImport latest DTS files from Linux 4.18
manu [Mon, 13 Aug 2018 05:53:54 +0000 (05:53 +0000)]
Import latest DTS files from Linux 4.18

5 years agoInstall symlink for sys/nvpair.h in include/Makefile symlinks target
kevans [Mon, 13 Aug 2018 05:16:27 +0000 (05:16 +0000)]
Install symlink for sys/nvpair.h in include/Makefile symlinks target

Noticed while fixing the install/sysroot situation for libnvpair and
libzfs_core- if one uses the symlinks target, libzfs_core.h is not
installed.

5 years agolibbe(3)/bectl(8): Remove now-redundant include paths
kevans [Mon, 13 Aug 2018 05:01:19 +0000 (05:01 +0000)]
libbe(3)/bectl(8): Remove now-redundant include paths

These were previously necessary because the libnvpair and libzfs_core
includes were not installed into the SYSROOT, being a part of the copies
target in include/Makefile rather than being installed with the library.

This was fixed in r337696 and the headers are now installed properly, so we
may let go of the cruft.

5 years agolibbe(3): Light typo fix/word addition
kevans [Mon, 13 Aug 2018 03:43:49 +0000 (03:43 +0000)]
libbe(3): Light typo fix/word addition

5 years agolibbe(3): Fix be_import to delete temp snapshot
kevans [Mon, 13 Aug 2018 03:42:14 +0000 (03:42 +0000)]
libbe(3): Fix be_import to delete temp snapshot

Deleting the temp snapshot isn't immediately possible because it's the
origin of the newly imported boot environment. However, this is trivially
solved by opening the new boot environment and promoting it. The roles are
now reversed and the temp snapshot/dataset may be completely destroyed.

Remove the BUGS from libbe(3) and bectl(8).

5 years agoUse INCS for non-sys/ libnvpair and libzfs_core includes
kevans [Mon, 13 Aug 2018 03:38:32 +0000 (03:38 +0000)]
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.

MFC after: 1 week

5 years agofix static ZFS linking
mmacy [Sun, 12 Aug 2018 21:04:53 +0000 (21:04 +0000)]
fix static ZFS linking

Static linking of ZFS is a newish option and LINT doesn't include it

5 years agoipmi/opal: Enable polled mode and proper callback
jhibbits [Sun, 12 Aug 2018 20:33:55 +0000 (20:33 +0000)]
ipmi/opal: Enable polled mode and proper callback

Fix a NULL dereference that would occur any time an ioctl() was done, due to a
missing ipmi_enqueue_request callback.  Just use the default for now, until we
decide to properly enable IPMI interrupts.

Reported by: kbowling

5 years agoAdd explicit cast to silence a warning for the userland stack.
tuexen [Sun, 12 Aug 2018 14:05:15 +0000 (14:05 +0000)]
Add explicit cast to silence a warning for the userland stack.

Thanks to Felix Weinrank for providing the patch.

5 years agoMove inetd.conf to usr.sbin/inetd/
brd [Sun, 12 Aug 2018 13:29:40 +0000 (13:29 +0000)]
Move inetd.conf to usr.sbin/inetd/

This is pkgbase related as it uses CONFS to tag the file as a config file

Approved by: AllanJude (mentor)
Sponsored by: Essen Hackathon
Differential Revision: https://reviews.freebsd.org/D16693

5 years agoMove all the newsyslog related configs to usr.sbin/newsyslog/
brd [Sun, 12 Aug 2018 13:24:53 +0000 (13:24 +0000)]
Move all the newsyslog related configs to usr.sbin/newsyslog/

This is related to pkgbase and changes these to use CONFS so that these are
tagged as config files.

Approved by: AllanJude (mentor)
Sponsored by: Essen Hackathon
Differential Revision: https://reviews.freebsd.org/D16694

5 years agoAdding myself to committers-src.dot
lwhsu [Sun, 12 Aug 2018 12:58:05 +0000 (12:58 +0000)]
Adding myself to committers-src.dot

Approved by: markj (mentor)