]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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.

5 years agopowerpc/SPE: Copy lower part of source register to target for efdabs/efdnabs/efdneg
jhibbits [Sun, 9 Dec 2018 04:54:55 +0000 (04:54 +0000)]
powerpc/SPE: Copy lower part of source register to target for efdabs/efdnabs/efdneg

MFC after: 1 week
MFC With: r341751

5 years agopowerpc/SPE: Reload vector registers after efdabs/efdnabs/efdneg
jhibbits [Sun, 9 Dec 2018 04:13:14 +0000 (04:13 +0000)]
powerpc/SPE: Reload vector registers after efdabs/efdnabs/efdneg

While here, also style(9)-adjust indents around this code.

5 years agoHook up ng_checksum(4) module and appropriate manpage to the build. The module
sobomax [Sun, 9 Dec 2018 02:58:53 +0000 (02:58 +0000)]
Hook up ng_checksum(4) module and appropriate manpage to the build. The module
was added back in 2016, but has never been connected.

MFC after: 1 week

5 years agoFix PAE boot.
kib [Sat, 8 Dec 2018 22:12:57 +0000 (22:12 +0000)]
Fix PAE boot.

With the introduction of M_EXEC support for kmem_malloc(), some kernel
mappings start having NX bit set in the paging structures early, for
PAE kernels on machines with NX support, i.e. practically on all
machines.  In particular, AP trampoline and initialization needs to
access pages which translations has NX bit set, before initializecpu()
is called.

Check for CPUID NX feature and enable EFER.NXE before we enable paging
in mp boot trampoline.  This allows the CPU to use the kernel page
table instead of generating page fault due to reserved bit set.

PR: 233819
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoarm64: add ACPI based NUMA support
jchandra [Sat, 8 Dec 2018 19:42:01 +0000 (19:42 +0000)]
arm64: add ACPI based NUMA support

Use the newly defined SRAT/SLIT parsing APIs in arm64 to support
ACPI based NUMA.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D17943

5 years agoacpica: support parsing of arm64 affinity in acpi_pxm.c
jchandra [Sat, 8 Dec 2018 19:32:23 +0000 (19:32 +0000)]
acpica: support parsing of arm64 affinity in acpi_pxm.c

ACPI SRAT table on arm64 uses GICC entries to provide CPU locality
information. These entries use an AcpiProcessorUid to identify the
CPU (unlike on x86 where the entries have an APIC ID).

Update acpi_pxm.c to extend the cpu_add/cpu_find/cpu_get_info
functions to handle AcpiProcessorUid. Use the updated functions
while parsing ACPI_SRAT_GICC_AFFINITY entry for arm64.

Also update sys/conf/files.arm64 to build acpi_pxm.c when ACPI is
enabled.

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D17942

5 years agoacpica : move SRAT/SLIT parsing to sys/dev/acpica
jchandra [Sat, 8 Dec 2018 19:10:58 +0000 (19:10 +0000)]
acpica : move SRAT/SLIT parsing to sys/dev/acpica

This moves the architecture independent parts of sys/x86/acpica/srat.c
to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function
declarations are moved to sys/dev/acpica/acpivar.h

We also need to update sys/conf/files.{i386,amd64} to use the new file.
No functional changes.

Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D17941

5 years agox86/acpica/srat.c: Add API for parsing proximity tables
jchandra [Sat, 8 Dec 2018 18:34:05 +0000 (18:34 +0000)]
x86/acpica/srat.c: Add API for parsing proximity tables

The SLIT and SRAT ACPI tables needs to be parsed on arm64 as well, on
systems that use UEFI/ACPI firmware and support NUMA. To do this, we
need to move most of the logic of x86/acpica/srat.c to dev/acpica and
provide an API that architectures can use to parse and configure ACPI
NUMA information.

This commit adds the API in srat.c as a first step, without making any
functional changes. We will move the common code to sys/dev/acpica
as the next step.

The functions added are:
  * int acpi_pxm_init(int ncpus, vm_paddr_t maxphys) - to allocate and
    initialize data structures used
  * void acpi_pxm_parse_tables(void) - parse SRAT/SLIT, save the cpu and
    memory proximity information
  * void acpi_pxm_set_mem_locality(void) - use the saved data to set
    memory locality
  * void acpi_pxm_set_cpu_locality(void) - use the saved data to set cpu
    locality
  * void acpi_pxm_free(void) - free data structures allocated by init

On arm64, we do not have an cpu APIC id that can be used as index to
store CPU data, we need to use the Processor Uid. To help with this,
define internal functions cpu_add, cpu_find, cpu_get_info to store
and get CPU proximity information.

Reviewed by: markj, jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D17940

5 years agoImplement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations.
mmel [Sat, 8 Dec 2018 14:58:17 +0000 (14:58 +0000)]
Implement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations.
Although these are slightly obsolete in favor of R_AARCH64_TLSDESC,
gcc -mtls-dialect=trad still use them.

Please note that definition of TLS_DTPMOD64 and TLS_DTPREL64 are incorrectly
exchanged in GNU binutils. TLS_DTPREL64 should be encoded to 1028 (as is
defined in ARM ELF ABI) but binutils encode it to 1029. And vice versa,
TLS_DTPMOD64 should be encoded to 1029 but binutils encode it to 1028.

While I'm in, add also R_AARCH64_NONE. It can be produced as result of linker
relaxation.

MFC after: 1 week

5 years agoumtx: avoid umtxshm locking on object termination if possible
mjg [Sat, 8 Dec 2018 14:04:57 +0000 (14:04 +0000)]
umtx: avoid umtxshm locking on object termination if possible

Sample build world result on tmpfs:
kern.ipc.umtx_terminate_notempty: 0
kern.ipc.umtx_terminate_empty: 2891815

Sponsored by: The FreeBSD Foundation

5 years agotools: netmap: pkt-gen: check packet length against interface MTU
vmaffione [Sat, 8 Dec 2018 12:52:09 +0000 (12:52 +0000)]
tools: netmap: pkt-gen: check packet length against interface MTU

Validate the value of the -l argument (packet length) against the MTU of the netmap port.
In case the netmap port does not refer to a physical interface (e.g. VALE port or pipe), then
the netmap buffer size is used as MTU.
This change also sets a better default value for the -M option, so that pkt-gen uses
the largest possible fragments in case of multi-slot packets.

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

5 years agosh(1): Remove -c string from set builtin documentation
jilles [Sat, 8 Dec 2018 12:49:19 +0000 (12:49 +0000)]
sh(1): Remove -c string from set builtin documentation

Altering the -c string at run time does not make sense and is not possible.

MFC after: 1 week

5 years agoRemove proctree acquire from note_procstat_proc
mjg [Sat, 8 Dec 2018 11:38:39 +0000 (11:38 +0000)]
Remove proctree acquire from note_procstat_proc

It is not needed since r340482 ("proc: always store parent pid in p_oppid")

Sponsored by: The FreeBSD Foundation

5 years agoFix a corner case in ID bitmap management.
mjg [Sat, 8 Dec 2018 10:22:12 +0000 (10:22 +0000)]
Fix a corner case in ID bitmap management.

If all IDs from trypid to pid_max were used as pids, the code would enter
a loop which would be infinite if none of the IDs could become free (e.g.
they all belong to processes which did not transitioned to zombie).

Fixes: r341684 ("Manage process-related IDs with bitmaps")

Sponsored by: The FreeBSD Foundation

5 years agoproc: postpone proc unlock until after reporting with kqueue
mjg [Sat, 8 Dec 2018 06:34:12 +0000 (06:34 +0000)]
proc: postpone proc unlock until after reporting with kqueue

kqueue would always relock immediately afterwards.

While here drop the NULL check for list itself. The list is
always allocated.

Sponsored by: The FreeBSD Foundation

5 years agoproc: handle sdt exit probe before taking the proc lock
mjg [Sat, 8 Dec 2018 06:31:43 +0000 (06:31 +0000)]
proc: handle sdt exit probe before taking the proc lock

Sponsored by: The FreeBSD Foundation

5 years agoProvide SDT_PROBES_ENABLED macro.
mjg [Sat, 8 Dec 2018 06:30:41 +0000 (06:30 +0000)]
Provide SDT_PROBES_ENABLED macro.

Sponsored by: The FreeBSD Foundation

5 years agoamd64: stop re-reading curpc on subyte/suword
mjg [Sat, 8 Dec 2018 04:53:08 +0000 (04:53 +0000)]
amd64: stop re-reading curpc on subyte/suword

Originally read value is still safely kept. Re-reading code was there
for previous iterations which were partially shared with i386.

Sponsored by: The FreeBSD Foundation

5 years agoSimplify kern_readlink_vp().
kib [Fri, 7 Dec 2018 23:07:51 +0000 (23:07 +0000)]
Simplify kern_readlink_vp().

When we detected that the vnode is not symlink, return immediately.
This moves the readlink code out of else branch and unindents it.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoFix expression evaluation.
kib [Fri, 7 Dec 2018 23:05:12 +0000 (23:05 +0000)]
Fix expression evaluation.

Braces were put in the wrong place, causing failing EAGAIN check to
return zero result.  Remove the problematic assignment from the
conditional expression at all.

While there, remove used once variable vp, and wrap too long line.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoEven though they are reserved, cdw2 and cdw3 can be set via nvme-cli
imp [Fri, 7 Dec 2018 21:58:08 +0000 (21:58 +0000)]
Even though they are reserved, cdw2 and cdw3 can be set via nvme-cli
(and soon nvmecontrol). Go ahead and copy them into rsvd2 and rsvd3.

Sponsored by: Netflix

5 years agoAdd nda(4) cross reference to nvme(4)
imp [Fri, 7 Dec 2018 21:57:39 +0000 (21:57 +0000)]
Add nda(4) cross reference to nvme(4)

5 years agoMake virtio-scsi pass SCSI Task Attributes to CTL.
mav [Fri, 7 Dec 2018 20:55:29 +0000 (20:55 +0000)]
Make virtio-scsi pass SCSI Task Attributes to CTL.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

5 years agoFix several iov handling bugs in bhyve virtio-scsi backend.
mav [Fri, 7 Dec 2018 20:30:00 +0000 (20:30 +0000)]
Fix several iov handling bugs in bhyve virtio-scsi backend.

 - buf_to_iov() does not use buflen parameter, allowing out of bound read.
 - buf_to_iov() leaks memory if seek argument > 0.
 - iov_to_buf() doesn't need to reallocate buffer for every segment.
 - there is no point to use size_t for iov counts, int is more then enough.
 - some iov function arguments can be constified.
 - pci_vtscsi_request_handle() used truncate_iov() incorrectly, allowing
   getting out of buffer and possibly corrupting data.
 - pci_vtscsi_controlq_notify() written returned status at wrong offset.
 - pci_vtscsi_controlq_notify() leaked one buffer per event.

Reported by: wg
Reviewed by: araujo
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D18465

5 years agoFill initid explicitly on requests.
mav [Fri, 7 Dec 2018 19:10:51 +0000 (19:10 +0000)]
Fill initid explicitly on requests.

Unfortunately ctl_scsi_zero_io() wipes that field, so it was always zero.
While there, targ_port is set by kernel, so user-space should not fill it.

MFC after: 1 week

5 years agoBSD.debug.dist: add newly added nvmecontrol directory
emaste [Fri, 7 Dec 2018 16:52:52 +0000 (16:52 +0000)]
BSD.debug.dist: add newly added nvmecontrol directory

5 years agofd: use racct_set_unlocked
mjg [Fri, 7 Dec 2018 16:51:38 +0000 (16:51 +0000)]
fd: use racct_set_unlocked

Sponsored by: The FreeBSD Foundation