]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoRestore ability to shutdown DGRAM sockets, still forcing ENOTCONN to be returned
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

7 years agoRename two gmirror state flags to make their meanings slightly clearer.
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

7 years agoDon't set the mirror GEOM softc to NULL in g_mirror_destroy().
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

7 years agoCheck for a provider error before enqueuing mirror I/O.
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

7 years agoAdjust shifting so that cursor widths up to 17 (was 9) work in vga planar
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.

7 years agoStop mirror synchronization before draining the I/O queue.
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

7 years agoMFV 316855
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

7 years agorename vfs.zfs.debug_flags to vfs.zfs.debugflags
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

7 years agodtrace: fix normalization of stddev aggregation
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

7 years agoIn fsck_ffs pass1, prevent the inosused variable from wrapping.
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

7 years agoCorrect calculation of the entry->free_down in the invariants-checking
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

7 years agoRemove RTL8153 quirk since ure(4) supports this chip.
kevlo [Fri, 14 Apr 2017 14:38:27 +0000 (14:38 +0000)]
Remove RTL8153 quirk since ure(4) supports this chip.

7 years agoOptimize drawing of the mouse cursor in vga planar mode almost as
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.

7 years agoRemove unused "cred" argument to ncl_flush().
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

7 years agoCorrect minor grammos; minor white-space fixes.
schweikh [Fri, 14 Apr 2017 12:54:39 +0000 (12:54 +0000)]
Correct minor grammos; minor white-space fixes.

7 years agoFurther unobfuscate the method of drawing the mouse cursor in vga planar
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.

7 years agoAvoid undefined behavior.
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

7 years agoUse address of specific union member instead of whole union address to
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

7 years agoThe rule field in the ipfw_dyn_rule structure is used as storage
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

7 years agoFix the build.
ae [Fri, 14 Apr 2017 10:21:38 +0000 (10:21 +0000)]
Fix the build.

Reported by: lwhsu

7 years agoRework r316770 to make it protocol independent and general, like we
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

7 years agoRemove dead code.
yongari [Fri, 14 Apr 2017 08:27:42 +0000 (08:27 +0000)]
Remove dead code.

7 years agoDon't overwrite mapped bits.
yongari [Fri, 14 Apr 2017 08:11:50 +0000 (08:11 +0000)]
Don't overwrite mapped bits.

Found by: PVS-Studio

7 years agoRemove unnecessary assignment.
yongari [Fri, 14 Apr 2017 07:27:23 +0000 (07:27 +0000)]
Remove unnecessary assignment.

Found by: PVS-Studio

7 years agoConditionally install /etc/pam.d/ftp* and /etc/pam.d/telnetd
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

7 years agoDerive {AT,RCMDS}{DIR,MODE} from FILE{DIR,MODE}
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

7 years agoAdd missing bracket (typo).
cy [Fri, 14 Apr 2017 05:32:03 +0000 (05:32 +0000)]
Add missing bracket (typo).

7 years agohyperv/kvp: Remove always false condition.
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

7 years agoDocument change in (incorrect) ipfilter behaviour fixed by r316810.
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.

7 years agohyperv/storvsc: Use ULL for 64bits value shift.
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

7 years agohyperv/kbd: Remove unnecessary assignment.
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

7 years agoAdd missing free()'s after calls to randomize().
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

7 years agoKeep state incorrectly assumes keep frags. This is counter to the
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

7 years agoFix a use after free panic in ipfilter's fragment processing.
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

7 years agoRemove unnecessary check aginst NULL. txp_ext_command() with
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

7 years agoDefault powerpcspe processor target to 8540
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.

7 years agoRemove unnecessary comparison.
yongari [Fri, 14 Apr 2017 02:33:26 +0000 (02:33 +0000)]
Remove unnecessary comparison.

Found by: PVS-Studio

7 years agoFix a potentially forever loop.
yongari [Fri, 14 Apr 2017 02:24:02 +0000 (02:24 +0000)]
Fix a potentially forever loop.

Found by: PVS-Studio

7 years agoFix potential NULL deref.
glebius [Fri, 14 Apr 2017 01:56:15 +0000 (01:56 +0000)]
Fix potential NULL deref.

Found by: PVS Studio

7 years agotcp_wrappers: Sprinkle some bounds-checked string copying
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: 10067101006804
Sponsored by: Dell EMC Isilon

7 years agobsdinstall(8): Sprinkle a snprintf to fixed size buffer
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

7 years agofsck(8): Don't overrun mount device buffer
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

7 years agorestore(8): Prevent some heap overflows
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: 10067061006707
Sponsored by: Dell EMC Isilon

7 years agobanner(6): Squash a harmless coverity warning
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

7 years agoAttempt to clear logos more thoroughly.
jkim [Thu, 13 Apr 2017 23:00:26 +0000 (23:00 +0000)]
Attempt to clear logos more thoroughly.

PR: 202288
Reviewed by: cem

7 years agoctm: Fix some trivial argv buffer overruns
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: 10066971006698
Sponsored by: Dell EMC Isilon

7 years agoCache compiler metadata and reuse it at installworld time.
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

7 years agoDocument the "oneopenown" option added by r316792.
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

7 years agoAdd an NFSv4.1 mount option for "use one openowner".
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

7 years agoAdd call to svcpool_close() for the NFSv4 callback pool (svcpool_nfscbd).
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

7 years agoPass COMPILER_FEATURES down to submakes for installworld.
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

7 years agoo Redundant assignments removed.
maxim [Thu, 13 Apr 2017 18:13:10 +0000 (18:13 +0000)]
o Redundant assignments removed.

Found by: PVS-Stdio, V519
Reviewed by: ae

7 years agodummynet: Use strlcpy to appease static checkers
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: 13561631356165
Sponsored by: Dell EMC Isilon

7 years agolinux_ioctl: Refactor some v4l2 struct converters
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: 100781910078201007821100782210096681009669
Security: no (false positive detection)
Sponsored by: Dell EMC Isilon

7 years agocxgbe: Query some more RDMA related parameters from the firmware.
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

7 years agoloader: Avoid possible overflow via environment variable
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

7 years agoClear h/w csum flags on mbuf handled by UDP.
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

7 years agoRather than checking if the top bit in a virtual address is a 0 or 1
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

7 years agoFix an out-of-bounds write when a zero-length buffer is passed.
brooks [Thu, 13 Apr 2017 15:52:45 +0000 (15:52 +0000)]
Fix an out-of-bounds write when a zero-length buffer is passed.

Found with ttyname_test and CHERI bounds checking.

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

7 years agoMap DMAP as nx.
kib [Thu, 13 Apr 2017 15:49:55 +0000 (15:49 +0000)]
Map DMAP as nx.

Demotions preserve PG_NX, so it is enough to set nx bit for initial
lowest-level paging entries.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

7 years agoCorrect an out of bounds read with HN_AUTOSCALE and very large numbers.
brooks [Thu, 13 Apr 2017 15:49:32 +0000 (15:49 +0000)]
Correct an out of bounds read with HN_AUTOSCALE and very large numbers.

The maximum scale is 6 (K, M, G, T, P, E) (B is 0).

Overly large explict scales were checked correctly, but for sufficently
large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds
read.

Found with humanize_number_test and CHERI bounds checking.

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

7 years agoDon't prefix zero with 0x in assym.s.
andrew [Thu, 13 Apr 2017 15:43:44 +0000 (15:43 +0000)]
Don't prefix zero with 0x in assym.s.

The arm64 binutils only accepts 0 as an offset to the Load-Acquire Register
instructions where llvm will acceps both 0 and 0x0. The thread switching
code uses these with SCHED_ULE to block waiting for a lock to be released.
As the offset of the data to be loaded is zero this is safe, however it is
useful to keep the offset in the instruction to document what is being
loaded.

To work around this issue in binutils only generate the 0x prefix for
non-zero values.

Reported by: kan
Sponsored by: DARPA, AFRL

7 years agoSet the arm64 Execute-never bits in more places.
andrew [Thu, 13 Apr 2017 15:03:03 +0000 (15:03 +0000)]
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.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10382

7 years agoFix vdev_geom_attach_by_guids for partitioned disks
asomers [Thu, 13 Apr 2017 14:51:34 +0000 (14:51 +0000)]
Fix vdev_geom_attach_by_guids for partitioned disks

When opening a vdev whose path is unknown, vdev_geom must find a geom
provider with a label whose guids match the desired vdev. However, due to
partitioning, it is possible that two non-synonomous providers will share
some labels. For example, if the first partition starts at the beginning of
the drive, then ada0 and ada0p1 will share the first label. More troubling,
if the last partition runs to the end of the drive, then ada0p3 and ada0
will share the last label. If vdev_geom opens ada0 when it should've opened
ada0p3, then the pool won't be readable. If it opens ada0 when it should've
opened ada0p1, then it will corrupt some other partition when it writes the
3rd and 4th labels.

The easiest way to reproduce this problem is to install a mirrored root pool
with the default partition layout, then swap the positions of the two boot
drives and reboot.  Whether the bug manifests depends on the order in which
geom lists its providers, which is arbitrary.

Fix this situation by modifying the search algorithm to prefer geom
providers that have all four labels intact. If no such provider exists, then
open whichever provider has the most.

Reviewed by: mav
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10365

7 years agoAdd large replay widow support to setkey(8) and libipsec.
ae [Thu, 13 Apr 2017 14:44:17 +0000 (14:44 +0000)]
Add large replay widow support to setkey(8) and libipsec.

When the replay window size is large than UINT8_MAX, add to the request
the SADB_X_EXT_SA_REPLAY extension header that was added in r309144.

Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT,
SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR,
SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST
extension headers to the key_debug that is used by `setkey -x`.

Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting.
And modify kdebug_sadb_x_policy() to show policy scope and priority.

Reviewed by: gnn, Emeric Poupon
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D10375

7 years agoUpdate list of Conexant and Realtek codecs.
mav [Thu, 13 Apr 2017 14:40:48 +0000 (14:40 +0000)]
Update list of Conexant and Realtek codecs.

MFC after: 2 weeks

7 years agoUse proper fields to check for interrupt trigger mode.
kan [Thu, 13 Apr 2017 14:23:27 +0000 (14:23 +0000)]
Use proper fields to check for interrupt trigger mode.

7 years agoIn ARMv8.1 ARM has added a process state bit to disable access to userspace
andrew [Thu, 13 Apr 2017 13:46:01 +0000 (13:46 +0000)]
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.

Reported by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10371

7 years agoAdd SCTLR bits added in ARMv8.1 and ARMv8.2 and start to use them in the
andrew [Thu, 13 Apr 2017 11:56:27 +0000 (11:56 +0000)]
Add SCTLR bits added in ARMv8.1 and ARMv8.2 and start to use them in the
early boot code.

Sponsored by: DARPA, AFRL

7 years agoloader/multiboot: fix multiboot loading
royger [Thu, 13 Apr 2017 09:59:12 +0000 (09:59 +0000)]
loader/multiboot: fix multiboot loading

The current multiboot loader code doesn't clean the metadata added to the
kernel after the bi_load64 dry run, which breaks accounting of the required
memory for the metadata.

This issue didn't show itself before because all the metadata items where small
(8bytes), but after r316343 there's a big blob in the metadata, which triggers
this. Fix it by cleaning the metadata added to the kernel after the bi_load64
dry run. Also add a comment describing the memory layout when booting using
multiboot (Xen Dom0).

This unbreaks booting a FreeBSD/Xen Dom0 after r316343.

MFC after: 3 weeks
Sponsored by: Citrix Systems R&D

7 years agoFix expectations for testcases per bsdgrep vs gnu grep from base/ports
ngie [Thu, 13 Apr 2017 04:10:27 +0000 (04:10 +0000)]
Fix expectations for testcases per bsdgrep vs gnu grep from base/ports

The following failures occur with various versions of grep:

BSD grep:
- :context
- :context2

GNU grep (base):
- :color
- :oflag_zerolen

GNU grep (ports):
- :recurse_symlink

Tested with: bsdgrep (^/head@r316542), gnu grep (base/2.5.1), gnu grep (ports/2.27)
Reported by: Jenkins (bsdgrep failures)
Sponsored by: Dell EMC Isilon

7 years agodrm2: Add some missing PCIIDs for some Haswell systems
cem [Thu, 13 Apr 2017 01:56:15 +0000 (01:56 +0000)]
drm2: Add some missing PCIIDs for some Haswell systems

Submitted by: Jia-Shiun Li <jiashiun at gmail.com>

7 years agoFix rss_ind_table entry for num_funcs > 1
davidcs [Thu, 13 Apr 2017 01:17:49 +0000 (01:17 +0000)]
Fix rss_ind_table entry for num_funcs > 1

MFC after:3 days

7 years agoAdd UEFI support to vmrun.sh
allanjude [Thu, 13 Apr 2017 00:07:39 +0000 (00:07 +0000)]
Add UEFI support to vmrun.sh

Adds:
 -E: Use UEFI mode
 -f: path to UEFI firmware image (default: path to uefi-edk2-bhyve package)
 -F: UEFI framebuffer size (default: w=1024,h=768)
 -L: IP to listen for VNC connections on (default: 127.0.0.1)
 -P: Port to listen for VNC connections on (default: 5900)
 -T: Enable tablnet device (for VNC)
 -v: Wait for VNC client before booting VM

Submitted by: Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D10378

7 years agoFix the NFS client for "text file modified, process killed" mmap'd case.
rmacklem [Wed, 12 Apr 2017 21:37:12 +0000 (21:37 +0000)]
Fix the NFS client for "text file modified, process killed" mmap'd case.

When an mmap'd text file is written and then executed immediately
afterwards, it was possible that the modify time would change after the
text file was executing, resulting in the process executing the file
being killed. This was usually only observed when the file system's
times were set to higher resolution, but could have occurred for any
time resolution.
This was reported on a recent email list discussion.
This patch adds a VOP_SET_TEXT() to the NFS client which flushed all
dirty pages to the NFS server and then makes sure that n_mtime is up
to date to avoid this from occurring.
Thanks go to kib@ and pho@ for their help with developing this patch.

Tested by: pho
Reviewed by: kib
MFC after: 2 weeks

7 years agosh: Reduce size of limits table.
jilles [Wed, 12 Apr 2017 21:15:55 +0000 (21:15 +0000)]
sh: Reduce size of limits table.

7 years agoThe sysctl variable net.inet.tcp.drop_synfin is not honored in all states,
tuexen [Wed, 12 Apr 2017 20:27:15 +0000 (20:27 +0000)]
The sysctl variable net.inet.tcp.drop_synfin is not honored in all states,
for example not in SYN-SENT.
This patch adds code to check the sysctl variable in other states than
LISTEN.
Thanks to ae and gnn for providing comments.
Reviewed by: gnn
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D9894

7 years agoClarify units for mediasize and sectorsize in DoFile(..)
ngie [Wed, 12 Apr 2017 20:20:04 +0000 (20:20 +0000)]
Clarify units for mediasize and sectorsize in DoFile(..)

They're byte quantities.

MFC after: 7 weeks
Sponsored by: Dell EMC Isilon

7 years agoImprove drawing of the vga planar mode mouse image a little. Unobfuscate
bde [Wed, 12 Apr 2017 20:18:38 +0000 (20:18 +0000)]
Improve drawing of the vga planar mode mouse image a little.  Unobfuscate
the method a lot.

Reduce the AND mask to the complement of the cursor's frame, so that area
inside the frame is not drawn first in black and then in lightwhite.  The
AND-OR method is only directly suitable for the text mouse image, since
it doesn't go to the hardware there.  Planar mode Mouse cursor drawing
takes 10-20 usec on my Haswell system (approx. 100 graphics accesses
at 130 nsec each), so the transient was not visible.

The method used the fancy read mode 1 and its color compare and color
don't care registers with value 0 in them so that all colors matched.
All that this did was make byte reads of frame buffer memory return 0xff,
so that the x86 case could obfuscate read+write as "and".  The read must
be done for its side effect on the graphics controller but is not used,
except it must return 0xff to avoid affecting the write when the write
is obfuscated as a read-modify-write "and".  Perhaps that was a good
optimization for 8088 CPUs where each extra instruction byte took as
long as a byte memory access.

Just use read+write after removing the fancy read mode.  Remove x86
ifdefs that did the "and".  After removing the "and" in the non-x86
part of the ifdefs, fix 4 of 6 cases where the shift was wrong.

7 years agoClarify `minfree` warning message in check_space(..)
ngie [Wed, 12 Apr 2017 20:08:39 +0000 (20:08 +0000)]
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)

MFC after: 7 weeks
Sponsored by: Dell EMC Isilon

7 years agoReport _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX which show parameters
kib [Wed, 12 Apr 2017 19:27:14 +0000 (19:27 +0000)]
Report _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX which show parameters
of the current usermode implementation of the POSIX semaphores.

For NSEMS_MAX, return -1 without changing errno, which indicates that
the variable has no limit.  Before, sysconf(3) returned parameters
queried from the ksem(9) legacy implementation, which apparently has
low defaults for NSEMS_MAX.

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

7 years agoFix an issue in the rev.316718 causing variable to be unsed uninitialized.
sobomax [Wed, 12 Apr 2017 19:23:41 +0000 (19:23 +0000)]
Fix an issue in the rev.316718 causing variable to be unsed uninitialized.

Reported by:    Coverity
Nudged by:      cem
MFC after: 2 weeks

7 years agoFix removal of mouse image by the vga planar renderer in the right border
bde [Wed, 12 Apr 2017 18:52:06 +0000 (18:52 +0000)]
Fix removal of mouse image by the vga planar renderer in the right border
in unusual cases.  Optimize and significantly clean up removal in this
renderer.  Optimize removal in the vga direct renderer.

Removal only needs to be done in the border (the part with pixels) in
both cases.  The planar renderer used the condition scp->xoff > 0 to
test whether a right border exists.  This actually tests for a left
border, and when the total horizontal border is 8 pixels, rounding gives
only a right border.  This was the unusual broken case.  An example
is easy to configure using something like "vidcontrol -f 8x16 iso-8x16
-g 79x25 MODE_27".

Optimize the planar case a little by only removing 9x13 active pixels
out of 16x16.  Optimize it a lot by not doing anything if there is no
overlap with the border.  Don't unroll the main loop or hard-code so
many assumptions about font sizes in it.  On my Haswell system, graphics
memory and i/o accesses takes about 520 cycles each so optimizations from
unrolling are in the noise.

Optimize the direct case to not do anything if there is no overlap with
the border.  Do a sanity check on the saveunder's coordinates.  This
requires a previous change to pass non-rounded coordinates.

7 years agoTrival style fix to previous commit to add this detail.
bde [Wed, 12 Apr 2017 17:38:00 +0000 (17:38 +0000)]
Trival style fix to previous commit to add this detail.

The previous commit also fixed the coordinates passed to the mouse
removal renderer.  The coordinates were rounded down to a character
boundary, and thus essentially unusable.  The renderer had to keep
track of the previous position, or clear a larger area.  The latter
is only safe in the border, which is all that needs special handling
anyway.

I think no renderer depends on the bug.  They have the following
handling:
- gfb sparc64: this seems to assume non-rounded coordinates
- gfb other: does nothing (seems to be missing border handling)
- vga text: does nothing (doesn't need border handling)
- vga planar: clears extras in the border, with some bugs.  The fixes
  will use the precise coordinates to optimize.
- vga direct: clears at the previous position with no check that it
  is active, and clears everything.  Checking finds this bug.
- others: are there any?

7 years agoFix removing of the mouse image in vga planar mode with 8x8 fonts, and
bde [Wed, 12 Apr 2017 17:06:24 +0000 (17:06 +0000)]
Fix removing of the mouse image in vga planar mode with 8x8 fonts, and
reduce hard-coded assumptions on font sizes so that the cursor size
can be more independent of the font size.  Moving the mouse in the
buggy mode left trails of garbage.

The mouse cursor currently has size 9x13 in all modes.  This can occupy
2x3 character cells with 8x8 fonts, but the algorithm was hard-coded
for only 2x2 character cells.  Rearrange to hard-code only a maximum
cursor size (now 10x16) and to not hard-code in the logic.  The number
of cells needed is now over-estimated in some cases.

2x3 character cells should also be used in text mode with 8x8 fonts
(except with large pixels, the cursor size should be reduced), but
hard-coding for 2x2 in the implementation makes it not very easy to
expand, and it practice it shifts out bits to reduce to 2x2.

In graphics modes, expansion is easier and there is no shifting out
for 9x13 cursors (but 9 is a limit for hard-coding for 2 8-bit VGA
cells wide).  A previous commit removed the same buggy hard-coding for
removal at a lower level in planar mode.  Another previous commit fixed
the much larger code for lower-level removal in direct mode; this is
independent of the font size so worked for 8x8 fonts.  Text mode always
depended on the higher-level removal here, and always worked since
everything was hard-coded consistently for 2x2 character cells.

7 years agoStart to use the User and Privileged execute-never bits in the arm64
andrew [Wed, 12 Apr 2017 16:28:40 +0000 (16:28 +0000)]
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.

Reviewed by: alc, kib (previous version)
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10360

7 years agoFix clobbering of the default attribute and the screen position in
bde [Wed, 12 Apr 2017 16:21:55 +0000 (16:21 +0000)]
Fix clobbering of the default attribute and the screen position in
scteken_init().  Move the internals of scteken_sync() into a local
function to help do this.

scteken_init() reset or adjusted the default attribute and screen
position at least 3 and 5 times, respectively.  Warm init shouldn't
do any more than reset the "input" state.
  (scterm-sc.c (which still works after minor editing), only resets
  the escape state and the saved cursor position, and then does a
  nearly-null sync of the current color.)

This mainly broke mode changes, and was most noticeable when the
background color is not teken's default (usually black).  Then the
screen gets cleared in the wrong color.  vidcontrol restores the
default normal attribute and tries to restore the default reverse
attribute.  vidcontrol doesn't clear the screen again after restoring
the attribute(s), and it is too late to do it there without flicker.
Now the default normal attribute is restored before the change affects
the rendering.

When the foreground color is not teken's default, clearing with the
wrong attributes gave strange cursor colors for some cursor types.

The default reverse attribute is not restored since it is unsupported.

2/3 of the clobbering was from 2 resetting window resizing calls.  The
second one is needed to restore the size, but must not reset.  Window
resizing also sanitizes the cursor position, and after the main reset
resets the window size, the cursor row would often be adjusted from
24 to 23 if it were not already reset to 0.  scteken_sync() is good
for restoring the window size and the cursor position in the correct
order, but was unusable at init time since scp->ts is not always
initialized then.  Adjust to use its internals.

I didn't notice any problems from the cursor reset.  The cursor should
be reset, and a previous fix was to reset it consistently a little
later.

Doing nothing for warm init works almost as well, if not better.  It
is not very useful to reset the escape state for mode changes, since
the reset is especially likely to be null then.  The escape state is
most likely to be non-initial and corrupted by its most normal uses
-- sloppy non-atomic output where a context switch or just mixing
stdout with stderr splits up escape sequences.

7 years agoUse the unprivileged variant of the load and store instructions most
andrew [Wed, 12 Apr 2017 12:34:27 +0000 (12:34 +0000)]
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.

MFC after: 1 week
Sponsored by: DARPA, AFRL

7 years agoOpenBSD 6.1 release added.
maxim [Wed, 12 Apr 2017 11:41:35 +0000 (11:41 +0000)]
OpenBSD 6.1 release added.

7 years agoInclude RISC-V target to universe build.
br [Wed, 12 Apr 2017 10:45:19 +0000 (10:45 +0000)]
Include RISC-V target to universe build.

Check if RISC-V external toolchain package is installed,
otherwise skip build.

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

7 years agoDisable fformat-extensions for RISC-V target as GCC 6.1 external compiler
br [Wed, 12 Apr 2017 10:40:30 +0000 (10:40 +0000)]
Disable fformat-extensions for RISC-V target as GCC 6.1 external compiler
has no support for that.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10348

7 years agoProvide a NULL pointer to device tree blob so GENERIC kernel
br [Wed, 12 Apr 2017 10:34:50 +0000 (10:34 +0000)]
Provide a NULL pointer to device tree blob so GENERIC kernel
can be compiled.
We will need to get pointer to DTB from hardware, so mark as TODO.

Sponsored by: DARPA, AFRL

7 years agortwn: remove out-of-bounds access + fix debug output.
avos [Wed, 12 Apr 2017 07:21:54 +0000 (07:21 +0000)]
rtwn: remove out-of-bounds access + fix debug output.

Omit unused rates while initializing / dumping Tx power values.

They were not accessed anywhere (except for debugging), so this is
(mostly) no-op.

Tested with
 * RTL8188EU, STA mode.
 * RTL8812AU, STA mode.

Found by: PVS-Studio

7 years agoMost wireless drivers don't support altq(4).
kevlo [Wed, 12 Apr 2017 01:15:33 +0000 (01:15 +0000)]
Most wireless drivers don't support altq(4).

7 years agoFix defects reported by Coverity
davidcs [Wed, 12 Apr 2017 00:52:09 +0000 (00:52 +0000)]
Fix defects reported by Coverity
1. Deadcode in ecore_init_cache_line_size(), qlnx_ioctl() and
qlnx_clean_filters()
2. ARRAY_VS_SINGLETON issue in qlnx_remove_all_mcast_mac() and
qlnx_update_rx_prod()

MFC after:5 days

7 years agoDon't throw away Open state when a NFSv4.1 client recovery fails.
rmacklem [Tue, 11 Apr 2017 22:47:02 +0000 (22:47 +0000)]
Don't throw away Open state when a NFSv4.1 client recovery fails.

If the ExchangeID/CreateSession operations done by an NFSv4.1 client
after the server crashes/reboots fails, it is possible that some process/thread
is waiting for an open_owner lock. If the client state is free'd, this
can cause a crash.
This would not normally happen, but has been observed on a mount of the
AmazonEFS service.

Reported by: cperciva
Tested by: cperciva
PR: 216086
MFC after: 2 weeks

7 years agoWork around an issue with mksnap_ffs not working in chroot'ed environment.
sobomax [Tue, 11 Apr 2017 21:55:39 +0000 (21:55 +0000)]
Work around an issue with mksnap_ffs not working in chroot'ed environment.
The problem is that the statfs(2) system call used to determine the relevant
mount point returns path within real root in the f_mntonname, causing
nmount(2) system call to fail with ENOENT.

Use a bit of heuristics to skip over few starting path elements when it
happens until we hit an actual mount point.

For this to work properly the whole mount should be accessible within the
chroot, it's going to still fail if chroot only has access to a part of the
mounted fs.

Reviewed by: mckusick
Approved by: mckusick
MFC after: 2 weeks

7 years agoDuring a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION
rmacklem [Tue, 11 Apr 2017 20:28:15 +0000 (20:28 +0000)]
During a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION
during recovery.

If the NFSv4.1 client gets a NFSv4.1 NFSERR_BADSESSION reply to an Open/Lock
operation while recovering from the server crash/reboot, allow the opens
to be retained for a subsequent recovery attempt. Since NFSv4.1 servers
should only reply NFSERR_BADSESSION after a crash/reboot that has lost
state, this case should almost never happen.
However, for the AmazonEFS file service, this has been observed when
the client does a fresh TCP connection for RPCs.

Reported by: cperciva
Tested by: cperciva
PR: 216088
MFC after: 2 weeks

7 years agoInherit IPv6 checksum offloading flags to vlan interfaces.
ae [Tue, 11 Apr 2017 19:23:25 +0000 (19:23 +0000)]
Inherit IPv6 checksum offloading flags to vlan interfaces.

if_vlan(4) interfaces inherit IPv4 checksum offloading flags from the
parent when VLAN_HWCSUM and VLAN_HWTAGGING flags are present on the
parent interface. Do the same for IPv6 checksum offloading flags.

Reported by: Harry Schmalzbauer
Reviewed by: np, gnn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10356

7 years agoMake sysctl identifiers for direct netisr queue unique.
ae [Tue, 11 Apr 2017 19:20:20 +0000 (19:20 +0000)]
Make sysctl identifiers for direct netisr queue unique.
Introduce IPCTL_INTRDQMAXLEN and IPCTL_INTRDQDROPS macros for this purpose.

Reviewed by: gnn
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D10358