]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoMFV r341771,342040,342041:
mm [Thu, 13 Dec 2018 11:18:45 +0000 (11:18 +0000)]
MFV r341771,342040,342041:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #1102: RAR5 reader - fix big-endian problems
  PR #1105: Fix various crash, memory corruption and infinite loop conditions
  PR #1107: RAR5 reader: removed an unused function: bf_is_last_block

MFC after: 1 week

5 years agoPlug memory leak for AES_*_NIST_GMAC algorithms.
ae [Thu, 13 Dec 2018 08:59:51 +0000 (08:59 +0000)]
Plug memory leak for AES_*_NIST_GMAC algorithms.

swcr_newsession() allocates sw_ictx for these algorithms, thus we need
to free() it in swcr_freesession().

PR: 233907
MFC after: 1 week

5 years agoFix dates that I set into the future incorrectly.
dim [Thu, 13 Dec 2018 06:59:55 +0000 (06:59 +0000)]
Fix dates that I set into the future incorrectly.

Noticed by: ler

5 years agopowerpc/booke: Change KERNBASE to be physical load address
jhibbits [Thu, 13 Dec 2018 05:07:39 +0000 (05:07 +0000)]
powerpc/booke: Change KERNBASE to be physical load address

Previous commits have made VM_MIN_KERNEL_ADDRESS its own separate entity,
and rebased the kernel around that address instead of KERNBASE.  This commit
pulls the trigger to rebase KERNBASE to a physical load address.  The
eventual goal is to align the address with the AIM KERNBASE, but at this
time that's not an option.

Currently a Book-E kernel must be loaded on a 64MB boundary, due to size
issues.  The common load address is at the 64MB mark (0x04000000), so simply
make that the default KERNBASE.

As of this commit, Book-E kernels can be loaded and booted with ubldr.

MFC after: 3 weeks

5 years agopowerpcspe: Fix GPR handling in SPE exception handler
jhibbits [Thu, 13 Dec 2018 04:48:28 +0000 (04:48 +0000)]
powerpcspe: Fix GPR handling in SPE exception handler

Optimize the exception handler to only save and load the upper word of the
GPRs used in the emulating instruction.  This reduces the save/load
overhead, and as a side effect does not overwrite the upper word of any
temporary register.

With this commit I am now able to run editors/abiword and math/gnumeric on a
e500-based system.

MFC after: 1 week
MFC With: r341752,r341751

5 years agoGeneralize AES iov optimization
mmacy [Thu, 13 Dec 2018 04:40:53 +0000 (04:40 +0000)]
Generalize AES iov optimization

Right now, aesni_cipher_alloc does a bit of special-casing
for CRYPTO_F_IOV, to not do any allocation if the first uio
is large enough for the requested size. While working on ZFS
crypto port, I ran into horrible performance because the code
uses scatter-gather, and many of the times the data to encrypt
was in the second entry. This code looks through the list, and
tries to see if there is a single uio that can contain the
requested data, and, if so, uses that.

This has a slight impact on the current consumers, in that the
check is a little more complicated for the ones that use
CRYPTO_F_IOV -- but none of them meet the criteria for testing
more than one.

Submitted by: sef at ixsystems.com
Reviewed by: cem@
MFC after: 3 days
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D18522

5 years agoCorrectly implemenet atomic_swap_long for mips64.
imp [Thu, 13 Dec 2018 00:42:26 +0000 (00:42 +0000)]
Correctly implemenet atomic_swap_long for mips64.

MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t.
sizeof(long) == sizeof(ptr) for all platforms, so define
atomic_swap_ptr in terms of atomic_swap_long.

Submitted by: hps@

5 years agomv_thermal: Add thermal driver for AP806 and CP110 thermal sensor
manu [Wed, 12 Dec 2018 22:33:05 +0000 (22:33 +0000)]
mv_thermal: Add thermal driver for AP806 and CP110 thermal sensor

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoarm64: mv_cp110_icu: Fix build
manu [Wed, 12 Dec 2018 22:24:30 +0000 (22:24 +0000)]
arm64: mv_cp110_icu: Fix build

5 years agomv_gpio: Since it's also an interrupt controller, attach sooner
manu [Wed, 12 Dec 2018 22:10:11 +0000 (22:10 +0000)]
mv_gpio: Since it's also an interrupt controller, attach sooner

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agosdhci_xenon: Add Marvell 8k compatible string
manu [Wed, 12 Dec 2018 22:09:35 +0000 (22:09 +0000)]
sdhci_xenon: Add Marvell 8k compatible string

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoarm64: Add mv_cp110_icu and mv_cp110_gicp
manu [Wed, 12 Dec 2018 22:08:43 +0000 (22:08 +0000)]
arm64: Add mv_cp110_icu and mv_cp110_gicp

icu is a interrupt concentrator in the CP110 block and gicp
is a gic extension to allow interrupts in the CP block to be turned
into GIC SPI interrupts

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agotwsi: Clean up marvell part and add support for Marvell 7k/8k
manu [Wed, 12 Dec 2018 22:05:07 +0000 (22:05 +0000)]
twsi: Clean up marvell part and add support for Marvell 7k/8k

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoarm64: marvell: Add cp110 clock controller support
manu [Wed, 12 Dec 2018 22:04:21 +0000 (22:04 +0000)]
arm64: marvell: Add cp110 clock controller support

The cp110 clock controller controls the clocks and gate of the CP110
hardware block.

Every clock/gate are implemented except the NAND clock.

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoarm64: mv_gpio: Add Marvell 8K support
manu [Wed, 12 Dec 2018 22:02:57 +0000 (22:02 +0000)]
arm64: mv_gpio: Add Marvell 8K support

While here put the interrupts setup in it's own function

Sponsored by: Rubicon Communications, LCC ("Netgate")

5 years agoarm64: marvell: Add driver for Marvell Ap806 System Controller
manu [Wed, 12 Dec 2018 22:01:06 +0000 (22:01 +0000)]
arm64: marvell: Add driver for Marvell Ap806 System Controller

The first two clocks are for the clusters and their frequencies can be
found reading a register. Then a fixed 1200Mhz clock is present and two
fixed clocks, 'mss' which is 1200 / 6 and 'sdio' which is 1200 / 3.

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoarm64: mvebu_pinctrl: Add driver for Marvell Pinmux Controller
manu [Wed, 12 Dec 2018 22:00:05 +0000 (22:00 +0000)]
arm64: mvebu_pinctrl: Add driver for Marvell Pinmux Controller

Add a driver compatible with Marvell mvebu-pinctrl and add ap806-pinctrl
support.

Sponsored by: Rubicon Communications, LCC ("Netgate")

5 years agoarm64: Add new SoC type MARVELL_8K
manu [Wed, 12 Dec 2018 21:58:30 +0000 (21:58 +0000)]
arm64: Add new SoC type MARVELL_8K

Sponsored by: Rubicon Communications, LLC ("Netgate")

5 years agoEnable devcryptoeng for OpenSSL.
jkim [Wed, 12 Dec 2018 21:56:47 +0000 (21:56 +0000)]
Enable devcryptoeng for OpenSSL.

Since OpenSSL 1.1.1, the good old BSD-specific cryptodev engine has been
deprecated in favor of this new engine.  However, this engine is not
throughly tested on FreeBSD because it was originally written for Linux.

http://cryptodev-linux.org/

Also, the author actually meant to enable it by default on BSD platforms but
he failed to do so because there was a bug in the Configure script.

https://github.com/openssl/openssl/pull/7882

Now they found that it was more generic issue.

https://github.com/openssl/openssl/pull/7885

Therefore, we need to enable this engine on head to give it more exposure.

5 years agofdt: Add support for simple-mfd bus
manu [Wed, 12 Dec 2018 21:56:45 +0000 (21:56 +0000)]
fdt: Add support for simple-mfd bus

Quoting the binding Documentation :

"These devices comprise a nexus for heterogeneous hardware blocks containing
more than one non-unique yet varying hardware functionality."

Reviewed by: loos
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D17751

5 years agopwm: Fix some arches by using %ju and casting to uintmax_t
manu [Wed, 12 Dec 2018 21:25:52 +0000 (21:25 +0000)]
pwm: Fix some arches by using %ju and casting to uintmax_t

Reported by: ci.freebsd.org

5 years agoarm64: allwinner: Fix pwm dtso
manu [Wed, 12 Dec 2018 21:10:34 +0000 (21:10 +0000)]
arm64: allwinner: Fix pwm dtso

Double patched files ended up in the tree

Reported by: kevans

5 years agoarm64: allwinner: Add DTSO for pwm and r_pwm
manu [Wed, 12 Dec 2018 21:02:22 +0000 (21:02 +0000)]
arm64: allwinner: Add DTSO for pwm and r_pwm

Those are both dtso (overlays) for the two pwm controllers found on the A64.

5 years agoarm64: allwinner: Add pwm driver
manu [Wed, 12 Dec 2018 20:58:43 +0000 (20:58 +0000)]
arm64: allwinner: Add pwm driver

Add a pwm driver for Allwinner PWM
Add pwm and aw_pwm to the GENERIC kernel

5 years agoAdd a pwm subsystem so we can configure pwm controller from kernel and userland.
manu [Wed, 12 Dec 2018 20:56:56 +0000 (20:56 +0000)]
Add a pwm subsystem so we can configure pwm controller from kernel and userland.

The pwm subsystem consist of API for PWM controllers, pwmbus to register them
and a pwm(8) utility to talk to them from userland.

Reviewed by: oshgobo (capsicum), bcr (manpage), 0mp (manpage)
Differential Revision: https://reviews.freebsd.org/D17938

5 years agoAdd NETGRAPH_CHECKSUM.
sobomax [Wed, 12 Dec 2018 20:40:01 +0000 (20:40 +0000)]
Add NETGRAPH_CHECKSUM.

MFC after: 1 week

5 years agolibcapsicum: add missing links
oshogbo [Wed, 12 Dec 2018 20:32:17 +0000 (20:32 +0000)]
libcapsicum: add missing links

Reported by: manu

5 years agopf tests: Basic rdr test
kp [Wed, 12 Dec 2018 20:19:56 +0000 (20:19 +0000)]
pf tests: Basic rdr test

MFC after: 2 weeks

5 years agopf tests: NAT exhaustion test
kp [Wed, 12 Dec 2018 20:19:18 +0000 (20:19 +0000)]
pf tests: NAT exhaustion test

It's been reported that pf doesn't handle running out of available ports
for NAT correctly. It freezes until a state expires and it can find a
free port.
Test for this, by setting up a situation where only two ports are
available for NAT and then attempting to create three connections.

If successful the third connection will fail immediately. In an
incorrect case the connection attempt will freeze, also freezing all
interaction with pf through pfctl and trigger timeout.

PR: 233867
MFC after: 2 weeks

5 years agopf: Fix endless loop on NAT exhaustion with sticky-address
kp [Wed, 12 Dec 2018 20:15:06 +0000 (20:15 +0000)]
pf: Fix endless loop on NAT exhaustion with sticky-address

When we try to find a source port in pf_get_sport() it's possible that
all available source ports will be in use. In that case we call
pf_map_addr() to try to find a new source IP to try from. If there are
no more available source IPs pf_map_addr() will return 1 and we stop
trying.

However, if sticky-address is set we'll always return the same IP
address, even if we've already tried that one.
We need to check the supplied address, because if that's the one we'd
set it means pf_get_sport() has already tried it, and we should error
out rather than keep trying.

PR: 233867
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18483

5 years agoAdd myself to the calendar
syrinx [Wed, 12 Dec 2018 19:58:54 +0000 (19:58 +0000)]
Add myself to the calendar

5 years agoAdd NETGRAPH_CHECKSUM.
sobomax [Wed, 12 Dec 2018 19:02:37 +0000 (19:02 +0000)]
Add NETGRAPH_CHECKSUM.

MFC after: 1 week

5 years agogmirror: Remove a last-minute INVARIANTS breakage in r341840
cem [Wed, 12 Dec 2018 18:13:56 +0000 (18:13 +0000)]
gmirror: Remove a last-minute INVARIANTS breakage in r341840

I mistakenly added a lock assertion to this routine at the last minute
without confirming it was held during g_mirror_create.  It isn't (it isn't
even initialized yet).  Mea culpa.  Access is exclusive in both callers,
just not always by that particular lock.

Reported by: lwhsu
X-MFC-With: r341840, r341674

5 years agonetmap: add man page for ptnet
vmaffione [Wed, 12 Dec 2018 17:05:47 +0000 (17:05 +0000)]
netmap: add man page for ptnet

Add a man page for ptnet(4), describing the guest driver for netmap passthrough.

Reviewed by: bcr
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18518

5 years agonetmap: fix warning in netmap_kloop.c
vmaffione [Wed, 12 Dec 2018 16:32:15 +0000 (16:32 +0000)]
netmap: fix warning in netmap_kloop.c

Reported by: markj
MFC after: 3 days

5 years agoFix a possible mbuf double free in bwn_dma_tx_start().
markj [Wed, 12 Dec 2018 15:49:14 +0000 (15:49 +0000)]
Fix a possible mbuf double free in bwn_dma_tx_start().

If bus_dmamap_load_mbuf() fails following a defrag, the caller of
bwn_dma_tx_start() would free the original mbuf after m_defrag() had
already done so.  Fix this by returning the defragged mbuf to the
caller instead.  Update bwn_pio_tx_start() similarly for consistency.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Reviewed by: landonf
Tested by: landonf
MFC after: 3 days
admbug: 820
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18342

5 years agoMakefile.inc1: update stale wpa dependency removal statement
emaste [Wed, 12 Dec 2018 15:23:40 +0000 (15:23 +0000)]
Makefile.inc1: update stale wpa dependency removal statement

Only stale .depend files are removed; do not mention object files.

5 years agoasmc: Add Support for Macbook Pro 8,1
dab [Wed, 12 Dec 2018 13:43:55 +0000 (13:43 +0000)]
asmc: Add Support for Macbook Pro 8,1

PR: 217505
Submitted by: John O. Brickley <obryan.brickley@gmail.com>, updated by Maciej Pasternacki <maciej@pasternacki.net>
Reported by: John O. Brickley <obryan.brickley@gmail.com>
MFC after: 1 week

5 years agoDon't register IOCTLs with capsicum when there is no valid file descriptor.
hselasky [Wed, 12 Dec 2018 09:51:10 +0000 (09:51 +0000)]
Don't register IOCTLs with capsicum when there is no valid file descriptor.
This fixes tcpdump when using mlx5_X devices.

Differential Revision: https://reviews.freebsd.org/D18499
Reviewed by: kib@, slavash@, oshogbo@
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agogmirror: Fix a bug introduced in r341674
cem [Wed, 12 Dec 2018 05:48:27 +0000 (05:48 +0000)]
gmirror: Fix a bug introduced in r341674

r341674 inadvertently introduced a bug where newer mirror components being
tasted would clear the high sc_flags that are not controlled by component
metadata, such as G_MIRROR_DEVICE_FLAG_TASTING.  This could plausibly expose
a small window of time during STARTING where device destruction might race
with mirror component addition, probably resulting in a crash.

Reviewed by: markj
X-MFC-With: r341674
Differential Revision: https://reviews.freebsd.org/D18521

5 years agoSet default ciphers.
cy [Wed, 12 Dec 2018 05:18:53 +0000 (05:18 +0000)]
Set default ciphers.

Submitted by: jkim@

5 years agoregcomp: reduce size of bitmap for multibyte locales
yuripv [Wed, 12 Dec 2018 04:23:00 +0000 (04:23 +0000)]
regcomp: reduce size of bitmap for multibyte locales

This fixes the obscure endless loop seen with case-insensitive
patterns containing characters in 128-255 range;  originally
found running GNU grep test suite.

Our regex implementation being kludgy translates the characters
in case-insensitive pattern to bracket expression containing both
cases for the character and doesn't correctly handle the case when
original character is in bitmap and the other case is not, falling
into the endless loop going through in p_bracket(), ordinary(),
and bothcases().

Reducing the bitmap to 0-127 range for multibyte locales solves this
as none of these characters have other case mapping outside of bitmap.
We are also safe in the case when the original character outside of
bitmap has other case mapping in the bitmap (there are several of those
in our current ctype maps having unidirectional mapping into bitmap).

Reviewed by: bapt, kevans, pfg
Differential revision: https://reviews.freebsd.org/D18302

5 years agoUse Capsicum helpers in ping(8).
markj [Wed, 12 Dec 2018 02:33:01 +0000 (02:33 +0000)]
Use Capsicum helpers in ping(8).

Also use caph_cache_catpages() to ensure that strerror() works when
run with kern.trap_enotcap=1.

Reviewed by: oshogbo
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18514

5 years agoContinuing efforts to provide hardening of FFS. This change adds a
mckusick [Tue, 11 Dec 2018 22:14:37 +0000 (22:14 +0000)]
Continuing efforts to provide hardening of FFS. This change adds a
check hash to the filesystem inodes. Access attempts to files
associated with an inode with an invalid check hash will fail with
EINVAL (Invalid argument). Access is reestablished after an fsck
is run to find and validate the inodes with invalid check-hashes.
This check avoids a class of filesystem panics related to corrupted
inodes. The hash is done using crc32c.

Note this check-hash is for the inode itself and not any of its
indirect blocks. Check-hash validation may be extended to also
cover indirect block pointers, but that will be a separate (and
more costly) feature.

Check hashes are added only to UFS2 and not to UFS1 as UFS1 is
primarily used in embedded systems with small memories and low-powered
processors which need as light-weight a filesystem as possible.

Reviewed by:  kib
Tested by:    Peter Holm
Sponsored by: Netflix

5 years agopf tests: Use the ATF cleanup infrastructure in the ioctl tests
kp [Tue, 11 Dec 2018 21:49:13 +0000 (21:49 +0000)]
pf tests: Use the ATF cleanup infrastructure in the ioctl tests

Use ATF_TC_CLEANUP(), because that means the cleanup code will get
called even if a test fails. Before it would only be executed if every
test within the body succeeded.

Reported by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
MFC after: 2 weeks

5 years agopf tests: ioctl tests require root rights
kp [Tue, 11 Dec 2018 21:45:56 +0000 (21:45 +0000)]
pf tests: ioctl tests require root rights

Explicitly mark these tests as requiring root rights. We need to be able
to open /dev/pf.

Reported by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
MFC after: 2 weeks

5 years agopf: Prevent integer overflow in PF when calculating the adaptive timeout.
kp [Tue, 11 Dec 2018 21:44:39 +0000 (21:44 +0000)]
pf: Prevent integer overflow in PF when calculating the adaptive timeout.

Mainly states of established TCP connections would be affected resulting
in immediate state removal once the number of states is bigger than
adaptive.start.  Disabling adaptive timeouts is a workaround to avoid this bug.
Issue found and initial diff by Mathieu Blanc (mathieu.blanc at cea dot fr)

Reported by: Andreas Longwitz <longwitz AT incore.de>
Obtained from:  OpenBSD
MFC after: 2 weeks

5 years agoRemove a dead file. CVS was removed in r251794.
bz [Tue, 11 Dec 2018 21:16:09 +0000 (21:16 +0000)]
Remove a dead file.  CVS was removed in r251794.

5 years agoAllow CTL device specification in bhyve virtio-scsi.
mav [Tue, 11 Dec 2018 20:47:00 +0000 (20:47 +0000)]
Allow CTL device specification in bhyve virtio-scsi.

There was a large refactoring done in CTL to allow multiple ioctl frontend
ports (and respective devices) to be created, particularly for bhyve.
Unfortunately, respective part of bhyve functionality got lost somehow from
the original virtio-scsi commit.  This change allows wanted device path to
be specified in either of two ways:
 -s 6,virtio-scsi,/dev/cam/ctl1.1
 -s 6,virtio-scsi,dev=/dev/cam/ctl2.3
If neither is specified, the default /dev/cam/ctl device is used.

While there, remove per-queue CTL device opening, which makes no sense at
this point.

Reported by: wg
Reviewed by: araujo
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18504

5 years agoRemove unused argument to priv_check_cred.
mjg [Tue, 11 Dec 2018 19:32:16 +0000 (19:32 +0000)]
Remove unused argument to priv_check_cred.

Patch mostly generated with cocinnelle:

@@
expression E1,E2;
@@

- priv_check_cred(E1,E2,0)
+ priv_check_cred(E1,E2)

Sponsored by: The FreeBSD Foundation

5 years agoUpgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
dim [Tue, 11 Dec 2018 19:05:28 +0000 (19:05 +0000)]
Upgrade our copies of clang, llvm, lld, lldb, compiler-rt and libc++ to
the upstream release_70 branch r348686 (effectively, 7.0.1 rc3).  The
release will follow very soon, but no more functional changes are
expected.

Release notes for llvm, clang and lld 7.0.0 are available here:
<http://releases.llvm.org/7.0.0/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/clang/docs/ReleaseNotes.html>
<http://releases.llvm.org/7.0.0/tools/lld/docs/ReleaseNotes.html>

PR: 230240, 230355
Relnotes: yes
MFC after: 2 months

5 years agoFix !tx_abdicate error from r336560
shurd [Tue, 11 Dec 2018 17:46:01 +0000 (17:46 +0000)]
Fix !tx_abdicate error from r336560

r336560 was supposed to restore pre-r323954 behaviour when tx_abdicate is
not set (the default case). However, it appears that rather than the drainage
check being made conditional on tx_abdicate being set, it was duplicated
so it occured twice if tx_abdicate was set and once if it was not.

Now when !tx_abdicate, drainage is only checked if the doorbell isn't
pending.

Reported by:    lev
MFC after:      1 week
Sponsored by:   Limelight Networks

5 years agoSet tentative merge date, and add UPDATING note.
dim [Tue, 11 Dec 2018 17:39:49 +0000 (17:39 +0000)]
Set tentative merge date, and add UPDATING note.

5 years agoaudi: replace open-coded TDP_AUDITREC checks with the macro
mjg [Tue, 11 Dec 2018 17:14:12 +0000 (17:14 +0000)]
audi: replace open-coded TDP_AUDITREC checks with the macro

Sponsored by: The FreeBSD Foundation

5 years agoFix the PAE kernel gcc build.
markj [Tue, 11 Dec 2018 16:49:01 +0000 (16:49 +0000)]
Fix the PAE kernel gcc build.

The error was caused by map_ucode() casting a vm_paddr_t to a void *.
Use a uintptr_t instead to match the caller.  Fix some style bugs while
here.

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

5 years agoasmc: Add Support for MacBookAir 7,1 and 7,2
dab [Tue, 11 Dec 2018 16:35:59 +0000 (16:35 +0000)]
asmc: Add Support for MacBookAir 7,1 and 7,2

PR: 226172
Submitted by: James Wright <james.wright@jigsawdezign.com>
Reported by: James Wright <james.wright@jigsawdezign.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18396

5 years agofd: dedup code in sys_getdtablesize
mjg [Tue, 11 Dec 2018 12:08:18 +0000 (12:08 +0000)]
fd: dedup code in sys_getdtablesize

Sponsored by: The FreeBSD Foundation

5 years agoMake lim_cur inline if possible.
mjg [Tue, 11 Dec 2018 12:01:46 +0000 (12:01 +0000)]
Make lim_cur inline if possible.

It is a function call only to accomodate *some* ABIs which install a hook.
They only care for 3 types of limits: DATA, STACK, VMEM

Instead of always calling the func, see at compilation time if the requested
limit is something else and just do the read if so.

Sponsored by: The FreeBSD Foundation

5 years agofd: tidy up closing a fd
mjg [Tue, 11 Dec 2018 11:58:44 +0000 (11:58 +0000)]
fd: tidy up closing a fd

- avoid a call to knote_close in the common case
- annotate mqueue as unlikely

Sponsored by: The FreeBSD Foundation

5 years agofd: stop looking for exact freefile after allocation
mjg [Tue, 11 Dec 2018 11:57:12 +0000 (11:57 +0000)]
fd: stop looking for exact freefile after allocation

If a lower fd is closed later, the lookup goes to waste. Allocation
always performs the lookup anyway.

Sponsored by: The FreeBSD Foundation

5 years agoOnly read the ACPI proximity tabled on arm64 when we are booting from
andrew [Tue, 11 Dec 2018 11:13:11 +0000 (11:13 +0000)]
Only read the ACPI proximity tabled on arm64 when we are booting from
ACPI.

Sponsored by: DARPA, AFRL

5 years agoMerge ^/head r341764 through r341812.
dim [Tue, 11 Dec 2018 06:47:04 +0000 (06:47 +0000)]
Merge ^/head r341764 through r341812.

5 years agoFor arm and armv6, only enable LLVM target support for arm by default,
dim [Tue, 11 Dec 2018 06:45:53 +0000 (06:45 +0000)]
For arm and armv6, only enable LLVM target support for arm by default,
to shrink libllvm.a.

This is a workaround for "relocation truncated to fit" errors with BFD
ld 2.17.50 on arm and armv6, when linking executables against it.

The required range extensions are not yet supported by this very old
version of BFD ld.  When arm and armv6 userland can be successfully
linked by lld, this workaround can be removed.

5 years agoRemove questionable initialization for ICH8M, rely on BIOS to properly
delphij [Tue, 11 Dec 2018 05:10:22 +0000 (05:10 +0000)]
Remove questionable initialization for ICH8M, rely on BIOS to properly
initialize the controller.

According to the datasheet, the old code checks if port 2 (P2E, 0x4) was
the only enabled port (except port 0, which was ignored by mask 0xfe),
and issue a write to the PCS register to disable all but port 0, right
before ahci_ctlr_reset.

Some other operating systems would issue a port enable to all ports, but
since the current code only does the special initialization for ICH8M,
it entirely and rely on BIOS to do the right thing (the alternative
would be https://reviews.freebsd.org/D18300?id=50922 , should we see
reports that we really need to do it).

Reviewed by: mav
MFC after: 3 months
Differential Revision: https://reviews.freebsd.org/D18300

5 years agoFree bootstacks after AP startup.
kib [Tue, 11 Dec 2018 02:54:36 +0000 (02:54 +0000)]
Free bootstacks after AP startup.

Bootstacks are unused after APs executed sched_throw() in
init_secondary_tail() and started executing on proper idle thread
stack.  Add sysinit that detects that the idle thread for each CPU was
scheduled at least once, and free corresponding bootstack.

Slight addition of the code (~200 bytes) is compensated by the saving,
because even on typical small modern desktop CPU we leak 128K of
memory otherwise (4 pages x 8 threads).

Reviewed by: jhb
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18486

5 years agoRemove special case handling for getfhat(fd, NULL, handle).
kib [Tue, 11 Dec 2018 02:48:49 +0000 (02:48 +0000)]
Remove special case handling for getfhat(fd, NULL, handle).

There is no reason for it to behave differently from openat(fd, NULL).
Also the handling did not worked because the substituted path was from
the system address space, causing EFAULT.

Submitted by: Jack Halford <jack@gandi.net>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18501

5 years agoRemove an unused malloc(9) type.
markj [Tue, 11 Dec 2018 02:16:27 +0000 (02:16 +0000)]
Remove an unused malloc(9) type.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoUse inline tests for individual PTE bits in the RISC-V pmap.
markj [Tue, 11 Dec 2018 02:15:56 +0000 (02:15 +0000)]
Use inline tests for individual PTE bits in the RISC-V pmap.

Inline tests for PTE_* bits are easy to read and don't really require a
predicate function, and predicates which operate on a pt_entry_t are
inconvenient when working with L1 and L2 page table entries.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18461

5 years agoAdd uk.macbook.kbd keymap (vt)
dab [Tue, 11 Dec 2018 02:14:40 +0000 (02:14 +0000)]
Add uk.macbook.kbd keymap (vt)

PR: 215185
Submitted by: James Wright <james.wright@jigsawdezign.com>
Reported by: James Wright <james.wright@jigsawdezign.com>
Reviewed by: emaste (earlier version)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D18395

5 years agopowerpc/booke: Don't get and use the load offset for TOC on APs
jhibbits [Tue, 11 Dec 2018 02:03:00 +0000 (02:03 +0000)]
powerpc/booke: Don't get and use the load offset for TOC on APs

The code was a near exact copy of the code in startup, but it doesn't need
the complexity since the kernel is already relocated.  With
VM_MIN_KERNEL_ADDRESS as currently set to KERNBASE, this doesn't cause a
problem, because it's a zero offset.  However, when KERNBASE is changed to a
physical load address, it then has a non-zero offset, and ends up with an
invalid stack pointer, causing the AP to hang.

5 years agorc.subr: Implement list_vars without using 'read'
cem [Tue, 11 Dec 2018 01:38:50 +0000 (01:38 +0000)]
rc.subr: Implement list_vars without using 'read'

'read' pessimistically read(2)s one byte at a time, which can be quite
silly for large environments in slow emulators.

In my boring user environment, truss shows that the number of read()
syscalls to source rc.subr and invoke list_vars is reduced by something like
3400 to 60.  ministat(1) shows a significant time difference of about -71%
for my environment.

Suggested by: jilles
Discussed with: dteske, jhb, jilles
Differential Revision: https://reviews.freebsd.org/D18481

5 years agoValidate the string size parameter passed to -s.
jhb [Mon, 10 Dec 2018 21:47:19 +0000 (21:47 +0000)]
Validate the string size parameter passed to -s.

Use strtonum() to reject negative sizes instead of core dumping.

PR: 232206
Submitted by: David Carlier <devnexen@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D17537

5 years agoRemove stray hints files.
imp [Mon, 10 Dec 2018 21:33:01 +0000 (21:33 +0000)]
Remove stray hints files.

5 years agoDon't report stale signal information for non-signal events in ptrace_lwpinfo.
jhb [Mon, 10 Dec 2018 19:39:24 +0000 (19:39 +0000)]
Don't report stale signal information for non-signal events in ptrace_lwpinfo.

Once a signal's siginfo was copied to 'td_si' as part of the signal
exchange in issignal(), it was never cleared.  This caused future
thread events that are reported as SIGTRAP events without signal
information to report the stale siginfo in 'td_si'.  For example, if a
debugger created a new process and used SIGSTOP to stop it after
PT_ATTACH, future system call entry / exit events would set PL_FLAG_SI
with the SIGSTOP siginfo in pl_siginfo.  This broke 'catch syscall' in
current versions of gdb as it assumed PL_FLAG_SI with SIGTRAP
indicates a breakpoint or single step trap.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18487

5 years agoRework how protocol number is tracked in rule. Save it when O_PROTO
ae [Mon, 10 Dec 2018 16:23:11 +0000 (16:23 +0000)]
Rework how protocol number is tracked in rule. Save it when O_PROTO
opcode will be printed. This should solve the problem, when protocol
name is not printed in `ipfw -N show`.

Reported by: Claudio Eichenberger <cei at yourshop.com>
MFC after: 1 week

5 years agoUse correct size for IPv4 address in gethostbyaddr().
ae [Mon, 10 Dec 2018 15:42:13 +0000 (15:42 +0000)]
Use correct size for IPv4 address in gethostbyaddr().

When u_long is 8 bytes, it returns EINVAL and 'ipfw -N show' doesn't work.

Reported by: Claudio Eichenberger <cei at yourshop.com>
MFC after: 1 week

5 years agoppc64: handle exception 0x1500 (soft patch)
luporl [Mon, 10 Dec 2018 14:54:28 +0000 (14:54 +0000)]
ppc64: handle exception 0x1500 (soft patch)

This change adds a hypervisor trap handler for exception 0x1500 (soft patch),
normalizing all VSX registers and returning.
This avoids a kernel panic due to unknown exception.

Change made with the collaboration of leonardo.bianconi_eldorado.org.br,
that found out that this is a hypervisor exception and not a supervisor one,
and fixed this in the code.

Reviewed by: jhibbits, sbruno
Differential Revision: https://reviews.freebsd.org/D17806

5 years agoClean stale wpa dependencies and objects after r341759
emaste [Mon, 10 Dec 2018 14:50:11 +0000 (14:50 +0000)]
Clean stale wpa dependencies and objects after r341759

The wpa update added some source files with the same name as a file in
another directory (found via .PATH in the previous version).  Having a
stale entry in a .depend file means the new file won't be built, so test
for this case and if found remove all of wpa's dependency files.

MFC with: r341759
Sponsored by: The FreeBSD Foundation

5 years agoping(8): add space after "<=" as per style(9).
eugen [Mon, 10 Dec 2018 14:39:21 +0000 (14:39 +0000)]
ping(8): add space after "<=" as per style(9).

MFC after: 1 week
X-MFC-with: r341768

5 years agoRemove no longer needed ifdefs in the LinuxKPI, after r341787.
hselasky [Mon, 10 Dec 2018 13:41:33 +0000 (13:41 +0000)]
Remove no longer needed ifdefs in the LinuxKPI, after r341787.

Differential Revision: https://reviews.freebsd.org/D18450
Reviewed by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agoImplement atomic_swap_xxx() for all platforms.
hselasky [Mon, 10 Dec 2018 13:38:13 +0000 (13:38 +0000)]
Implement atomic_swap_xxx() for all platforms.

Differential Revision: https://reviews.freebsd.org/D18450
Reviewed by: kib@
MFC after: 3 days
Sponsored by: Mellanox Technologies

5 years agortwn, rsu: add more USB ids.
avos [Mon, 10 Dec 2018 09:45:57 +0000 (09:45 +0000)]
rtwn, rsu: add more USB ids.

PR: 233638
Submitted by: cezary.sliwa@gmail.com
MFC after: 3 days

5 years agosfxge(4): use n Tx queues instead of n + 2 on EF10 HW
arybchik [Mon, 10 Dec 2018 09:36:05 +0000 (09:36 +0000)]
sfxge(4): use n Tx queues instead of n + 2 on EF10 HW

On EF10 HW we can avoid sending packets without checksum offload
or with IP-only checksum offload to dedicated queues. Instead, we
can use option descriptors to change offload policy on any queue
during runtime. Thus, we don't need to create two dedicated queues.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18390

5 years agosfxge(4): prepare the number of Tx queues on event queue 0 to become variable
arybchik [Mon, 10 Dec 2018 09:35:53 +0000 (09:35 +0000)]
sfxge(4): prepare the number of Tx queues on event queue 0 to become variable

The number of Tx queues on event queue 0 can depend on the NIC family type,
and this property will be leveraged by future patches.
This patch prepares the code for this change.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18389

5 years agosfxge(4): report support for Tx checksum op descriptors
arybchik [Mon, 10 Dec 2018 09:35:45 +0000 (09:35 +0000)]
sfxge(4): report support for Tx checksum op descriptors

FreeBSD driver needs a patch to provide a means for packets
which do not need checksum offload but have flow ID set
to avoid hitting only the first Tx queue (which has been used
for packets not needing checksum offload).

This should be possible on Huntington, Medford or Medford2 chips
since these support toggling checksum offload on any given queue
dynamically by means of pushing option descriptors.

The patch for FreeBSD driver will then need a means to figure out
whether the feature can be used, and testing adapter family might
not be a good solution.

This patch adds a feature bit specifically to indicate support
for checksum option descriptors. The new feature bits may have
more users in future, apart from the mentioned FreeBSD patch.

Submitted by:   Ivan Malov <Ivan.Malov at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18388

5 years agosfxge(4): populate per-event queue stats in sysctl
arybchik [Mon, 10 Dec 2018 09:35:33 +0000 (09:35 +0000)]
sfxge(4): populate per-event queue stats in sysctl

In order to find out why the first event queue and corresponding
interrupt is triggered more frequent, it is useful to know which
events go to each event queue.

Sponsored by:   Solarflare Communications, Inc.
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D18418

5 years agopowerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call
jhibbits [Mon, 10 Dec 2018 04:16:40 +0000 (04:16 +0000)]
powerpc/booke: Replace a logical equivalent of pmap_kextract() with a real call

No sense in reinventing the wheel here.  AP bringup is not a time-critical
point.

5 years agopowerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels
jhibbits [Mon, 10 Dec 2018 01:52:39 +0000 (01:52 +0000)]
powerpc/ubldr: Teach powerpc's ubldr to boot 64-bit kernels

This is just a copy of powerpc/ofw's ppc64_elf_freebsd.c modified to fit
ubldr's boot format.

MFC after: 1 week

5 years agoFix typo in powerpcspe name.
imp [Sun, 9 Dec 2018 21:53:45 +0000 (21:53 +0000)]
Fix typo in powerpcspe name.

5 years agoSend a START UNIT command when a disk responds with an ASC of 04/1C.
imp [Sun, 9 Dec 2018 21:37:34 +0000 (21:37 +0000)]
Send a START UNIT command when a disk responds with an ASC of 04/1C.
This will hopefully spin up a disk that's in low-power mode.

Sponsored by: Netflix
Submitted by: scottl@

5 years agoping(8): remove needless comparision with LONG_MAX
eugen [Sun, 9 Dec 2018 21:11:15 +0000 (21:11 +0000)]
ping(8): remove needless comparision with LONG_MAX
after unsigned long ultmp changed to long ltmp in r340245.

MFC after: 1 week

5 years agoblst_leaf_alloc updates bighint for a leaf when an allocation is successful
alc [Sun, 9 Dec 2018 17:55:10 +0000 (17:55 +0000)]
blst_leaf_alloc updates bighint for a leaf when an allocation is successful
and includes the last block represented by the leaf.  The reasoning is that,
if the last block is included, then there must be no solution before that
one in the leaf, so the leaf cannot provide an allocation that big again;
indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not
represent the first block of the leaf, because the cursor was pointing to
the middle of the leaf, then a possible solution before the cursor may have
been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing
that same block, and allocate 1 (returning 63).  The result is that one
block is allocated from the first leaf, and the value of bighint is 0, so
that nothing can be allocated from that leaf until the only block allocated
from that leaf is freed.  This change detects that skipped-over solution,
and when there is one it makes sure that the value of bighint is not changed
when the last block is allocated.

Submitted by: Doug Moore <dougm@rice.edu>
Tested by: pho
X-MFC with: r340402
Differential Revision: https://reviews.freebsd.org/D18474

5 years agoFix devstat on md devices.
bde [Sun, 9 Dec 2018 15:34:20 +0000 (15:34 +0000)]
Fix devstat on md devices.

devstat_end_transaction() was called before the i/o was actually ended
(by delivering it to GEOM), so at least the i/o length was messed up.
It was always recorded as 0, so the average transaction size and the
average transfer rate was always displayed as 0.

devstat_end_transaction() was not called at all for the error case, so
there were sometimes multiple starts per end.  I didn't observe this in
practice and don't know if it did much damage.  I think it extended the
length of the i/o to the next transaction.

Reviewed by: kib

5 years agoMerge ^/head r340918 through r341763.
dim [Sun, 9 Dec 2018 11:39:45 +0000 (11:39 +0000)]
Merge ^/head r340918 through r341763.

5 years agoMerge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
dim [Sun, 9 Dec 2018 11:36:04 +0000 (11:36 +0000)]
Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
r348686 (effectively 7.0.1 rc3), resolve conflicts, and bump version
numbers.

PR: 230240, 230355

5 years agoI missed powerpcspe in the previous commit for excluding mps and mpr.
scottl [Sun, 9 Dec 2018 06:52:25 +0000 (06:52 +0000)]
I missed powerpcspe in the previous commit for excluding mps and mpr.
I also learned that 'mips' is overly broad and covers 64bit architectures
too.  However, it's not worth the fight right now, so any refinements
will have to come another day.

5 years agoMFV r341618:
cy [Sun, 9 Dec 2018 06:45:49 +0000 (06:45 +0000)]
MFV r341618:

Update wpa 2.6 --> 2.7.

5 years agoDon't allocate the config_intrhook separately from the softc, it's small
scottl [Sun, 9 Dec 2018 06:16:54 +0000 (06:16 +0000)]
Don't allocate the config_intrhook separately from the softc, it's small
enough that it costs more code to handle the malloc/free than it saves.

5 years agoCopy and clear the reply descriptor atomically. This prevents concurrency
scottl [Sun, 9 Dec 2018 06:10:11 +0000 (06:10 +0000)]
Copy and clear the reply descriptor atomically.  This prevents concurrency
in the interrupt handlers (usually due to timeout/error recovery) from
seeing and processing the same descriptor twice.

5 years agoRemove the mps driver from powerpc 32bit GENERIC, and don't build it and
scottl [Sun, 9 Dec 2018 06:06:06 +0000 (06:06 +0000)]
Remove the mps driver from powerpc 32bit GENERIC, and don't build it and
mpr as a module for powerpc or mips.  An upcoming commit will cause these
drivers to rely on the presence of 64bit atomic operations.  Discussed
with jhibbits.