dim [Sun, 16 Apr 2017 16:48:25 +0000 (16:48 +0000)]
Merge lldb trunk r300422 and resolve conflicts.
dim [Sun, 16 Apr 2017 16:35:48 +0000 (16:35 +0000)]
Merge lld trunk r300422 and resolve conflicts.
dim [Sun, 16 Apr 2017 16:31:20 +0000 (16:31 +0000)]
Merge clang trunk r300422 and resolve conflicts.
dim [Sun, 16 Apr 2017 16:25:46 +0000 (16:25 +0000)]
Merge llvm trunk r300422 and resolve conflicts.
dim [Sun, 16 Apr 2017 16:04:10 +0000 (16:04 +0000)]
Vendor import of lldb trunk r300422:
https://llvm.org/svn/llvm-project/lldb/trunk@300422
dim [Sun, 16 Apr 2017 16:03:39 +0000 (16:03 +0000)]
Vendor import of lld trunk r300422:
https://llvm.org/svn/llvm-project/lld/trunk@300422
dim [Sun, 16 Apr 2017 16:02:28 +0000 (16:02 +0000)]
Vendor import of clang trunk r300422:
https://llvm.org/svn/llvm-project/cfe/trunk@300422
dim [Sun, 16 Apr 2017 16:01:22 +0000 (16:01 +0000)]
Vendor import of llvm trunk r300422:
https://llvm.org/svn/llvm-project/llvm/trunk@300422
cy [Sat, 15 Apr 2017 23:34:05 +0000 (23:34 +0000)]
Clean up extraneous brackets.
neel [Sat, 15 Apr 2017 22:42:23 +0000 (22:42 +0000)]
Due to time constraints remove myself as a vmm(4) maintainer.
dim [Sat, 15 Apr 2017 22:34:22 +0000 (22:34 +0000)]
Pull in r300404 from upstream llvm trunk (by me):
Use correct registers for "A" inline asm constraint
Summary:
In PR32594, inline assembly using the 'A' constraint on x86_64 causes
llvm to crash with a "Cannot select" stack trace. This is because
`X86TargetLowering::getRegForInlineAsmConstraint` hardcodes that 'A'
means the EAX and EDX registers.
However, on x86_64 it means the RAX and RDX registers, and on 16-bit
x86 (ia16?) it means the old AX and DX registers.
Add new register classes in `X86RegisterInfo.td` to support these
cases, and amend the logic in `getRegForInlineAsmConstraint` to cope
with different subtargets. Also add a test case, derived from
PR32594.
Reviewers: craig.topper, qcolombet, RKSimon, ab
Reviewed By: ab
Subscribers: ab, emaste, royger, llvm-commits
Differential Revision: https://reviews.llvm.org/D31902
This should fix crashes when using the 'A' constraint on amd64, for
example as it is being used in Xen.
Reported by: royger
MFC after: 3 days
bapt [Sat, 15 Apr 2017 21:19:49 +0000 (21:19 +0000)]
Remove files which seems to confuse the git converter
bapt [Sat, 15 Apr 2017 21:12:11 +0000 (21:12 +0000)]
Install the zstdgrep shell wrapper
bapt [Sat, 15 Apr 2017 20:55:09 +0000 (20:55 +0000)]
rename zstless into zstdless to be consistent with other zstdcommands
bapt [Sat, 15 Apr 2017 20:53:51 +0000 (20:53 +0000)]
Add forgotten links for zstdcat and unzstd
des [Sat, 15 Apr 2017 20:51:53 +0000 (20:51 +0000)]
3BSD-licensed implementation of the chacha20 stream cipher, intended for
use by the upcoming arc4random replacement.
bapt [Sat, 15 Apr 2017 20:37:34 +0000 (20:37 +0000)]
Add a new Y flag to newsyslog.conf
This makes newsyslog use zstandard to compress log files.
Given Z is already taken for gzip and zstandard compression level stands in
between gzip and xz (which has the X flag) chosing Y sounds ok :)
bapt [Sat, 15 Apr 2017 20:15:44 +0000 (20:15 +0000)]
Change some default to make zstd a dropin replacement for gzip,bzip etc
in most cases
Changes ares:
- quiet by default
- remove the source files one compression completion by default
bapt [Sat, 15 Apr 2017 20:06:24 +0000 (20:06 +0000)]
Add a zstdless equivalent to zless, bzless xzless
bapt [Sat, 15 Apr 2017 20:05:22 +0000 (20:05 +0000)]
Import zstandard 1.1.4 in base
zstandard is a new compression library/tool which is very fast at
compression/decompression
For now import as a private library
bde [Sat, 15 Apr 2017 20:03:50 +0000 (20:03 +0000)]
Add a 10x16 mouse cursor and use it in all graphics (strictly, pixel)
modes if the font size is >= 14.
This is the X cursor XC_left_ptr (#68) (glyph #45 in an X cursor font).
Also found in vt. The old 9x13 cursor is the 10x16 one trimmed not very
well.
8x8 fonts need a smaller cursor instead of a larger one, except when
the pixel size is small. Text mode is still limited to width and height
1 more than the font (so the 9x13 is already 4 pixels too high for it).
bapt [Sat, 15 Apr 2017 19:47:16 +0000 (19:47 +0000)]
Import zstd 1.1.4
bde [Sat, 15 Apr 2017 19:27:39 +0000 (19:27 +0000)]
Structure the mouse cursor data so that it is easier to switch, and
access it via pointers (still to only 1 instance, now with a less
generic name).
Restructure the "and" and "or" masks as border and interior masks
(where the "and" mask was for the union of the border and the interior).
"and" and "or" were only a detail in a not very good implementation,
and after fixing that the union was only used to calculate the border
at runtime.
Use the metric data in more places to clip to active pixels earlier.
sobomax [Sat, 15 Apr 2017 18:20:11 +0000 (18:20 +0000)]
Fix another logic bug that came out of recent syslogd refactoring and exposed by
the r316874: don't call shutdown(2) on all sockets, but only net ones, which seems
to be the behaviour existed before that refactoring. Also don't call listen(2)
in datagram sockets and fix misplaced debug messages while I am here.
Reported by: peter
ian [Sat, 15 Apr 2017 17:02:32 +0000 (17:02 +0000)]
Add support for the imx6ul SoC.
np [Sat, 15 Apr 2017 17:00:50 +0000 (17:00 +0000)]
cxgbe: Add a tunable to configure the SGE time scaler, which is
available starting with T6. The values in the timer holdoff registers
are multiplied by the scaling factor before use.
dev.<nexus>.<n>.holdoff_timers shows the final values of the
timers in microseconds.
MFC after: 1 week
Sponsored by: Chelsio Communications
bapt [Sat, 15 Apr 2017 13:57:35 +0000 (13:57 +0000)]
Clean up headers declaration
bapt [Sat, 15 Apr 2017 09:56:42 +0000 (09:56 +0000)]
Update to 2017.04.03
ngie [Sat, 15 Apr 2017 06:53:07 +0000 (06:53 +0000)]
Switch back to non-IEC units for 1024 bytes
I was swayed a little too quickly when I saw the wiki page discussing
kB vs KiB. Switch back as none of the code in base openly uses
IEC units via humanize_number(3) (which was my next step), and there's
a large degree of dislike with IEC vs more SI-like units.
MFC after: 7 weeks
Submitted by: jhb, rgrimes
Sponsored by: Dell EMC Isilon
sjg [Sat, 15 Apr 2017 03:28:13 +0000 (03:28 +0000)]
Latest version, we need to realpath anyway to check if an obj
dependency is also a src dependency.
sobomax [Sat, 15 Apr 2017 02:24:22 +0000 (02:24 +0000)]
Since shutdown(2) on datagram socket is no longer a NOP after rev 316874
don't bother to select/recv on that socket. This prevents syslogd(8)
from spinning endlessly when started with the -s option (default).
Reported by: peter
sjg [Sat, 15 Apr 2017 01:52:49 +0000 (01:52 +0000)]
Update to latest, handle case of __objdir=obj
sjg [Sat, 15 Apr 2017 01:44:45 +0000 (01:44 +0000)]
asomers [Sat, 15 Apr 2017 00:39:45 +0000 (00:39 +0000)]
Reorder Makefile entries from r316945
PR: 176049
Reported by: Oliver Pinter
MFC after: 3 weeks
X-MFC-With: 316945
asomers [Fri, 14 Apr 2017 22:59:14 +0000 (22:59 +0000)]
Add 410.status-mfi, a periodic script for mfi(4) arrays
PR: 176049
Submitted by: doconnor@gsoft.com.au
Reviewed by: scottl, Larry Rosenman <ler@lerctr.org>
MFC after: 3 weeks
Relnotes: yes
trasz [Fri, 14 Apr 2017 20:15:34 +0000 (20:15 +0000)]
Don't try to write out bufs that have already failed with ENXIO.
This fixes some panics after disconnecting mounted disks.
Submitted by: imp (slightly different version, which I've then lost)
Reviewed by: kib, imp, mckusick
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D9674
np [Fri, 14 Apr 2017 20:15:17 +0000 (20:15 +0000)]
cxgbe/iw_cxgbe: Report the actual values of various parameters as
configured by the firmware.
MFC after: 3 days
Sponsored by: Chelsio Communications
adrian [Fri, 14 Apr 2017 20:10:18 +0000 (20:10 +0000)]
[lib80211] fix a missing cleanup path.
PR: lib/218655
Reported by: <valentin.vergez@stormshield.eu>
ngie [Fri, 14 Apr 2017 19:41:48 +0000 (19:41 +0000)]
savecore: fix space calculation with respect to `minfree` in check_space(..)
- Use strtoll(3) instead of atoi(3), because atoi(3) limits the
representable data to INT_MAX. Check the values received from
strtoll(3), trimming trailing whitespace off the end to maintain
POLA.
- Use `KiB` instead of `kB` when describing free space, total space,
etc. I am now fully aware of `KiB` being the IEC standard for 1024
bytes and `kB` being the IEC standard for 1000 bytes.
- Store available number of KiB in `available` so it can be more
easily queried and compared to ensure that there are enough KiB to
store the dump image on disk.
- Print out the reserved space on disk, per `minfree`, so end-users
can troubleshoot why check_space(..) is reporting that there isn't
enough free space.
MFC after: 7 weeks
Reviewed by: Anton Rang <rang@acm.com> (earlier diff), cem (earlier diff)
Tested with: positive/negative cases (see review); make tinderbox
Sponsored by: Dell EMC Isilon
Differential Revision: D10379
np [Fri, 14 Apr 2017 19:18:50 +0000 (19:18 +0000)]
cxgbe/iw_cxgbe: Report accurate page_size_cap in ib_query_device.
MFC after: 3 days
Sponsored by: Chelsio Communications
np [Fri, 14 Apr 2017 19:15:31 +0000 (19:15 +0000)]
cxgbe/iw_cxgbe: hw supports 64K (not 32K) Protection Domains.
MFC after: 3 days
Sponsored by: Chelsio Communications
bde [Fri, 14 Apr 2017 17:38:43 +0000 (17:38 +0000)]
Oops, the previous revision was missing the update of the shift variable.
sobomax [Fri, 14 Apr 2017 17:23:28 +0000 (17:23 +0000)]
Restore ability to shutdown DGRAM sockets, still forcing ENOTCONN to be returned
by the shutdown(2) system call. This ability has been lost as part of the svn
revision 285910.
Reviewed by: ed, rwatson, glebius, hiren
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10351
markj [Fri, 14 Apr 2017 17:13:57 +0000 (17:13 +0000)]
Rename two gmirror state flags to make their meanings slightly clearer.
No functional change.
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
markj [Fri, 14 Apr 2017 17:08:37 +0000 (17:08 +0000)]
Don't set the mirror GEOM softc to NULL in g_mirror_destroy().
At this point we have not rendezvous'ed with the mirror worker thread, and
I/O may still be in flight. Various I/O completion paths expect to be able
to obtain a reference to the mirror softc from the GEOM, so setting it to
NULL may result in various NULL pointer dereferences if the mirror is
stopped with -f or the kernel is shut down while a mirror is
synchronizing. The worker thread will clear the softc pointer before
exiting.
Tested by: pho
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
markj [Fri, 14 Apr 2017 17:03:32 +0000 (17:03 +0000)]
Check for a provider error before enqueuing mirror I/O.
We are otherwise susceptible to a race with a concurrent teardown of the
mirror provider, causing the I/O to be left uncompleted after the mirror
started withering.
Tested by: pho
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
bde [Fri, 14 Apr 2017 17:02:24 +0000 (17:02 +0000)]
Adjust shifting so that cursor widths up to 17 (was 9) work in vga planar
mode.
Direct mode always supported widths up to 32, except for its hard-coded
16s matching the pixmap size. Text mode is still limited to 9 its 2x2
character cell method and missing adjustments for the gap between
characters, if any.
Cursor heights can be almost anything in graphics modes.
markj [Fri, 14 Apr 2017 16:54:50 +0000 (16:54 +0000)]
Stop mirror synchronization before draining the I/O queue.
Regular I/O requests may be blocked by concurrent synchronization requests
targeted to the same LBAs, in which case they are moved to a holding queue
until the conflicting I/O completes. We therefore want to stop
synchronization before completing pending I/O in g_mirror_destroy_provider()
since this ensures that blocked I/O requests are completed as well.
Tested by: pho
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
asomers [Fri, 14 Apr 2017 16:30:37 +0000 (16:30 +0000)]
MFV 316855
7900 zdb shouldn't print the path of a znode at verbosity < 5
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alan Somers <asomers@freebsd.org>
illumos/illumos-gate@
e548d2fa41d1baa06662ed9abbb8bcec86e27dd9
https://www.illumos.org/issues/7900
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
avg [Fri, 14 Apr 2017 15:35:07 +0000 (15:35 +0000)]
rename vfs.zfs.debug_flags to vfs.zfs.debugflags
While the former name is easier to read, the "_flags" suffix has a special
meaning for loader(8) and, thus, it was impossible to set the knob via
loader.conf(5). The loader interpreted the setting as flags that should
be passed to a kernel module named "vfs.zfs.debug".
Discussed with: smh
MFC after: 2 weeks
avg [Fri, 14 Apr 2017 15:31:04 +0000 (15:31 +0000)]
dtrace: fix normalization of stddev aggregation
To be upstreamed.
Discussed with: Bryan Cantrill <bryancantrill@gmail.com>
MFC after: 2 weeks
Sponsored by: Panzura
kib [Fri, 14 Apr 2017 15:22:00 +0000 (15:22 +0000)]
In fsck_ffs pass1, prevent the inosused variable from wrapping.
The loop that scans the used inode map when soft updates is in use
assumes that the inosused variable is signed. However, ino_t is
unsigned, so the loop invariant is incorrect and the check for
inosused wrapping to < 0 can never be true.
Instead of checking for wrap after the fact just prevent it from
happening in the first place.
PR: 218592
Submitted by: Todd Miller <todd.miller@courtesan.com>
Reviewed by: mckusick
MFC after: 1 week
kib [Fri, 14 Apr 2017 15:16:41 +0000 (15:16 +0000)]
Correct calculation of the entry->free_down in the invariants-checking
code.
Reported by: maxim
Found by: PVS studio scan
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
kevlo [Fri, 14 Apr 2017 14:38:27 +0000 (14:38 +0000)]
Remove RTL8153 quirk since ure(4) supports this chip.
bde [Fri, 14 Apr 2017 14:00:13 +0000 (14:00 +0000)]
Optimize drawing of the mouse cursor in vga planar mode almost as
much as possible, by avoiding null ANDs and ORs to the frame buffer.
Mouse cursors are fairly sparse, especially for their frame. Pixels
are written in groups of 8 in planar mode and the per-group sparseness
is not as large, but it still averages about 40% with the current
9x13 mouse cursor. The average drawing time is reduced by about this
amount (from 22 usec constant to 12.5 usec average on Haswell).
This optimization is relatively larger with larger cursors. Width 10
requires 6 frame buffer accesses per line instead of 4 if not done
sparsely, but rarely more than 4 if done sparsely.
rmacklem [Fri, 14 Apr 2017 13:25:45 +0000 (13:25 +0000)]
Remove unused "cred" argument to ncl_flush().
The "cred" argument of ncl_flush() is unused and it was confusing to have
the code passing in NULL for this argument in some cases. This patch deletes
this argument.
There is no semantic change because of this patch.
MFC after: 2 weeks
schweikh [Fri, 14 Apr 2017 12:54:39 +0000 (12:54 +0000)]
Correct minor grammos; minor white-space fixes.
bde [Fri, 14 Apr 2017 12:03:34 +0000 (12:03 +0000)]
Further unobfuscate the method of drawing the mouse cursor in vga planar
mode.
Don't manually unroll the 2 inner loops. On Haswell, doing so gave a
speedup of about 0.5% (about 4 cycles per iteration out of 1400), but
hard-coded a limit of width 9 and made better better optimizations
harder to see. gcc-4.2.1 -O does the unrolling anyway, unless tricked
with a volatile hack. gcc's unrolling is not very good and gives a
a speedup of about half as much (about 2 cycles per iteration). (All
timing on i386.)
Manual unrolling was only feasible because the inner loop only iterates
once or twice. Usually twice, but a dynamic check is needed to decide,
and was not moved from the second-innermost loop manually or by gcc.
This commit basically adds another dynamic check in the inner loop.
Cursor widths of 10-17 require 3 iterations in the inner loop and this
is not so easy to unroll -- even gcc stops at 2.
ae [Fri, 14 Apr 2017 11:58:41 +0000 (11:58 +0000)]
Avoid undefined behavior.
The 'pktid' variable is modified while being used twice between
sequence points, probably due to htonl() is macro.
Reported by: PVS-Studio
MFC after: 1 week
ae [Fri, 14 Apr 2017 11:41:09 +0000 (11:41 +0000)]
Use address of specific union member instead of whole union address to
fix PVS-Studio warnings.
MFC after: 1 week
ae [Fri, 14 Apr 2017 11:19:09 +0000 (11:19 +0000)]
The rule field in the ipfw_dyn_rule structure is used as storage
to pass rule number and rule set to userland. In r272840 the kernel
internal rule representation was changed and the rulenum field of
struct ip_fw_rule got the type uint32_t, but userlevel representation
still have the type uint16_t. To not overflow the size of pointer
on the systems with 32-bit pointer size use separate variable to
copy rulenum and set.
Reported by: PVS-Studio
MFC after: 1 week
ae [Fri, 14 Apr 2017 10:21:38 +0000 (10:21 +0000)]
Fix the build.
Reported by: lwhsu
ae [Fri, 14 Apr 2017 09:00:48 +0000 (09:00 +0000)]
Rework r316770 to make it protocol independent and general, like we
do for streaming sockets.
And do more cleanup in the sbappendaddr_locked_internal() to prevent
leak information from existing mbuf to the one, that will be possible
created later by netgraph.
Suggested by: glebius
Tested by: Irina Liakh <spell at itl ua>
MFC after: 1 week
yongari [Fri, 14 Apr 2017 08:27:42 +0000 (08:27 +0000)]
Remove dead code.
yongari [Fri, 14 Apr 2017 08:11:50 +0000 (08:11 +0000)]
Don't overwrite mapped bits.
Found by: PVS-Studio
yongari [Fri, 14 Apr 2017 07:27:23 +0000 (07:27 +0000)]
Remove unnecessary assignment.
Found by: PVS-Studio
ngie [Fri, 14 Apr 2017 06:42:46 +0000 (06:42 +0000)]
Conditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd
/etc/pam.d/ftp* should be installed with MK_FTP != no and
/etc/pam.d/telnetd should be installed when MK_TELNET != no.
MFC after: 7 weeks
Sponsored by: Dell EMC Isilon
ngie [Fri, 14 Apr 2017 06:33:15 +0000 (06:33 +0000)]
Derive {AT,RCMDS}{DIR,MODE} from FILE{DIR,MODE}
This reduces duplicity a bit.
MFC after: 7 weeks
Sponsored by: Dell EMC Isilon
cy [Fri, 14 Apr 2017 05:32:03 +0000 (05:32 +0000)]
Add missing bracket (typo).
sephe [Fri, 14 Apr 2017 05:29:27 +0000 (05:29 +0000)]
hyperv/kvp: Remove always false condition.
Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
cy [Fri, 14 Apr 2017 05:25:40 +0000 (05:25 +0000)]
Document change in (incorrect) ipfilter behaviour fixed by r316810.
Keep frags can be used with keep state independently.
sephe [Fri, 14 Apr 2017 05:25:21 +0000 (05:25 +0000)]
hyperv/storvsc: Use ULL for 64bits value shift.
Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
sephe [Fri, 14 Apr 2017 05:18:42 +0000 (05:18 +0000)]
hyperv/kbd: Remove unnecessary assignment.
Reported by: PVS
MFC after: 3 days
Sponsored by: Microsoft
cy [Fri, 14 Apr 2017 05:13:50 +0000 (05:13 +0000)]
Add missing free()'s after calls to randomize().
PR: NetBSD PR/50559
Obtained from: Netbsd radix_ipf.c r1.6
MFC after: 1 week
cy [Fri, 14 Apr 2017 05:12:01 +0000 (05:12 +0000)]
Keep state incorrectly assumes keep frags. This is counter to the
ipfilter man pages. This also currently restricts keep frags to only when
keep state is used, which is redundant because keep state currently
assumes keep frags. This commit fixes this.
To the user this change means that to maintain the current behaviour
one must add keep frags to any ipfilter keep state rule (as documented
in the man pages).
This patch also allows the flexability to specify and use keep frags
separate from keep state, as documented in an example in ipf.conf.5,
instead of the currently broken behaviour.
Relnotes: yes
cy [Fri, 14 Apr 2017 03:54:36 +0000 (03:54 +0000)]
Fix a use after free panic in ipfilter's fragment processing.
Memory is malloc'd, then a search for a match in the fragment table
is made and if the fragment matches, the wrong fragment table is
freed, causing a use after free panic. This commit fixes this.
A symptom of the problem is a kernel page fault in bcopy() called by
ipf_frag_lookup() at line 715 in ip_frag.c. Another symptom is a
kernel page fault in ipf_frag_delete() when called by ipf_frag_expire()
via ipf_slowtimer().
MFC after: 1 week
yongari [Fri, 14 Apr 2017 03:23:03 +0000 (03:23 +0000)]
Remove unnecessary check aginst NULL. txp_ext_command() with
TXP_CMD_WAIT argument allocates a response buffer. If the allocation
fails, txp_ext_command() returns an error and it's handed in caller.
Found by: PVS-Studio
jhibbits [Fri, 14 Apr 2017 03:20:34 +0000 (03:20 +0000)]
Default powerpcspe processor target to 8540
This prevents internal compiler errors when -mcpu is omitted.
yongari [Fri, 14 Apr 2017 02:33:26 +0000 (02:33 +0000)]
Remove unnecessary comparison.
Found by: PVS-Studio
yongari [Fri, 14 Apr 2017 02:24:02 +0000 (02:24 +0000)]
Fix a potentially forever loop.
Found by: PVS-Studio
glebius [Fri, 14 Apr 2017 01:56:15 +0000 (01:56 +0000)]
Fix potential NULL deref.
Found by: PVS Studio
cem [Fri, 14 Apr 2017 00:45:09 +0000 (00:45 +0000)]
tcp_wrappers: Sprinkle some bounds-checked string copying
It isn't clear if tcpd.c is even compiled in FreeBSD.
Reported by: Coverity
CIDs: 1006710, 1006804
Sponsored by: Dell EMC Isilon
cem [Fri, 14 Apr 2017 00:36:45 +0000 (00:36 +0000)]
bsdinstall(8): Sprinkle a snprintf to fixed size buffer
Use a snprintf to write an environment variable to a fixed-size buffer to
avoid stack overflow.
Reported by: Coverity (CWE-120)
CID: 1238926
Sponsored by: Dell EMC Isilon
cem [Fri, 14 Apr 2017 00:22:28 +0000 (00:22 +0000)]
fsck(8): Don't overrun mount device buffer
Apply a very similar fix to r299460 (fsck_ffs) to apparently duplicated code
in fsck.
Reported by: Coverity
CID: 1006789
Sponsored by: Dell EMC Isilon
cem [Fri, 14 Apr 2017 00:14:40 +0000 (00:14 +0000)]
restore(8): Prevent some heap overflows
The environment variable TMPDIR was copied unchecked into a fixed-size heap
buffer. Use a length-limiting snprintf in place of ordinary sprintf to
prevent the overflow. Long TMPDIR variables can still cause odd truncated
filenames, which may be undesirable.
Reported by: Coverity (CWE-120)
CIDs: 1006706, 1006707
Sponsored by: Dell EMC Isilon
cem [Thu, 13 Apr 2017 23:22:18 +0000 (23:22 +0000)]
banner(6): Squash a harmless coverity warning
The destination buffer is sized as the sum of program argument lengths, so
it has plenty of room for *argv. Appease Coverity by using strlcpy instead
of strcpy. Similar to a nearby cleanup performed in r316500.
No functional change.
Reported by: Coverity (CWE-120)
CID: 1006703
Sponsored by: Dell EMC Isilon
jkim [Thu, 13 Apr 2017 23:00:26 +0000 (23:00 +0000)]
Attempt to clear logos more thoroughly.
PR: 202288
Reviewed by: cem
cem [Thu, 13 Apr 2017 22:59:17 +0000 (22:59 +0000)]
ctm: Fix some trivial argv buffer overruns
It may not do the right thing with these obviously wrong inputs, but at
least it won't smash the stack.
Reported by: Coverity (CWE-120)
CIDs: 1006697, 1006698
Sponsored by: Dell EMC Isilon
bdrewery [Thu, 13 Apr 2017 22:07:34 +0000 (22:07 +0000)]
Cache compiler metadata and reuse it at installworld time.
Right after cross-tools, a compiler-metadata.mk file is created that
stores all of the bsd.compiler.mk metadata. It is then read in
with a fail-safe during installworld time.
The file is explicitly removed when invoking cross-tools to ensure that
a stale file is not left around from odd manual 'make _cross-tools' ->
'make installworld' invocations.
This fixes several issues:
- With WITH_SYSTEM_COMPILER (default yes on head and no on releng/11.0):
If you build on a system where the bootstrap compiler does not
build due to the host compiler matching the in-tree one, but then
installworld on another system where that logic fails (a
bootstrap compiler is needed), the installworld immediately fails
with:
sh: cc: not found
Note that fixing this logic may then hit a case where a rebuild is
attempted in installworld. Normally cc would be ran with
'CFLAGS+=ERROR-tried-to-rebuild-during-make-install' to cause an
error such as:
cc: error: no such file or directory: 'ERROR-tried-to-rebuild-during-make-install'
However, now it will just fail with the 'cc: not found' error.
Inspection of the compile line will show
'ERROR-tried-to-rebuild-during-make-install'; It's not useful to
set CC to anything other than 'cc' during install as it is more
helpful to see the attempted compile rather than some other bogus
error.
- This now avoids running bsd.compiler.mk (cc executions) even more
during installworld. There are compiler-dependent SUBDIR in the
tree which required having a compiler during install.
There is at least 1 case where CC is still executed in the install,
such as from a LOOKUP!= in secure/lib/libcrypto/Makefile.inc checking
for 'vzeroall' support. This is not significant for installworld
as the lookup has a fallback (and hides its error) and only modifies CFLAGS,
thus it's not worth fixing.
PR: 212877
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
rmacklem [Thu, 13 Apr 2017 22:05:24 +0000 (22:05 +0000)]
Document the "oneopenown" option added by r316792.
This is a content change.
MFC after: 2 weeks
rmacklem [Thu, 13 Apr 2017 21:54:19 +0000 (21:54 +0000)]
Add an NFSv4.1 mount option for "use one openowner".
Some NFSv4.1 servers such as AmazonEFS can only support a small fixed number
of open_owner4s. This patch adds a mount option called "oneopenown" that
can be used for NFSv4.1 mounts to make the client do all Opens with the
same open_owner4 string. This option can only be used with NFSv4.1 and
may not work correctly when Delegations are is use.
Reported by: cperciva
Tested by: cperciva
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8988
rmacklem [Thu, 13 Apr 2017 20:16:29 +0000 (20:16 +0000)]
Add call to svcpool_close() for the NFSv4 callback pool (svcpool_nfscbd).
A function called svcpool_close() was added to the server side krpc by
r313735, so that a pool could be closed without destroying the data structures.
This little patch adds a call to it for the callback pool (svcpool_nfscbd),
so that the nfscbd daemon can be killed/restarted and continue to work
correctly.
MFC after: 2 weeks
bdrewery [Thu, 13 Apr 2017 19:27:46 +0000 (19:27 +0000)]
Pass COMPILER_FEATURES down to submakes for installworld.
This is for WITH_SYSTEM_COMPILER, WITHOUT_CROSS_COMPILER, external
compiler, etc.
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
maxim [Thu, 13 Apr 2017 18:13:10 +0000 (18:13 +0000)]
o Redundant assignments removed.
Found by: PVS-Stdio, V519
Reviewed by: ae
cem [Thu, 13 Apr 2017 17:47:44 +0000 (17:47 +0000)]
dummynet: Use strlcpy to appease static checkers
Some dummynet modules used strcpy() to copy from a larger buffer
(dn_aqm->name) to a smaller buffer (dn_extra_parms->name). It happens that
the lengths of the strings in the dn_aqm buffers were always hardcoded to be
smaller than the dn_extra_parms buffer ("CODEL", "PIE").
Use strlcpy() instead, to appease static checkers. No functional change.
Reported by: Coverity
CIDs: 1356163, 1356165
Sponsored by: Dell EMC Isilon
cem [Thu, 13 Apr 2017 17:34:51 +0000 (17:34 +0000)]
linux_ioctl: Refactor some v4l2 struct converters
According to the C standard, it is invalid to copy beyond the end of an
object, even if that object is obviously a member of a larger object (a
struct, in this case).
Appease the standard and Coverity by refactoring the copy in a
straightforward way. No functional change.
Reported by: Coverity (CWE-120)
CIDs: 1007819, 1007820, 1007821, 1007822, 1009668, 1009669
Security: no (false positive detection)
Sponsored by: Dell EMC Isilon
np [Thu, 13 Apr 2017 17:16:36 +0000 (17:16 +0000)]
cxgbe: Query some more RDMA related parameters from the firmware.
MFC after: 3 days
Sponsored by: Chelsio Communications
cem [Thu, 13 Apr 2017 17:11:49 +0000 (17:11 +0000)]
loader: Avoid possible overflow via environment variable
Reported by: Coverity (CWE-120)
CID: 1006704
Sponsored by: Dell EMC Isilon
ae [Thu, 13 Apr 2017 17:03:57 +0000 (17:03 +0000)]
Clear h/w csum flags on mbuf handled by UDP.
When checksums of received IP and UDP header already checked, UDP uses
sbappendaddr_locked() to pass received data to the socket.
sbappendaddr_locked() uses given mbuf as is, and if NIC supports checksum
offloading, mbuf contains csum_data and csum_flags that were calculated
for already stripped headers. Some NICs support only limited checksums
offloading and do not use CSUM_PSEUDO_HDR flag, and csum_data contains
some value that UDP/TCP should use for pseudo header checksum calculation.
When L2TP is used for tunneling with mpd5, ng_ksocket receives mbuf with
filled csum_flags and csum_data, that were calculated for outer headers.
When L2TP header is stripped, a packet that was tunneled goes to the IP
layer and due to presence of csum_flags (without CSUM_PSEUDO_HDR) and
csum_data, the UDP/TCP checksum check fails for this packet.
Reported by: Irina Liakh <spell at itl ua>
Tested by: Irina Liakh <spell at itl ua>
MFC after: 1 week
andrew [Thu, 13 Apr 2017 16:57:02 +0000 (16:57 +0000)]
Rather than checking if the top bit in a virtual address is a 0 or 1
compare against VM_MAXUSER_ADDRESS as we should have been doing.
Sponsored by: DARPA, AFRL