]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoImport zstandard 1.3.1
Baptiste Daroussin [Tue, 22 Aug 2017 11:11:49 +0000 (11:11 +0000)]
Import zstandard 1.3.1

6 years agoAdd missing compiler.h
Baptiste Daroussin [Tue, 22 Aug 2017 11:09:16 +0000 (11:09 +0000)]
Add missing compiler.h

6 years agoImport zstd 1.3.1
Baptiste Daroussin [Tue, 22 Aug 2017 11:02:59 +0000 (11:02 +0000)]
Import zstd 1.3.1

6 years agosubr_smp: Clean up topology analysis, add additional layers
Conrad Meyer [Tue, 22 Aug 2017 00:10:15 +0000 (00:10 +0000)]
subr_smp: Clean up topology analysis, add additional layers

Rather than repeatedly nesting loops, separate concerns with a single loop
per call stack level.  Use a table to drive the recursive routine.  Handle
missing topology layers more gracefully (infer a single unit).

Analyze some additional optional layers which may be present on e.g. AMD Zen
systems (groups, aka dies, per package; and cachegroups, aka CCXes, per
group).

Display that additional information in the boot-time topology information,
when it is relevent (non-one).

Reviewed by: markj@, mjoras@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12019

6 years agoUse an updated copy of the CDDL header boilerplate from illumos.
Mark Johnston [Mon, 21 Aug 2017 22:26:49 +0000 (22:26 +0000)]
Use an updated copy of the CDDL header boilerplate from illumos.

Reported by: Yuri Pankov <yuripv@gmx.com>
X-MFC with: r322774

6 years agoAdd a regression test for r322773.
Mark Johnston [Mon, 21 Aug 2017 21:58:42 +0000 (21:58 +0000)]
Add a regression test for r322773.

MFC after: 1 week

6 years agoFix an off-by-two in the llquantize() action parameter validation.
Mark Johnston [Mon, 21 Aug 2017 21:56:02 +0000 (21:56 +0000)]
Fix an off-by-two in the llquantize() action parameter validation.

The aggregation created by llquantize() partitions values into buckets; the
lower bound of the bucket containing the largest values is b^{m+1}, where
b and m are the second and fourth parameters to the action, respectively.
Bucket bounds are stored in a 64-bit integer, and so the llquantize()
validation checks need to verify that b^{m+1} fits in 64 bits. However, it
was only verifying that b^{m-1} fits in 64 bits, so certain parameter
combinations could trigger assertion failures in libdtrace.

PR: 219451
MFC after: 1 week

6 years agoEnable hardfloat CPU instructions in the FP exception handler.
John Baldwin [Mon, 21 Aug 2017 21:48:24 +0000 (21:48 +0000)]
Enable hardfloat CPU instructions in the FP exception handler.

This permits compiling with clang's integrated assembler.

Sponsored by: DARPA / AFRL

6 years agoUpgrade FW to 5.4.66
David C Somayajulu [Mon, 21 Aug 2017 20:27:45 +0000 (20:27 +0000)]
Upgrade FW to 5.4.66
sysctls to display stats, stats polled every 2 seconds
Modify QLA_LOCK()/QLA_UNLOCK() to not sleep after acquiring mtx_lock
Add support to turn OFF/ON error recovery following heartbeat failure for
debug purposes.
Set default max values to 32 Tx/Rx/SDS rings

MFC after:5 days

6 years agoApply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
Glen Barber [Mon, 21 Aug 2017 20:23:05 +0000 (20:23 +0000)]
Apply changes from bin/chmod/tests/chmod_test.sh (r321949, r321950,
and r322101), adding atf_expect_fail() before chflags(8) is invoked
if the filesystem is ZFS, which does not support UF_IMMUTABLE.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoImprove the performance of the arm64 thread switching code.
Andrew Turner [Mon, 21 Aug 2017 18:12:32 +0000 (18:12 +0000)]
Improve the performance of the arm64 thread switching code.

The full system memory barrier around a TLB invalidation is stricter than
required. It needs to wait on accesses to main memory, with just the weaker
store variant before the invalidate. As such use the dsb istst, tlbi, dlb
ish sequence already used in pmap.

The tlbi instruction in this sequence is also unnecessarily using a
broadcast invalidate when it just needs to invalidate the local CPUs TLB.
Switch to a non-broadcast variant of this instruction.

Sponsored by: DARPA, AFRL

6 years agoFix FreeBSD-presence macro to fix the build on mips with clang.
John Baldwin [Mon, 21 Aug 2017 17:52:09 +0000 (17:52 +0000)]
Fix FreeBSD-presence macro to fix the build on mips with clang.

GCC doesn't define 'mips' which is why it doesn't trip over this.

Sponsored by: DARPA / AFRL

6 years agoInclude {u,}{div,mod}si3() on mips in libcompiler_rt.
John Baldwin [Mon, 21 Aug 2017 17:49:01 +0000 (17:49 +0000)]
Include {u,}{div,mod}si3() on mips in libcompiler_rt.

These builtins were listed in the mips-specific Symbol.map for libc but
were not implemented.  Compiling mips with recent clang requires these
symbols.

Sponsored by: DARPA / AFRL

6 years agoAdd a guard around _ILP32 for mips.
John Baldwin [Mon, 21 Aug 2017 17:45:06 +0000 (17:45 +0000)]
Add a guard around _ILP32 for mips.

This is already done for other architectures in this file and fixes the
build with clang.

6 years agoOptimize libc to get and set TLS using the RDFSBASE and RDGSBASE
Konstantin Belousov [Mon, 21 Aug 2017 17:39:12 +0000 (17:39 +0000)]
Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE
instructions, if supported both by CPU and kernel.

Reviewed by: jhb (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12023

6 years agoMake WRFSBASE and WRGSBASE instructions functional.
Konstantin Belousov [Mon, 21 Aug 2017 17:38:02 +0000 (17:38 +0000)]
Make WRFSBASE and WRGSBASE instructions functional.

Right now, we enable the CR4.FSGSBASE bit on CPUs which support the
facility (Ivy and later), to allow usermode to read fs and gs bases
without syscalls. This bit also controls the write access to bases
from userspace, but WRFSBASE and WRGSBASE instructions currently
cannot be used, because return path from both exceptions or interrupts
overrides bases with the values from pcb.

Supporting the instructions is useful because this means that usermode
can implement green-threads completely in userspace without issuing
syscalls to change all of the machine context.

Support is implemented by saving the fs base and user gs base when
PCB_FULL_IRET flag is set. The flag is set on the context switch,
which potentially causes clobber of the bases due to activation of
another context, and when explicit modification of the user context by
a syscall or exception handler is performed. In particular, the patch
moves setting of the flag before syscalls change context.

The changes to doreti_exit and PUSH_FRAME to clear PCB_FULL_IRET on
entry from userspace can be considered a bug fixes on its own.

Reviewed by: jhb (previous version)
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12023

6 years agoAvoid dereferencing potentially freed workitem in
Konstantin Belousov [Mon, 21 Aug 2017 16:23:44 +0000 (16:23 +0000)]
Avoid dereferencing potentially freed workitem in
softdep_count_dependencies().

Buffer's b_dep list is protected by the SU mount lock.  Owning the
buffer lock is not enough to guarantee the stability of the list.

Calculation of the UFS mount owning the workitems from the buffer must
be much more careful to not dereference the work item which might be
freed meantime.  To get to ump, use the pointers chain which does not
involve workitems at all.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

6 years agoStyle.
Konstantin Belousov [Mon, 21 Aug 2017 16:16:02 +0000 (16:16 +0000)]
Style.

Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoUpdate the tests(7) manual page to note the test suite is installed
Glen Barber [Mon, 21 Aug 2017 14:14:13 +0000 (14:14 +0000)]
Update the tests(7) manual page to note the test suite is installed
by default as of 11.0-RELEASE.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

6 years agoRemove stale comments.
Andrey V. Elsukov [Mon, 21 Aug 2017 13:54:29 +0000 (13:54 +0000)]
Remove stale comments.

MFC after: 1 week

6 years agoFix the regression introduced in r275710.
Andrey V. Elsukov [Mon, 21 Aug 2017 13:52:21 +0000 (13:52 +0000)]
Fix the regression introduced in r275710.

When a security policy should match TCP connection with specific ports,
the SYN+ACK segment send by syncache_respond() is considered as forwarded
packet, because at this moment TCP connection does not have PCB structure,
and ip_output() is called without inpcb pointer. In this case SPIDX filled
for SP lookup will not contain TCP ports and security policy will not
be found. This can lead to unencrypted SYN+ACK on the wire.

This patch restores the old behavior, when ports will not be filled only
for forwarded packets.

Reported by: Dewayne Geraghty <dewayne.geraghty at heuristicsystems.com.au>
MFC after: 1 week

6 years agoReplace the include path using CURDIR with KRB5DIR. This is consistent
Cy Schubert [Mon, 21 Aug 2017 12:42:05 +0000 (12:42 +0000)]
Replace the include path using CURDIR with KRB5DIR. This is consistent
with the rest of the Makefiles in kerberos5/.

MFC after: 1 week

6 years agoFix for deadlock situation in the LinuxKPI's RCU synchronize API.
Hans Petter Selasky [Mon, 21 Aug 2017 11:51:40 +0000 (11:51 +0000)]
Fix for deadlock situation in the LinuxKPI's RCU synchronize API.

Deadlock condition:
The return value of TDQ_LOCKPTR(td) is the same for two threads.

1) The first thread signals a wakeup while keeping the rcu_read_lock().
This invokes sched_add() which in turn will try to lock TDQ_LOCK().

2) The second thread is calling synchronize_rcu() calling mi_switch() over
and over again trying to yield(). This prevents the first thread from running
and releasing the RCU reader lock.

Solution:
Release the thread lock while yielding to allow other threads to acquire the
lock pointed to by TDQ_LOCKPTR(td).

Found by: KrishnamRaju ErapaRaju <Krishna2@chelsio.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoUpgrade our copies of clang, llvm, lld and libc++ to r311219 from the
Dimitry Andric [Mon, 21 Aug 2017 07:03:02 +0000 (07:03 +0000)]
Upgrade our copies of clang, llvm, lld and libc++ to r311219 from the
upstream release_50 branch.

MFC after: 2 months
X-MFC-with: r321369

6 years agoVendor import of lld release_50 branch r311219:
Dimitry Andric [Sun, 20 Aug 2017 21:03:55 +0000 (21:03 +0000)]
Vendor import of lld release_50 branch r311219:
https://llvm.org/svn/llvm-project/lld/branches/release_50@311219

6 years agoVendor import of libc++ release_50 branch r311219:
Dimitry Andric [Sun, 20 Aug 2017 21:03:49 +0000 (21:03 +0000)]
Vendor import of libc++ release_50 branch r311219:
https://llvm.org/svn/llvm-project/libcxx/branches/release_50@311219

6 years agoVendor import of clang release_50 branch r311219:
Dimitry Andric [Sun, 20 Aug 2017 21:03:30 +0000 (21:03 +0000)]
Vendor import of clang release_50 branch r311219:
https://llvm.org/svn/llvm-project/cfe/branches/release_50@311219

6 years agoVendor import of llvm release_50 branch r311219:
Dimitry Andric [Sun, 20 Aug 2017 21:02:43 +0000 (21:02 +0000)]
Vendor import of llvm release_50 branch r311219:
https://llvm.org/svn/llvm-project/llvm/branches/release_50@311219

6 years agoBring back the much more readable unified format for differences in
Marius Strobl [Sun, 20 Aug 2017 20:38:15 +0000 (20:38 +0000)]
Bring back the much more readable unified format for differences in
/etc/{group,master.passwd}. This was originally turned on for all of
/etc/{aliases,group,master.passwd} in r55196, but then backed out
only for the latter two in r56697, as the adaption of the sed(1)ing
done in r56308 was incorrect. This left us with inconsistent diff(1)
formats in the daily output of periodic(8) ever since, despite in
r56697 having been promised to be revisited. So properly adapt the
password hash filtering to the unified format and turn the later on
again for /etc/{group,master.passwd}, too.

6 years agoSimplify the code.
Konstantin Belousov [Sun, 20 Aug 2017 11:18:16 +0000 (11:18 +0000)]
Simplify the code.

Noted by: Oliver Pinter
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoDo not drop NFS vnode lock when performing consistency checks.
Konstantin Belousov [Sun, 20 Aug 2017 10:08:45 +0000 (10:08 +0000)]
Do not drop NFS vnode lock when performing consistency checks.

Currently several paths in the NFS client upgrade the shared vnode
lock to exclusive, which might cause temporal dropping of the lock.
This action appears to be fatal for nullfs mounts over NFS. If the
operation is performed over nullfs vnode, then bypassed down to NFS
VOP, and the lock is dropped, other thread might reclaim the upper
nullfs vnode.  Since on reclaim the nullfs vnode lock and NFS vnode
lock are split, the original lock state of the nullfs vnode is not
restored.  As result, VFS operations receive not locked vnode after a
VOP call.

Stop upgrading the vnode lock when we check the consistency or flush
buffers as result of detected inconsistency.  Instead, allocate a new
lockmgr lock for each NFS node, which is locked exclusive instead of
the vnode lock upgrade.  In other words, the other parallel
modification of the vnode are excluded by either vnode lock conflict
or exclusivity of the new lock when the vnode lock is shared.

Also revert r316529 because now the vnode cannot be reclaimed during
ncl_vinvalbuf().

In collaboration with: pho
Reviewed by: rmacklem
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D12083

6 years agoAllow vinvalbuf() to operate with the shared vnode lock.
Konstantin Belousov [Sun, 20 Aug 2017 10:07:45 +0000 (10:07 +0000)]
Allow vinvalbuf() to operate with the shared vnode lock.

This mode allows other clean buffers to arrive while we flush the buf
lists for the vnode, which is fine for the targeted use.  We only need
that all buffers existed at the time of the function start were
flushed.  In fact, only one assert has to be relaxed.

In collaboration with: pho
Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D12083

6 years agoSimplify amd64 trap().
Konstantin Belousov [Sun, 20 Aug 2017 09:52:25 +0000 (09:52 +0000)]
Simplify amd64 trap().

- Use more relevant name 'signo' instead of 'i' for the local variable
  which contains a signal number to send for the current exception.
- Eliminate two labels 'userout' and 'out' which point to the very end
  of the trap() function.  Instead use return directly.
- Re-indent the prot_fault_translation block by reducing if() nesting.
- Some more monor style changes.

Requested and reviewed by: bde
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoTrim excessive 'extern' and remove unused declaration.
Konstantin Belousov [Sun, 20 Aug 2017 09:42:09 +0000 (09:42 +0000)]
Trim excessive 'extern' and remove unused declaration.

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

6 years agoUse ANSI C declaration for trap_pfault(). Style.
Konstantin Belousov [Sun, 20 Aug 2017 09:39:10 +0000 (09:39 +0000)]
Use ANSI C declaration for trap_pfault().  Style.

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

6 years agoDefine prefetch() only if it hasn't already been defined.
Mark Johnston [Sun, 20 Aug 2017 01:42:01 +0000 (01:42 +0000)]
Define prefetch() only if it hasn't already been defined.

MFC after: 1 week

6 years agoAdd a couple of trivial headers to the LinuxKPI.
Mark Johnston [Sun, 20 Aug 2017 01:40:24 +0000 (01:40 +0000)]
Add a couple of trivial headers to the LinuxKPI.

MFC after: 1 week

6 years agohwpstate: Add support for family 17h pstate info from MSRs
Conrad Meyer [Sun, 20 Aug 2017 00:41:49 +0000 (00:41 +0000)]
hwpstate: Add support for family 17h pstate info from MSRs

This information is normally available via acpi_perf, but in case it is not,
add support for fetching the information via MSRs on AMD family 17h (Zen)
processors.  Zen uses a slightly different formula than previous generation
AMD CPUs.

This was inspired by, but does not fix, PR 221621.

Reported by: Sean P. R. <seanpr AT swbell.net>
Reviewed by: mjoras@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12082

6 years agoFix setting of defaults for the text cursor.
Bruce Evans [Sat, 19 Aug 2017 23:13:33 +0000 (23:13 +0000)]
Fix setting of defaults for the text cursor.

There was already a per-vty defaults field, but it was useless since it was
only initialized when propagating the global settings and thus no different
from the current global settings and not per-vty.  The global defaults field
was also invariant after boot time, but not quite so useless.

Fix this by adding a second selection bit the the control flags of the
relevant ioctl().  vidcontrol doesn't support this yet.  Setting either
default propagates the change to the current setting for the same level
and then to all lower levels.

Improve the 3-way escape sequence used by termcap to control the cursor.
The "normal" (ve) case has always used reset, so the user could set
it to anything, but since the reset is to a global value this is not
very useful, especially since the "very visible" (vs) case doesn't
reset but inconsistently forces to a blinking block.  Change vs to
first reset and then XOR the blinking bit so that it is predictably
different from ve.

6 years agoRename curr_curs_attr to base_curr_attr. The actual current cursor
Bruce Evans [Sat, 19 Aug 2017 21:40:42 +0000 (21:40 +0000)]
Rename curr_curs_attr to base_curr_attr.  The actual current cursor
attribute field is curs_attr.  The base field holds user data translated
in a reversible way and is needed because current field holds this in
an irreversible way for efficiency.

Factor out some common code for the reversible translation.  This is
slightly simpler now, and much easier to expand.

Translate the magic flags value -1 to a single control flag internally
up front so other flags can be trusted later.  This can be used for the
relevant ioctl() too.

Remove CONS_CURSOR_FLAGS which contained all the control flags.  It was
unused and not useful.  After adding more flags, there will be tests on
a couple at a time but never on them all.  This API should have used this
to disallow unknown flags.

6 years agoUse the known valid segment when accessing memory in #UD handler.
Konstantin Belousov [Sat, 19 Aug 2017 21:00:02 +0000 (21:00 +0000)]
Use the known valid segment when accessing memory in #UD handler.
Make sure that %eflags.D flag is cleared for hook.
Improve comments.

When #UD dtrace code checks for a registered hook before checking that
the exception was raised from kernel mode, we might run with the user
%ds, trapping on access.  Exception entry from userspace automatically
load valid %ss, which we can use there instead.

Noted and reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

6 years agoUse better hard-coded defaults for the cursor shape, and remove nearby
Bruce Evans [Sat, 19 Aug 2017 19:33:16 +0000 (19:33 +0000)]
Use better hard-coded defaults for the cursor shape, and remove nearby
redundant initializations.

Hard-code base = 0, height = (approx. 1/8 of the boot-time font height)
in all cases, and remove the BIOS/MD support for setting these values.
This asks for an underline cursor sized for the boot-time font instead
of various less hard-coded but worse values.  I used that think that
the x86 BIOS always gave the same values as the above hard-coding, but
on 1 of my systems it gives the wrong value of base = 1.

The remaining BIOS fields are shift_state and bell_pitch.  These are now
consistently not explicitly reinitialized to 0.  All sc_get_bios_value()
functions except x86's are now empty, and the only useful thing that x86
returns is shift_state.  This really belongs in atkbdc, but heavier
use of the BIOS to read the more useful typematic rate has been removed
there.  fb still makes much heavier use of the BIOS.

6 years agoRemove redundant declarations. Newer gcc has a warning for these so will
Andrew Turner [Sat, 19 Aug 2017 17:18:27 +0000 (17:18 +0000)]
Remove redundant declarations. Newer gcc has a warning for these so will
fail when building with -Werror.

Sponsored by: DARPA, AFRL

6 years agoUse armv8-a in -march, it is accepted by both clang and gcc.
Andrew Turner [Sat, 19 Aug 2017 17:15:40 +0000 (17:15 +0000)]
Use armv8-a in -march, it is accepted by both clang and gcc.

Sponsored by: DARPA, AFRL

6 years agoAdd support for generic MS Windows 7/8/10-compatible USB HID touchscreens
Vladimir Kondratyev [Sat, 19 Aug 2017 17:00:10 +0000 (17:00 +0000)]
Add support for generic MS Windows 7/8/10-compatible USB HID touchscreens
found in many laptops.

Reviewed by: hps, gonzo, bcr (manpages)
Approved by: gonzo (mentor)
Differential Revision: https://reviews.freebsd.org/D12017

6 years agoRPI DTS: Add value previously set by VideoCore and DTB links
Emmanuel Vadot [Sat, 19 Aug 2017 14:27:11 +0000 (14:27 +0000)]
RPI DTS: Add value previously set by VideoCore and DTB links

Using latest U-Boot for RPI 1 or 2 the DTB loaded by the firmware is discarded.
The DTB was previously patched by the firmware to contain the DMA channel mask.
DTB provided by the rpi firmware or DTS in the Linux tree contain the raw value
directly. Do the same for our DTS as we cannot switch to the upstream ones yet.
Not having the DMA channel mask setup properly cause mmc not to be detected
(and probably other problems on driver using DMA).

Also, add links for rpi dtb to the name used by u-boot. This way the dtb can be
loaded by ubldr using the U-Boot env variable fdtfile.

Tested On: RPI B Rev2, RPI Zero, RPI 2 v1.1 RPI 2 v1.2

Thanks to Sylvain Garrigues <sylvain@sylvaingarrigues.com> for the help.

PR: 218344

6 years agoReduce complexity and backwards compatibilty a little by removing new aliases
Bruce Evans [Sat, 19 Aug 2017 12:14:46 +0000 (12:14 +0000)]
Reduce complexity and backwards compatibilty a little by removing new aliases
and repurposing "blink".  Improve accuracy of documentation of historical
mistakes and other bugs.

"blink" now means "set the blink attribute for the target(s)" instead of
"set the blink attribute and clear other attributes [and control flags]".
It was even more confusing to use "blinking" for the single attribute to
keep the old meaning for "blink".

"destructive" is not as historically broken or gone as the previous version
said.

The bugs involving resetting from defaults are now understood and partly
documented (the defaults are mis-initialized).

6 years agosys/modules: don't build qlxgbe if the user objects to sourceless ucode
Ed Maste [Sat, 19 Aug 2017 01:12:05 +0000 (01:12 +0000)]
sys/modules: don't build qlxgbe if the user objects to sourceless ucode

PR: 204749
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agoena.4: fix spelling of 'occurred'
Ed Maste [Sat, 19 Aug 2017 00:51:45 +0000 (00:51 +0000)]
ena.4: fix spelling of 'occurred'

PR: 331298
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agosys/modules: don't build bxe if the user objects to sourceless ucode
Ed Maste [Sat, 19 Aug 2017 00:45:29 +0000 (00:45 +0000)]
sys/modules: don't build bxe if the user objects to sourceless ucode

PR: 204747
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agosa.4: fix spelling of 'suppresses'
Ed Maste [Sat, 19 Aug 2017 00:37:33 +0000 (00:37 +0000)]
sa.4: fix spelling of 'suppresses'

PR: 221302
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agopw useradd: Validate the user name before creating the entry
Ed Maste [Sat, 19 Aug 2017 00:32:26 +0000 (00:32 +0000)]
pw useradd: Validate the user name before creating the entry

Previouly it was possible to create users with spaces in the name with:
pw useradd -u 1234 -g 1234 -n 'test user'

The "-g 1234" is relevant, without it the name was already rejected
as expected:

[fk@test ~]$ sudo pw useradd -u 1234 -n 'test user'
pw: invalid character ` ' at position 4 in userid/group name

Bug unintentionally found with a salt config without explicit name entry:

test user:
  user.present:
    - uid: 1234
    - gid: 1234
    - fullname: Test user
    - shell: /usr/local/bin/bash
    - home: /home/test
    - groups:
      - wheel
      - salt

"Luckily" salt modules rarely bother with input validation either ...

PR: 221416
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week

6 years agopw usermod: Properly deal with empty secondary group lists (-G '')
Ed Maste [Sat, 19 Aug 2017 00:19:23 +0000 (00:19 +0000)]
pw usermod: Properly deal with empty secondary group lists (-G '')

"pw usermod someuser -G ''" is supposed make sure that someuser
doesn't have any secondary group memberships.

Previouly it was a nop because split_groups() only intitialised
"groups" if at least one group was specified. As a result the
existing secondary group memberships were kept.

PR: 221417
Submitted by: Fabian Keil
Obtained from: ElectroBSD
MFC after: 1 week
Relnotes: yes

6 years agogas: add parens to clarify expression and eliminate clang warning
Ed Maste [Fri, 18 Aug 2017 21:20:38 +0000 (21:20 +0000)]
gas: add parens to clarify expression and eliminate clang warning

Building mips64 w/ Clang failed with -Werror,-Wshift-negative-value
error: shifting a negative signed value is undefined

6 years agoAdd Thunderbolt Apple interfaces to the bge(4) supported list.
Sevan Janiyan [Fri, 18 Aug 2017 20:35:35 +0000 (20:35 +0000)]
Add Thunderbolt Apple interfaces to the bge(4) supported list.
Document message reported by kernel upon removal in DIAGNOSTIC section.
Document shortcomings in BUGS section.

Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D11771

6 years agoMove some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ
Conrad Meyer [Fri, 18 Aug 2017 18:55:07 +0000 (18:55 +0000)]
Move some other SI_SUB_INIT_IF initializations to SI_SUB_TASKQ

Drop the EARLY_AP_STARTUP gtaskqueue code, as gtaskqueues are now
initialized before APs are started.

Reviewed by: hselasky@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12054

6 years agogas: fix "format string is not a string literal" errors on mips
Ed Maste [Fri, 18 Aug 2017 18:26:30 +0000 (18:26 +0000)]
gas: fix "format string is not a string literal" errors on mips

Sponsored by: The FreeBSD Foundation

6 years agobfd: cast BFD_ALIGN to fix clang error on mips
Ed Maste [Fri, 18 Aug 2017 18:20:51 +0000 (18:20 +0000)]
bfd: cast BFD_ALIGN to fix clang error on mips

error: implicit conversion from 'bfd_vma' (aka 'unsigned long long')
to 'int' changes value from 18446744073709551615 to -1
  return BFD_ALIGN (ret, 16);
  ~~~~~~ ^~~~~~~~~~~~~~~~~~~
note: expanded from macro 'BFD_ALIGN'
   : ~ (bfd_vma) 0)
     ^~~~~~~~~~~~~

Sponsored by: The FreeBSD Foundation

6 years agoIn fetch_resolve(), if the port number or service name is included in
Dag-Erling Smørgrav [Fri, 18 Aug 2017 18:20:36 +0000 (18:20 +0000)]
In fetch_resolve(), if the port number or service name is included in
the host argument (e.g. "www.freebsd.org:443"), the service pointer,
which is supposed to point to the port or service part, instead points
to the separator, causing getaddrinfo() to fail.

Note that I have not been able to trigger this bug with fetch(1), nor
do I believe it is possible, as libfetch always parses the host:port
specification itself.  I discovered it when I copied fetch_resolve()
into an unrelated project.

MFC after: 3 days

6 years agoFreeBSD 11.1 release added.
Maxim Konovalov [Fri, 18 Aug 2017 17:32:14 +0000 (17:32 +0000)]
FreeBSD 11.1 release added.

6 years agoWhen checking that #UD comes from kernel mode, check that the
Konstantin Belousov [Fri, 18 Aug 2017 17:11:15 +0000 (17:11 +0000)]
When checking that #UD comes from kernel mode, check that the
exception did not happen in vm86 mode.  A vm86 userland process could
have a %cs that matches GSEL_KPL, while dtrace cannot hook it.

Submitted by: Maxime Villard <max@m00nbsd.net>
MFC after: 3 days

6 years agoAdd caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Sevan Janiyan [Fri, 18 Aug 2017 16:42:58 +0000 (16:42 +0000)]
Add caveat to kinfo_getvmmap(3) explaining high CPU utilisation.
Based on kib's reply on https://lists.freebsd.org/pipermail/freebsd-hackers/2016-July/049710.html

PR: 210904
Submitted by: Yuri Victorovich <yuri AT rawbw DOT com>
Reviewed by: jilles
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12004

6 years agocam iosched: fix typos in comments
Ed Maste [Fri, 18 Aug 2017 16:38:33 +0000 (16:38 +0000)]
cam iosched: fix typos in comments

PR: 220947
Submitted by: Fabian Keil
Obtained from: ElectroBSD

6 years agoCorrect multicast address used in pfsync(4)
Sevan Janiyan [Fri, 18 Aug 2017 16:14:41 +0000 (16:14 +0000)]
Correct multicast address used in pfsync(4)
As stated in src/sys/netinet/in.h L395, address used is 224.0.0.240.

PR: 216885
Submitted by: Matthias Ordner <matthias.ordner AT noris DOT net>
Reviewed by: kp
Approved by: bcr (mentor)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D12011

6 years agoFix syscons escape sequence for setting the local cursor type. This sequence
Bruce Evans [Fri, 18 Aug 2017 15:40:40 +0000 (15:40 +0000)]
Fix syscons escape sequence for setting the local cursor type.  This sequence
was aliased to a vt sequence, causing and fixing various bugs.

For syscons, this restores support for arg 2 which sets blinking block
too forcefully, and restores bugs for arg 0 and 1.  Arg 2 is used for
vs in the cons25 entry in termcap, but I've never noticed an application
that uses this.  The bugs involve replacing local settings by global
ones and need better handling of defaults to fix.

For vt, this requires moving the aliasing code from teken to vt where
it belongs.  This sequences is very important for cons25 compatibility
in vt since it is used by the cons25 termcap entries for ve, vi and
vs.  vt can't properly support vs for either cons25 or xterm since it
doesn't support blinking.  For xterm, the termcap entry for vs asks
for something different using 12;25h instead of 25h.

Rename C25CURS for this to C25LCT and change its description to be closer
to echoing the old comment about it.  CURS is too generic.

Fix missing syscons escape sequence for setting the global cursor shape
(and type).  Only support this in syscons since vt can't emulate anything
in it.

6 years agoFix module unload when SGX support is not present in CPU.
Ruslan Bukin [Fri, 18 Aug 2017 14:47:06 +0000 (14:47 +0000)]
Fix module unload when SGX support is not present in CPU.

Sponsored by: DARPA, AFRL

6 years agoFix cut and paste typo that prevented T5 firmware to be compiled in.
Gleb Smirnoff [Fri, 18 Aug 2017 14:30:12 +0000 (14:30 +0000)]
Fix cut and paste typo that prevented T5 firmware to be compiled in.

Reviewed by: np

6 years agotypo
Sevan Janiyan [Fri, 18 Aug 2017 14:17:12 +0000 (14:17 +0000)]
typo

PR: 211160
Submitted by: Dan Robertson <dan.robertson AT anidata DOT org>
Reviewed by: oshogbo
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D12005

6 years agoImprove names for cons25 sequences.
Bruce Evans [Fri, 18 Aug 2017 14:04:14 +0000 (14:04 +0000)]
Improve names for cons25 sequences.

In a recent commit, I forgot to expand an X to an abbreviation of "BORDER".
Fix this and some nearby bad names.

The descriptions were copied from comments in scterm-sc.c, but some
of these are bad.  The border [color] was inconsistently described as
a property of the "display", but I had changed this to "adapter" to
match the descriptions for other color settings.  All colors supported
by the cons25 sequences are actually properties of the current vty and
that should not be described.  But the other colors are defaults.
Change "adapter" to "default" for them and remove "adapter" for the
border.  Reduce the verbosity of the abbreviation from AD to D.

6 years agoFix vt100 escape sequence for showing and hiding the cursor in syscons.
Bruce Evans [Fri, 18 Aug 2017 12:45:00 +0000 (12:45 +0000)]
Fix vt100 escape sequence for showing and hiding the cursor in syscons.
It should toggle between 2 states, but it used a cut-down version of
support for a related 3-state syscons escape sequence and inherited
bugs from that.  The usual misbehaviour was that hiding and showing
the cursor reset it to a global default.

Support for the 3-state sequence remains broken by aliasing to the 2-state
sequence.  This works better but incompatibly for the 2 cases that it
supports.

6 years agoRemove example from zstd sources, their license does not allow redistribution
Baptiste Daroussin [Fri, 18 Aug 2017 11:33:10 +0000 (11:33 +0000)]
Remove example from zstd sources, their license does not allow redistribution

Reported by: joerg@NetBSD

6 years agoRemove example from zstandard distribution as it is not supposed to be
Baptiste Daroussin [Fri, 18 Aug 2017 11:27:10 +0000 (11:27 +0000)]
Remove example from zstandard distribution as it is not supposed to be
distributed

6 years agoFix missing syscons escape sequence for setting the border color.
Bruce Evans [Fri, 18 Aug 2017 10:38:49 +0000 (10:38 +0000)]
Fix missing syscons escape sequence for setting the border color.

6 years agosafe: quiet -Wtautological-compare
Ryan Libby [Fri, 18 Aug 2017 08:05:33 +0000 (08:05 +0000)]
safe: quiet -Wtautological-compare

Code was testing that an unsigned type was >= 0.

Reviewed by: markj
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon

6 years agoClarify the fact that Andrey (ache) passed away in Moscow
Enji Cooper [Fri, 18 Aug 2017 07:34:34 +0000 (07:34 +0000)]
Clarify the fact that Andrey (ache) passed away in Moscow

Take care friend <3.

6 years agoEnsure inp_vflag is consistently set for TCP endpoints.
Michael Tuexen [Fri, 18 Aug 2017 07:27:15 +0000 (07:27 +0000)]
Ensure inp_vflag is consistently set for TCP endpoints.

Make sure that the flags INP_IPV4 and INP_IPV6 are consistently set
for inpcbs used for TCP sockets, no matter if the setting is derived
from the net.inet6.ip6.v6only sysctl or the IPV6_V6ONLY socket option.
For UDP this was already done right.

PR: 221385
MFC after: 1 week

6 years agoRemove some unneeded subroutines for padding writes to dump devices.
Mark Johnston [Fri, 18 Aug 2017 04:07:25 +0000 (04:07 +0000)]
Remove some unneeded subroutines for padding writes to dump devices.

Right now we only need to pad when writing kernel dump headers, so
flatten three related subroutines into one. The encrypted kernel dump
code already writes out its key in a dumper.blocksize-sized block.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11647

6 years agoRename mkdumpheader() and group EKCD functions in kern_shutdown.c.
Mark Johnston [Fri, 18 Aug 2017 04:04:09 +0000 (04:04 +0000)]
Rename mkdumpheader() and group EKCD functions in kern_shutdown.c.

This helps simplify the code in kern_shutdown.c and reduces the number
of globally visible functions.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11603

6 years agoFactor out duplicated kernel dump code into dump_{start,finish}().
Mark Johnston [Fri, 18 Aug 2017 03:52:35 +0000 (03:52 +0000)]
Factor out duplicated kernel dump code into dump_{start,finish}().

dump_start() and dump_finish() are responsible for writing kernel dump
headers, optionally writing the key when encryption is enabled, and
initializing the initial offset into the dump device.

Also remove the unused dump_pad(), and make some functions static now that
they're only called from kern_shutdown.c.

No functional change intended.

Reviewed by: cem, def
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11584

6 years agoAn off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an
Lawrence Stewart [Fri, 18 Aug 2017 02:06:28 +0000 (02:06 +0000)]
An off-by-one error exists in sbuf_vprintf()'s use of SBUF_HASROOM() when an
sbuf is filled to capacity by vsnprintf(), the loop exits without error, and
the sbuf is not marked as auto-extendable.

SBUF_HASROOM() evaluates true if there is room for one or more non-NULL
characters, but in the case that the sbuf was filled exactly to capacity,
SBUF_HASROOM() evaluates false. Consequently, sbuf_vprintf() incorrectly
assigns an ENOMEM error to the sbuf when in fact everything is fine, in turn
poisoning the buffer for all subsequent operations.

Correct by moving the ENOMEM assignment into the loop where it can be made
unambiguously.

As a related safety net change, explicitly check for the zero bytes drained
case in sbuf_drain() and set EDEADLK as the error. This avoids an infinite loop
in sbuf_vprintf() if a drain function were to inadvertently return a value of
zero to sbuf_drain().

Reviewed by: cem, jtl, gallatin
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D8535

6 years agoGoodbye, ache.
Greg Lehey [Fri, 18 Aug 2017 00:25:27 +0000 (00:25 +0000)]
Goodbye, ache.

6 years agoDon't leak bpf on early return when YP isn't defined (NIS support)
Enji Cooper [Thu, 17 Aug 2017 20:41:28 +0000 (20:41 +0000)]
Don't leak bpf on early return when YP isn't defined (NIS support)

MFC after: 1 week
Reported by: cppcheck

6 years agoFix WARNS
Enji Cooper [Thu, 17 Aug 2017 20:37:01 +0000 (20:37 +0000)]
Fix WARNS

- Remove ad hoc inet_ntoa prototype declaration; it's already handled
  by the included headers.
- De-K&Rify the function prototypes for eachres_whoami(..),
  eachres_getfile(..), and main(..).

MFC after: 1 week
PR: 71667
Tested with: clang (5.0), gcc (4.2.1, 5)

6 years agoI misplaced a newline in the previous commit. Fix this, and move line
Bruce Evans [Thu, 17 Aug 2017 20:25:50 +0000 (20:25 +0000)]
I misplaced a newline in the previous commit.  Fix this, and move line
breaks in the vt case to the same places that the man(1) puts then in
the SYNOPSIS.  This was already done for the syscons case.  Man pages
can't depend on the driver, and the SYNOPSIS is hard-coded for syscons
except for -f where it is hard-coded for vt.  The usage message reverses
this for sc.  The only other differences are whitespace and removing
-[dL] and -l for vt.

6 years agoHonor NO_RTLD for rtld-elf, similar to what's done in libexec/Makefile, with
Enji Cooper [Thu, 17 Aug 2017 20:15:20 +0000 (20:15 +0000)]
Honor NO_RTLD for rtld-elf, similar to what's done in libexec/Makefile, with
libexec/rtld-elf/... for MK_{LIB32,LIBSOFT}.

MFC after: 1 week

6 years agoFix BSD label partition end sector calculation.
Oleg Bulyzhin [Thu, 17 Aug 2017 19:39:42 +0000 (19:39 +0000)]
Fix BSD label partition end sector calculation.

Reviewed by: ae
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12066

6 years agoarm64: return error instead of panic in unimplemented ptrace ops
Ed Maste [Thu, 17 Aug 2017 19:16:23 +0000 (19:16 +0000)]
arm64: return error instead of panic in unimplemented ptrace ops

We don't need a panic as a reminder that these need to be implemented.

Reported by: Shawn Webb
MFC after: 3 week
Sponsored by: The FreeBSD Foundation

6 years agoUpdate vidcontrol -c to support all cursor appearance setting
Bruce Evans [Thu, 17 Aug 2017 18:08:45 +0000 (18:08 +0000)]
Update vidcontrol -c to support all cursor appearance setting
capabilities.

Most of the capabilities (all of the arcane ones) were in FreeBSD-2.0.5,
but were harder to use then, and vidcontrol didn't try.  FreeBSD-4.1.0
added per-vty support, fixed the destructivness of the "destructive"
cursor, and improved APIs.  Start using the new APIs, support all of
their capabilities, and document all of the capabilities and some of
the historical mistakes.

vt doesn't support any of this before or after the change.

Fix minor unrelated bitrot in the usage message for the syscons case.

6 years agoDiscover CPU topology on multi-die AMD Zen systems
Conrad Meyer [Thu, 17 Aug 2017 16:54:37 +0000 (16:54 +0000)]
Discover CPU topology on multi-die AMD Zen systems

The Nodes per Processor topology information determines how many bits of the
APIC ID represent the Node (Zeppelin die, on Zen systems) ID.  Documented in
Ryzen and Epyc Processor Programming Reference (PPR).

Correct topology information enables the scheduler to make better decisions
on this hardware.

Reviewed by: kib@
Tested by: jeff@ (earlier version)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11801

6 years agobsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex
Kyle Evans [Thu, 17 Aug 2017 13:40:45 +0000 (13:40 +0000)]
bsdgrep: cast pmatch.rm_so to fix build when linking against libgnuregex

Reported by: many
Approved by: emaste (mentor)
MFC after: immediate

6 years agoImplement simple record boundary tracking in sbuf(9) to avoid record splitting
Lawrence Stewart [Thu, 17 Aug 2017 07:20:09 +0000 (07:20 +0000)]
Implement simple record boundary tracking in sbuf(9) to avoid record splitting
during drain operations. When an sbuf is configured to use this feature by way
of the SBUF_DRAINTOEOR sbuf_new() flag, top-level sections started with
sbuf_start_section() create a record boundary marker that is used to avoid
flushing partial records.

Reviewed by: cem,imp,wblock
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D8536

6 years agoThe r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
Lawrence Stewart [Thu, 17 Aug 2017 06:36:21 +0000 (06:36 +0000)]
The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
output to not include a trailing new line, which is a potential POLA violation
for existing consumers. Change pgrep to always emit a trailing new line on
completion of its output, regardless of the delimeter in use (which technically
is also a potential POLA violation for existing consumers that rely on the
pre-r322210 buggy behaviour, but a line has to be drawn somewhere).

PR: 221534
Submitted by: kdrakehp zoho com
Reported by: kdrakehp zoho com
MFC after: 1 week
X-MFC-with: r322210

6 years agoFix unused varable warning in !SMP case
Conrad Meyer [Thu, 17 Aug 2017 04:37:27 +0000 (04:37 +0000)]
Fix unused varable warning in !SMP case

Fallout from r322588.  I'm not sure why !SMP is a knob we have, but, we have
it.

Reported by: Michael Butler <imb AT protected-networks.net>
Sponsored by: Dell EMC Isilon

6 years agoMark ZFS ABD inline functions static.
John Baldwin [Wed, 16 Aug 2017 23:40:32 +0000 (23:40 +0000)]
Mark ZFS ABD inline functions static.

When built with -fno-inline-functions zfs.ko contains undefined references
to these functions if they are only marked inline.

Reviewed by: avg (earlier version)
MFC after: 1 week
Sponsored by: Chelsio Communications

6 years agoaesni: quiet -Wcast-qual
Ryan Libby [Wed, 16 Aug 2017 22:54:35 +0000 (22:54 +0000)]
aesni: quiet -Wcast-qual

Reviewed by: delphij
Approved by: markj (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12021

6 years agoAdd SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_...
Conrad Meyer [Wed, 16 Aug 2017 21:42:27 +0000 (21:42 +0000)]
Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP

This fixes a regression accidentally introduced in r322588, due to an
interaction with EARLY_AP_STARTUP.

Reviewed by: bdrewery@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12053

6 years agoDefine proposed GUID for FreeBSD boot loader variables.
Warner Losh [Wed, 16 Aug 2017 20:09:39 +0000 (20:09 +0000)]
Define proposed GUID for FreeBSD boot loader variables.

6 years agoRemove unused defines.
Warner Losh [Wed, 16 Aug 2017 20:06:38 +0000 (20:06 +0000)]
Remove unused defines.

6 years agobpf: Fix incorrect cleanup
Kristof Provost [Wed, 16 Aug 2017 19:40:07 +0000 (19:40 +0000)]
bpf: Fix incorrect cleanup

Cleaning up a bpf_if is a two stage process. We first move it to the
bpf_freelist (in bpfdetach()) and only later do we actually free it (in
bpf_ifdetach()).

We cannot set the ifp->if_bpf to NULL from bpf_ifdetach() because it's
possible that the ifnet has already gone away, or that it has been assigned
a new bpf_if.
This can lead to a struct ifnet which is up, but has if_bpf set to NULL,
which will panic when we try to send the next packet.

Keep track of the pointer to the bpf_if (because it's not always
ifp->if_bpf), and NULL it immediately in bpfdetach().

PR: 213896
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11782

6 years agoforce use of ld.bfd for linking i386 libc, even when using lld
Ed Maste [Wed, 16 Aug 2017 18:55:39 +0000 (18:55 +0000)]
force use of ld.bfd for linking i386 libc, even when using lld

lld can successfully link most of a working i386 userland and kernel,
but produces a broken libc. For now if we're otherwise using lld, and
ld.bfd is available, explicitly use it for libc.

Sponsored by: The FreeBSD Foundation