]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agols(1): Enable colors with COLORTERM is set in the environment
Kyle Evans [Wed, 8 Aug 2018 21:51:19 +0000 (21:51 +0000)]
ls(1): Enable colors with COLORTERM is set in the environment

COLORTERM is the de facto standard, while CLICOLOR is generally specific to
FreeBSD and ls(1).

PR: 230101
Submitted by: D Green <dfrg@xsmail.com> (with manpage additions by myself)
Reviewed by: cem ("LGTM" in PR; pre-manpage changes)
MFC after: 1 week

5 years agodd: add status=progress support
Kyle Evans [Wed, 8 Aug 2018 21:37:02 +0000 (21:37 +0000)]
dd: add status=progress support

This reports the current status on a single line every second, mirroring
similar functionality in GNU dd, and carefully interacts with SIGINFO.

PR: 229615
Submitted by: Thomas Hurst <tom@hur.st> (modified for style(9) nits by me)
MFC after: 1 week

5 years agoapply(1): Fix magic number substitution with magic character ' '
Kyle Evans [Wed, 8 Aug 2018 21:21:28 +0000 (21:21 +0000)]
apply(1): Fix magic number substitution with magic character ' '

Using a space as the magic character would result in problems if the command
started with a number:

- For a 'valid' number n, n < size of argv, it would erroneously get
  replaced with that argument; e.g. `apply -a ' ' -d 1rm x => `execxrm x`

- For an 'invalid' number n, n >= size of argv, it would segfault.
  e.g. `apply -a ' ' 2to3 test.py` would try to access argv[2]

This problem occurred because apply(1) would prepend "exec " to the command
string before doing the actual magic number replacements, so it would come
across "exec 2to3 1" and assume that the " 2" is also a magic number to be
replaced.

Re-work this to instead just append "exec " to the command sbuf and
workaround the ugliness. This also simplifies stuff in the process.

PR: 226948
Submitted by: Tobias Stoeckmann <tobias@stoeckmann.org>
MFC after: 1 week

5 years agopowerpc64/powernv: re-read RTC after polling
Breno Leitao [Wed, 8 Aug 2018 21:19:07 +0000 (21:19 +0000)]
powerpc64/powernv: re-read RTC after polling

If OPAL_RTC_READ is busy and does not return the information on the first run,
as returning OPAL_BUSY_EVENT, the system will crash since ymd and hmsm variable
will contain junk values.

This is happening because we were not calling OPAL_RTC_READ again after
OPAL_POLL_EVENTS' return, which would finally replace the old/junk hmsm and ymd
values.

The code was also mixing OPAL_RTC_READ and OPAL_POLL_EVENTS return values.

This patch fix this logic and guarantee that we call OPAL_RTC_READ after
OPAL_POLL_EVENTS return, and guarantee the code will only proceed if
OPAL_RTC_READ returns OPAL_SUCCESS.

Reviewed by: jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D16617

5 years agoFix the err() arguments for a nfssvc(8) failure.
Rick Macklem [Wed, 8 Aug 2018 20:30:12 +0000 (20:30 +0000)]
Fix the err() arguments for a nfssvc(8) failure.

argv has been incremented during argument handling, so elements of the
array are no longer valid. Change the err() arguments so only the
first string pointer in argv is used.
Found during code inspection.

5 years agoAssorted fixes to handling of LayoutRecall callbacks, mostly error handling.
Rick Macklem [Wed, 8 Aug 2018 20:21:45 +0000 (20:21 +0000)]
Assorted fixes to handling of LayoutRecall callbacks, mostly error handling.

After a re-read of the appropriate section of RFC5661, I decided that a
few things should be changed related to LayoutRecall callback handling.
Here are the things fixed by this patch.
- For two of the three cases that LayoutRecall is done, I now think
  setting the clora_changed argument false is correct.
- All errors other than NFSERR_DELAY returned by LayoutRecall appear
  permanent, so don't retry for any of them. (NFSERR_DELAY is retried by
  newnfs_request(), so it is not affected by this patch.)
- Instead of waiting "forever" (actually until the process is SIGTERM'd)
  for Layouts to be returned during a mirror copy, fail and return
  ENXIO after about 1minute.
  Waiting for a <ctrl>C made sense when pnfsdscopymr() was done by itself,
  but did not make sense when done via find(1).
This patch only affects the pNFS server.

5 years agoUse the right variable when updating interface routes.
Mark Johnston [Wed, 8 Aug 2018 20:15:40 +0000 (20:15 +0000)]
Use the right variable when updating interface routes.

PR: 229807
Submitted by: John Hay <jhay@meraka.org.za>
MFC after: 2 weeks

5 years agoSwitch the default pager for most commands to less
Alan Somers [Wed, 8 Aug 2018 19:24:20 +0000 (19:24 +0000)]
Switch the default pager for most commands to less

Finally, a pager for the nineties.

MFC after: Never
Relnotes: Yes
Differential Revision: https://reviews.freebsd.org/D13465
Poll: https://reviews.freebsd.org/V7

5 years agoDIRS: Fix duplicate target warnings.
Bryan Drewery [Wed, 8 Aug 2018 19:15:48 +0000 (19:15 +0000)]
DIRS: Fix duplicate target warnings.

5 years agoDIRS: Ensure existing directory still has permissions set.
Bryan Drewery [Wed, 8 Aug 2018 19:15:45 +0000 (19:15 +0000)]
DIRS: Ensure existing directory still has permissions set.

5 years agoBring VOP_LOOKUP(9) up to date
Alan Somers [Wed, 8 Aug 2018 18:50:42 +0000 (18:50 +0000)]
Bring VOP_LOOKUP(9) up to date

* Remove the cn_hash field (removed by r51906)
* Add the cn_lkflags field (added by r144285)
* Remove duplicate definition of cnp.

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16629

5 years agoUse host byte order when comparing mss values.
Andrey V. Elsukov [Wed, 8 Aug 2018 17:32:02 +0000 (17:32 +0000)]
Use host byte order when comparing mss values.

This fixes tcp-setmss action on little endian machines.

PR: 225536
Submitted by: John Zielinski

5 years agoSimplify compression code.
Mark Johnston [Wed, 8 Aug 2018 17:26:51 +0000 (17:26 +0000)]
Simplify compression code.

- Remove the compression suffix macros and move them directly into the
  compress_type array.
- Remove the hardcoded sizes on the suffix and compression args arrays.
- Simplify the compression args arrays at the expense of a __DECONST
  when calling execv().
- Rewrite do_zipwork.  The COMPRESS_* macros can directly index the
  compress_types array, so the outer loop is not needed. Convert
  fixed-length strings into asprintf or sbuf calls.

Submitted by: Dan Nelson <dnelson_1901@yahoo.com>
Reviewed by: gad
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D16518

5 years agoAdd support for pmap_enter(..., psind=1) to the armv6 pmap. In other words,
Alan Cox [Wed, 8 Aug 2018 16:55:01 +0000 (16:55 +0000)]
Add support for pmap_enter(..., psind=1) to the armv6 pmap.  In other words,
add support for explicitly requesting that pmap_enter() create a 1 MB page
mapping.  (Essentially, this feature allows the machine-independent layer
to create superpage mappings preemptively, and not wait for automatic
promotion to occur.)

Export pmap_ps_enabled() to the machine-independent layer.

Add a flag to pmap_pv_insert_pte1() that specifies whether it should fail
or reclaim a PV entry when one is not available.

Refactor pmap_enter_pte1() into two functions, one by the same name, that
is a general-purpose function for creating pte1 mappings, and another,
pmap_enter_1mpage(), that is used to prefault 1 MB read- and/or execute-
only mappings for execve(2), mmap(2), and shmat(2).

In addition, as an optimization to pmap_enter(..., psind=0), eliminate the
use of pte2_is_managed() from pmap_enter().  Unlike the x86 pmap
implementations, armv6 does not have a managed bit defined within the PTE.
So, pte2_is_managed() is actually a call to PHYS_TO_VM_PAGE(), which is O(n)
in the number of vm_phys_segs[].  All but one call to PHYS_TO_VM_PAGE() in
pmap_enter() can be avoided.

Reviewed by: kib, markj, mmel
Tested by: mmel
MFC after: 6 weeks
Differential Revision: https://reviews.freebsd.org/D16555

5 years agoImplement uma_small_alloc(), uma_small_free().
Ruslan Bukin [Wed, 8 Aug 2018 16:08:38 +0000 (16:08 +0000)]
Implement uma_small_alloc(), uma_small_free().

Reviewed by: markj
Obtained from: arm64
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D16628

5 years agoFix printf(1) ignores width and precision in %b format.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:25:01 +0000 (15:25 +0000)]
Fix printf(1) ignores width and precision in %b format.

The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong log in r337440.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

PR: 229641
Reported by: Rudolf Cejka
Submitted by: Garrett D'Amore (illumos)
MFC after: 1 week

5 years agoRevert r337440: the log message is wrong.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:12:32 +0000 (15:12 +0000)]
Revert r337440: the log message is wrong.

5 years agomsdosfs: fixes for Undefined Behavior.
Pedro F. Giffuni [Wed, 8 Aug 2018 15:08:22 +0000 (15:08 +0000)]
msdosfs: fixes for Undefined Behavior.

These were found by the Undefined Behaviour GsoC project at NetBSD:

Do not change signedness bit with left shift.
While there avoid signed integer overflow.
Address both issues with using unsigned type.

msdosfs_fat.c:512:42, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:521:44, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:14, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:744:24, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'
msdosfs_fat.c:840:13, left shift of 1 by 31 places cannot be represented
in type 'int'
msdosfs_fat.c:840:36, signed integer overflow: -2147483648 - 1 cannot be
represented in type 'int [20]'

Detected with micro-UBSan in the user mode.

Hinted from: NetBSD (CVS 1.33)
MFC after: 2 weeks
Differenctial Revision: https://reviews.freebsd.org/D16615

5 years agoFix a small bug in rack where it will
Randall Stewart [Wed, 8 Aug 2018 13:36:49 +0000 (13:36 +0000)]
Fix a small bug in rack where it will
end up sending the FIN twice.
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D16604

5 years agoSplit the dir_index and dir_nlink features.
Fedor Uporov [Wed, 8 Aug 2018 12:08:46 +0000 (12:08 +0000)]
Split the dir_index and dir_nlink features.

Do not allow to create more that EXT4_LINK_MAX links to directory in case
if the dir_nlink is not set, like it is done in the fresh e2fsprogs updates.

MFC after:      3 months

5 years agoFix directory blocks checksum updating logic.
Fedor Uporov [Wed, 8 Aug 2018 12:07:45 +0000 (12:07 +0000)]
Fix directory blocks checksum updating logic.

The checksum updating functions were not called in case of dir index inode splitting
and in case of dir entry removing, when the entry was first in the block.
Fix and move the dir entry adding logic when i_count == 0 to new function.

MFC after:      3 months

5 years agobuild: skip the database check for the distributeworld target
Roger Pau Monné [Wed, 8 Aug 2018 07:58:29 +0000 (07:58 +0000)]
build: skip the database check for the distributeworld target

distributeworld is used to generate install media, so it makes no
sense to check the host database since the install media can be
generated from any box, regardless of the version of FreeBSD it's
running.

Sponsored by: Citrix Systems R&D
Reviewed by: ian, gjb
Differential revision: https://reviews.freebsd.org/D16507

5 years agotop(1): hide THR column in separate-thread mode.
Eitan Adler [Wed, 8 Aug 2018 06:31:46 +0000 (06:31 +0000)]
top(1): hide THR column in separate-thread mode.

It does not make sense to show a "thread count" column when displaying
threads separately. In fact we don't, but do show the header for this
column. Fix this.

5 years agoFUSE: Remove some set-but-not-used variables
Conrad Meyer [Wed, 8 Aug 2018 04:46:03 +0000 (04:46 +0000)]
FUSE: Remove some set-but-not-used variables

No functional change.

5 years agoDefer and aggregate swap_pager_meta_build frees.
Alan Cox [Wed, 8 Aug 2018 02:30:34 +0000 (02:30 +0000)]
Defer and aggregate swap_pager_meta_build frees.

Before swp_pager_meta_build replaces an old swapblk with an new one,
it frees the old one.  To allow such freeing of blocks to be
aggregated, have swp_pager_meta_build return the old swap block, and
make the caller responsible for freeing it.

Define a pair of short static functions, swp_pager_init_freerange and
swp_pager_update_freerange, to do the initialization and updating of
blk addresses and counters used in aggregating blocks to be freed.

Submitted by: Doug Moore <dougm@rice.edu>
Reviewed by: kib, markj (an earlier version)
Tested by: pho
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D13707

5 years agofile: update to 5.34
Eitan Adler [Wed, 8 Aug 2018 01:33:36 +0000 (01:33 +0000)]
file: update to 5.34

PR: 230141
exp-run by: antoine

5 years ago- Fix hash calculation by MAC address
Kevin Lo [Wed, 8 Aug 2018 01:20:02 +0000 (01:20 +0000)]
- Fix hash calculation by MAC address
- Since rx_cmd_c is an uint16_t, use le16toh() instead of le32toh()

Reviewed by: emaste

5 years agoFix printf(1) ignores width and precision in %b format.
Pedro F. Giffuni [Tue, 7 Aug 2018 23:03:50 +0000 (23:03 +0000)]
Fix printf(1) ignores width and precision in %b format.

The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as for
"s"; applied after the unescaping.
Adopt the same treatment on our printf.

PR: 229641
Submitted by: Garrett D'Amore (illumos)

5 years agocxgbe(4): Allow the driver to specify a burst size when configuring a
Navdeep Parhar [Tue, 7 Aug 2018 22:13:03 +0000 (22:13 +0000)]
cxgbe(4): Allow the driver to specify a burst size when configuring a
traffic class for rate limiting.

Add experimental knobs that allow the user to specify a default pktsize
and burstsize for traffic classes associated with a port:

dev.<ifname>.<instance>.tc.pktsize
dev.<ifname>.<instance>.tc.burstsize

Sponsored by: Chelsio Communications

5 years agoAllow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.
Rick Macklem [Tue, 7 Aug 2018 21:29:14 +0000 (21:29 +0000)]
Allow newnfs_request() to retry all callback RPCs with an NFSERR_DELAY reply.

The code in newnfs_request() retries RPCs that get a reply of NFSERR_DELAY,
but exempts certain NFSv4 operations. However, for callback RPCs, there
should not be any exemptions at this time. The code would have erroneously
exempted the CBRECALL callback, since it has the same operation number as
the CLOSE operation.
This patch fixes this by checking for a callback RPC (indicated by clp != NULL)
and not checking for exempt operations for callbacks.
This would have only affected the NFSv4 server when delegations are enabled
(they are not enabled by default) and the client replies to CBRECALL with
NFSERR_DELAY. This may never actually happen.
Spotted during code inspection.

MFC after: 2 weeks

5 years agoWhen getting mount information for all filesystems, mount uses the
Kirk McKusick [Tue, 7 Aug 2018 21:17:45 +0000 (21:17 +0000)]
When getting mount information for all filesystems, mount uses the
getfsstat(2) system call using the MNT_NOWAIT flag to indicate that
it wants to use the statfs information cached in the mount structure.
When the -v (verbose) flag is specified, we need to use the MNT_WAIT
flag to getfsstat(2) so that kernel will call VFS_STATFS to get the
current statfs statistics from each filesystem.

Sponsored by: Netflix

5 years agoFollowup to r337430: only call elf_reloc_ifunc on x86.
Konstantin Belousov [Tue, 7 Aug 2018 20:43:50 +0000 (20:43 +0000)]
Followup to r337430: only call elf_reloc_ifunc on x86.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoMove description of init_shell, init_script, and init_chroot kenv
Edward Tomasz Napierala [Tue, 7 Aug 2018 19:23:03 +0000 (19:23 +0000)]
Move description of init_shell, init_script, and init_chroot kenv
tunables from loader(8) to init(8), since it's init that actually
uses them.  Add .Xrs at their old place.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoUpdate the list of architectures having atomic_fcmpset_{8,16,64}(9) and
Marius Strobl [Tue, 7 Aug 2018 18:59:02 +0000 (18:59 +0000)]
Update the list of architectures having atomic_fcmpset_{8,16,64}(9) and
atomic_swap_{64,int}(9) respectively as of r337433.

5 years agoImplement atomic_swap_{int,long,ptr}(9).
Marius Strobl [Tue, 7 Aug 2018 18:56:51 +0000 (18:56 +0000)]
Implement atomic_swap_{int,long,ptr}(9).

5 years agoImplement atomic_swap_64(9).
Marius Strobl [Tue, 7 Aug 2018 18:56:01 +0000 (18:56 +0000)]
Implement atomic_swap_64(9).

5 years agoFutex support functions in linux.ko and linux32.ko on amd64 should be
Konstantin Belousov [Tue, 7 Aug 2018 18:29:10 +0000 (18:29 +0000)]
Futex support functions in linux.ko and linux32.ko on amd64 should be
aware of SMAP.

Reported and tested by: Johannes Lundberg <johalun0@gmail.com>, wulf
Sponsored by: The FreeBSD Foundation

5 years agoAdd missed handling of local relocs against ifunc target in the obj modules.
Konstantin Belousov [Tue, 7 Aug 2018 18:26:46 +0000 (18:26 +0000)]
Add missed handling of local relocs against ifunc target in the obj modules.

Reported and tested by: wulf
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

5 years agoifconfig: Fix use of _Noreturn.
Mark Johnston [Tue, 7 Aug 2018 17:25:38 +0000 (17:25 +0000)]
ifconfig: Fix use of _Noreturn.

The _Noreturn is a function-specifier (like inline) which must preceed
the declarator.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

5 years agoRecognize ICS1893C PHYs.
Mark Johnston [Tue, 7 Aug 2018 17:13:42 +0000 (17:13 +0000)]
Recognize ICS1893C PHYs.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 1 week

5 years agoUpdate PR 131876 regression tests after r337423.
Mark Johnston [Tue, 7 Aug 2018 16:39:07 +0000 (16:39 +0000)]
Update PR 131876 regression tests after r337423.

- Add some more cases to the truncation test.
- Remove the "expect fail" annotations.

PR: 131876
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16562

5 years agoImprove handling of control message truncation.
Mark Johnston [Tue, 7 Aug 2018 16:36:48 +0000 (16:36 +0000)]
Improve handling of control message truncation.

If a recvmsg(2) or recvmmsg(2) caller doesn't provide sufficient space
for all control messages, the kernel sets MSG_CTRUNC in the message
flags to indicate truncation of the control messages.  In the case
of SCM_RIGHTS messages, however, we were failing to dispose of the
rights that had already been externalized into the recipient's file
descriptor table.  Add a new function and mbuf type to handle this
cleanup task, and use it any time we fail to copy control messages
out to the recipient.  To simplify cleanup, control message truncation
is now only performed at control message boundaries.

The change also fixes a few related bugs:
- Rights could be leaked to the recipient process if an error occurred
  while copying out a message's contents.
- We failed to set MSG_CTRUNC if the truncation occurred on a control
  message boundary, e.g., if the caller received two control messages
  and provided only the exact amount of buffer space needed for the
  first.

PR: 131876
Reviewed by: ed (previous version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16561

5 years agolibc: fix cases of undefined behavior.
Pedro F. Giffuni [Tue, 7 Aug 2018 15:24:19 +0000 (15:24 +0000)]
libc: fix cases of undefined behavior.

These were found by the Undefined Behavious  GsoC project at NetBSD:

Avoid undefined behavior in ftok(3)

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

ftok.c:56:10, left shift of 123456789 by 24 places cannot be represented
in type 'int'
ftok.c:56:10, left shift of 4160 by 24 places cannot be represented in
type 'int'

Avoid undefined behavior in an inet_addr.c

Do not change the signedness bit with a left shift operation.
Cast to unsigned integer to prevent this.

inet_addr.c:218:20, left shift of 131 by 24 places cannot be represented
in type 'int'

Detected with micro-UBSan in the user mode.

Obtained from: NetBSD
MFC after: 2 weeks

5 years agosed(1): partial fix for the case of the regex delimited with '['.
Pedro F. Giffuni [Tue, 7 Aug 2018 14:47:39 +0000 (14:47 +0000)]
sed(1): partial fix for the case of the regex delimited with '['.

We don't generally support the weird case of regular expresions delimited
by an opening square bracket ('[') but POSIX says that inside
bracket expressions, escaping is not possible and both '[' and '\'
represent themselves.

PR: 230198 (exp-run)
Obtained from: OpenBSD

5 years agodhclient: Enter capability mode before dropping privileges.
Mark Johnston [Tue, 7 Aug 2018 13:50:21 +0000 (13:50 +0000)]
dhclient: Enter capability mode before dropping privileges.

This is needed to be able to chroot in the fallback case where
Capsicum is not available.

Reported by: Daniel Braniss <danny@cs.huji.ac.il>
X-MFC with: r337382
Sponsored by: The FreeBSD Foundation

5 years agolibsa: gzipfs.c converts pointers to integer types with different sign
Toomas Soome [Tue, 7 Aug 2018 10:53:51 +0000 (10:53 +0000)]
libsa: gzipfs.c converts pointers to integer types with different sign

Signed versus unsigned char.

5 years agolibsa: dos_checksum() should take unsigned chars
Toomas Soome [Tue, 7 Aug 2018 10:48:36 +0000 (10:48 +0000)]
libsa: dos_checksum() should take unsigned chars

Fix pointers to integers with different sign issue.

5 years agoReplace a pair of 8-bit writes to VGA memory with a single 16-bit write.
Colin Percival [Tue, 7 Aug 2018 08:33:40 +0000 (08:33 +0000)]
Replace a pair of 8-bit writes to VGA memory with a single 16-bit write.

The VGA "text mode" buffer has a pair of bytes for each character: One
byte for the character symbol, and an "attribute" byte encoding the
foreground and background colours.  When updating the screen, we were
writing these two bytes separately.

On some virtualized systems, every write results in a glyph being redrawn
into a (graphical) virtual screen; writing these two bytes separately
results in twice as much work being done to draw characters, whereas if
we perform a single 16-bit write instead, the character only needs to be
redrawn once.

On an EC2 c5.4xlarge instance, this change cuts 1.30s from the kernel boot,
speeding it up from 8.90s to 7.60s.

MFC after: 1 week

5 years agoRemove redundant and incorrect default definition of AF_INET6. AF_INET6
Cy Schubert [Tue, 7 Aug 2018 07:12:59 +0000 (07:12 +0000)]
Remove redundant and incorrect default definition of AF_INET6. AF_INET6
is defined in sys/socket.h where it's defined as 28.

A bit of trivia: On NetBSD AF_INET6 is defined as 24. On Solaris it is
defined as 26. This is probably why Darren defaulted to 26, because
ipfilter was originally written for SunOS 4 and Solaris many moons ago.

MFC after: 2 weeks

5 years agoFix copy-and-paste error in previous commit.
Colin Percival [Tue, 7 Aug 2018 00:51:49 +0000 (00:51 +0000)]
Fix copy-and-paste error in previous commit.

5 years agoRemove spurious ABI tags from kdump output.
John Baldwin [Tue, 7 Aug 2018 00:10:58 +0000 (00:10 +0000)]
Remove spurious ABI tags from kdump output.

The abidump routine output an ABI tag when -A was specified for records
that were not displayed due to type or pid filtering.  To fix, split
the code to lookup the ABI from the code to display the ABI, move the
code to display the ABI into dumpheader(), and move dumpheader() later
in the main loop as a simplification.  Previously dumpheader() was
called under a condition that repeated conditions made later in the
main loop.

Reviewed by: kib
MFC after: 1 month
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D16608

5 years agoMake the system C11 atomics headers fully compatible with external GCC.
John Baldwin [Mon, 6 Aug 2018 23:51:08 +0000 (23:51 +0000)]
Make the system C11 atomics headers fully compatible with external GCC.

The <sys/cdefs.h> and <stdatomic.h> headers already included support for
C11 atomics via intrinsincs in modern versions of GCC, but these versions
tried to "hide" atomic variables inside a wrapper structure.  This wrapper
is not compatible with GCC's internal <stdatomic.h> header, so that if
GCC's <stdatomic.h> was used together with <sys/cdefs.h>, use of C11
atomics would fail to compile.  Fix this by not hiding atomic variables
in a structure for modern versions of GCC.  The headers already avoid
using a wrapper structure on clang.

Note that this wrapper was only used if C11 was not enabled (e.g.
via -std=c99), so this also fixes compile failures if a modern version
of GCC was used with -std=c11 but with FreeBSD's <stdatomic.h> instead
of GCC's <stdatomic.h> and this change fixes that case as well.

Reported by: Mark Millard
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D16585

5 years agocxgbe(4): Allow user-configured and driver-configured traffic classes to
Navdeep Parhar [Mon, 6 Aug 2018 23:21:13 +0000 (23:21 +0000)]
cxgbe(4): Allow user-configured and driver-configured traffic classes to
be used simultaneously.  Move sysctl_tc and sysctl_tc_params to
t4_sched.c while here.

MFC after: 3 weeks
Sponsored by: Chelsio Communications

5 years agocxgbe(4): Break up sysctl_bitfield into 8 bit and 16 bit variants. Have
Navdeep Parhar [Mon, 6 Aug 2018 21:54:51 +0000 (21:54 +0000)]
cxgbe(4): Break up sysctl_bitfield into 8 bit and 16 bit variants.  Have
them display the current value of the bitfield rather than the fixed
value that was provided when the sysctl node was created.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agoPut in place the framework for consolodating contiguous blocks into
Kirk McKusick [Mon, 6 Aug 2018 21:09:11 +0000 (21:09 +0000)]
Put in place the framework for consolodating contiguous blocks into
a smaller number of larger TRIM requests. The hope had been to have
the full TRIM consolodation in place for 12.0, but the algorithms
are still under development and need further testing. With this
framework in place it will be possible to easily add TRIM consolodation
once the optimal strategy has been found.

The only functional change with this patch is the elimination of TRIM
requests for blocks that are freed before they have been likely to
have been written.

Reviewed by: kib
Discussed with: Warner Losh and Chuck Silvers
Sponsored by: Netflix

5 years agoAdd EC2PUBLICSNAP option to EC2 builds; this passes a (recently added)
Colin Percival [Mon, 6 Aug 2018 19:21:32 +0000 (19:21 +0000)]
Add EC2PUBLICSNAP option to EC2 builds; this passes a (recently added)
flag to bsdec2-image-upload instructing it to mark the snapshot of its
root disk as public (which is independent from marking the created AMIs
as public).

Requested by: Amazon

5 years agoFix typo in cxgbe/t4_tom.
Navdeep Parhar [Mon, 6 Aug 2018 19:09:55 +0000 (19:09 +0000)]
Fix typo in cxgbe/t4_tom.

5 years agoBump date after r337384.
Jonathan T. Looney [Mon, 6 Aug 2018 18:42:37 +0000 (18:42 +0000)]
Bump date after r337384.

Reported by: bz

5 years agoAddress concerns about CPU usage while doing TCP reassembly.
Jonathan T. Looney [Mon, 6 Aug 2018 17:36:57 +0000 (17:36 +0000)]
Address concerns about CPU usage while doing TCP reassembly.

Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Reviewed by: jhb
Approved by: so
Security: FreeBSD-SA-18:08.tcp
Security: CVE-2018-6922

5 years agorelease: arm: Copy the dtb to the fat partition
Emmanuel Vadot [Mon, 6 Aug 2018 17:21:20 +0000 (17:21 +0000)]
release: arm: Copy the dtb to the fat partition

When booting via EFI on arm we have no way to know the dtb file to load
and we always use the one provided from the bootloader.
This works in most case but :

 U-Boot have some really old DTB for some boards, the sync from Linux isn't done automatically for all boards
 Some boards (like TI BeagleBone series) use one u-boot for all the model and it doesn't embed the DTBs
 Some boards (like IMX6 based ones), don't embed the DTB

We want u-boot to load and patch the DTB with the mac address or the display
node enabled or not.

Reviewed by: gjb, imp
Differential Revision: https://reviews.freebsd.org/D16596

5 years agodhclient: Don't chroot if we are in capability mode.
Mark Johnston [Mon, 6 Aug 2018 16:22:01 +0000 (16:22 +0000)]
dhclient: Don't chroot if we are in capability mode.

The main dhclient process is Capsicumized but also chroots to
restrict filesystem access.  With r322369, pidfile(3) maintains a
directory descriptor for the pidfile, which can cause the chroot
to fail in certain cases.  To minimize the problem, only chroot
if we fail to enter capability mode, and store dhclient pidfiles
in a subdirectory of /var/run, thus restricting access via
pidfile(3)'s directory descriptor.

PR: 223327
Reviewed by: cem, oshogbo
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16584

5 years agoIncrease timeout for timedmutex_test:mutex2, timedmutex_test:mutex3
Ruslan Bukin [Mon, 6 Aug 2018 15:55:58 +0000 (15:55 +0000)]
Increase timeout for timedmutex_test:mutex2, timedmutex_test:mutex3
tests.

Default value is 300. It takes ~310s to complete each of these tests
in QEMU/RISC-V.

Sponsored by: DARPA, AFRL

5 years agoDefault to armv5te in LINT on arm. This should fix building LINT there.
Andrew Turner [Mon, 6 Aug 2018 14:40:45 +0000 (14:40 +0000)]
Default to armv5te in LINT on arm. This should fix building LINT there.

5 years agoFix "mandoc -Tlint" warnings.
Mateusz Piotrowski [Mon, 6 Aug 2018 11:45:28 +0000 (11:45 +0000)]
Fix "mandoc -Tlint" warnings.

Reviewed by: bcr
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D15580

5 years agoFix synopsis of the -t option.
Mateusz Piotrowski [Mon, 6 Aug 2018 11:38:55 +0000 (11:38 +0000)]
Fix synopsis of the -t option.

While here:

 - Remove deprecated ".Tn" macros.
 - Improve formatting and fix typos in the description of
   the -t option.

Reviewed by: bcr
Approved by: mat (mentor)
Differential Revision: https://reviews.freebsd.org/D16541

5 years agoImplement current_work() function in the LinuxKPI.
Hans Petter Selasky [Mon, 6 Aug 2018 10:48:20 +0000 (10:48 +0000)]
Implement current_work() function in the LinuxKPI.

Tested by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoThis fixes a bug in Rack where we were
Randall Stewart [Mon, 6 Aug 2018 09:22:07 +0000 (09:22 +0000)]
This fixes a bug in Rack where we were
not properly using the correct value for
Delayed Ack.

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

5 years agoImplement atomic_long_cmpxchg() function in the LinuxKPI.
Hans Petter Selasky [Mon, 6 Aug 2018 08:40:02 +0000 (08:40 +0000)]
Implement atomic_long_cmpxchg() function in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoDefine __poll_t type in the LinuxKPI.
Hans Petter Selasky [Mon, 6 Aug 2018 08:35:16 +0000 (08:35 +0000)]
Define __poll_t type in the LinuxKPI.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

5 years agoaw_thermal: Add nvmem and H5 support
Emmanuel Vadot [Mon, 6 Aug 2018 05:36:00 +0000 (05:36 +0000)]
aw_thermal: Add nvmem and H5 support

Now that aw_sid expose nvmem interface, use that to read the calibration
data.
Add support for H5 SoC.
Fix the bindings, we used to have non-upstreamed bindings. Switch to the
one that have been sent upstream. They are not stable yet, so we switch
from custom, wrong, bindings to correct, proposed bindings

5 years agoaw_sid: Add nvmem interface
Emmanuel Vadot [Mon, 6 Aug 2018 05:35:24 +0000 (05:35 +0000)]
aw_sid: Add nvmem interface

Rework aw_sid so it can work with the nvmem interface.
Each SoC expose a set of fuses (for now rootkey/boardid and, if available,
the thermal calibration data). A fuse can be private or public, reading private
fuse needs to be done via some registers instead of reading directly.
Each fuse is exposed as a sysctl.
For now leave the possibility for a driver to read any fuse without using
the nvmem interface as the awg and emac driver use this to generate a mac
address.

5 years agogit-svn-init: Clarify branch creation commands
Ben Widawsky [Mon, 6 Aug 2018 01:08:43 +0000 (01:08 +0000)]
git-svn-init: Clarify branch creation commands

Suggested by: eadler
Reviewed by: eadler
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D16593

5 years agoDocument 64-bit arm in terms of arch name (aarch64) not machine (arm64).
Ian Lepore [Sun, 5 Aug 2018 22:24:38 +0000 (22:24 +0000)]
Document 64-bit arm in terms of arch name (aarch64) not machine (arm64).
Other architectures are documented in terms of the name that is displayed by
'uname -p', aka MACHINE_ARCH and TARGET_ARCH in the build system, now
aarch64 matches the rest of them.

PR: 220297

5 years agoAdd a reference to pnfsserver.4 to the nfsd.8 man page.
Rick Macklem [Sun, 5 Aug 2018 20:36:48 +0000 (20:36 +0000)]
Add a reference to pnfsserver.4 to the nfsd.8 man page.

This is a content change.

5 years agoUpdate the pnfs.4 man page to reference the pnfsserver.4 man page.
Rick Macklem [Sun, 5 Aug 2018 20:20:04 +0000 (20:20 +0000)]
Update the pnfs.4 man page to reference the pnfsserver.4 man page.

This is a content change.

5 years agoAdd pnfsserver.4 to the Makefile for nfsd.
Rick Macklem [Sun, 5 Aug 2018 20:15:33 +0000 (20:15 +0000)]
Add pnfsserver.4 to the Makefile for nfsd.

5 years agoAdd a man page that describes the setup of a pNFS service.
Rick Macklem [Sun, 5 Aug 2018 20:14:07 +0000 (20:14 +0000)]
Add a man page that describes the setup of a pNFS service.

This is a content change.

5 years agoCopy all bits of a file handle in case there is padding in the structure.
Rick Macklem [Sun, 5 Aug 2018 19:21:50 +0000 (19:21 +0000)]
Copy all bits of a file handle in case there is padding in the structure.

At least on x86, fhandle_t is a packed structure, so I believe an
assignment will copy all the bits. However, for some current/future
architectures, there might be padding in the structure that doesn't get
copied via an assignment.
Since NFS assumes a file handle is an opaque blob of bits that can be
compared via memcmp()/bcmp(), all the bits including any padding must be
copied.
This patch replaces the assignments with a call to a byte copy function.
Spotted during code inspection.

5 years agoloader: bd_open() should cleanup from disk_open() error
Toomas Soome [Sun, 5 Aug 2018 19:17:07 +0000 (19:17 +0000)]
loader: bd_open() should cleanup from disk_open() error

Since bd_open() does early increment for reference counter and bcache
allocation, it also should undo those in case of the error.

Also remove unused variables rdev, g_err.

5 years agoloader: 337353 did miss to rename 2 write instances
Toomas Soome [Sun, 5 Aug 2018 18:24:35 +0000 (18:24 +0000)]
loader: 337353 did miss to rename 2 write instances

2 write instances got somehow missed.

5 years agoloader: cstyle cleanup for biosdisk.c
Toomas Soome [Sun, 5 Aug 2018 18:19:40 +0000 (18:19 +0000)]
loader: cstyle cleanup for biosdisk.c

Also switch u_int to uint32_t. Also replace "write" by "dowrite".
No functional changes intended.

5 years agopf: Increase default hash table size
Kristof Provost [Sun, 5 Aug 2018 13:54:37 +0000 (13:54 +0000)]
pf: Increase default hash table size

Now that we (by default) limit the number of states to 100.000 it makse sense
to also adjust the default size of the hash table.

Based on the benchmarking results in
https://github.com/ocochard/netbenches/blob/master/Atom_C2758_8Cores-Chelsio_T540-CR/pf-states_hashsize/results/fbsd12-head.r332390/README.md
128K entries offers a good compromise between performance and memory use.

Users may still overrule this setting with the net.pf.states_hashsize and
net.pf.source_nodes_hashsize loader(8) tunables.

5 years agozfsboot: Fix startup crash
Kristof Provost [Sun, 5 Aug 2018 11:15:28 +0000 (11:15 +0000)]
zfsboot: Fix startup crash

On a FreeNAS mini XL, with geli encrypted drives the loader crashed in
geli_read().

When we iterate over the list of disks and allocate the zfsdsk structures we
don’t zero out the gdev pointer. In one case that resulted in geli_read()
(called on the bogus pointer) dividing by zero.

Use calloc() to ensure the zfsdsk structure is always zeroed, so the pointer is
initialised to NULL. As a side benefit it gets rid of one #ifdef
LOADER_GELI_SUPPORT.

5 years agouep(4): add evdev support
Vladimir Kondratyev [Sun, 5 Aug 2018 11:14:13 +0000 (11:14 +0000)]
uep(4): add evdev support

To compile this driver with evdev support enabled, place
following lines into the kernel configuration file:

options EVDEV_SUPPORT
device evdev

Note: Native and evdev modes are mutually exclusive.

Reviewed by: gonzo, wblock (docs)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D11156

5 years agoallwinner: a64: Add THS clock support
Emmanuel Vadot [Sun, 5 Aug 2018 06:16:36 +0000 (06:16 +0000)]
allwinner: a64: Add THS clock support

The clock for the thermal sensor controller was missing when this driver
was made.

5 years agoextres: clkdiv: Fix div_with_table
Emmanuel Vadot [Sun, 5 Aug 2018 06:15:35 +0000 (06:15 +0000)]
extres: clkdiv: Fix div_with_table

We didn't allowed a divider register value of 0 which can exists and
also didn't wrote the value but the divider, which result of a wrong
frequency to be selected

5 years agoarm: allwinner: Disconnect A10/A20 HDMI driver
Emmanuel Vadot [Sun, 5 Aug 2018 06:10:13 +0000 (06:10 +0000)]
arm: allwinner: Disconnect A10/A20 HDMI driver

It doesn't work since 2 years when we stopped patching DTS.
The DTS now have the correct bindings but they are a lot different
from our hacked ones we used to have (and more representative of the
reality).

5 years agoarm: allwinner: Remove old unused clocks
Emmanuel Vadot [Sun, 5 Aug 2018 06:08:23 +0000 (06:08 +0000)]
arm: allwinner: Remove old unused clocks

Remove the old clocks for allwinner as now all the SoCs have been converted
to clkng.
The only old clock now is the gmac clock which still lives under the /clocks
dts node.

5 years agoFix build after r337340.
Brad Davis [Sun, 5 Aug 2018 04:20:52 +0000 (04:20 +0000)]
Fix build after r337340.

Approved by: will (mentor)

5 years agoMove autofs related configs to usr.sbin/autofs/
Brad Davis [Sat, 4 Aug 2018 22:41:17 +0000 (22:41 +0000)]
Move autofs related configs to usr.sbin/autofs/

This is prep for pkgbase to have config files tagged as such.

Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D16492

5 years agoMove portsnap.conf to head/usr.sbin/portsnap/portsnap/
Brad Davis [Sat, 4 Aug 2018 22:31:29 +0000 (22:31 +0000)]
Move portsnap.conf to head/usr.sbin/portsnap/portsnap/

This is prep for pkgbase to have config files tagged as such.

Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D16554

5 years agoMove freebsd-update.conf to usr.sbin/freebsd-update.
Brad Davis [Sat, 4 Aug 2018 22:25:41 +0000 (22:25 +0000)]
Move freebsd-update.conf to usr.sbin/freebsd-update.

This is prep for pkgbase so that config files are tagged as such.

Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D16556

5 years agoMove etc/minfree to sbin/savecore/.
Brad Davis [Sat, 4 Aug 2018 22:15:59 +0000 (22:15 +0000)]
Move etc/minfree to sbin/savecore/.

This is prep for pkgbase to have config files tagged as such.

Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D16558

5 years agosettimeofday(2): Remove stale note about timezone
Conrad Meyer [Sat, 4 Aug 2018 22:08:24 +0000 (22:08 +0000)]
settimeofday(2): Remove stale note about timezone

Contrary to the removed comment, the kernel does appear to use the timezone
argument of settimeofday.  The comment dates to the BSD4.4 import; I assume it
is just stale.

5 years agodate(1): Add ISO 8601 formatting option
Conrad Meyer [Sat, 4 Aug 2018 21:54:30 +0000 (21:54 +0000)]
date(1): Add ISO 8601 formatting option

The new flag is named '-I'.  It is documented in the manual page and covered
by basic unit tests.

5 years agoefirt: Don't enter EFI context early, convert addrs to KVA instead
Kyle Evans [Sat, 4 Aug 2018 21:41:10 +0000 (21:41 +0000)]
efirt: Don't enter EFI context early, convert addrs to KVA instead

efi_enter here was needed because efi_runtime dereference causes a fault
outside of EFI context, due to runtime table living in runtime service
space. This may cause problems early in boot, though, so instead access it
by converting paddr to KVA for access.

While here, remove the other direct PHYS_TO_DMAP calls and the explicit DMAP
requirement from efidev.

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

5 years agoSwap in WKILLED processes.
Konstantin Belousov [Sat, 4 Aug 2018 20:45:43 +0000 (20:45 +0000)]
Swap in WKILLED processes.

Swapped-out process that is WKILLED must be swapped in as soon as
possible.  The reason is that such process can be killed by OOM and
its pages can be only freed if the process exits.  To exit, the kernel
stack of the process must be mapped.

When allocating pages for the stack of the WKILLED process on swap in,
use VM_ALLOC_SYSTEM requests to increase the chance of the allocation
to succeed.

Add counter of the swapped out processes to avoid unneeded iteration
over the allprocs list when there is no work to do, reducing the
allproc_lock ownership.

Reviewed by: alc, markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16489

5 years agoFix the regression test for PR 181741.
Mark Johnston [Sat, 4 Aug 2018 20:29:58 +0000 (20:29 +0000)]
Fix the regression test for PR 181741.

With r337328, the test hangs becase the sendmsg() call will block until
the receive buffer is at least partially drained.  Fix the problem by
using a non-blocking socket and allowing short writes.  Also assert
that a SCM_CREDS message was received if one was expected.

PR: 181741
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16516

5 years agoDon't check rcv sockbuf limits when sending on a unix stream socket.
Mark Johnston [Sat, 4 Aug 2018 20:26:54 +0000 (20:26 +0000)]
Don't check rcv sockbuf limits when sending on a unix stream socket.

sosend_generic() performs an initial comparison of the amount of data
(including control messages) to be transmitted with the send buffer
size. When transmitting on a unix socket, we then compare the amount
of data being sent with the amount of space in the receive buffer size;
if insufficient space is available, sbappendcontrol() returns an error
and the data is lost.  This is easily triggered by sending control
messages together with an amount of data roughly equal to the send
buffer size, since the control message size may change in uipc_send()
as file descriptors are internalized.

Fix the problem by removing the space check in sbappendcontrol(),
whose only consumer is the unix sockets code.  The stream sockets code
uses the SB_STOP mechanism to ensure that senders will block if the
receive buffer fills up.

PR: 181741
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16515

5 years agoStyle.
Mark Johnston [Sat, 4 Aug 2018 20:16:36 +0000 (20:16 +0000)]
Style.