]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoDocument r319269, cxgbe(4) firmware update.
gjb [Wed, 31 May 2017 13:33:03 +0000 (13:33 +0000)]
Document r319269, cxgbe(4) firmware update.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r319086:
kib [Wed, 31 May 2017 09:23:21 +0000 (09:23 +0000)]
MFC r319086:
Mention that the basep argument to getdirentries(2) can be NULL.

7 years agoMFC r317632:
ngie [Wed, 31 May 2017 08:46:39 +0000 (08:46 +0000)]
MFC r317632:

Fix "make cscope-clean" when .OBJDIR already exists

The cscope generated files are always put in .CURDIR .

7 years agoMFC r316742:
ngie [Wed, 31 May 2017 08:43:46 +0000 (08:43 +0000)]
MFC r316742:

Clarify units for mediasize and sectorsize in DoFile(..)

They're byte quantities.

7 years agoMFC r316740:
ngie [Wed, 31 May 2017 08:42:31 +0000 (08:42 +0000)]
MFC r316740:

Clarify `minfree` warning message in check_space(..)

- State that the units are kB.
- Be more complete/concise in terms of what is required (in this case
  `minfree` must be at least `X`kB)

7 years agoMFC r317311,r317312,r319019:
ngie [Wed, 31 May 2017 08:40:39 +0000 (08:40 +0000)]
MFC r317311,r317312,r319019:

r317311:

Check for failures from getpagesize(3)

Return errno on failure, similar to the open(2) call above it.

CID: 1193753

r317312:

Fix type for `pagesize` to match the return type for getpagesize(3)
to fix the build

Pointyhat to: ngie

r319019:

Remove getpagesize(3) error checking added in r317312

getpagesize(3) no longer fails as of r317436.

7 years agoMFC r319056,r319058,r319059,r319060,r319061,r319078:
ngie [Wed, 31 May 2017 08:36:43 +0000 (08:36 +0000)]
MFC r319056,r319058,r319059,r319060,r319061,r319078:

r319056:

tests/sys/file/ftruncate_test: use an exit code of 1 instead
of -1 with err*(3).

An exit code of -1 is implementation defined -- it's best to stick
with something well-defined (1).

r319058:

Create a deterministic file in the kyua sandbox, instead of a
temporary file outside the kyua sandbox

This helps ensure that the file is removed at test exit, and as
a side effect, cures a warning about umasks with Coverity.

r319059:

Use an exit code of 1 instead of -1 for reasons noted in r319056

r319060:

Use main(void) instead of main(argc __unused, argv __unused)

r319061:

Don't leak accept_fd on thread completion

CID: 1296068

r319078:

Tweak r319058 slightly

- Specify an explicit mode when using O_CREAT per open(2).
- Fix the error message (add missing enclosing parentheses).

MFC with: r319058

7 years agoMFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037...
ngie [Wed, 31 May 2017 08:32:05 +0000 (08:32 +0000)]
MFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037,r319038,r319039,r319040,r319041,r319042,r319043,r319044,r319045,r319046:

r319027:

lib/libc/tests/nss: use calloc appropriately

The pattern used prior to this commit was `calloc(1, n * sizeof(type))`;
the pattern that should be used however is `calloc(n, sizeof(type))`.

r319028:

Sort make variables to suit style.Makefile(5)

This is being done prior to functional changes.

r319029:

Staticize functions and remove unused variables to aid with bumping WARNS

r319030:

Fix -Wsign-compare warnings

r319031:

getusershell_test: staticize run_tests(..) to fix warnings

r319033:

getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings

r319034:

getaddrinfo_test: fix -Wsign-compare warnings

r319035:

getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings

r319036:

getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings

r319037:

getaddrinfo_test: mark unused function parameters __unused to fix -Wunused
warnings

r319038:

getusershell_test: mark mdata parameter in compare_usershell __unused

r319039:

getserv_test: mark unused parameters __unused to fix corresponding
warnings

r319040:

getrpc_test: fix -Wunused warnings

- Mark unused function parameters unused.
- Remove an unused function prototype.

r319041:

getproto_test: fix -Wunused warnings

Mark unused parameters __unused in functions.

r319042:

gethostby_test: fix multiple warning types

- Fix -Wmissing-declaration warning by staticizing run_tests.
- Fix -Wsign-compare warnings by casting size_t types to int
  for comparisons.

Reindent some of the code in sdump_hostent(..) to accomodate the
overall changes.

r319043:

getpw_test: fix -Wunused warnings

- Mark unused parameters __unused.
- Put dump_passwd under DEBUG as it's only used in that case.

r319044:

getgr_test: fix -Wunused warnings

r319045:

Fix -Wunused and -Wshadow warnings

r319046:

Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0

7 years agoMFC r306691,310036:
delphij [Wed, 31 May 2017 08:21:16 +0000 (08:21 +0000)]
MFC r306691,310036:

Merge byacc 20161202.

7 years agoMFC r319062:
ngie [Wed, 31 May 2017 08:07:51 +0000 (08:07 +0000)]
MFC r319062:

Initial `srv` before using it in bind(2)

CID: 1357526

7 years agoMFC r304106:
delphij [Wed, 31 May 2017 06:47:56 +0000 (06:47 +0000)]
MFC r304106:

Add timingsafe_bcmp and timingsafe_memcmp.

Obtained from: OpenBSD
Reviewed by: trasz

7 years agoMFC r316649 (kan):
delphij [Wed, 31 May 2017 06:07:19 +0000 (06:07 +0000)]
MFC r316649 (kan):

Add missing double quote to fix r316635 commit.

7 years agoMFC r318514-r318515, r318517, r318917
delphij [Wed, 31 May 2017 05:52:32 +0000 (05:52 +0000)]
MFC r318514-r318515, r318517, r318917

r318514:
Use size_t.

Inspired by: OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

r318515:
The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from: PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096

r318517:
Sync qsort.c with userland r318515.

(Note that MIN macro is removed in favor of sys/param.h's version).

PR: 213922

r318917:
Disconnect heimdal version of qsort.c from build because we are already
using libc's version of qsort.

PR: bin/213922

7 years agoMFC r311989 (cem):
delphij [Wed, 31 May 2017 05:45:06 +0000 (05:45 +0000)]
MFC r311989 (cem):

libkern: Remove obsolete 'register' keyword

7 years agoMFC r316635:
delphij [Wed, 31 May 2017 05:37:51 +0000 (05:37 +0000)]
MFC r316635:

Enable 16-bit longest_match for x86.

This gives a ~2% improvement in compression tests.

7 years agoMFC r313327:
delphij [Wed, 31 May 2017 05:29:20 +0000 (05:29 +0000)]
MFC r313327:

Reflect actual NetBSD revision we already have.

7 years agoMFC r313695, r313760, r314769, r314863, r314865, r316125
delphij [Wed, 31 May 2017 05:20:59 +0000 (05:20 +0000)]
MFC r313695, r313760, r314769, r314863, r314865, r316125

r313695:
MFV r313676: libpcap 1.8.1

r313760:
MFV r313759: license change for a few headers (4 clause BSD to 3 clause BSD).

X-MFC-with: r313695

r314769:
Remove compatibility with old libpcap.

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

r314863:
Stop installing pcap-int.h, which is the internal interface for libpcap.

Reference: https://github.com/the-tcpdump-group/libpcap/issues/560
PR: 217221

r314865:
Bump __FreeBSD_version for removal of pcap-int.h.

PR: 217221

r316125:
MFV r316124: Fix build when WITHOUT_INET6.

Reported by: Randy Westlund <rwestlun gmail com>

7 years agoMFC r315272, r315370
delphij [Wed, 31 May 2017 05:10:03 +0000 (05:10 +0000)]
MFC r315272, r315370

r315272:
Implement INHERIT_ZERO for minherit(2).

INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR: 182610
Reviewed by: kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D427

r315370:
The adj_free and max_free values of new_entry will be calculated and
assigned by subsequent vm_map_entry_link(), therefore, remove the
pointless copying.

Submitted by: alc

7 years agoMFC r315615:
delphij [Wed, 31 May 2017 05:05:32 +0000 (05:05 +0000)]
MFC r315615:

Make space style consistent with earlier entries.

7 years agoMFC r318975:
delphij [Wed, 31 May 2017 05:00:02 +0000 (05:00 +0000)]
MFC r318975:

Tighten /entropy permissions.

PR: 219527
Reported by: Lu Tung-Pin <lutungpin at openmailbox.org>
Submitted by: jilles

7 years agoMFC r318774:
np [Wed, 31 May 2017 00:43:34 +0000 (00:43 +0000)]
MFC r318774:

cxgbe/iw_cxgbe: sodisconnect failures are harmless and should not be
treated as fatal errors.

Sponsored by: Chelsio Communications

7 years agoMFC r318762:
np [Wed, 31 May 2017 00:16:05 +0000 (00:16 +0000)]
MFC r318762:

cxgbe(4): Update the T4, T5, and T6 firmwares to 1.16.45.0.

The latest firmware has a number of link related fixes, support for a
new custom card, and the fix for a bug that affected rate limiting on
FreeBSD.

Relnotes: Yes
Sponsored by: Chelsio Communications

7 years agoMFC r314176 and r318973.
np [Tue, 30 May 2017 21:55:48 +0000 (21:55 +0000)]
MFC r314176 and r318973.

r314176:
Add support for RDMA from userspace with T6 cards.

r318973:
libcxgb4: Use memcpy instead of copying WRs 8B at a time in the userspace
RDMA library for cxgbe(4).

Sponsored by: Chelsio Communications

7 years agoRegenerate src.conf(5)
ngie [Tue, 30 May 2017 18:08:33 +0000 (18:08 +0000)]
Regenerate src.conf(5)

7 years agoMFC r313169,r319246:
ngie [Tue, 30 May 2017 18:04:55 +0000 (18:04 +0000)]
MFC r313169,r319246:

r313169 (by wblock):

Clarify some option descriptions, add a line of text to makeman to
add the slightest hint of a shade of a clue of what it does.

r319246:

Use .Xr to reference libblacklist(3), blacklistctl(8), and blacklistd(8)

7 years agoMFC r317168:
ngie [Tue, 30 May 2017 17:47:19 +0000 (17:47 +0000)]
MFC r317168:

Add a knob, WITH*_RPCBIND_WARMSTART_SUPPORT, to allow the end-user to build
rpcbind(8) with/without warmstart support.

The knob defaults to off to preserve POLA for the feature.

See rpcbind(8) for more details about the warmstart feature.

Relnotes: yes

7 years agoMFC r317155,r317162,r317163,r317164:
ngie [Tue, 30 May 2017 17:37:40 +0000 (17:37 +0000)]
MFC r317155,r317162,r317163,r317164:

r317155:

rpcbind(8): wordsmith -h description and mention -W in the SYNOPSIS section

-W was already documented in the OPTIONS section.

r317162:

rpcbind(8): add a description for /var/run/rpcbind.sock under the FILES section

r317163:

rpcbind(8): post-humously document -w (warmstart) support added in r74462

warmstart support saves portmap/rpcbind(8) registration state on exit and
restores the saved registration state on restart.

r317164:

Fix indentation per style.Makefile(5)

7 years agoMFC r318305: makeman: reword description, based on feedback from wblock
emaste [Tue, 30 May 2017 17:09:47 +0000 (17:09 +0000)]
MFC r318305: makeman: reword description, based on feedback from wblock

7 years agoMFC arch.7 man page describing some arch-specific details
emaste [Tue, 30 May 2017 17:07:40 +0000 (17:07 +0000)]
MFC arch.7 man page describing some arch-specific details

MFC of r318386, r317938, r317844, r317843, r317840, r317835, r317809,
       r317790, r317754, r317708, r317681, r312563, r308251, r308130,
       r307687, r303153, r303134, r303045, r303044, r303033
Changes by br, emaste, jhb, jhibbits, kevlo, kib

Sponsored by: The FreeBSD Foundation

7 years agoMFC r318316: uniq: allow -c to be used with -d or -u
emaste [Tue, 30 May 2017 16:55:15 +0000 (16:55 +0000)]
MFC r318316: uniq: allow -c to be used with -d or -u

Bring in some bits from NetBSD and lift the restriction in uniq(1) that
-c cannot be used with the -d and -u options.  This restriction seems
unnecessary and is supported at least by GNU, OpenBSD, and NetBSD.  Lift
the restriction and simplify the show() logic a little bit to maintain
functionality when -c is provided with -d/-u.

Also with this change, -d and -u are now actually a mutually exclusive,
albeit valid, combination.  Given that they both indicate opposite
behavior, uniq(1) will no longer output anything if both -d and -u are
supplied.  This is in line with NetBSD as well as GNU.

Adjust the man page and usage() to reflect that -c is its own standalone
option.

PR: 200553
Submitted by: Kyle Evans <kevans91@ksu.edu>

7 years agoMFC r318689: Add parent interface reference counting to if_vlan.
mav [Tue, 30 May 2017 16:34:18 +0000 (16:34 +0000)]
MFC r318689: Add parent interface reference counting to if_vlan.

Using plain ifunit() looks like a request for troubles.

7 years agoMFC r318593:
asomers [Tue, 30 May 2017 15:33:27 +0000 (15:33 +0000)]
MFC r318593:

Fix build of AIO tests with -DDEBUG

Also, redefine some constants for clarity.  No functional change.

7 years agoMFC r318141, r318143-r318144
asomers [Tue, 30 May 2017 15:18:22 +0000 (15:18 +0000)]
MFC r318141, r318143-r318144

r318141:
strcpy => strlcpy

Reported by: Coverity
CID: 1352771
Sponsored by: Spectra Logic Corp

r318143:
strcpy => strlcpy

Reported by: Coverity
CID: 1006715
Sponsored by: Spectra Logic Corp

r318144:
Don't depend on assert(3) getting evaluated

Reported by: imp
X-MFC-With: 318141, 318143
Sponsored by: Spectra Logic Corp

7 years agoMFC r307334, r318252: Support write-through caches on arm64
andrew [Tue, 30 May 2017 13:56:38 +0000 (13:56 +0000)]
MFC r307334, r318252: Support write-through caches on arm64

r307334:
Create macros for the MAIR memory attributes. While here add an uncached
memory type, however the VM code still needs to be taught about this.

r318252:
Add the VM_MEMATTR_WRITE_THROUGH memory type to arm64 and use it to support
VM_MEMATTR_WRITE_COMBINING in the kernel. This fixes a bug where Xorg would
use write back cached memory for its graphics buffers. This would produce
artifacts on the screen as cachelines were written to memory.

7 years agoMFC r317824:
andrew [Tue, 30 May 2017 13:35:54 +0000 (13:35 +0000)]
MFC r317824:

Add reclaim_pv_chunk on arm64. This is based on the amd64 code so should
operate similarly, other than not needing the delayed invalidation.

It has been tested with artificial injection of vm_page_alloc failures
while running 'sort /dev/zero'.

7 years agoMFC r317361:
andrew [Tue, 30 May 2017 13:26:37 +0000 (13:26 +0000)]
MFC r317361:

Call the PSCI reset from cpu_reset on arm64. When rebooting from DDB the
kernel calls this directly so the event handler is not called, meaning
the computer fails to reboot.

7 years agoMFC r317197:
andrew [Tue, 30 May 2017 13:21:43 +0000 (13:21 +0000)]
MFC r317197:

Restrict the arm64 supervisor all instructions to only allow a zero
immediate value for system calls. We may wish to use other values in the
future for other purposes.

7 years agoMFC r317192:
andrew [Tue, 30 May 2017 13:16:06 +0000 (13:16 +0000)]
MFC r317192:

Push loading curthread into assembly in the synchronous exception handlers.
This will help investigating the performance impact of moving parts of the
switch statement in do_el0_sync into assembly.

7 years agoMFC r313396:
andrew [Tue, 30 May 2017 13:02:10 +0000 (13:02 +0000)]
MFC r313396:

Push reading of ESR_EL1 to assembly. Among other uses this will allow us
to expose this to signal handlers, e.g. for the clang sanitizers.

7 years agoMFC r316734, r316761: Support Execute-Never bit in the arm64 pmap.
andrew [Tue, 30 May 2017 12:44:01 +0000 (12:44 +0000)]
MFC r316734, r316761: Support Execute-Never bit in the arm64 pmap.

r316734:
Start to use the User and Privileged execute-never bits in the arm64
pagetables. This sets both bits when entering an address we know shouldn't
be executed.

I expect we could mark all userspace pages as Privileged execute-never to
ensure the kernel doesn't branch to one of these addresses.

While here add the ARMv8.1 upper attributes.

r316761:
Set the arm64 Execute-never bits in more places.

We need to set the Execute-never bits when mapping device memory as the
hardware may perform speculative instruction fetches.

Set the Privileged Execute-ever bit on userspace memory to stop the kernel
if it is tricked into executing it.

7 years agoMFC r316732, r316756: Enable Privileged Access Never on arm64.
andrew [Tue, 30 May 2017 12:26:36 +0000 (12:26 +0000)]
MFC r316732, r316756: Enable Privileged Access Never on arm64.

r316732:
Use the unprivileged variant of the load and store instructions most
places possible in the kernel. This forces these functions to fail if
userspace is unable to access a given memory location, even if it is in
the user memory range.

This will simplify adding Privileged Access Never support later.

r316756:
In ARMv8.1 ARM has added a process state bit to disable access to userspace
from the kernel. Make use of this to restrict accessing userspace to just
the functions that explicitly handle crossing the user kernel boundary.

7 years agoMFC r316755:
andrew [Tue, 30 May 2017 11:03:05 +0000 (11:03 +0000)]
MFC r316755:

Add SCTLR bits added in ARMv8.1 and ARMv8.2 and start to use them in the
early boot code.

7 years agoMFC r312703:
andrew [Tue, 30 May 2017 10:50:15 +0000 (10:50 +0000)]
MFC r312703:

Fix the error value we write in cerror. __error returns an int *, however
we were writing a 64 bit value meaning the 32 bits after this would be
trashed.

7 years agoRegenerate src.conf(5) after MK_DIALOG was added
ngie [Tue, 30 May 2017 07:31:02 +0000 (07:31 +0000)]
Regenerate src.conf(5) after MK_DIALOG was added

7 years agoMFC r314463:
ngie [Tue, 30 May 2017 07:29:18 +0000 (07:29 +0000)]
MFC r314463:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

7 years agoMFC r306375,r307802:
ngie [Tue, 30 May 2017 07:28:27 +0000 (07:28 +0000)]
MFC r306375,r307802:

r306375 (by emaste):

Add a WITHOUT_DIALOG src.conf(5) knob

It also turns off dependencies (bsdinstall, bsdconfig, dpv, tzsetup).

r307802 (by bapt):

Fix build of tzsetup when WITHOUT_DIALOG is set

Hide dialog specific code behind HAVE_DIALOG. It allows to build a stripped
down version (missing the dialog UI) but perfectly function tzsetup when
world is built WITHOUT_DIALOG

Reorganise a bit the code to limit the number of blocks under HAVE_DIALOG

7 years agoMFC r314451,r314452,r314453,r314456,r314457,r314458,r314459,r314460,r314461,r314462...
ngie [Tue, 30 May 2017 05:15:09 +0000 (05:15 +0000)]
MFC r314451,r314452,r314453,r314456,r314457,r314458,r314459,r314460,r314461,r314462,r314464,r314466,r314468,r314470,r314472,r314478:

r314451:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

The SRCTOP conversion simplifies pathing in make/displayed output.

Also, while here, change a hardcoded path to ar5523.bin.uu in the make target
with ${.ALLSRC} .

r314452:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

r314453:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

r314456:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314457:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

The SRCTOP conversion simplifies pathing in make/displayed output.

Also, while here, change a hardcoded path to ${RPCDIR}/ypupdate_prot.x in
the make targets with ${.ALLSRC} .

r314458:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314459:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314460:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314461:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314462:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

The SRCTOP conversion simplifies pathing in make/displayed output.

Also, while here, change a hardcoded path to ${RPCDIR}/ypxfrd.x in
the make targets with ${.ALLSRC} .

r314464:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314466:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314468:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

Also, use :H where possible/sensical to manipulate .CURDIR-relative paths

This simplifies pathing in make/displayed output.

r314470:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

r314472:

Simplify/improve idioms in usr.sbin/ntp Makefiles

- Use SRCTOP-relative paths to other directories instead of
  .CURDIR-relative ones. This simplifies pathing in make/displayed output.
- Also, use :H where possible/sensical to manipulate .CURDIR-relative
  paths
- Remove superfluous bsd.own.mk .includes which are already handled via
  src.opts.mk .includes

r314478:

Simplify idioms in Makefiles further

- Use SRCTOP-relative paths instead of .CURDIR-relative ones where possible
- Use :H to manipulate .CURDIR in areas instead of ..-relative paths.

7 years agoMFC r314541:
ngie [Tue, 30 May 2017 04:45:11 +0000 (04:45 +0000)]
MFC r314541:

Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output.

7 years agoMFC r314658:
ngie [Tue, 30 May 2017 04:42:36 +0000 (04:42 +0000)]
MFC r314658:

crypto: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

7 years agoMFC r318439:
ngie [Tue, 30 May 2017 04:36:11 +0000 (04:36 +0000)]
MFC r318439:

Normalize .PATH on SRCTOP

This will help Jenkins dedupe 9 warnings between the static build and
the module build of ipsec(4).

Missed in SRCTOP conversion in r314651.

MFC with: r314651

7 years agoMFC r307741:
ngie [Tue, 30 May 2017 04:31:35 +0000 (04:31 +0000)]
MFC r307741:
r307741 (by emaste):

Allow all subdirectories to be optional via SUBDIR.${MK_*}

Tested by: br
Pointy hat to: emaste

7 years agoMFC r315170:
ngie [Tue, 30 May 2017 04:27:05 +0000 (04:27 +0000)]
MFC r315170:
r315170 (by imp):

Adopt SRCTOP in usr.bin

Prefer ${SRCTOP}/foo over ${.CURDIR}/../../foo and ${SRCTOP}/usr.bin/foo
over ${.CURDIR}/../foo for paths in Makefiles.

Silence on: arch@ (twice)

7 years agoMFC r314655:
ngie [Tue, 30 May 2017 04:17:22 +0000 (04:17 +0000)]
MFC r314655:

bin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

7 years agoMFC r314655:
ngie [Tue, 30 May 2017 04:15:40 +0000 (04:15 +0000)]
MFC r314655:

bin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

7 years agoMFC r314657:
ngie [Tue, 30 May 2017 04:13:06 +0000 (04:13 +0000)]
MFC r314657:

kerberos5: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

7 years agoMFC r314651,r318439,r318440:
ngie [Tue, 30 May 2017 04:11:12 +0000 (04:11 +0000)]
MFC r314651,r318439,r318440:

r314651:

sys/modules: normalize .CURDIR-relative paths to SRCTOP

This simplifies make output/logic

Tested with: `cd sys/modules; make ALL_MODULES=` on amd64

r318439:

Normalize .PATH on SRCTOP

This will help Jenkins dedupe 9 warnings between the static build and
the module build of ipsec(4).

Missed in SRCTOP conversion in r314651.

MFC with: r314651

r318440:

Normalize SYSDIR on SRCTOP instead of .CURDIR

This is being done to simplify pathing for CFLAGS and source files.

7 years agoMFC r307698:
ngie [Tue, 30 May 2017 04:00:26 +0000 (04:00 +0000)]
MFC r307698:
r307698 (by lwhsu):

- Add required header for fixing `make` in sys/modules/gpio

7 years agoMFC r308161:
ngie [Tue, 30 May 2017 03:55:38 +0000 (03:55 +0000)]
MFC r308161:
r308161 (by lwhsu):

- Fix `make` in sys/modules/bhnd

7 years agoMFC r318606:
cy [Tue, 30 May 2017 03:33:48 +0000 (03:33 +0000)]
MFC r318606:

Refactor & compact struct i6addr_t #ifdef: remove redundant structure
definintion when USE_INET6 is false.

7 years agoMFC r318588:
cy [Tue, 30 May 2017 03:30:53 +0000 (03:30 +0000)]
MFC r318588:

Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by: vangyzen@

7 years agoMFC r318578:
cy [Tue, 30 May 2017 03:27:59 +0000 (03:27 +0000)]
MFC r318578:

Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

positive-time-to-live hosts 30
negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

hosts: files cache dns

Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR: 207804
Submitted by: Jov <amutu@amutu.com>

7 years agoMFC r318745:
cy [Tue, 30 May 2017 03:25:05 +0000 (03:25 +0000)]
MFC r318745:

Remove redundant variable declaration.

7 years agoMFC r315368:
cy [Tue, 30 May 2017 03:22:18 +0000 (03:22 +0000)]
MFC r315368:

calloc() and realloc() modernization.

This commit replaces calloc calls, which called calloc() as if it were
malloc() by allocating a multiple of objects as a sizeof multiplied by
the number of objects. The patch rectifies this by calling calloc() as
it was meant to be called.

This commit also replaces realloc() with reallocarray() in a similar
fashion as above. Instead of calculating the memory to reallocated
(changed) by multiplying sizeof by the number of objects, the sizeof
and number are passed as separate arguments to reallocarray(), letting
reallocarray() do the multiplication instead. Like the calloc()
adjustment above, this is approach is cleaner and more elegant than
than the previous code.

This has been tested on my production firewall and a laptop (also
running ipfilter).

Submitted by: pfg

7 years agoMFC r318006:
ngie [Tue, 30 May 2017 03:10:05 +0000 (03:10 +0000)]
MFC r318006:

style(9): sort headers and remove duplicates

7 years agoMFC r312913,r318100,r318107:
ngie [Tue, 30 May 2017 03:09:01 +0000 (03:09 +0000)]
MFC r312913,r318100,r318107:

r312913 (by asomers):

Improve the aio tests

* Add tests for aio_suspend(2).
* Add tests for polled completion notification.
* Test the full matrix of file descriptor types and completion notification
  mechanisms.
* Don't bother with mkstemp, because ATF runs every test in its own temp dir.
* Fix some typos.
* Remove extraneous ATF_REQUIRE_KERNEL_MODULE calls.

r318100:

style(9): move function definition curly braces to column 0

r318107:

Remove unused constant (PATH_TEMPLATE)

It was made unnecessary in r312913.

MFC with: r312913

7 years agoMFC r318094,r318098,r318099:
ngie [Tue, 30 May 2017 03:05:22 +0000 (03:05 +0000)]
MFC r318094,r318098,r318099:

r318094:

style(9): clean up trailing whitespace

r318098:

Refactor ATF_REQUIRE_UNSAFE_AIO and PLAIN_REQUIRE_UNSAFE_AIO

This is being done to reduce duplication between the two macros.

r318099:

Print out when unsafe AIO is enabled to debugging purposes

7 years agoMFC r318007,r318008,r318009,r318011:
ngie [Tue, 30 May 2017 03:02:07 +0000 (03:02 +0000)]
MFC r318007,r318008,r318009,r318011:

r318007:

Add intermediary Makefile for compiling all items in the directory

r318008:

Only compile tests/ if MK_TESTS != no or ALL_MODULES is defined

r318009:

Add MK_TESTS to kern.opts.mk to support r31800

MFC with: r318008
Pointyhat to: ngie

r318011:

Mark this Makefile SUBDIR_PARALLEL

I inserted the necessary SUBDIR+= .WAIT in the previous commit

7 years agoMFC r319015:
ngie [Tue, 30 May 2017 02:56:17 +0000 (02:56 +0000)]
MFC r319015:

Use calloc instead of malloc + memset

7 years agoMFC r318010:
ngie [Tue, 30 May 2017 02:53:00 +0000 (02:53 +0000)]
MFC r318010:

style(9): sort headers

7 years agoMFC r318591: compress: Add basic tests.
jilles [Mon, 29 May 2017 21:48:02 +0000 (21:48 +0000)]
MFC r318591: compress: Add basic tests.

7 years agoMFC r317313:
ngie [Mon, 29 May 2017 18:19:32 +0000 (18:19 +0000)]
MFC r317313:

gctl_test.t: catch errors with the mdcfg directive

While here, add a note about certain testcases relying on `count=1024` in
the "create" portion.

7 years agoMFC r314659,r314676:
ngie [Mon, 29 May 2017 18:17:34 +0000 (18:17 +0000)]
MFC r314659,r314676:

r314659:

usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

r314676:

Fix build after r314656

Some of the changes I introduced to use .ALLSRC were correct in spirit,
but incorrect in reality -- in particular, ../Makefile.inc hadn't been
pulled in via bsd.init.mk (via bsd.lib.mk, bsd.prog.mk), so the value
of .ALLSRC (evaluated immediately) was empty. .include bsd.init.mk
explicitly so we can be certain that the values used as dependencies in
the targets are defined when the target recipe has been evaluated.

Reminder: thou shalt separate out separate functional changes before
          committing them.

(YUGE) Pointyhat to: ngie
In collaboration with: bdrewery

7 years agoMFC r318788:
pfg [Mon, 29 May 2017 15:24:45 +0000 (15:24 +0000)]
MFC r318788:
bhyvegc_resize: make use of reallocarray(3) for bounds-checking.

Also add __FBSDID.

Reviewed by: grehan

7 years agoMFC r318446:
kib [Mon, 29 May 2017 13:25:55 +0000 (13:25 +0000)]
MFC r318446:
Update my copyright, note The FreeBSD Foundation involvement.

7 years agoMFC direct execution mode for rtld.
kib [Mon, 29 May 2017 13:24:27 +0000 (13:24 +0000)]
MFC direct execution mode for rtld.

MFC r318313:
Make ld-elf.so.1 directly executable.

MFC r318352 (by jonathan):
Rename rtld's parse_libdir to parse_integer.

MFC r318380:
Pretend that there is some security when executing in direct mode.

MFC r318431 (by jonathan):
Allow rtld direct-exec to take a file descriptor.

MFC r318445:
Fix style, add static keyword before static function definition.

MFC r318739:
For ld.so direct execution mode, implement -p option.

7 years agoMFC r318312:
kib [Mon, 29 May 2017 13:18:20 +0000 (13:18 +0000)]
MFC r318312:
Fix the AT_EXECFD functionality.

7 years agoMFC r318318:
kib [Mon, 29 May 2017 13:17:00 +0000 (13:17 +0000)]
MFC r318318:
Ensure that resume path on amd64 only accesses page tables for normal
operation after processor is configured to allow all required
features.

7 years agoMFC r318303:
kib [Mon, 29 May 2017 12:55:26 +0000 (12:55 +0000)]
MFC r318303:
Style.

7 years agoMFC r318299:
kib [Mon, 29 May 2017 12:53:44 +0000 (12:53 +0000)]
MFC r318299:
Simplify cleanup on failure in realpath(3).

7 years agoMFC r318298:
kib [Mon, 29 May 2017 12:52:13 +0000 (12:52 +0000)]
MFC r318298:
Fix several buffer overflows in realpath(3), and other minor issues.

PR: 219154

7 years agoMFC r318632, r318633:
royger [Mon, 29 May 2017 11:37:08 +0000 (11:37 +0000)]
MFC r318632, r318633:

bsdinstall: mount is not needed for the ZFS install case
bsdinstall: do not use distextract in scripted mode

7 years agoMFC r314659,r314676:
ngie [Mon, 29 May 2017 10:15:41 +0000 (10:15 +0000)]
MFC r314659,r314676:

r314659:

usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible

This simplifies make logic/output

r314676:

Fix build after r314656

Some of the changes I introduced to use .ALLSRC were correct in spirit,
but incorrect in reality -- in particular, ../Makefile.inc hadn't been
pulled in via bsd.init.mk (via bsd.lib.mk, bsd.prog.mk), so the value
of .ALLSRC (evaluated immediately) was empty. .include bsd.init.mk
explicitly so we can be certain that the values used as dependencies in
the targets are defined when the target recipe has been evaluated.

Reminder: thou shalt separate out separate functional changes before
          committing them.

(YUGE) Pointyhat to: ngie
In collaboration with: bdrewery

7 years agoMFC r315561:
ngie [Mon, 29 May 2017 06:31:07 +0000 (06:31 +0000)]
MFC r315561:
r315561 (by trasz):

Bring back the "i".  The point is to make it easy to find via "apropos
iscsi", along with all the other relevant components.

7 years agoMFC r316179,r316180,r316181,r316260:
ngie [Mon, 29 May 2017 06:26:00 +0000 (06:26 +0000)]
MFC r316179,r316180,r316181,r316260:

r316179 (by cem):

t_msgsnd: Use msgsnd()'s msgsz argument correctly to avoid overflow

msgsnd's msgsz argument is the size of the message following the 'long'
message type.  Don't include the message type in the size of the message
when invoking msgsnd(2).

CID: 1368712

r316180 (by cem):

Follow-up to r316179: More of the same

CIDs: 1368705136870613687071368710

r316181 (by cem):

t_msgctl: Fix the same msgsnd() misuse as t_msgsnd

msgsnd(2)'s msgsz argument does not describe the full structure, only the
message component.

CIDs: 13687031368711

r316260:

Annotate all changes made in r316178-r316180 with __FreeBSD__

Restore the stock (upstream) code under an #else block, so it's easier
for me to visualize and understand the code that needs to be upstreamed.

7 years agoMFC r318315:
ngie [Mon, 29 May 2017 06:15:41 +0000 (06:15 +0000)]
MFC r318315:

lib/libc/gen/realpath_test: make check result from getcwd(3)

This is being done to avoid dereferencing a NULL pointer via strlcat,
obscuring the underlying issue with the getcwd(3) call.

7 years agoMFC r308826: zfs: fix up after the removal of PG_CACHED pages in r308691
avg [Mon, 29 May 2017 06:15:06 +0000 (06:15 +0000)]
MFC r308826: zfs: fix up after the removal of PG_CACHED pages in r308691

Now that r308691 has been MFC-ed as a part of r318716,
r308826 must be MFC-ed as well.

PR: 214629
Reported by: mshirk@daemon-security.com [head], lev [stable/11]

7 years agoMFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
rpokala [Mon, 29 May 2017 05:22:34 +0000 (05:22 +0000)]
MFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
offset 20*7*.

Sponsored by: Panasas

7 years agoMFC r318906:
dim [Sun, 28 May 2017 18:18:01 +0000 (18:18 +0000)]
MFC r318906:

Pull in r303257 from upstream llvm trunk (by Krzysztof Parzyszek)

  [PPC] Properly update register save area offsets

  The variables MinGPR/MinG8R were not updated properly when resetting the
  offsets, which in the included testcase lead to saving the CR register
  in the same location as R30.

  This fixes another issue reported in PR26519.

  Differential Revision: https://reviews.llvm.org/D33017

Reported by: Mark Millard
PR: 206990

7 years agoMFC r318860:
hselasky [Sun, 28 May 2017 10:43:16 +0000 (10:43 +0000)]
MFC r318860:
Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes of
binary data from sound.ko and the kernel.

7 years agoMFC r315698:
ngie [Sun, 28 May 2017 06:31:52 +0000 (06:31 +0000)]
MFC r315698:

libkvm: bump WARNS to 6 after recent commits done to resolve warnings issues

Tested with: make tinderbox; clang 4.0.0 (amd64), gcc 4.2.1/6.3.0 (amd64)

7 years agoMFC r318872:
gjb [Sun, 28 May 2017 03:59:33 +0000 (03:59 +0000)]
MFC r318872:
 Enable DHCP and IPv6 autoconfig on non-cloud VM images.

PR: 203653
Sponsored by: The FreeBSD Foundation

7 years agoMFC r309412,r316109,r316132:
ngie [Sun, 28 May 2017 01:08:46 +0000 (01:08 +0000)]
MFC r309412,r316109,r316132:

r309412 (by imp):

dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

r316109:

Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead

This is a better pattern to follow when creating the bootloaders and doing
the relevant space checks to make sure that the sizes aren't exceeded (and
thus, copy-pasting is a bit less error prone).

r316132:

Parameterize out 7680 (15 * 512) as BOOT2SIZE, similar to sys/boot/i386/zfsboot/...

This is being done to make it easier to change in the future--this action might be
needed sooner rather than later because of gcc 6.3.0 bailing, stating that there
is negative free space left (deficit) in the boot2 bootloader.

7 years agoMFC r316131:
ngie [Sun, 28 May 2017 00:45:02 +0000 (00:45 +0000)]
MFC r316131:

Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)

Part of my original reasoning as far as converting the snprintf
calls was to permit switching over from char[] to wchar_t[] in the
future, as well as futureproof in case cam_errbuf's size was ever
changed.

Unfortunately, my approach was bugged because it conflated the
number of items with the size of the buffer, instead of the number of
elements being a fixed size != 1 byte.

Use nitems(..) instead which counts the quantity of items of a specific
type, as opposed to an unqualified sizeof(..) (which assumes that the
number of characters is equal to the buffer size).

Noted by: cem

7 years agoMFC r317310,r317316:
ngie [Sun, 28 May 2017 00:25:41 +0000 (00:25 +0000)]
MFC r317310,r317316:

r317310:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

r317316:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

7 years agoMFC r314833
rgrimes [Sun, 28 May 2017 00:13:44 +0000 (00:13 +0000)]
MFC r314833
Convert absolute links to relative links.
Style.Makefile(9) has been ignored to produce minimal diffs.

MFC r314837
The relative symlink fix causes downstream issues for
EMC DELL Isilon so revert the relative symlink fix
pending a better solution.

Reported by: ngie

MFC r315091
Revert r314833 until the problem with INSTALL_RSYMLINKS can be found
as it appears to break arm release builds.

PR: 217705
Reported by: cyclaero@gmail.com

Approved by: grehan (mentor)

7 years agoMFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308...
ngie [Sat, 27 May 2017 23:31:51 +0000 (23:31 +0000)]
MFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308,r317309:

r317290:

Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
#include below the stdio.h #include.

gctl_dump(3) needs stdio.h, per reasoning noted in r317289.

PR: 218809

r317291:

Rename gctl.t to gctl_test.t and test.c to gctl_test_helper.c

This is being done to reduce ambiguity and to make the tests more portable
in the future to other locations in the source tree.

r317292:

gctl_test.t: use make to compile gctl_test_helper instead of calling cc directly

r317293:

gctl_test_helper: apply polish

- Staticize variables to fix warnings.
- Sprinkle asserts around for calls that can fail
- Apply style(9) for main(..) definition.
- ANSIify usage(..) definition.

r317294:

Bump WARNS to 6 per previous commits which fixed warnings

Tested with: clang (4.0), gcc (4.2.1, 6.3.0)

r317295:

The GPT class no longer exists; use the PART class instead

r317304:

gctl_test_helper: add diagnostic output for parse_retval(..)

This will help end-users better diagnose issues with the function.

r317306:

gctl_test.t: minor tweaks

- Declare $count with the `my` scope operator to permit `use strict`.
- Add `use strict`.
- Use `use warnings` instead of using `-w` in the shebang.
- Don't unlink $cmd when done (prevents unnecessary rebuilding).
- Improve the error message when running with insufficient permissions, e.g.,
  non-root.

r317307:

Use verb=delete not verb=remove

The `remove` verb hasn't been present in geom_part*(4) for well
over a decade, if ever. I couldn't find any references to it in
^/stable/5 at least, which is around the timeframe that this test
was written.

r317308:

gctl_test.t: more tweaks to try and update the code and get it functional (again?)

- Make the logfile for $out be built off the basename for $cmd, instead of $cmd.
  (r317292 broke this assumption).
- Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
  mountpoints.
- Reindent the umount directive block while here to match the rest of the code.

r317309:

gctl_test.t: improve error reporting with mdcfg and mount directives

If the commands had failed previously, it would press on and result in a
series of cascading failures. Fail early and continue on to the next case
instead of executing additional commands after a previously failed series
of steps.

7 years agoMFC r319010:
ngie [Sat, 27 May 2017 23:24:33 +0000 (23:24 +0000)]
MFC r319010:

Fix #if conditional added in r319008

I committed an earlier version of the file by accident

This is a no-op on ^/head and ^/stable/11.

7 years agoMFC r319008:
ngie [Sat, 27 May 2017 23:20:28 +0000 (23:20 +0000)]
MFC r319008:

kvm_geterr_test: Compile out the portions that require kvm_open2(3) on
systems that lack the libcall, based on __FreeBSD_version.

kvm_open2(3) wasn't made available until r291406, which is in ^/stable/11,
but not ^/stable/10. This makes some of kvm_geterr_test available for testing
on ^/stable/10.

7 years agoMFC r316099:
ngie [Sat, 27 May 2017 23:04:40 +0000 (23:04 +0000)]
MFC r316099:

lib/libkvm: start adding basic tests for kvm(3)

- kvm_close: add a testcase to verify support for errno = EINVAL / -1
  (see D10065) when kd == NULL is provided to the libcall.
- kvm_geterr:
-- Add a negative testcase for kd == NULL returning "" (see D10022).
-- Add two positive testcases:
--- test the error case using kvm_write on a O_RDONLY descriptor.
--- test the "no error" case using kvm_read(3) and kvm_nlist(3) as
    helper routines and by injecting a bogus error message via
    _kvm_err (an internal API) _kvm_err was used as there isn't a
    formalized way to clear the error output, and because
    kvm_nlist always returns ENOENT with the NULL terminator today.
- kvm_open, kvm_open2:
-- Add some basic negative tests for kvm_open(3) and kvm_open2(3).
   Testing positive cases with a specific
   `corefile`/`execfile`/`resolver` requires more work and would require
   user intervention today in order to reliably test this out.

7 years agoMFC r318546:
ngie [Sat, 27 May 2017 22:59:23 +0000 (22:59 +0000)]
MFC r318546:

sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.