]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoi386: Bump KSTACK_PAGES default to match amd64
Conrad Meyer [Mon, 11 Dec 2017 04:32:37 +0000 (04:32 +0000)]
i386: Bump KSTACK_PAGES default to match amd64

Logically, extend r286288 to cover all threads, by default.

The world has largely moved on from i386.  Most FreeBSD users and developers
test on amd64 hardware.  For better or worse, we have written a non-trivial
amount of kernel code that relies on stacks larger than 8 kB, and it "just
works" on amd64, so there has been little incentive to shrink it.

amd64 had its KSTACK_PAGES bumped to 4 back in Peter's initial AMD64 commit,
r114349, in 2003.  Since that time, i386 has limped along on a stack half
the size.  We've even observed the stack overflows years ago, but neglected
to fix the issue; see the 20121223 and 20150728 entries in UPDATING.

If anyone is concerned with this change, I suggest they configure their
AMD64 kernels with KSTACK_PAGES 2 and fix the fallout there first.  Eugene
has identified a list of high stack usage functions in the first PR below.

PR: 219476, 224218
Reported by: eugen@, Shreesh Holla <hshreesh AT yahoo.com>
Relnotes: maybe
Sponsored by: Dell EMC Isilon

6 years agoStart adding commands that I know are good to build up residual
Warner Losh [Mon, 11 Dec 2017 02:44:15 +0000 (02:44 +0000)]
Start adding commands that I know are good to build up residual
knowledge about qemu's quirks. Other qemu commands are possible, but
this is the quickest for testing.

Sponsored by: Netflix

6 years agoAdd -I to just run the imaging part of nanobsd so you can test out
Warner Losh [Mon, 11 Dec 2017 02:44:10 +0000 (02:44 +0000)]
Add -I to just run the imaging part of nanobsd so you can test out
changes to the packaging part of nanobsd more easily, or experiment
with the image contents w/o regenerating a whole new image tree. This
can save minutes when you don't need to do the installworld /
installkernel, etc.

Sponsored by: Netflix

6 years agoFix the std-x86 layout to produce a bootable system. Due to
Warner Losh [Mon, 11 Dec 2017 02:43:56 +0000 (02:43 +0000)]
Fix the std-x86 layout to produce a bootable system. Due to
limitations in mkimg we're still not quite to where I'd like to be
(I'd like to put s3 first on the disk, then s1, but mkimg won't allow
that currently). However, the resulting image now boots with qemu using:

qemu-system-x86_64 -hdd $file -serial telnet::4444,server -nographic

We'll need tweaks to create a specialized /etc/rc.d/growfs that can
create a properly grown image for either the simple or ping-pong
cases, but that will be later. Switched to pure serial console (-h)
instead of video or serial (-P) since that fits this usecase better.

Sponsored by: Netflix

6 years agoWhen building for arm arches, set PKGALIGN to the max cache line size
Ian Lepore [Sun, 10 Dec 2017 23:06:45 +0000 (23:06 +0000)]
When building for arm arches, set PKGALIGN to the max cache line size
supported by the arch, to meet u-boot's requirement that I/O be done
in cache-aligned chunks.

PR: 223977

6 years agoCorrect r326748, indicating that tgammal(3) is mapped to tgamma(3), not
Dimitry Andric [Sun, 10 Dec 2017 23:03:13 +0000 (23:03 +0000)]
Correct r326748, indicating that tgammal(3) is mapped to tgamma(3), not
to itself.

Noticed by: jilles
MFC after: 3 days

6 years agoSave and restore r9 register in arm ubldr. In old gcc 4.2, r9 was a callee-
Ian Lepore [Sun, 10 Dec 2017 21:51:27 +0000 (21:51 +0000)]
Save and restore r9 register in arm ubldr.  In old gcc 4.2, r9 was a callee-
saved register, but in arm EABI it may be either callee-saved or dedicated
to some special purpose (such as a TLS pointer).  It appears clang does not
treat it as a callee-saved register (instead using it as another work
register, similar to r12).

Another important side effect of these changes is that saving an extra
register in the push/pop statements keeps the stack aligned to an 8-byte
boundary during the self_reloc() call, as it always should have been.

As stated in the PR...

Essentially the important caller-saved registers are pushed (r0, r1, r9, lr)
before the relocation call, and popped after.  Then r8/r9 are saved as usual
for the syscall trampoline, and lr is stored in r8 (now free) as a
callee-saved value before calling into `main`.

The call to `main` can no longer be a tail call because we must restore r9
especially after main returns (although since we have used r8 to hold lr we
must also restore this).

PR: 224008

6 years agoDo not give up if writing to the chip's control and status registers fails
Ian Lepore [Sun, 10 Dec 2017 18:55:42 +0000 (18:55 +0000)]
Do not give up if writing to the chip's control and status registers fails
during startup.  When a brand new chip leaves the factory, it is in a
special power-saving mode that disables most functions on the chip to
save battery power.  The chip is stuck in this mode until the first write
to the time registers, which automatically clears the special power-saving
mode and starts the oscillator.

Also, the day-of-week register in this chip counts 1-7, not 0-6, so write
the values accordingly.

These changes are based on the patch submitted by Brian Scott, but I
elimated warnings since this condition is expected, and added some comments,
and so in general blame me for any mistakes.

PR: 223642

6 years agowc(1): Restore regular file char count fast path
Conrad Meyer [Sun, 10 Dec 2017 17:56:03 +0000 (17:56 +0000)]
wc(1): Restore regular file char count fast path

fstat(2) is going to be a lot faster than reading all of the bytes in a
file, if we just need a character count for a regular file.  This fast path
was accidentally broken in r326736.

PR: 224160
Reported by: bde
Sponsored by: Dell EMC Isilon

6 years agoDocument the existence and precision of the remaining long double
Dimitry Andric [Sun, 10 Dec 2017 16:42:59 +0000 (16:42 +0000)]
Document the existence and precision of the remaining long double
functions for which an imprecise stub implementation was added in
r255294, namely powl(3) and tgammal(3).

Submitted by: Steve Kargl
MFC after: 3 days

6 years agoRelax too restrictive assert.
Michal Meloun [Sun, 10 Dec 2017 09:17:21 +0000 (09:17 +0000)]
Relax too restrictive assert.

The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by: David Goldblatt <davidtgoldblatt@gmail.com>
MFC after:  2 weeks

6 years agoRevert r326740. I committed wrong diff.
Michal Meloun [Sun, 10 Dec 2017 09:15:37 +0000 (09:15 +0000)]
Revert r326740. I committed wrong diff.

6 years agoRelax too restrictive assert.
Michal Meloun [Sun, 10 Dec 2017 08:55:48 +0000 (08:55 +0000)]
Relax too restrictive assert.

The problem has been reported to upstream and similar change will
be included in next jemalloc release.

Submitted by: David Goldblatt <davidtgoldblatt@gmail.com>
MFC after:  2 weeks

6 years agoRetrieve the page outside of holding locks
Justin Hibbits [Sun, 10 Dec 2017 04:43:27 +0000 (04:43 +0000)]
Retrieve the page outside of holding locks

pmap_track_page() only works with physical memory pages, which have a
constant vm_page_t address.  Microoptimize pmap_track_page() to perform one
less operation under the lock.

6 years agopw(8): correct expiration period handling and command line overrides
Eugene Grosbein [Sat, 9 Dec 2017 23:34:00 +0000 (23:34 +0000)]
pw(8): correct expiration period handling and command line overrides
to preconfigured values for -e, -p and -w flags.

Use non-negative symbols instead of magic values
in passwd_val/pw_password functions.

PR: 223431
Submitted by: Yuri Pankov (in part, patch for the manual)
Reported by: mav (mentor)
MFC after: 3 days
Relnotes: yes

6 years ago[net80211] add a method for checking if a VAP WME AC has a NOACK policy or not.
Adrian Chadd [Sat, 9 Dec 2017 23:16:02 +0000 (23:16 +0000)]
[net80211] add a method for checking if a VAP WME AC has a NOACK policy or not.

A subsequent set of commits will introduce this instead of a whole lot of
gymnastics to check the WME category.

6 years agowc(1): Extend non-controversial optimizations to '-c' mode
Conrad Meyer [Sat, 9 Dec 2017 21:55:19 +0000 (21:55 +0000)]
wc(1): Extend non-controversial optimizations to '-c' mode

wc(1)'s slow path for counting words or multibyte characters requires
conversion of the 8-bit input stream to wide characters.  However, a faster
path can be used for counting only lines ('-l' -- newlines have the same
representation in all supported encodings) or bytes ('-c').

The existing line count optimization was not used if the input was the
implicit stdin.  Additionally, it wasn't used if only byte counting was
requested.  This change expands the fast path to both of these scenarios.

Expanding the buffer size from 64 kB helps reduce the number of read(2)
calls needed, but exactly what impact that change has and what size to
expand the buffer to are still under discussion.

PR: 224160
Tested by: wosch (earlier version)
Sponsored by: Dell EMC Isilon

6 years agoDefine macros used by the pNFS server code.
Rick Macklem [Sat, 9 Dec 2017 21:04:56 +0000 (21:04 +0000)]
Define macros used by the pNFS server code.

This commit defines some macros used by the pNFS server code.
They will not be used until the main pNFS server code merge occurs,
which will probably be in April 2018.

6 years agogifconfig_gif0 no longer works, document replacement
Mike Karels [Sat, 9 Dec 2017 17:27:36 +0000 (17:27 +0000)]
gifconfig_gif0 no longer works, document replacement

rc.conf(5) documents the gifconfig_<interface> keyword, which is
no longer implemented. Document the replacement, which works with
cloned_interfaces as well.

Reviewed by: dab
Group Reviwers: manpages
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D13130

6 years agoImprove options and error handling.
Niclas Zeising [Sat, 9 Dec 2017 15:59:10 +0000 (15:59 +0000)]
Improve options and error handling.

Improve options handling and error out if multiple mutually exclusive
options are passed to acpiconf.  Switch from using atoi() to strtol() for
argument parsing, and add error checking and handling, instead of blindly
trusting that the integer conversion is OK.
Cange err() to errx() in once case, the errno value was garbage there.

Reviewed by: emaste
Approved by: emaste
Differential Revision: D13430

6 years agoFix the act_scan_laundry_weight mechanism.
Mark Johnston [Sat, 9 Dec 2017 15:47:26 +0000 (15:47 +0000)]
Fix the act_scan_laundry_weight mechanism.

r292392 modified the active queue scan to weigh clean pages differently
from dirty pages when attempting to meet the inactive queue target. When
r306706 was merged into the PQ_LAUNDRY branch, this mechanism was
broken. Fix it by scalaing the correct page shortage variable.

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

6 years agoProvide a sysctl to force synchronous initialization of inode blocks.
Mark Johnston [Sat, 9 Dec 2017 15:44:30 +0000 (15:44 +0000)]
Provide a sysctl to force synchronous initialization of inode blocks.

FFS performs asynchronous inode initialization, using a barrier write
to ensure that the inode block is written before the corresponding
cylinder group header update. Some GEOMs do not appear to handle
BIO_ORDERED correctly, meaning that the barrier write may not work as
intended. The sysctl allows one to work around this problem at the
cost of expensive file creation on new filesystems. The default
behaviour is unchanged.

Reviewed by: kib, mckusick
MFC after: 1 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13428

6 years agoMove the DIAGNOSTIC check for lost iSCSI PDUs from icl_conn_close()
Edward Tomasz Napierala [Sat, 9 Dec 2017 15:34:40 +0000 (15:34 +0000)]
Move the DIAGNOSTIC check for lost iSCSI PDUs from icl_conn_close()
to icl_conn_free().  It's perfectly valid for the counter to be non-zero
in the former.

MFC after: 2 weeks
Sponsored by: playkey.net

6 years agoarc lint: Explain linting explain
Eitan Adler [Sat, 9 Dec 2017 08:21:29 +0000 (08:21 +0000)]
arc lint: Explain linting explain

shell scripts in scripts don't need
to be chmod +x to work. In fact most are not.
Of the tests I found from a simple search:
65 are chmod +x
84 are chmod -x

simply disable the check for test shell scripts.

6 years agoIndent multiple device path entries correctly.
Warner Losh [Sat, 9 Dec 2017 07:44:00 +0000 (07:44 +0000)]
Indent multiple device path entries correctly.

Sponsored by: Netflix

6 years agoRemove vestiges of -d and -p commands.
Warner Losh [Sat, 9 Dec 2017 07:43:55 +0000 (07:43 +0000)]
Remove vestiges of -d and -p commands.
Fix two core dumps when optional data isn't specified.

Sponsored by: Netflix

6 years agoForgotten in 326725
Warner Losh [Sat, 9 Dec 2017 06:57:19 +0000 (06:57 +0000)]
Forgotten in 326725

Release Notes: Yes

6 years agoImport Netflix's efibootmgr to help manage UEFI boot variables
Warner Losh [Sat, 9 Dec 2017 06:52:20 +0000 (06:52 +0000)]
Import Netflix's efibootmgr to help manage UEFI boot variables

efibootmgr manages the UEFI BootXXXX variables that implement the UEFI
Boot Manager protocol defined in the UEFI standards. It is modeled
after the Linux program of the same name with a mostly compatible set
of command line options. Since there's a fair amount of OS specifioc
code due to differeing names and methods of doing things, the
compatibility isn't 100%.

Basic functionality is implemented, though the more advanced next boot
functionality that's been defined elsewhere is unimplemented.

Submitted by: Matt Williams (with unix / efi path xlate by me)
Sponsored by: Netflix

6 years agoAdd two dates derived from looking at archival source tarballs in the
Warner Losh [Sat, 9 Dec 2017 05:05:25 +0000 (05:05 +0000)]
Add two dates derived from looking at archival source tarballs in the
TUHS collection for 7th Edition and V32.

6 years agoThis path belongs in ficl/Makefile, not the common defines for users
Warner Losh [Fri, 8 Dec 2017 22:19:41 +0000 (22:19 +0000)]
This path belongs in ficl/Makefile, not the common defines for users
of ficl.

Sponsored by: Netflix

6 years agoRemove basename_r(3).
Ed Schouten [Fri, 8 Dec 2017 22:06:18 +0000 (22:06 +0000)]
Remove basename_r(3).

Now that the POSIX working group is going to require that basename(3)
and dirname(3) are thread-safe in future revisions of the standard,
there is even less of a need to provide basename_r(3). Remove this
function to prevent people from writing code that only builds on
FreeBSD and Bionic.

Removing this function seems to break exactly one port: sbruno@'s
qemu-user-static. I will send him a pull request on GitHub in a bit.
__FreeBSD_version will not be bumped, as any value from 2017 can be used
to test for the presence of a thread-safe basename(3)/dirname(3).

PR: https://bugs.freebsd.org/224016

6 years agoDon't automatically create objdir here. We're just after the
Warner Losh [Fri, 8 Dec 2017 21:59:50 +0000 (21:59 +0000)]
Don't automatically create objdir here. We're just after the
TMPPATH. We'll make the paths later.

Sponsored by: Netflix

6 years agoRemove local here. It was a cut and paste error.
Warner Losh [Fri, 8 Dec 2017 21:59:42 +0000 (21:59 +0000)]
Remove local here. It was a cut and paste error.

Sponsored by: Netflix

6 years agoCorrectly define the unordered_map namespace in ofed/libibnetdisc .
Hans Petter Selasky [Fri, 8 Dec 2017 21:01:09 +0000 (21:01 +0000)]
Correctly define the unordered_map namespace in ofed/libibnetdisc .

This should fix ofed/libibnetdisc compilation with C-compilers
different from clang and GCC v4.2.1.

Submitted by: kib
Sponsored by: Mellanox Technologies

6 years agoboot1.c needs EFI_ZFS_BOOT too, so add it globally. Otherwise we'll
Warner Losh [Fri, 8 Dec 2017 19:57:26 +0000 (19:57 +0000)]
boot1.c needs EFI_ZFS_BOOT too, so add it globally. Otherwise we'll
not be able to actually read ZFS partitions.

Submitted by: kevans@

6 years agoBuild WITHOUT_FORTH too, at least for amd64 and i386
Warner Losh [Fri, 8 Dec 2017 19:57:21 +0000 (19:57 +0000)]
Build WITHOUT_FORTH too, at least for amd64 and i386

Sponsored by: Netflix

6 years agoCreate interp class.
Warner Losh [Fri, 8 Dec 2017 19:57:16 +0000 (19:57 +0000)]
Create interp class.

Create an interp class. Use it to separate out the different types of
interpreters: forth and simple with function pointers rather than
via #ifdefs.

Obtained from: lua boot loader project
    (via https://bsdimp@github.com/bsdimp/freebsd.git lua-bootloader)
Sponsored by: Netflix

6 years agoConst poison a couple of interfaces.
Warner Losh [Fri, 8 Dec 2017 19:57:11 +0000 (19:57 +0000)]
Const poison a couple of interfaces.

Obtained from: lua boot project
Sponsored by: Netflix

6 years agoPut the files we're copying over into a few variables and add them to
Warner Losh [Fri, 8 Dec 2017 19:57:06 +0000 (19:57 +0000)]
Put the files we're copying over into a few variables and add them to
CLEANDIRS and CLEANFILES so make clean removes any divots.

Sponsored by: Netflix

6 years agoProvide implementations for iscntrl, ispunct and isgraph.
Warner Losh [Fri, 8 Dec 2017 19:57:02 +0000 (19:57 +0000)]
Provide implementations for iscntrl, ispunct and isgraph.

Sponsored by: Netflix

6 years agoRemove _KERNEL hack now that errno.h does the right thing when
Warner Losh [Fri, 8 Dec 2017 19:56:57 +0000 (19:56 +0000)]
Remove _KERNEL hack now that errno.h does the right thing when
_STANDALONE is defined.

Sponsored By: Netflix

6 years agoAdd partial support signal.h functioanlity. Pull in machine/signal.h
Warner Losh [Fri, 8 Dec 2017 19:56:35 +0000 (19:56 +0000)]
Add partial support signal.h functioanlity. Pull in machine/signal.h
to define sig_atomic_t.

Sponsored by: Netflix

6 years agoFree mbuf chain when m_dup fails
Stephen Hurd [Fri, 8 Dec 2017 19:50:06 +0000 (19:50 +0000)]
Free mbuf chain when m_dup fails

Fix memory leak where mbuf chain wasn't free()d if iflib_ether_pad()
has a failure in m_dup().

Reported by: "Ryan Stone" <rysto32@gmail.com>
Sponsored by: Limelight Networks

6 years agoActually add the -x setenv test Makefile, missed in r326499.
Mark Johnston [Fri, 8 Dec 2017 19:26:25 +0000 (19:26 +0000)]
Actually add the -x setenv test Makefile, missed in r326499.

X-MFC with: r326499

6 years agoHandle read-only mbufs in iflib ether pad function
Stephen Hurd [Fri, 8 Dec 2017 18:43:31 +0000 (18:43 +0000)]
Handle read-only mbufs in iflib ether pad function

If ethernet padding is enabled, and a read-only mbuf is passed,
it would modify the mbuf using m_append(). Instead, call m_dup() and
append to the new packet.

Reported by: Pyun YongHyeon
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D13414

6 years agoSPDX: more ISC-related files.
Pedro F. Giffuni [Fri, 8 Dec 2017 17:52:53 +0000 (17:52 +0000)]
SPDX: more ISC-related files.

6 years agoat(1): annotate some intended switch-case fallthroughs
Alan Somers [Fri, 8 Dec 2017 17:15:20 +0000 (17:15 +0000)]
at(1): annotate some intended switch-case fallthroughs

Reported by: Coverity
CID: 1008191
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoSPDX: license IDs for some ISC-related files.
Pedro F. Giffuni [Fri, 8 Dec 2017 15:57:29 +0000 (15:57 +0000)]
SPDX: license IDs for some ISC-related files.

6 years agoSet the io width when using an ACPI uart. Previously it would only ever be
Andrew Turner [Fri, 8 Dec 2017 10:05:23 +0000 (10:05 +0000)]
Set the io width when using an ACPI uart. Previously it would only ever be
set when finding the uart from the device tree.

Sponsored by: DARPA, AFRL

6 years agoRemove PTE VA mappings for tracked pages in 64-bit mode
Justin Hibbits [Fri, 8 Dec 2017 03:49:53 +0000 (03:49 +0000)]
Remove PTE VA mappings for tracked pages in 64-bit mode

This was done in 32-bit mode, but not duplicated when 64-bit mode was
brought in.  Without this, stale mappings can be left, leading to odd
crashes when the wrong VA is checked in XX_PhysToVirt() (dpaa(4)).

6 years agoSupport mounted boot partitions in the installer. This allows the platform
Nathan Whitehorn [Fri, 8 Dec 2017 00:57:13 +0000 (00:57 +0000)]
Support mounted boot partitions in the installer. This allows the platform
layer, for example, to specify that the EFI boot partition should be
mounted at /efi and formatted normally with newfs_msdos rather than
splatted to from /boot/boot1.efifat.

This commit adds only the API for this; actual platform use will come later.

6 years agoSeparate out send buffer autoscaling code into function, so that
Gleb Smirnoff [Thu, 7 Dec 2017 22:36:58 +0000 (22:36 +0000)]
Separate out send buffer autoscaling code into function, so that
alternative TCP stacks may reuse it instead of pasting.

Obtained from: Netflix

6 years agoRetire SCTP_WITH_NO_CSUM option.
Michael Tuexen [Thu, 7 Dec 2017 22:19:08 +0000 (22:19 +0000)]
Retire SCTP_WITH_NO_CSUM option.

This option was used in the early days to allow performance measurements
extrapolating the use of SCTP checksum offloading. Since this feature
is now available, get rid of this option.
This also un-breaks the LINT kernel. Thanks to markj@ for making me
aware of the problem.

6 years agoAvoid setting -Wno-tentative-definition-incomplete-type with gcc.
Mark Johnston [Thu, 7 Dec 2017 22:11:23 +0000 (22:11 +0000)]
Avoid setting -Wno-tentative-definition-incomplete-type with gcc.

No version of gcc that I've tried accepts this flag.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13415

6 years agoRemove an unused incude from lib/msun/bsdsrc/b_log.c.
Dimitry Andric [Thu, 7 Dec 2017 20:41:23 +0000 (20:41 +0000)]
Remove an unused incude from lib/msun/bsdsrc/b_log.c.

Submitted by: Steve Kargl
MFC after: 3 days

6 years agoRemove the sentence in math(3) about some long double math functions not
Dimitry Andric [Thu, 7 Dec 2017 20:38:37 +0000 (20:38 +0000)]
Remove the sentence in math(3) about some long double math functions not
being available.

Submitted by: Steve Kargl
MFC after: 3 days

6 years agogeom_raid (RAID5): do not lose bp->bio_error, keep it in pbp->bio_error
Eugene Grosbein [Thu, 7 Dec 2017 20:09:17 +0000 (20:09 +0000)]
geom_raid (RAID5): do not lose bp->bio_error, keep it in pbp->bio_error
and return it by passing to g_raid_iodone()

Approved by: mav (mentor)
MFC after: 3 days

6 years agoFix the reldoc target in release/Makefile following doc commit r51264.
Glen Barber [Thu, 7 Dec 2017 20:00:19 +0000 (20:00 +0000)]
Fix the reldoc target in release/Makefile following doc commit r51264.

Sponsored by: The FreeBSD Foundation

6 years agomlx4: Remove redundant declarations to fix GCC build
Conrad Meyer [Thu, 7 Dec 2017 19:57:51 +0000 (19:57 +0000)]
mlx4: Remove redundant declarations to fix GCC build

These were made redundant in r325841.

Reviewed by: hselasky
MFC after: 1 week (hselasky will MFC)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D13401

6 years agoUse correct field in the description for the lock after r319722.
Bjoern A. Zeeb [Thu, 7 Dec 2017 19:40:46 +0000 (19:40 +0000)]
Use correct field in the description for the lock after r319722.

Reviewed by: glebius
Sponsored by: iXsystems, Inc.

6 years agoFix the UMA reclaim worker after r326347.
Mark Johnston [Thu, 7 Dec 2017 19:38:09 +0000 (19:38 +0000)]
Fix the UMA reclaim worker after r326347.

atomic_set_*() sets a bit in the target memory location, so
atomic_set_int(&uma_reclaim_needed, 0) does not do what it looks like
it does.

PR: 224080
Reviewed by: jeff, kib
Differential Revision: https://reviews.freebsd.org/D13412

6 years agoMerge OpenSSL 1.0.2n.
Jung-uk Kim [Thu, 7 Dec 2017 18:02:57 +0000 (18:02 +0000)]
Merge OpenSSL 1.0.2n.

6 years agoImport OpenSSL 1.0.2n.
Jung-uk Kim [Thu, 7 Dec 2017 17:37:15 +0000 (17:37 +0000)]
Import OpenSSL 1.0.2n.

6 years agoLook for libraries in OBJDIR when building outside of buildworld.
Bryan Drewery [Thu, 7 Dec 2017 16:37:19 +0000 (16:37 +0000)]
Look for libraries in OBJDIR when building outside of buildworld.

This allows build testing more easily without establishing a sysroot
or installing the files.

Sponsored by: Dell EMC

6 years agoEnsure that "out" is initialized in all error paths.
Mark Johnston [Thu, 7 Dec 2017 15:16:17 +0000 (15:16 +0000)]
Ensure that "out" is initialized in all error paths.

Reported by: gcc
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D13402

6 years agoFix livelock in ufsdirhash_create().
Konstantin Belousov [Thu, 7 Dec 2017 09:05:34 +0000 (09:05 +0000)]
Fix livelock in ufsdirhash_create().

When more than one thread enters ufsdirhash_create() for the same
directory and the inode dirhash is instantiated, but the dirhash' hash
is not, all of them lock the dirhash shared and then try to upgrade.
Since there are several threads owning the lock shared, upgrade fails
and the same attempt is repeated, ad infinitum.

To break the lockstep, lock the dirhash in exclusive mode after the
failed try-upgrade.

Reported and tested by: pho
Sponsored by: Mellanox Technologies
MFC after: 1 week

6 years agoMove instantiation of msgbufp from 9 MD files to subr_prf.c.
Bruce Evans [Thu, 7 Dec 2017 07:55:38 +0000 (07:55 +0000)]
Move instantiation of msgbufp from 9 MD files to subr_prf.c.

This variable should be pure MI except possibly for reading it in MD
dump routines.  Its initialization was pure MD in 4.4BSD, but FreeBSD
changed this in r36441 in 1998.  There were many imperfections in
r36441.  This commit fixes only a small one, to simplify fixing the
others 1 arch at a time.  (r47678 added support for
special/early/multiple message buffer initialization which I want in
a more general form, but this was too fragile to use because hacking
on the msgbufp global corrupted it, and was only used for 5 hours in
-current...)

6 years agoFix use-after-free that sometimes results in a garbage returned
Eugene Grosbein [Thu, 7 Dec 2017 05:55:18 +0000 (05:55 +0000)]
Fix use-after-free that sometimes results in a garbage returned
instead of right error code after requests to SINGLE/CONCAT volumes, f.e:

# dd if=/dev/raid/r0 bs=512 of=/dev/null
dd: /dev/raid/r0: Unknown error: -559038242

Reviewed by: avg (mentor), mav (mentor)
MFC after: 3 days

6 years agoUse consistent name for the vxlan VNI parameter name and provide shorthand
Bryan Venteicher [Thu, 7 Dec 2017 04:55:31 +0000 (04:55 +0000)]
Use consistent name for the vxlan VNI parameter name and provide shorthand

Submitted by: hrs
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D2868

6 years agodc(1): fix modulo operations with fractional inputs
Alan Somers [Thu, 7 Dec 2017 02:08:55 +0000 (02:08 +0000)]
dc(1): fix modulo operations with fractional inputs

Our dc(1) has never correctly calculated remainders with fractional inputs.
Both bmod and bdivmod seem to have copy/pasted code from bdiv, which results
in the remainder having the wrong output scale.

PR: 162495
Reported by: anonymous
Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D13390

6 years agoFix mandoc -Tlint warnings in bin/
Benjamin Kaduk [Thu, 7 Dec 2017 01:57:27 +0000 (01:57 +0000)]
Fix mandoc -Tlint warnings in bin/

Many style-level issues are still reported.

Submitted by: Yuri Pankov <yuripv@gmx.com>
Reviewed by: jilles (previous revision)
Differential Revision: https://reviews.freebsd.org/D13334

6 years agoNote that old sys/event.h required manual sys/types.h inclusion
Benjamin Kaduk [Thu, 7 Dec 2017 01:50:17 +0000 (01:50 +0000)]
Note that old sys/event.h required manual sys/types.h inclusion

ed fixed this in r313704 but older versions are still affected.

6 years agoDisconnect OFED after r326169 broke all DIRDEPS support for it.
Bryan Drewery [Thu, 7 Dec 2017 01:49:35 +0000 (01:49 +0000)]
Disconnect OFED after r326169 broke all DIRDEPS support for it.

6 years agotinderbox/universe: Don't execute KERNCONFS lookup if not needed.
Bryan Drewery [Thu, 7 Dec 2017 00:31:28 +0000 (00:31 +0000)]
tinderbox/universe: Don't execute KERNCONFS lookup if not needed.

Sponsored by: Dell EMC

6 years agoRevert r325529: No longer needed after r325699.
Bryan Drewery [Thu, 7 Dec 2017 00:31:10 +0000 (00:31 +0000)]
Revert r325529: No longer needed after r325699.

Sponsored by: Dell EMC

6 years agoFix a null-pointer dereference and a tautological check in cam_get_device
Alan Somers [Wed, 6 Dec 2017 23:24:11 +0000 (23:24 +0000)]
Fix a null-pointer dereference and a tautological check in cam_get_device

Reported by: Coverity
CID: 1017964
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13184

6 years agoDefine xpt_path_inq.
Warner Losh [Wed, 6 Dec 2017 23:05:22 +0000 (23:05 +0000)]
Define xpt_path_inq.

This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and
calling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13387

6 years agoNow that cam_periph_runccb() can be called from situations where the
Warner Losh [Wed, 6 Dec 2017 23:05:15 +0000 (23:05 +0000)]
Now that cam_periph_runccb() can be called from situations where the
kernel scheduler is stopped, replace the by hand calling of
xpt_polled_action() with it.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13388

6 years agoMake cam_periph_runccb be safe to call when we can only do polling.
Warner Losh [Wed, 6 Dec 2017 23:05:07 +0000 (23:05 +0000)]
Make cam_periph_runccb be safe to call when we can only do polling.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D13388

6 years agoGarbage collect IFCAP_POLLING_NOCOUNT. It wasn't used since very
Gleb Smirnoff [Wed, 6 Dec 2017 23:03:34 +0000 (23:03 +0000)]
Garbage collect IFCAP_POLLING_NOCOUNT.  It wasn't used since very
beginning of polling(4).  The module always ignored return value
from driver polling handler.

6 years agoSplit body of mails not respecting RFC2822
Baptiste Daroussin [Wed, 6 Dec 2017 22:08:35 +0000 (22:08 +0000)]
Split body of mails not respecting RFC2822

For mails which has a body not respecting RFC2822 (which often happen with
crontabs) try to split by words finding the last space before 1000's character

If no spaces are found then consider the mail to be malformed anyway

PR: 208261

6 years agoOptimize telldir(3)
Alan Somers [Wed, 6 Dec 2017 22:06:48 +0000 (22:06 +0000)]
Optimize telldir(3)

Currently each call to telldir() requires a malloc and adds an entry to a
linked list which must be traversed on future telldir(), seekdir(),
closedir(), and readdir() calls. Applications that call telldir() for every
directory entry incur O(n^2) behavior in readdir() and O(n) in telldir() and
closedir().

This optimization eliminates the malloc() and linked list in most cases by
packing the relevant information into a single long. On 64-bit architectures
msdosfs, NFS, tmpfs, UFS, and ZFS can all use the packed representation.  On
32-bit architectures msdosfs, NFS, and UFS can use the packed
representation, but ZFS and tmpfs can only use it for about the first 128
files per directory.  Memory savings is about 50 bytes per telldir(3) call.
Speedup for telldir()-heavy directory traversals is about 20-30x for one
million files per directory.

Reviewed by: kib, mav, mckusick
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13385

6 years agoThe function make_relative_prefix_1 does not properly free locally
Stephen J. Kiernan [Wed, 6 Dec 2017 21:18:45 +0000 (21:18 +0000)]
The function make_relative_prefix_1 does not properly free locally
allocated memory when it returns early.

Free the memory associated with the variables full_programe, bin_dirs,
prog_dirs, and prefix_dirs when the function returns early.

Submitted by: Tom Rix <trix@juniper.net>
Reviewed by: jhibbits, emaste
Approved by: sjg (mentor)
Obtained from: Juniper Networks, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9691

6 years agoThe function fwscanf() return value is wrong when encountering an early
Stephen J. Kiernan [Wed, 6 Dec 2017 21:12:24 +0000 (21:12 +0000)]
The function fwscanf() return value is wrong when encountering an early
matching failure.

According to the Open Group documentation for fwscanf:
"Upon successful completion, these functions shall return the number of
successfully matched and assigned input items; this number can be zero in
the event of an early matching failure."

Without this change, fwscanf would return EOF in the case of an early
matching failure, instead of the proper return value of 0.

This change aligns fwscanf(3) with the implementation in fscanf(3).

PR: 202240
Submitted by: rajendra.sy@gmail.com
Reviewed by: jhb, cem
Approved by: sjg (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13288

6 years agoAUTO_OBJ: Don't create nested OBJDIRS with print-dir or make -n.
Bryan Drewery [Wed, 6 Dec 2017 21:00:41 +0000 (21:00 +0000)]
AUTO_OBJ: Don't create nested OBJDIRS with print-dir or make -n.

Sponsored by: Dell EMC

6 years agoUpdate to 2017-12-06
Baptiste Daroussin [Wed, 6 Dec 2017 20:23:38 +0000 (20:23 +0000)]
Update to 2017-12-06

MFC after: 2 days

6 years agosdiff(1) can now be built defaults warning level
Baptiste Daroussin [Wed, 6 Dec 2017 20:10:05 +0000 (20:10 +0000)]
sdiff(1) can now be built defaults warning level

6 years agoRename variables confusing gcc 4.2.1
Baptiste Daroussin [Wed, 6 Dec 2017 20:09:30 +0000 (20:09 +0000)]
Rename variables confusing gcc 4.2.1

While there is no reason it shadows div(3) gcc 4.2.1 complains about it

MFC after: 1 week

6 years agoFix -Wincompatible-pointer-types-discards-qualifiers warnings
Baptiste Daroussin [Wed, 6 Dec 2017 20:05:36 +0000 (20:05 +0000)]
Fix -Wincompatible-pointer-types-discards-qualifiers warnings

MFC after: 1 week

6 years agoUse unique wait messages in the page daemon control loop.
Mark Johnston [Wed, 6 Dec 2017 18:36:54 +0000 (18:36 +0000)]
Use unique wait messages in the page daemon control loop.

Discussed with: alc
MFC after: 1 week

6 years agotcpdump: remove undesired svn:keywords property from contrib
Ed Maste [Wed, 6 Dec 2017 18:11:56 +0000 (18:11 +0000)]
tcpdump: remove undesired svn:keywords property from contrib

Reported by: glebius
MFC after: 6 days
MFC with: r326613

6 years agoUse a global extern declaration to appease gcc.
Mark Johnston [Wed, 6 Dec 2017 17:52:01 +0000 (17:52 +0000)]
Use a global extern declaration to appease gcc.

Reported by: gjb
X-MFC with: r326498

6 years agoFix crash with a dotless hostname.
Gleb Smirnoff [Wed, 6 Dec 2017 17:50:10 +0000 (17:50 +0000)]
Fix crash with a dotless hostname.

6 years agocam: fix sign-extension error in adagetparams
Alan Somers [Wed, 6 Dec 2017 17:01:25 +0000 (17:01 +0000)]
cam: fix sign-extension error in adagetparams

adagetparams contains a sign-extension error that will cause the sector
count to be incorrectly calculated for ATA disks of >=1TiB that still use
CHS addressing. Disks using LBA48 addressing are unaffected.

Reported by: Coverity
CID: 1007296
Reviewed by: ken
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13198

6 years agoaw_mp.c: use argument name in macros
Kyle Evans [Wed, 6 Dec 2017 14:53:53 +0000 (14:53 +0000)]
aw_mp.c: use argument name in macros

Rather than relying on 'cluster' existing in the context they're used in,
use the argument name.

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

6 years agoReally fix typo and improve wording of the comment
Baptiste Daroussin [Wed, 6 Dec 2017 10:47:50 +0000 (10:47 +0000)]
Really fix typo and improve wording of the comment

6 years agoFix typo
Baptiste Daroussin [Wed, 6 Dec 2017 10:20:01 +0000 (10:20 +0000)]
Fix typo

Reported by: danfe

6 years agoRevert local changes made to make zstd(1) frontend behave like gzip(1) and friends
Baptiste Daroussin [Wed, 6 Dec 2017 09:53:10 +0000 (09:53 +0000)]
Revert local changes made to make zstd(1) frontend behave like gzip(1) and friends

This change was made to allow zstd(1) to be a dropin replacement for gzip(1) and
friends, allowing easy integration, in particular with newsyslog(8). At the
price of having a zstd(1) command which by default behaves differently than what
upstream default, confusing users.

newsyslog(8) has been adapted to now be more flexible in what it accepts as
compression program, so we can switch back zstd(1) to its default behaviour

Reported by: many

6 years agoAllow newsyslog to execute compression commands which
Baptiste Daroussin [Wed, 6 Dec 2017 09:44:35 +0000 (09:44 +0000)]
Allow newsyslog to execute compression commands which
have a semantic different than the traditional gzip(1)

This is done to allow to use zstd(1) as a compression tool without
having to patch it to change its default behavior.

6 years agodhcp_try_rfc1048() is not used any more
Toomas Soome [Wed, 6 Dec 2017 06:49:53 +0000 (06:49 +0000)]
dhcp_try_rfc1048() is not used any more

Remove unused function.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D13382