]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoRevert previous change to sys/conf/options & associated notes so builds can
sevan [Fri, 7 Apr 2017 21:06:50 +0000 (21:06 +0000)]
Revert previous change to sys/conf/options & associated notes so builds can
resume while I investigate what I had missed.

7 years agoExplicitly set the desired MIPS ABI in toolchain flags.
jhb [Fri, 7 Apr 2017 20:02:01 +0000 (20:02 +0000)]
Explicitly set the desired MIPS ABI in toolchain flags.

Specifically, set '-mabi=XX' in AFLAGS, CFLAGS, and LDFLAGS.  This permits
building MIPS worlds and binaries with a toolchain whose default output
does not match the desired TARGET_ARCH.

_LDFLAGS (which is used with LD instead of with CC) required an update as
LD does not accept the -mabi flags (so they must be stripped from LDFLAGS
when generating _LDFLAGS).  For bare uses of LD (rather than linking via
CC), the desired ABI must be set by setting an explicit linker emulation
as done in r316514 for kernels and kernel modules.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoDon't set the MIPS endianness flags in both ACFLAGS and CFLAGS.
jhb [Fri, 7 Apr 2017 19:56:12 +0000 (19:56 +0000)]
Don't set the MIPS endianness flags in both ACFLAGS and CFLAGS.

This should no longer be necessary after r316620 as all places that
use ACFLAGS should already be using CFLAGS.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoRework r234502 to include a modified CFLAGS along with ACFLAGS.
jhb [Fri, 7 Apr 2017 19:53:14 +0000 (19:53 +0000)]
Rework r234502 to include a modified CFLAGS along with ACFLAGS.

On most architectures crt objects are compiled in a multiple-step process
so that sed can be run on the generated assembly.  As the final step,
the C compiler generates an object file from the modified assembly output.
Currently this last step uses $CC with only $ACFLAGS.  However, for other
uses in the tree, $ACFLAGS is meant to include assembly-specific compiler
flags that are in addition to $CFLAGS (see default .S.o rules
bsd.suffixes.mk).  In particular, external toolchains may require
additional flags to select a non-default target which will be present
in CFLAGS but not ACFLAGS.  To support this while still mitigating the
issue with CFLAGS described in r234502, include a modified CFLAGS that
excludes "-g" when assembling the modified assembly files.

Note that normally an assembler ($AS) is used to assemble .s flags to
object files (see bsd.suffixes.mk).  However, llvm-based toolchains do
not currently have a stand-alone assembler.

Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoRemove support for long gone oldnfs.
brooks [Fri, 7 Apr 2017 18:31:31 +0000 (18:31 +0000)]
Remove support for long gone oldnfs.

The code was calling nmount with an fstype of everything in the program
name after the last '_'. This was there to support mount_nfs being
linked to mount_oldnfs. Support for the link was removed in 2015 with
r281691.

Reviewed by: rmacklem
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10301

7 years ago- Increase the image size for RPI2 and IMX6-based boards from 1G
gjb [Fri, 7 Apr 2017 16:55:13 +0000 (16:55 +0000)]
- Increase the image size for RPI2 and IMX6-based boards from 1G
  to 1.5G.
- Use the 'conv=sync' dd(1) option to fix writing the u-boot.imx
  file to the md(4) device for IMX6-based boards.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

7 years agobnxt(4): add support for WOL Magic.
sbruno [Fri, 7 Apr 2017 16:15:50 +0000 (16:15 +0000)]
bnxt(4): add support for WOL Magic.

Submitted by: venkatkumar.duvvuru@broadcom.com
Differential Revision: https://reviews.freebsd.org/D10124

7 years agoRemove the last vestiges of FDC_DEBUG & FD_DEBUG
sevan [Fri, 7 Apr 2017 16:14:25 +0000 (16:14 +0000)]
Remove the last vestiges of FDC_DEBUG & FD_DEBUG
FDC_DEBUG is not referenced in any c or header files but traces of it
still remain in other files.

PR: 105608
Reported by: Eugene Grosbein <ports AT grosbein DOT net>
Reviewed by: imp
Approved by: bcr (mentor)
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D10303

7 years agoIn r298230 the value of HEAP_MIN was changed from 3MB to 64MB. Correct a
benno [Fri, 7 Apr 2017 15:41:49 +0000 (15:41 +0000)]
In r298230 the value of HEAP_MIN was changed from 3MB to 64MB. Correct a
comment that was still referencing the 3MB value.

Sponsored by: Dell EMC Isilon
Discussed with: jhb

7 years agosbin/mount: strcpy -> strlcpy
asomers [Fri, 7 Apr 2017 15:39:41 +0000 (15:39 +0000)]
sbin/mount: strcpy -> strlcpy

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

7 years agousr.bin/netstat: strcpy -> strlcpy
asomers [Fri, 7 Apr 2017 15:15:10 +0000 (15:15 +0000)]
usr.bin/netstat: strcpy -> strlcpy

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

7 years agoCreate the LinuxKPI current task structure on the fly if it doesn't
hselasky [Fri, 7 Apr 2017 14:43:28 +0000 (14:43 +0000)]
Create the LinuxKPI current task structure on the fly if it doesn't
exist when the current macro is used.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoAdd -fPIC to the standalone build flags on arm64. This is needed as
andrew [Fri, 7 Apr 2017 14:30:51 +0000 (14:30 +0000)]
Add -fPIC to the standalone build flags on arm64. This is needed as
loader.efi is position independend, however we were not building it as
such causing a build failure when building with lld.

Sponsored by: DARPA, AFRL

7 years agoFix linking with lld by marking OPENSSL_armcap_P as hidden.
andrew [Fri, 7 Apr 2017 12:41:57 +0000 (12:41 +0000)]
Fix linking with lld by marking OPENSSL_armcap_P as hidden.

Linking with lld fails as it contains a relative address, however the data
this address is for may be relocated from the shared object to the main
executable.

Fix this by adding the hidden attribute. This stops moving this value to
the main executable. It seems this is implicit upstream as it uses a
version script.

Approved by: jkim
Sponsored by: DARPA, AFRL

7 years agoThe __stringify() macro in the LinuxKPI should expand any macros
hselasky [Fri, 7 Apr 2017 12:27:49 +0000 (12:27 +0000)]
The __stringify() macro in the LinuxKPI should expand any macros
before stringifying.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoMETA_MODE: add additional reachover relative paths to DIRDEPS_BUILD
ngie [Fri, 7 Apr 2017 07:46:21 +0000 (07:46 +0000)]
META_MODE: add additional reachover relative paths to DIRDEPS_BUILD

These additional entries are being added, after their addition to the
source tree.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc_read(3): fix manlint error
ngie [Fri, 7 Apr 2017 06:06:55 +0000 (06:06 +0000)]
pmc_read(3): fix manlint error

Remove spurious trailing comma from last .Nm entry in NAME section.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc.atomsilvermont(3): fix manlint warnings
ngie [Fri, 7 Apr 2017 06:00:19 +0000 (06:00 +0000)]
pmc.atomsilvermont(3): fix manlint warnings

Start new sentences on new lines.

Sentences affected by the change are wrapped at <80 columns. Other
potentially offending lines have been left alone to reduce churn.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agopmc(3): add additional references for libpmc functions in the SEE ALSO section
ngie [Fri, 7 Apr 2017 05:46:45 +0000 (05:46 +0000)]
pmc(3): add additional references for libpmc functions in the SEE ALSO section

These functions are already referenced throughout the manpage -- this makes their
presence more apparent.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoPrevent ushort values overflow when convert new Linux 64-bit ipc
dchagin [Fri, 7 Apr 2017 05:37:08 +0000 (05:37 +0000)]
Prevent ushort values overflow when convert new Linux 64-bit ipc
struct to the old Linux ipc struct.

Reported by: PVS-Studio
XMFC with: r314866

MFC after: 3 days

7 years agokern_descrip: Move kinfo_ofile size assert under COMPAT_FREEBSD7
cem [Fri, 7 Apr 2017 05:00:09 +0000 (05:00 +0000)]
kern_descrip: Move kinfo_ofile size assert under COMPAT_FREEBSD7

The size and structure are not used outside of FreeBSD 7 compatibility ABIs.

Sponsored by: Dell EMC Isilon

7 years agomakefs: Sync with NetBSD (fix unused variable warnings)
emaste [Fri, 7 Apr 2017 02:31:55 +0000 (02:31 +0000)]
makefs: Sync with NetBSD (fix unused variable warnings)

NetBSD revs:
cd9660.c 1.45
cd9660/cd9660_write.c 1.17

Obtained from: NetBSD

7 years agoMove pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
sbruno [Fri, 7 Apr 2017 00:33:03 +0000 (00:33 +0000)]
Move pause frame counter out of struct if_ctx and into struct if_softc_ctx_t
so that we can use it in iflib to detect pause frames.

The igb(4) driver definitely used to use this in its old timer function and
I see no reason to restrict it to that driver only.

Sponsored by: Limelight Networks

7 years agoRegen after r316594.
brooks [Thu, 6 Apr 2017 23:40:51 +0000 (23:40 +0000)]
Regen after r316594.

7 years agoChange the size argument of __getcwd() to size_t.
brooks [Thu, 6 Apr 2017 23:40:13 +0000 (23:40 +0000)]
Change the size argument of __getcwd() to size_t.

This matches the getcwd() definition.

This is technically an ABI change, but that would only effect 64-bit
big-endian platforms that pass arguments on the stack. We have none of
those.

Reviewed by: jhb
Obtained from: CheriABI
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9428

7 years agoPoint out that -F probably does not do what the user expects.
brooks [Thu, 6 Apr 2017 23:35:10 +0000 (23:35 +0000)]
Point out that -F probably does not do what the user expects.

Users attempting to create images from mtree METALOG files created by
installworld often use -F when they should be passing the METALOG file
in place of a directory. This is often produces difficult to debug
error reports.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10038

7 years agoIntroduce libxo support to arp(8)
garga [Thu, 6 Apr 2017 22:50:28 +0000 (22:50 +0000)]
Introduce libxo support to arp(8)

Reviewed by: wblock, gnn, allanjude, phil
Approved by: allanjude
MFC after: 1 week
Sponsored by: Rubicon Communications (Netgate)
Differential Revision: https://reviews.freebsd.org/D9563

7 years agoRemove dead code.
obrien [Thu, 6 Apr 2017 22:21:49 +0000 (22:21 +0000)]
Remove dead code.
The #ifdef __FreeBSD__ section within the OpenBSD tpm_attach() implementation
can never be active.

7 years agolibstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory
tsoome [Thu, 6 Apr 2017 20:12:39 +0000 (20:12 +0000)]
libstand/dosfs: cache FAT32 in 128 Kb blocks to save loader memory

Current implementation of dosfs in libstand reads full File Allocation Table to
the RAM in the initialization code. In the extreme case of FAT32 filesystem,
this structure will take up to 256-1024 Mb of loader memory, depending on the
cluster size.

Proposed patch reduces libstands/dosfs memory requirements to 128 Kb for all
variants of dosfs filesystem. For FAT12 and FAT16 filesystems, File Allocation
Table is cached in full, as before. For FAT32, File Allocation Table is broken
into the equal blocks of 128 Kilobytes (32768 entries), and only current block
is cached.

Because per-filesystem context is now small, global FAT cache (for all
instances of dosfs filesystem) is replaced by local per-instance cache.

Submitted by: Mikhail.Kupchik_gmail.com
Reviewed by: tsoome, allanjude
Differential Revision: https://reviews.freebsd.org/D9547

7 years agoUnify capitalization.
trasz [Thu, 6 Apr 2017 19:17:20 +0000 (19:17 +0000)]
Unify capitalization.

MFC after: 2 weeks

7 years agoUpdate hier(7) by removing files and directories that no longer
trasz [Thu, 6 Apr 2017 19:10:16 +0000 (19:10 +0000)]
Update hier(7) by removing files and directories that no longer
exist and doing a few random tweaks.

MFC after: 2 weeks

7 years agoMETA_MODE: Fix build-tools still sometimes rebuilding during target build.
bdrewery [Thu, 6 Apr 2017 18:21:59 +0000 (18:21 +0000)]
META_MODE: Fix build-tools still sometimes rebuilding during target build.

In a cross-build, the build-tools are native host binaries.  We do not
want to rebuild them when building for the target.  Bmake previously
did not support checking .NOMETA on an existing target, so .NOMETA_CMP
was used here.  However, .NOMETA_CMP still triggers meta mode conditions
if the number of commands or the command changes.  In r312467 the paths
to build ncurses files were modified and thus triggered meta mode to
rebuild the build tools (make_keys, make_hash) in ncurses during the
target build.  Bmake 20160604 committed in r301462 changed .NOMETA to
also skip meta mode logic for an existing .meta file as well, thus it
is now the proper fix here.

I explored moving the build-tools output to WORLDTMP/tools with
relatively good success, but have concerns that doing so would be
problematic for downstream vendors who use LOCAL_TOOL_DIRS and
expect the tools to be in current OBJDIR for the target.  It also
adds more complexity into finding the tools during target build
and handling of where they are for rescue/rescue and
mkcsmapper_static/mkesdb_static which should really not be connected in
build-tools anyway.

MFC after: 2 weeks
Reported by: many
Sponsored by: Dell EMC Isilon

7 years agoloader: zfs reader should check all labels
tsoome [Thu, 6 Apr 2017 18:17:29 +0000 (18:17 +0000)]
loader: zfs reader should check all labels

The current zfs reader is only checking first label from each device, however,
we do have 4 labels on device and we should check all 4 to be protected
against disk failures and incomplete label updates.

The difficulty is about the fact that 2 label copies are in front of the
pool data, and 2 are at the end, which means, we have to know the size of
the pool data area.

Since we have now the mechanism from common/disk.c to use the partition
information, it does help us in this task; however, there are still some
corner cases.

Namely, if the pool is created without partition, directly on the disk,
and firmware will give us the wrong size for the disk, we only can check
the first two label copies.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D10203

7 years agosmbfs: Fix an indentation level
cem [Thu, 6 Apr 2017 17:31:58 +0000 (17:31 +0000)]
smbfs: Fix an indentation level

Based on the change in r242386, it seems clear that scred was intended to
be released in all paths at exit.

No functional change.  This line's indent was just the result of a bad copy
paste from the previous free() in an early exit path.

Reported by: PVS-Studio
Sponsored by: Dell EMC Isilon

7 years agoremove archaic register keyword from ixgb and ex
emaste [Thu, 6 Apr 2017 17:16:41 +0000 (17:16 +0000)]
remove archaic register keyword from ixgb and ex

Reviewed by: sbruno

7 years agobwn(4): Fix trivial null dereference
cem [Thu, 6 Apr 2017 17:08:59 +0000 (17:08 +0000)]
bwn(4): Fix trivial null dereference

Reported by: PVS-Studio
Sponsored by: Dell EMC Isilon

7 years agotx and rx interrupts are not combined in bnxt(4) and should be handled
sbruno [Thu, 6 Apr 2017 16:22:54 +0000 (16:22 +0000)]
tx and rx interrupts are not combined in bnxt(4) and should be handled
independantly.

Submitted by: venkatkumar.duvvuru@broadcom.com>
Differential Revision: https://reviews.freebsd.org/D10297

7 years agocxgbe/iw_cxgbe: Remove another bad cast. This should have been
np [Thu, 6 Apr 2017 16:19:19 +0000 (16:19 +0000)]
cxgbe/iw_cxgbe: Remove another bad cast.  This should have been
included in r316571.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agomakefs: use emalloc and friends
emaste [Thu, 6 Apr 2017 16:18:42 +0000 (16:18 +0000)]
makefs: use emalloc and friends

The emalloc set of error-checking memory allocation routines were added
to libnetbsd in r316572. Use them in makefs to reduce differences with
NetBSD.

NetBSD revs:
cd9660.c 1.39
ffs.c 1.56
makefs.c 1.42
walk.c 1.27
cd9660/cd9660_archimedes.c 1.2
cd9660/cd9660_eltorito.c 1.20
cd9660/cd9660_write.c 1.16
cd9660/iso9660_rrip.c 1.12
ffs/buf.c 1.17
ffs/mkfs.c 1.26

Obtained from: NetBSD

7 years agoloader: want mechanism to avoid RA with bcache
tsoome [Thu, 6 Apr 2017 15:57:53 +0000 (15:57 +0000)]
loader: want mechanism to avoid RA with bcache

While we have mechanisms in place to protect ourselves against the read
behind the disk end, there is still one corner case. As the GPT
partition table has backup table at the end of the disk, and we yet
do not know the size of the disk (if the wrong size is provided by the
firmware/bios), we need to limit the reads to avoid read ahead in such case.

Note: this update does add constant into stand.h, so the incremental build
will need to get local stand.h updated first.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D10187

7 years agoloader: part.c cstyle cleanup
tsoome [Thu, 6 Apr 2017 15:42:12 +0000 (15:42 +0000)]
loader: part.c cstyle cleanup

The description tells it all, as an side note, I am using uint8_t instead of
u_char as the partition table data really is handled as byte stream, not
char array.

Reviewed by: allanjude, imp
Differential Revision: https://reviews.freebsd.org/D10180

7 years agocxgbe/iw_cxgbe: Replace a magic constant with something more readable
np [Thu, 6 Apr 2017 14:50:15 +0000 (14:50 +0000)]
cxgbe/iw_cxgbe: Replace a magic constant with something more readable
(and accurate).

T4 and later have an extra bit for page shift so the maximum page size
is 8TB (shift of 12 + 31) instead of 128MB (12 + 15).  This saves space
in the chip's PBL (physical buffer list) when registering very large
memory regions.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agolibnetbsd: add emalloc and friends
emaste [Thu, 6 Apr 2017 14:36:08 +0000 (14:36 +0000)]
libnetbsd: add emalloc and friends

These are error-checked versions of memory allocation routines used by
NetBSD code, and are being added to facilitate updates to makefs.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D10291

7 years agocxgbe/iw_cxgbe: Remove bad cast that resulted in incorrect length for
np [Thu, 6 Apr 2017 13:58:59 +0000 (13:58 +0000)]
cxgbe/iw_cxgbe: Remove bad cast that resulted in incorrect length for
memory regions larger than 4GB.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoCleanup the bitmap_xxx() functions in the LinuxKPI:
hselasky [Thu, 6 Apr 2017 13:30:31 +0000 (13:30 +0000)]
Cleanup the bitmap_xxx() functions in the LinuxKPI:

- Move all bitmap related functions from bitops.h to bitmap.h, similar
  to what Linux does.

- Apply some minor code cleanup and simplifications to optimize the
  generated code when using static inline functions.

- Implement the following list of bitmap functions which are needed by
  drm-next and ibcore:
  - bitmap_find_next_zero_area_off()
  - bitmap_find_next_zero_area()
  - bitmap_or()
  - bitmap_and()
  - bitmap_xor()

- Add missing include directives to the qlnxe driver
  (davidcs@ has been notified)

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoRevert r316487. It is broken, causing boot to fail due to line 25 in
cy [Thu, 6 Apr 2017 12:52:05 +0000 (12:52 +0000)]
Revert r316487. It is broken, causing boot to fail due to line 25 in
etc/rc.d/dhclient unconditionally testing true when called by a devd
rule during boot, ignoring statically assigned IP addresses in rc.conf.

Requested by: des@

7 years agoRemove spl*() calls from the nfsclient code. Style adjustments in the
kib [Thu, 6 Apr 2017 12:44:34 +0000 (12:44 +0000)]
Remove spl*() calls from the nfsclient code.  Style adjustments in the
related lines in ncl_writebp().

Reviewed by: rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoDefine VM_READ, VM_WRITE and VM_EXEC in the LinuxKPI.
hselasky [Thu, 6 Apr 2017 10:52:52 +0000 (10:52 +0000)]
Define VM_READ, VM_WRITE and VM_EXEC in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement need_resched() in the LinuxKPI.
hselasky [Thu, 6 Apr 2017 10:29:54 +0000 (10:29 +0000)]
Implement need_resched() in the LinuxKPI.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoFix implementation of task_pid_group_leader() in the LinuxKPI.
hselasky [Thu, 6 Apr 2017 10:26:03 +0000 (10:26 +0000)]
Fix implementation of task_pid_group_leader() in the LinuxKPI.

In FreeBSD thread IDs and procedure IDs have distinct number
spaces. When asking for the group leader task ID in the LinuxKPI,
return the procedure ID and let this resolve to the first task in the
procedure having a valid LinuxKPI task structure pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement proper support for memory map operations in the LinuxKPI,
hselasky [Thu, 6 Apr 2017 09:34:54 +0000 (09:34 +0000)]
Implement proper support for memory map operations in the LinuxKPI,
like open, close and fault using the character device pager.

Some notes about the implementation:

1) Linux drivers set the vm_ops and vm_private_data fields during a
mmap() call to indicate that the driver wants to use the LinuxKPI VM
operations. Else these operations are not used.

2) The vm_private_data pointer is associated with a VM area structure
and inserted into an internal LinuxKPI list. If the vm_private_data
pointer already exists, the existing VM area structure is used instead
of the allocated one which gets freed.

3) The LinuxKPI's vm_private_data pointer is used as the callback
handle for the FreeBSD VM object. The VM subsystem in FreeBSD has a
similar list to identify equal handles and will only call the
character device pager's close function once.

4) All LinuxKPI VM operations are serialized through the mmap_sem
sempaphore, which is per procedure, which prevents simultaneous access
to the shared VM area structure when receiving page faults.

Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoBefore registering a new mm_struct in the LinuxKPI check if other
hselasky [Thu, 6 Apr 2017 09:07:01 +0000 (09:07 +0000)]
Before registering a new mm_struct in the LinuxKPI check if other
tasks in the belonging procedure already have a valid mm_struct and
reference that instead.

The mm_struct in the LinuxKPI should be shared among all tasks
belonging to the same procedure. This has to do with with the mmap_sem
semaphore which should serialize all VM operations inside a given
procedure. Linux based drivers depend on this behaviour.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoUse __FBSDID instead of the license agreement to embed the $FreeBSD$ RCS keyword
ngie [Thu, 6 Apr 2017 05:36:35 +0000 (05:36 +0000)]
Use __FBSDID instead of the license agreement to embed the $FreeBSD$ RCS keyword

Reminded by a comment made by markj w.r.t. using __FBSDID in .c files ala a
past Phabricator review.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agosbuf(3): add some basic functional tests for the library
ngie [Thu, 6 Apr 2017 05:29:28 +0000 (05:29 +0000)]
sbuf(3): add some basic functional tests for the library

Areas not covered still [positive functionality wise] are:
- sbuf_{clear,get,set}_flags
- sbuf_new (in particular, with fixed buffers, etc).

Some basic negative testing has been added, but more will be added in the
future.

This work was in part to validate work done by cem in r288223, and ian
before that.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agosbuf(9): add MLINKS for sbuf_{clear,get,set}_flags(9)
ngie [Thu, 6 Apr 2017 05:02:03 +0000 (05:02 +0000)]
sbuf(9): add MLINKS for sbuf_{clear,get,set}_flags(9)

These functions were added in r279992.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agosbuf(3): expose sbuf_{clear,get,set}_flags(3) via libsbuf
ngie [Thu, 6 Apr 2017 04:58:51 +0000 (04:58 +0000)]
sbuf(3): expose sbuf_{clear,get,set}_flags(3) via libsbuf

These functions were added to sbuf(9) in r279992, but never
exposed to userspace. Expose them now so they can be used/tested.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoatf-c: fix documentation description for atf_utils_wait(3)
ngie [Thu, 6 Apr 2017 03:50:58 +0000 (03:50 +0000)]
atf-c: fix documentation description for atf_utils_wait(3)

atf_utils_wait(3) should be used in combination with atf_utils_fork(3),
not itself (atf_utils_wait(3)).

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agosbuf(9): clarify kernel-only APIs
ngie [Thu, 6 Apr 2017 02:46:09 +0000 (02:46 +0000)]
sbuf(9): clarify kernel-only APIs

- move sbuf_bcopyin(9) and sbuf_copyin(9) near sbuf_new_for_sysctl(9), as
  all three functions are kernel-only APIs.
- add #ifdef _KERNEL around sbuf_*copyin and sbuf_new_for_sysctl(9) to
  make it visually clear that they are kernel-only APIs.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agosbuf(9): convert SYNOPSIS section from .Fn entries to .Fo/.Fa/.Fc entries
ngie [Thu, 6 Apr 2017 02:40:52 +0000 (02:40 +0000)]
sbuf(9): convert SYNOPSIS section from .Fn entries to .Fo/.Fa/.Fc entries

This shortens the column count on many lines considerably.

While here, add "(void)" to sbuf_new_auto(3) for consistency with style(9)
recommendations.

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoAdd sys/types.h #include to EXAMPLE to provide a complete functional
ngie [Thu, 6 Apr 2017 02:03:35 +0000 (02:03 +0000)]
Add sys/types.h #include to EXAMPLE to provide a complete functional
standalone example program

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoQuiet 450.status-security when *_inline="YES"
asomers [Thu, 6 Apr 2017 01:37:03 +0000 (01:37 +0000)]
Quiet 450.status-security when *_inline="YES"

Previously, 450.status-security would always set rc=3 in inline mode,
because it doesn't know whether "periodic security" is going to find
anything interesting. But this annoyingly results in daily reports that
simply say "Security check: \n\n-- End of daily output --".

This change fixes that by testing whether "periodic security" printed
anything, and setting 450.status-security's exit status to 3 if it did. An
alternative would be to change the exit status of periodic(8) to be the
worst of its scripts' exit statuses, but that would be a more intrusive
change.

Reviewed by: brian
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D10267

7 years ago[net80211] refactor out the A-MPDU dispatch routine.
adrian [Thu, 6 Apr 2017 01:35:42 +0000 (01:35 +0000)]
[net80211] refactor out the A-MPDU dispatch routine.

The "dispatch a frame from the A-MPDU reorder buffer" code is essentially
duplicated in a couple of places.  This refactors it out into a single
place in preparation for A-MSDU in A-MPDU offload support, where multiple
A-MSDUs are decap'ed in hardware to 802.3/802.11 frames, but with the
same sequence number.

Reviewed by: avos
Differential Revision: https://reviews.freebsd.org/D10240

7 years agoRevert r316516. des@ asked that r316516 be reverted so that he can spend
cy [Thu, 6 Apr 2017 00:15:18 +0000 (00:15 +0000)]
Revert r316516. des@ asked that r316516 be reverted so that he can spend
a little more time getting r316487 right.

Requested by: des@

7 years agomakefs: zero memory
emaste [Thu, 6 Apr 2017 00:07:11 +0000 (00:07 +0000)]
makefs: zero memory

NetBSD revs:
ffs/buf.c 1.14

Obtained from: NetBSD

7 years agoDon't overrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf().
sbruno [Wed, 5 Apr 2017 22:01:49 +0000 (22:01 +0000)]
Don't overrite vf->flags variable at the end of ixgbe(4) ixgbe_add_vf().

Found by PVS-Studio Static code analyzer.

PR: 217748
Submitted by: razmyslov@viva64.com
MFC after: 1 week

7 years agobsdgrep: Handle special case of single-byte NUL pattern
emaste [Wed, 5 Apr 2017 20:11:05 +0000 (20:11 +0000)]
bsdgrep: Handle special case of single-byte NUL pattern

PR: 202022
Submitted by: Kyle Evans <kevans91 at ksu.edu>
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10102

7 years agoFix a double free in ixgbe_rxeof()
sbruno [Wed, 5 Apr 2017 19:52:49 +0000 (19:52 +0000)]
Fix a double free in ixgbe_rxeof()

Submitted by: rstone
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10255

7 years agoFix the linker emulation setting for riscv.
jhb [Wed, 5 Apr 2017 18:59:58 +0000 (18:59 +0000)]
Fix the linker emulation setting for riscv.

Reported by: lwhsu
MFC after: 1 week
Sponsored by: DARPA / AFRL

7 years agobsdgrep: create additional tests for coverage on recent fixes
emaste [Wed, 5 Apr 2017 18:41:44 +0000 (18:41 +0000)]
bsdgrep: create additional tests for coverage on recent fixes

Create additional tests to cover regressions that were discovered by
PRs linked to reviews D10098, D10102, and D10104.

It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base
system currently pass all of these tests, and gnugrep(1) not quite being
up to snuff was also noted in at least one of the PRs.

PR: 175314 202022 195763 180990 197555 197531 181263 209116
Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: cem, ngie, emaste
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D10112

7 years agoFix memory leak in "gpart bootcode"
asomers [Wed, 5 Apr 2017 18:31:26 +0000 (18:31 +0000)]
Fix memory leak in "gpart bootcode"

Also, annotate that gpart_issue never returns

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

7 years agoStop building assym.o into the module.
bdrewery [Wed, 5 Apr 2017 17:56:21 +0000 (17:56 +0000)]
Stop building assym.o into the module.

DTrace includes assym.s, to build this we build assym.o, however
this is unneeded as assym.s only contains macros.

Remove the need to build this by removing it from OBJS, but keep assym.s
in the module dependencies via DPSRCS.

This fixes the build when there is no assembler, e.g. on arm64 without
the external binutils.

Submitted by: andrew
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10041

7 years agoSupport assym.s in DPSRCS to depend on it but not link it in.
bdrewery [Wed, 5 Apr 2017 17:56:17 +0000 (17:56 +0000)]
Support assym.s in DPSRCS to depend on it but not link it in.

Reported by: andrew
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon

7 years agoMake nfs pageout coherent with the dirty state of the buffers.
kib [Wed, 5 Apr 2017 17:26:20 +0000 (17:26 +0000)]
Make nfs pageout coherent with the dirty state of the buffers.

Write out the dirty pages using VOP_WRITE() instead of directly
calling ncl_writerpc(). The state of the buffers now reflects the
write, fixing some hard to diagnose consistency and write order
issues.  The change also allowed to remove remapping of paged out
pages into kernel space and related allocation of the phys buffer.

Reviewed by: markj, rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D10241

7 years agoHandle nfs IO_ASYNC write requests asynchronously.
kib [Wed, 5 Apr 2017 17:20:31 +0000 (17:20 +0000)]
Handle nfs IO_ASYNC write requests asynchronously.

Reviewed by: markj, rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoFix clearing geom metadata if DIOCGSECTORSIZE fails
asomers [Wed, 5 Apr 2017 17:17:18 +0000 (17:17 +0000)]
Fix clearing geom metadata if DIOCGSECTORSIZE fails

An unhandled error case would result in passing SIZE_MAX to malloc.
While I'm here, remove an unnecessary NULL check before free

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

7 years agoHandle possible vnode reclamation after ncl_vinvalbuf() call.
kib [Wed, 5 Apr 2017 17:11:39 +0000 (17:11 +0000)]
Handle possible vnode reclamation after ncl_vinvalbuf() call.

ncl_vinvalbuf() might need to upgrade vnode lock, allowing the vnode
to be reclaimed by other thread.  Handle the situation, indicated by
the returned error zero and VI_DOOMED iflag set, converting it into
EBADF.  Handle all calls, even where the vnode is exclusively locked
right now.

Reviewed by: markj, rmacklem
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoAdd V_VMIO flag for vinvalbuf(9) to indicate that the flush request
kib [Wed, 5 Apr 2017 16:57:53 +0000 (16:57 +0000)]
Add V_VMIO flag for vinvalbuf(9) to indicate that the flush request
was issued during VM-initiated i/o (pageout), so that the function
does not try to flush or remove pages or wait for the vm object
paging-in-progress counter.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoRevert the optimization from r304436
rstone [Wed, 5 Apr 2017 16:57:13 +0000 (16:57 +0000)]
Revert the optimization from r304436

r304436 attempted to optimize the handling of incoming UDP packet by only
making an expensive call to in_broadcast() if the mbuf was marked as an
broadcast packet.  Unfortunately, this cannot work in the case of point-to-
point L2 protocols like PPP, which have no notion of "broadcast".  The
optimization has been disabled for several months now with no progress
towards fixing it, so it needs to go.

7 years agoExtract calculation of ioflags from the vm_pager_putpages flags into a
kib [Wed, 5 Apr 2017 16:56:04 +0000 (16:56 +0000)]
Extract calculation of ioflags from the vm_pager_putpages flags into a
helper.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoSome style fixes for vnode_pager_generic_putpages(), in the local
kib [Wed, 5 Apr 2017 16:45:00 +0000 (16:45 +0000)]
Some style fixes for vnode_pager_generic_putpages(), in the local
declaration block.

Reviewed by: markj (as part of the larger patch)
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoUse int instead of boolean_t for flags argument type in
kib [Wed, 5 Apr 2017 16:30:41 +0000 (16:30 +0000)]
Use int instead of boolean_t for flags argument type in
vnode_pager_generic_putpages() prototype; change the argument name to
reflect that it is flags.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D10241

7 years agoRemove a duplicate fclose() that snuck into r316501
asomers [Wed, 5 Apr 2017 16:13:36 +0000 (16:13 +0000)]
Remove a duplicate fclose() that snuck into r316501

Reported by: Coverity
CID: 1373338
MFC after: 20 days
X-MFC-With: 316501
Sponsored by: Spectra Logic Corp

7 years agoUnify error handling when si_drv1 is NULL in the LinuxKPI.
hselasky [Wed, 5 Apr 2017 12:48:24 +0000 (12:48 +0000)]
Unify error handling when si_drv1 is NULL in the LinuxKPI.

Make sure the character device poll callback function does not return
an error code, but a POLLXXX value, in case of failure.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agoImplement down_write_killable() in the LinuxKPI.
hselasky [Wed, 5 Apr 2017 12:10:02 +0000 (12:10 +0000)]
Implement down_write_killable() in the LinuxKPI.

MFC after: 1 week
Sponsored by: Mellanox Technologies

7 years agohyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.
sephe [Wed, 5 Apr 2017 08:25:22 +0000 (08:25 +0000)]
hyperv/hn: Fixat RNDIS rxfilter after the successful RNDIS init.

Under certain conditions on certain versions of Hyper-V, the RNDIS
rxfilter is _not_ zero on the hypervisor side after the successful
RNDIS initialization, which breaks the assumption of any following
code (well, it breaks the RNDIS API contract actually).  Clear the
RNDIS rxfilter explicitly, drain packets sneaking through, and drain
the interrupt taskqueues scheduled due to the stealth packets.

Reported by: dexuan@
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10230

7 years agohyperv/storvsc: Fixup SRB status.
sephe [Wed, 5 Apr 2017 08:15:47 +0000 (08:15 +0000)]
hyperv/storvsc: Fixup SRB status.

This unbreaks GEN2 Hyper-V cd support.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
Reviewed by: dexuan@
MFC after: 3 days
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10212

7 years agor316487 altered the defined values of rc_force from "yes" (for yes)
cy [Wed, 5 Apr 2017 05:23:09 +0000 (05:23 +0000)]
r316487 altered the defined values of rc_force from "yes" (for yes)
and NULL (for no) to "no" (for no) and no change to the definition
of yes. Two rc.d scripts, dhclient and bgfsck check rc_force for
yesi, using test -n, and no, using test -z. The redefinition of
yes and no by r316487 caused rc.d/dhclient, when invoked by devd
using a devd.conf rule, to assign DHCP assigned IP addresses for
interfaces with statically assigned interfaces, breaking boot.
Point of breakage was at line 25 of etc/rc.d/dhclient (r301068)
where $rc_force needs to be NULL.

MFC after: 3 weeks
X-MFC with: r316487

7 years agohyperv/kbd: Add support for synthetic keyboard.
sephe [Wed, 5 Apr 2017 05:01:23 +0000 (05:01 +0000)]
hyperv/kbd: Add support for synthetic keyboard.

Synthetic keyboard is the only supported keyboard on GEN2 Hyper-V.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10196

7 years agoAlways pass the linker emulation via -m when linking modules and kernels.
jhb [Wed, 5 Apr 2017 03:05:04 +0000 (03:05 +0000)]
Always pass the linker emulation via -m when linking modules and kernels.

Previously the linker emulation was only passed when building binary
objects for firmware modules.  This change always passes the desired
output format for kernel modules and kernels rather than requiring the
toolchain's default output format to match the desired output format.
This in turn permits use of external toolchains whose default output
format does not match the desired output format.

Reviewed by: imp, emaste
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoSync SYSTEM_LD in Makefile.arm with kern.pre.mk.
jhb [Wed, 5 Apr 2017 03:00:52 +0000 (03:00 +0000)]
Sync SYSTEM_LD in Makefile.arm with kern.pre.mk.

- Add --no-warn-mismatch.
- Use same whitespace to make future updates simpler.

Reviewed by: imp (part of a larger change)
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoUse correct linker emulation name for armeb.
jhb [Wed, 5 Apr 2017 02:52:49 +0000 (02:52 +0000)]
Use correct linker emulation name for armeb.

MFC after: 1 week
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085

7 years agoAdd an implementation of __ffssi2() derived from __ffsdi2().
jhb [Wed, 5 Apr 2017 02:40:53 +0000 (02:40 +0000)]
Add an implementation of __ffssi2() derived from __ffsdi2().

Newer versions of GCC include an __ffssi2() symbol in libgcc and the
compiler can emit calls to it in generated code.  This is true for at
least GCC 6.2 when compiling world for mips and mips64.

Reviewed by: jmallett, dim
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10086

7 years agoDon't leak a session and lock if a GMAC key has an invalid length.
jhb [Wed, 5 Apr 2017 01:46:41 +0000 (01:46 +0000)]
Don't leak a session and lock if a GMAC key has an invalid length.

Reviewed by: delphij (secteam)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10273

7 years agoufs: Export UFS_MAXNAMLEN to pathconf, statfs
cem [Wed, 5 Apr 2017 01:44:03 +0000 (01:44 +0000)]
ufs: Export UFS_MAXNAMLEN to pathconf, statfs

Rather than the global NAME_MAX constant.  This change is required to
support systems with a NAME_MAX/MAXNAMLEN that differs from UFS_MAXNAMLEN.

This was missed in r313475 due to the alternative spelling ("NAME_MAX") of
MAXNAMLEN.  This change is also similar in spirit to r313780.

Reported by: ngie@
Sponsored by: Dell EMC Isilon

7 years agoUse unique SPI.
ae [Tue, 4 Apr 2017 23:30:05 +0000 (23:30 +0000)]
Use unique SPI.

MFC after: 1 week

7 years agoIn the example section show that TCP-MD5 connection needs SA for both
ae [Tue, 4 Apr 2017 23:28:22 +0000 (23:28 +0000)]
In the example section show that TCP-MD5 connection needs SA for both
directions.

Submitted by: Mike Tancsa <mike at sentex net>
MFC after: 1 week

7 years agocxgbe(4): Program the global RSS key once instead of once per ifnet.
np [Tue, 4 Apr 2017 23:14:03 +0000 (23:14 +0000)]
cxgbe(4): Program the global RSS key once instead of once per ifnet.

MFC after: 3 days
Sponsored by: Chelsio Communications

7 years agoDon't assume NAME_MAX is 255
ngie [Tue, 4 Apr 2017 21:36:13 +0000 (21:36 +0000)]
Don't assume NAME_MAX is 255

Query the filesystem limit via getconf(3) instead

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoClean up more trailing whitespace in the licensing tort that
ngie [Tue, 4 Apr 2017 21:30:24 +0000 (21:30 +0000)]
Clean up more trailing whitespace in the licensing tort that
happened to be spaces, not tabs

MFC after: 2 months
Sponsored by: Dell EMC Isilon

7 years agoClean up trailing whitespace
ngie [Tue, 4 Apr 2017 21:29:37 +0000 (21:29 +0000)]
Clean up trailing whitespace

MFC after: 2 months
Sponsored by: Dell EMC Isilon