Commit Graph

222234 Commits

Author SHA1 Message Date
Andriy Gapon
656074ea60 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
2017-04-14 15:35:07 +00:00
Andriy Gapon
5ad79d9b20 dtrace: fix normalization of stddev aggregation
To be upstreamed.

Discussed with:	Bryan Cantrill <bryancantrill@gmail.com>
MFC after:	2 weeks
Sponsored by:	Panzura
2017-04-14 15:31:04 +00:00
Konstantin Belousov
f4247773fa 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
2017-04-14 15:22:00 +00:00
Konstantin Belousov
366bb48985 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
2017-04-14 15:16:41 +00:00
Kevin Lo
5d70641052 Remove RTL8153 quirk since ure(4) supports this chip. 2017-04-14 14:38:27 +00:00
Bruce Evans
a5126f539e 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.
2017-04-14 14:00:13 +00:00
Rick Macklem
6d4377c1ae 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
2017-04-14 13:25:45 +00:00
Jens Schweikhardt
a3a09aef5d Correct minor grammos; minor white-space fixes. 2017-04-14 12:54:39 +00:00
Bruce Evans
ddac85e5a0 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.
2017-04-14 12:03:34 +00:00
Andrey V. Elsukov
da62ffd9cd 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
2017-04-14 11:58:41 +00:00
Andrey V. Elsukov
ba3e1361b0 Use address of specific union member instead of whole union address to
fix PVS-Studio warnings.

MFC after:	1 week
2017-04-14 11:41:09 +00:00
Andrey V. Elsukov
1ca7c3b815 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
2017-04-14 11:19:09 +00:00
Andrey V. Elsukov
57386f5dce Fix the build.
Reported by:	lwhsu
2017-04-14 10:21:38 +00:00
Andrey V. Elsukov
c33a231337 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
2017-04-14 09:00:48 +00:00
Pyun YongHyeon
d2c2bbeaee Remove dead code. 2017-04-14 08:27:42 +00:00
Pyun YongHyeon
f9beb16729 Don't overwrite mapped bits.
Found by:	PVS-Studio
2017-04-14 08:11:50 +00:00
Pyun YongHyeon
9935c65a28 Remove unnecessary assignment.
Found by:	PVS-Studio
2017-04-14 07:27:23 +00:00
Enji Cooper
2f4a73322e 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
2017-04-14 06:42:46 +00:00
Enji Cooper
269960e4b7 Derive {AT,RCMDS}{DIR,MODE} from FILE{DIR,MODE}
This reduces duplicity a bit.

MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-14 06:33:15 +00:00
Cy Schubert
0cad3eca15 Add missing bracket (typo). 2017-04-14 05:32:03 +00:00
Sepherosa Ziehau
1e85137841 hyperv/kvp: Remove always false condition.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:29:27 +00:00
Cy Schubert
5810e45bfb Document change in (incorrect) ipfilter behaviour fixed by r316810.
Keep frags can be used with keep state independently.
2017-04-14 05:25:40 +00:00
Sepherosa Ziehau
e25942b0eb hyperv/storvsc: Use ULL for 64bits value shift.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:25:21 +00:00
Sepherosa Ziehau
7737abe4f2 hyperv/kbd: Remove unnecessary assignment.
Reported by:	PVS
MFC after:	3 days
Sponsored by:	Microsoft
2017-04-14 05:18:42 +00:00
Cy Schubert
d716cde795 Add missing free()'s after calls to randomize().
PR:		NetBSD PR/50559
Obtained from:	Netbsd radix_ipf.c r1.6
MFC after:	1 week
2017-04-14 05:13:50 +00:00
Cy Schubert
64d57d7db8 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
2017-04-14 05:12:01 +00:00
Cy Schubert
666bd4d253 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
2017-04-14 03:54:36 +00:00
Pyun YongHyeon
8d16945419 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
2017-04-14 03:23:03 +00:00
Justin Hibbits
a860c16ab7 Default powerpcspe processor target to 8540
This prevents internal compiler errors when -mcpu is omitted.
2017-04-14 03:20:34 +00:00
Pyun YongHyeon
90b45a3200 Remove unnecessary comparison.
Found by:	PVS-Studio
2017-04-14 02:33:26 +00:00
Pyun YongHyeon
857b699d7e Fix a potentially forever loop.
Found by:	PVS-Studio
2017-04-14 02:24:02 +00:00
Gleb Smirnoff
9f5efe718f Fix potential NULL deref.
Found by:	PVS Studio
2017-04-14 01:56:15 +00:00
Conrad Meyer
4f14ba6ca3 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
2017-04-14 00:45:09 +00:00
Conrad Meyer
6c546e77b6 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
2017-04-14 00:36:45 +00:00
Conrad Meyer
bcbaf9fd47 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
2017-04-14 00:22:28 +00:00
Conrad Meyer
63298eb19c 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
2017-04-14 00:14:40 +00:00
Conrad Meyer
17fac79462 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
2017-04-13 23:22:18 +00:00
Jung-uk Kim
bae56e46c4 Attempt to clear logos more thoroughly.
PR:		202288
Reviewed by:	cem
2017-04-13 23:00:26 +00:00
Conrad Meyer
9c363a12fb 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
2017-04-13 22:59:17 +00:00
Bryan Drewery
848d5e929b 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
2017-04-13 22:07:34 +00:00
Rick Macklem
19625f29fe Document the "oneopenown" option added by r316792.
This is a content change.

MFC after:	2 weeks
2017-04-13 22:05:24 +00:00
Rick Macklem
037a2012e9 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
2017-04-13 21:54:19 +00:00
Rick Macklem
60287c0c03 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
2017-04-13 20:16:29 +00:00
Bryan Drewery
d5b29b60f8 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
2017-04-13 19:27:46 +00:00
Maxim Konovalov
f91eb6adad o Redundant assignments removed.
Found by:	PVS-Stdio, V519
Reviewed by:	ae
2017-04-13 18:13:10 +00:00
Conrad Meyer
bcd8d3b805 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
2017-04-13 17:47:44 +00:00
Conrad Meyer
c6943f3abc 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
2017-04-13 17:34:51 +00:00
Navdeep Parhar
0a600b6312 cxgbe: Query some more RDMA related parameters from the firmware.
MFC after:	3 days
Sponsored by:	Chelsio Communications
2017-04-13 17:16:36 +00:00
Conrad Meyer
c789e03fb5 loader: Avoid possible overflow via environment variable
Reported by:	Coverity (CWE-120)
CID:		1006704
Sponsored by:	Dell EMC Isilon
2017-04-13 17:11:49 +00:00
Andrey V. Elsukov
8428914909 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
2017-04-13 17:03:57 +00:00