]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
5 years agoMFC r321333:
bdrewery [Wed, 8 Aug 2018 18:59:25 +0000 (18:59 +0000)]
MFC r321333:

  Properly set userid for truncate_test.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337491 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r323620:
bdrewery [Wed, 8 Aug 2018 18:54:05 +0000 (18:54 +0000)]
MFC r323620:

  Fix the raise tests.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337486 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335183:
bdrewery [Wed, 8 Aug 2018 17:49:35 +0000 (17:49 +0000)]
MFC r335183:

  proc0_post: Fix some locking issues

git-svn-id: svn://svn.freebsd.org/base/stable/10@337471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoDocument SA-18:08.
gjb [Tue, 7 Aug 2018 15:03:11 +0000 (15:03 +0000)]
Document SA-18:08.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@337420 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337390: Bump date after r337384.
jtl [Mon, 6 Aug 2018 18:47:03 +0000 (18:47 +0000)]
MFC r337390: Bump date after r337384.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337392 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r337384:
jtl [Mon, 6 Aug 2018 17:46:28 +0000 (17:46 +0000)]
MFC r337384:

Address concerns about CPU usage while doing TCP reassembly.

Currently, the per-queue limit is a function of the receive buffer
size and the MSS.  In certain cases (such as connections with large
receive buffers), the per-queue segment limit can be quite large.
Because we process segments as a linked list, large queues may not
perform acceptably.

The better long-term solution is to make the queue more efficient.
But, in the short-term, we can provide a way for a system
administrator to set the maximum queue size.

We set the default queue limit to 100.  This is an effort to balance
performance with a sane resource limit.  Depending on their
environment, goals, etc., an administrator may choose to modify this
limit in either direction.

Approved by: so
Security: FreeBSD-SA-18:08.tcp
Sponsored by: CVE-2018-6922

git-svn-id: svn://svn.freebsd.org/base/stable/10@337386 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336926:
pfg [Mon, 6 Aug 2018 02:10:52 +0000 (02:10 +0000)]
MFC r336926:
sed: unsign some indexes to fix sign-compare warnings.

Hinted by: OpenBSD (CVS 1.32)

git-svn-id: svn://svn.freebsd.org/base/stable/10@337367 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFH r336801,r336854:
mm [Sun, 5 Aug 2018 14:36:12 +0000 (14:36 +0000)]
MFH r336801,r336854:

MFH r336801 (cem):
Cherry-pick upstream 2c8c83b9

Relevant vendor changes:
  Fix issue #948: out-of-bounds read in lha_read_data_none()

MFH r336854:
Sync libarchive with vendor.

Important vendor changes:
  PR #993: Chdir to -C directory for metalog processing
  OSS-Fuzz #4969: Check size of the extended time field in zip archives
  PR #973: Record informational compression level in gzip header

amdbugs: 877
Security: CVE-2017-14503

git-svn-id: svn://svn.freebsd.org/base/stable/10@337352 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336319:
asomers [Fri, 3 Aug 2018 14:47:47 +0000 (14:47 +0000)]
MFC r336319:

auditon(2): fix A_SETPOLICY with 64-bit values

A_SETPOLICY is supposed to work with either 64 or 32-bit values, but due to a
typo the 64-bit version has never worked correctly.

Submitted by: aniketp
Reviewed by: asomers, cem
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D16222

git-svn-id: svn://svn.freebsd.org/base/stable/10@337259 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336205:
asomers [Fri, 3 Aug 2018 14:45:53 +0000 (14:45 +0000)]
MFC r336205:

Don't acquire evclass_lock with a spinlock held

When the "pc" audit class is enabled and auditd is running, witness will
panic during thread exit because au_event_class tries to lock an rwlock
while holding a spinlock acquired upstack by thread_exit.

To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is
acquired. Of thread_exit's 16 callers, it's only necessary to call
AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit
(for exiting threads). The other callers are all kernel threads, which
needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls
there will be nothing to audit.  And exit1 already does call
AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that
case.

PR: 228444
Reported by: aniketp
Reviewed by: aniketp, kib
Differential Revision: https://reviews.freebsd.org/D16210

git-svn-id: svn://svn.freebsd.org/base/stable/10@337258 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335899:
asomers [Fri, 3 Aug 2018 14:37:23 +0000 (14:37 +0000)]
MFC r335899:

auditd(8): register signal handlers interrutibly

auditd_wait_for_events() relies on read(2) being interrupted by signals,
but it registers signal handlers with signal(3), which sets SA_RESTART.
That breaks asynchronous signal handling. It means that signals don't
actually get handled until after an audit(8) trigger is received.
Symptoms include:

* Sending SIGTERM to auditd doesn't kill it right away; you must send
  SIGTERM and then send a trigger with auditon(2).
* Same with SIGHUP
* Zombie child processes don't get reaped until auditd receives a trigger
  sent by auditon. This includes children created by expiring audit trails
  at auditd startup.

Fix by using sigaction(2) instead of signal(3).

Cherry pick https://github.com/openbsm/openbsm/commit/d060887

PR: 229381
Reviewed by: cem
Obtained from: OpenBSM
Differential Revision: https://github.com/openbsm/openbsm/pull/36

git-svn-id: svn://svn.freebsd.org/base/stable/10@337257 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335287, r335290
asomers [Fri, 3 Aug 2018 14:36:29 +0000 (14:36 +0000)]
MFC r335287, r335290

r335287:
praudit(1): return 0 on success

Cherry pick https://github.com/openbsm/openbsm/commit/ed83bb3

Submitted by: aniketp
Reviewed by: rwatson, 0mp
Obtained from: OpenBSM
Sponsored by: Google, Inc. (GSoC 2018)
Pull Request: https://github.com/openbsm/openbsm/pull/32

r335290:
praudit(1): add tests

Submitted by: aniketp
X-MFC-With: 335287
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15751

git-svn-id: svn://svn.freebsd.org/base/stable/10@337256 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334547:
asomers [Fri, 3 Aug 2018 14:25:15 +0000 (14:25 +0000)]
MFC r334547:

pty.3: Add a HISTORY section

These functions were first added in 4.3 BSD-Reno, according to
http://unix.superglobalmegacorp.com/ and the CSRG svn repository.

Reviewed by: bcr, bjk
Differential Revision: https://reviews.freebsd.org/D15652

git-svn-id: svn://svn.freebsd.org/base/stable/10@337254 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334394:
asomers [Fri, 3 Aug 2018 14:23:51 +0000 (14:23 +0000)]
MFC r334394:

auditpipe(4): fix some ioctl arguments in the man page

Fix the argument types for the AUDITPIPE_[GS]ET_PRESELECT_(NA)?FLAGS ioctls.
Also, fix some grammar.

[skip ci]

PR: 226713
Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15620

git-svn-id: svn://svn.freebsd.org/base/stable/10@337253 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334390:
asomers [Fri, 3 Aug 2018 14:23:01 +0000 (14:23 +0000)]
MFC r334390:

au_read_rec(3): correct return value in man page

Submitted by: aniketp
Reviewed by: csjp (earlier version)
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15618

git-svn-id: svn://svn.freebsd.org/base/stable/10@337252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334296:
asomers [Fri, 3 Aug 2018 14:22:16 +0000 (14:22 +0000)]
MFC r334296:

Fix "Bad tailq" panic when auditing auditon(A_SETCLASS, ...)

Due to an oversight in r195280, auditon(A_SETCLASS, ...) would cause a tailq
element to get added to the tailq twice, resulting in a circular tailq. This
panics when INVARIANTS are on.

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

git-svn-id: svn://svn.freebsd.org/base/stable/10@337251 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330720:
asomers [Fri, 3 Aug 2018 14:19:56 +0000 (14:19 +0000)]
MFC r330720:

tftpd: reject unknown opcodes

If tftpd receives a command with an unknown opcode, it simply exits 1.  It
doesn't send an ERROR packet, and the client will hang waiting for one.  Fix
it.

PR: 226005

git-svn-id: svn://svn.freebsd.org/base/stable/10@337250 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330719:
asomers [Fri, 3 Aug 2018 14:19:09 +0000 (14:19 +0000)]
MFC r330719:

tftpd: Abort on an WRQ access violation

On a WRQ (write request) tftpd checks whether the client has access
permission for the file in question.  If not, then the write is prevented.
However, tftpd doesn't reply with an ERROR packet, nor does it abort.
Instead, it tries to receive the packet anyway.

The symptom is slightly different depending on the nature of the error.  If
the target file is nonexistent and tftpd lacks permission to create it, then
tftpd will willingly receive the file, but not write it anywhere.  If the
file exists but is not writable, then tftpd will fail to ACK to WRQ.

PR: 225996

git-svn-id: svn://svn.freebsd.org/base/stable/10@337249 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330718:
asomers [Fri, 3 Aug 2018 14:18:02 +0000 (14:18 +0000)]
MFC r330718:

tftpd: Verify world-writability for WRQ when using relative paths

tftpd(8) says that files may only be written if they already exist and are
publicly writable.  tftpd.c verifies that a file is publicly writable if it
uses an absolute pathname.  However, if the pathname is relative, that check
is skipped.  Fix it.

Note that this is not a security vulnerability, because the transfer
ultimately doesn't work unless the file already exists and is owned by user
nobody.  Also, this bug does not affect the default configuration, because
the default uses the "-s" option which makes all pathnames absolute.

PR: 226004

git-svn-id: svn://svn.freebsd.org/base/stable/10@337248 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330710:
asomers [Fri, 3 Aug 2018 14:17:11 +0000 (14:17 +0000)]
MFC r330710:

tftpd: Flush files as soon as they are fully received

On an RRQ, tftpd doesn't exit as soon as it's finished receiving a file.
Instead, it waits five seconds just in case the client didn't receive the
server's last ACK and decides to resend the final DATA packet.
Unfortunately, this created a 5 second delay from when the client thinks
it's done sending the file, and when the file is available for other
processes.

Fix this bug by closing the file as soon as receipt is finished.

PR: 157700
Reported by: Barry Mishler <barry_mishler@yahoo.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@337247 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330696, r330709, r330742, r331358
asomers [Fri, 3 Aug 2018 14:13:15 +0000 (14:13 +0000)]
MFC r330696, r330709, r330742, r331358

r330696:
Add some functional tests for tftpd(8)

tftpd(8) is difficult to test in isolation due to its relationship with
inetd.  Create a test program that mimics the behavior of tftp(1) and
inetd(8) and verifies tftpd's response in several different scenarios.

These test cases cover all of the basic TFTP protocol, but not the optional
parts.

PR: 157700
PR: 225996
PR: 226004
PR: 226005
Differential Revision: https://reviews.freebsd.org/D14310

r330709:
Commit missing file from r330696

X-MFC-With: 330696

r330742:
tftpd: fix the build of tests on i386 after 330696

It's those darn printf format specifiers again

Reported by: cy, kibab
X-MFC-With: 330696

r331358:
tftpd: misc Coverity cleanup in the tests

A bunch of unchecked return values from open(2) and read(2)

Reported by: Coverity
CID: 138690013869111386926138692813869321386942
CID: 13869611386979
X-MFC-With: 330696

git-svn-id: svn://svn.freebsd.org/base/stable/10@337246 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336683:
kib [Fri, 3 Aug 2018 14:12:37 +0000 (14:12 +0000)]
MFC r336683:
Extend ranges of the critical sections to ensure that context switch
code never sees FPU pcb flags not consistent with the hardware state.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337245 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r328266:
asomers [Fri, 3 Aug 2018 14:08:39 +0000 (14:08 +0000)]
MFC r328266:

mlock(2): correct documentation for error conditions.

The man page is years out of date regarding errors. Our implementation _does_
allow unaligned addresses, and it _does_not_ check for negative lengths,
because the length is unsigned. It checks for overflow instead.

Update the tests accordingly.

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D13826

git-svn-id: svn://svn.freebsd.org/base/stable/10@337244 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r336357
rmacklem [Wed, 1 Aug 2018 19:25:12 +0000 (19:25 +0000)]
MFC: r336357
Modify the reasons for not issuing a delegation in the NFSv4.1 server.

The ESXi NFSv4.1 client will generate warning messages when the reason for
not issuing a delegation is two. Two refers to a resource limit and I do
not see why it would be considered invalid. However it probably was not the
best choice of reason for not issuing a delegation.
This patch changes the reasons used to ones that the ESXi client doesn't
complain about. This change does not affect the FreeBSD client and does
not appear to affect behaviour of the Linux NFSv4.1 client.
RFC5661 defines these "reasons" but does not give any guidance w.r.t. which
ones are more appropriate to return to a client.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337058 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r322596:
hselasky [Wed, 1 Aug 2018 13:13:43 +0000 (13:13 +0000)]
MFC r322596:
Add SI_SUB_TASKQ after SI_SUB_INTR and move taskqueue initialization there for EARLY_AP_STARTUP

This fixes a regression accidentally introduced in r322588, due to an
interaction with EARLY_AP_STARTUP.

Reviewed by: bdrewery@, jhb@
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12053

git-svn-id: svn://svn.freebsd.org/base/stable/10@337042 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r311169, r312975, r313080, r315718 and r316031:
hselasky [Wed, 1 Aug 2018 12:49:51 +0000 (12:49 +0000)]
MFC r311169, r312975, r313080, r315718 and r316031:

Add support for atomic_(f)cmpset to x86.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337041 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r321686 and r330361:
hselasky [Wed, 1 Aug 2018 11:08:52 +0000 (11:08 +0000)]
MFC r321686 and r330361:
Add inline functions to convert between sbintime_t and decimal time units.
Use them in some existing code that is vulnerable to roundoff errors.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330344:
hselasky [Wed, 1 Aug 2018 10:35:49 +0000 (10:35 +0000)]
MFC r330344:
Correct the return code from pause() during cold startup from zero to
EWOULDBLOCK. This also matches the description in pause(9).

Discussed with: kib@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r330349 and r330362:
hselasky [Wed, 1 Aug 2018 10:34:53 +0000 (10:34 +0000)]
MFC r330349 and r330362:

Allow pause_sbt() to catch signals during sleep by passing C_CATCH flag.
Define pause_sig() function macro helper similarly to other kernel functions
which catch signals. Update outdated function description.

Document pause_sig(9) and update prototypes for existing pause(9) and
pause_sbt(9) functions.

Discussed with: kib@
Suggested by: cem@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@337034 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r336215
rmacklem [Tue, 31 Jul 2018 21:02:45 +0000 (21:02 +0000)]
MFC: r336215
Ignore the cookie verifier for NFSv4.1 when the cookie is 0.

RFC5661 states that the cookie verifier should be 0 when the cookie is 0.
However, the wording is somewhat unclear and a recent discussion on the
nfsv4@ietf.org mailing list indicated that the NFSv4 server should ignore
the cookie verifier's value when the dirctory offset cookie is 0.
This patch deletes the check for this that would return NFSERR_BAD_COOKIE
when the verifier was not 0.
This was found during testing of the ESXi client against the NFSv4.1 server.

git-svn-id: svn://svn.freebsd.org/base/stable/10@337006 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRevert r335693, r335694, r335695 by eadler.
markj [Tue, 31 Jul 2018 00:37:25 +0000 (00:37 +0000)]
Revert r335693, r335694, r335695 by eadler.

They cause mail(1) to crash in certain scenarios.

PR: 230196
Reported by: Pete French <petefrench@ingresso.co.uk>

git-svn-id: svn://svn.freebsd.org/base/stable/10@336953 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r335866
rmacklem [Mon, 30 Jul 2018 19:29:31 +0000 (19:29 +0000)]
MFC: r335866
Fix the server side krpc so that the kernel nfsd threads terminate.

Occationally the kernel nfsd threads would not terminate when a SIGKILL
was posted for the kernel process (called nfsd (slave)). When this occurred,
the thread associated with the process (called "ismaster") had returned from
svc_run_internal() and was sleeping waiting for the other threads to terminate.
The other threads (created by kthread_start()) were still in svc_run_internal()
handling NFS RPCs.
The only way this could occur is for the "ismaster" thread to return from
svc_run_internal() without having called svc_exit().
There was only one place in the code where this could happen and this patch
stops that from happening.
Since the problem is intermittent, I cannot be sure if this has fixed the
problem, but I have not seen an occurrence of the problem with this patch
applied.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334966
rmacklem [Mon, 30 Jul 2018 12:17:10 +0000 (12:17 +0000)]
MFC: r334966
Add a couple of safety belt checks to the NFSv4.1 client related to sessions.

There were a couple of cases in newnfs_request() that it assumed that it
was an NFSv4.1 mount with a session. This should always be the case when
a Sequence operation is in the reply or the server replies NFSERR_BADSESSION.
However, if a server was broken and sent an erroneous reply, these safety
belt checks should avoid trouble.
The one check required a small tweak to nfsmnt_mdssession() so that it
returns NULL when there is no session instead of the offset of the field
in the structure (0x8 for i386).
This patch should have no effect on normal operation of the client.
Found by inspection during pNFS server development.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336632:
hselasky [Mon, 30 Jul 2018 09:28:00 +0000 (09:28 +0000)]
MFC r336632:
Update modify counter when setting a mixer control.

PR: 229969

git-svn-id: svn://svn.freebsd.org/base/stable/10@336890 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335700:
hselasky [Mon, 30 Jul 2018 09:21:19 +0000 (09:21 +0000)]
MFC r335700:
Improve the kernel's USB descriptor reading function.
Some USB devices does not allow a partial descriptor readout.

Found by: bz@
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@336887 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335669:
hselasky [Mon, 30 Jul 2018 09:16:47 +0000 (09:16 +0000)]
MFC r335669:
Improve the userspace USB string reading function in LibUSB.
Some USB devices does not allow a partial descriptor readout.

Found by: bz @
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@336884 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334492
rmacklem [Sat, 28 Jul 2018 20:38:08 +0000 (20:38 +0000)]
MFC: r334492
Add the BindConnectiontoSession operation to the NFSv4.1 server.

Under some fairly unusual circumstances, the Linux NFSv4.1 client is
doing a BindConnectiontoSession operation for TCP connections.
It is also used by the ESXi6.5 NFSv4.1 client.
This patch adds this operation to the NFSv4.1 server.

PR: 226493

git-svn-id: svn://svn.freebsd.org/base/stable/10@336846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336457:
dab [Mon, 23 Jul 2018 18:47:04 +0000 (18:47 +0000)]
MFC r336457:

Make the definition of struct kevent in event.h match what the man page for kevent(2) says.

This is a trivial comment-only fix. The man page for kevent(2) gives
the definition of struct kevent, including a comment on each
field. The actual definition in sys/event.h omitted the comments on
some fields. Add the comments in. Not only does this make the man page
and include file agree, but the comments are useful in and of
themselves.

Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@336647 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: 336426
dexuan [Mon, 23 Jul 2018 17:38:35 +0000 (17:38 +0000)]
MFC: 336426

    r336426
        hyperv/hn: Fix panic in hypervisor code upon device detach event

        Submitted by:       hselasky
        Reviewed by:        dexuan
        Differential Revision:      https://reviews.freebsd.org/D16139

git-svn-id: svn://svn.freebsd.org/base/stable/10@336644 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333766
rmacklem [Thu, 19 Jul 2018 21:07:39 +0000 (21:07 +0000)]
MFC: r333766
Add a missing nfsrv_freesession() call for an unlikely failure case.

Since NFSv4.1 clients normally create a single session which supports
both fore and back channels, it is unlikely that a callback will fail
due to a lack of a back channel.
However, if this failure occurred, the session wasn't being dereferenced
and would never be free'd.
Found by inspection during pNFS server development.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336518 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRetrospectively document SVN branch point for stable-10 and its releases.
peterj [Wed, 18 Jul 2018 09:32:43 +0000 (09:32 +0000)]
Retrospectively document SVN branch point for stable-10 and its releases.

This is a direct commit to stable/10 because the releases are taken
from the stable/10 branch.

Approved by: jhb (mentor)
Differential Revision: D16263

git-svn-id: svn://svn.freebsd.org/base/stable/10@336448 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoPull in r211155 from upstream llvm trunk (by Tim Northover):
dim [Tue, 17 Jul 2018 21:10:31 +0000 (21:10 +0000)]
Pull in r211155 from upstream llvm trunk (by Tim Northover):

  DAG: move sret demotion into most basic LowerCallTo implementation.

  It looks like there are two versions of LowerCallTo here: the
  SelectionDAGBuilder one is designed to operate on LLVM IR, and the
  TargetLowering one in the case where everything is at DAG level.

  Previously, only the SelectionDAGBuilder variant could handle
  demoting an impossible return to sret semantics (before delegating to
  the TargetLowering version), but this functionality is also useful
  for certain libcalls (e.g. 128-bit operations on 32-bit x86).  So
  this commit moves the sret handling down a level.

  rdar://problem/17242889

This should fix "Call result #3 has unhandled type i32" errors when
building devel/libslang2 for i386.  Direct commit to stable/10, since
clang 3.5 and later already have this change.

Reported by: mi
PR: 229754

git-svn-id: svn://svn.freebsd.org/base/stable/10@336429 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333645
rmacklem [Tue, 17 Jul 2018 19:26:17 +0000 (19:26 +0000)]
MFC: r333645
End grace for the NFSv4 server if all mounts do ReclaimComplete.

The NFSv4 protocol requires that the server only allow reclaim of state
and not issue any new open/lock state for a grace period after booting.
The NFSv4.0 protocol required this grace period to be greater than the
lease duration (over 2minutes). For NFSv4.1, the client tells the server
that it has done reclaiming state by doing a ReclaimComplete operation.
If all NFSv4 clients are NFSv4.1, the grace period can end once all the
clients have done ReclaimComplete, shortening the time period considerably.
This patch does this. If there are any NFSv4.0 mounts, the grace period
will still be over 2minutes.
This change is only an optimization and does not affect correct operation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r336115;
pfg [Mon, 16 Jul 2018 00:28:33 +0000 (00:28 +0000)]
MFC r336115;
libiconv: correct undefined behavior.

Detected on NetBSD:
# nm /usr/lib/libc.so|grep sanit
    /public/src.git/lib/libc/citrus/modules/citrus_mapper_std.c:173:8:
runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Obtained from: NetBSD (CVS Rev. 1.11)

git-svn-id: svn://svn.freebsd.org/base/stable/10@336324 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333579
rmacklem [Thu, 12 Jul 2018 22:59:02 +0000 (22:59 +0000)]
MFC: r333579
The NFSv4.1 server should return NFSERR_BACKCHANBUSY instead of NFS_OK.

When an NFSv4.1 session is busy due to a callback being in progress,
nfsrv_freesession() should return NFSERR_BACKCHANBUSY instead of NFS_OK.
The only effect this has is that the DestroySession operation will report
the failure for this case and this probably has little or no effect on a
client. Spotted by inspection and no failures related to this have been
reported.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336234 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335765, r335776, r336186:
dab [Wed, 11 Jul 2018 14:56:38 +0000 (14:56 +0000)]
MFC r335765, r335776, r336186:

Remove potential identifier conflict in the EV_SET macro.

PR43905 pointed out a problem with the EV_SET macro if the passed
struct kevent pointer were specified with an expression with side
effects (e.g., "kevp++"). This was fixed in rS110241, but by using a
local block that defined an internal variable (named "kevp") to get
the pointer value once. This worked, but could cause issues if an
existing variable named "kevp" is in scope. To avoid that issue,
jilles@ pointed out that "C99 compound literals and designated
initializers allow doing this cleanly using a macro". This change
incorporates that suggestion, essentially verbatim from jilles@
comment on PR43905, except retaining the old definition for pre-C99 or
non-STDC (e.g., C++) compilers.

PR: 43905
Submitted by: Jilles Tjoelker (jilles@)
Reported by: Lamont Granquist <lamont@scriptkiddie.org>
Sponsored by: Dell EMC

git-svn-id: svn://svn.freebsd.org/base/stable/10@336200 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333508
rmacklem [Tue, 10 Jul 2018 19:37:52 +0000 (19:37 +0000)]
MFC: r333508
Add support for the TestStateID operation to the NFSv4.1 server.

The Linux client now uses the TestStateID operation, so this patch adds
support for it to the NFSv4.1 server. The FreeBSD client never uses this
operation, so it should not be affected.

git-svn-id: svn://svn.freebsd.org/base/stable/10@336179 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335921:
jamie [Fri, 6 Jul 2018 19:10:07 +0000 (19:10 +0000)]
MFC r335921:

  Allow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
   sockstat(1), ugidfw(8)
  These are the last of the jail-aware userland utilities that didn't work
   with names.

PR: 229266
Differential Revision: D16047

git-svn-id: svn://svn.freebsd.org/base/stable/10@336039 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r306098 (br): Use kqueue(2) instead of select(2).
emaste [Wed, 4 Jul 2018 18:03:19 +0000 (18:03 +0000)]
MFC r306098 (br): Use kqueue(2) instead of select(2).

This helps to ensure we will not lose SIGINT sent by parent to child.

PR: 212562, 228492

git-svn-id: svn://svn.freebsd.org/base/stable/10@335965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335575, r335786
ian [Wed, 4 Jul 2018 14:12:09 +0000 (14:12 +0000)]
MFC r335575, r335786

r335575:
Use 'mv -f' in rc.d/ntpd to avoid spuriously halting the boot.

The final 'mv' to install a fetched leap-list file can fail (due to a
readonly fs, or schg flags, for example), and that leads to mv(1)
prompting the user, stopping the boot process.  Instead, use mv -f
to supress the prompting, and if verbose mode is on, emit a warning
that the existing file cannot be replaced.

PR: 219255

r335786:
Rename variable ntp_tmp_leapfile to have a leading underbar, to distinguish
it from variables with similar names which are set in rc.conf.  This will
make more sense as the script grows more similar-name local variables in
some upcoming changes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335595-r335596
ian [Wed, 4 Jul 2018 14:10:36 +0000 (14:10 +0000)]
MFC r335595-r335596

r335595:
Modernize usage of "restrict" keyword in ntp.conf

It is no longer necessary to specify a -4/-6 flag on any ntp.conf
keyword.  The address type is inferred from the address itself as
necessary.  "restrict default" statements always apply to both address
families regardless of any -4/-6 flag that may be present.

So this change just tidies up our default config by removing the redundant
restrict -6 statement and comment, and by removing the -6 flag from the
restrict keyword that allows access from localhost.

This change was inspired by the patches provided in PRs 201803 and 210245,
and included some contrib/ntp code inspection to verify that the -4/-6
keywords are basically no-ops in all contexts now.

PR: 201803 210245
Differential Revision: https://reviews.freebsd.org/D15974

r335596:
Fix a comment; the ntp leaplist file is updated periodically, but not weekly
(it's only updated when a check shows it's within 30 days of expiring).

PR: 207138

git-svn-id: svn://svn.freebsd.org/base/stable/10@335950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC SVN r335750: Fix typo in top-level Makefile
dteske [Wed, 4 Jul 2018 03:24:11 +0000 (03:24 +0000)]
MFC SVN r335750: Fix typo in top-level Makefile

Submitted by: Ben Widawsky <ben.widawsky@intel.com>
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/P186

git-svn-id: svn://svn.freebsd.org/base/stable/10@335927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC SVN r290340: Fix typo in error message
dteske [Tue, 3 Jul 2018 22:11:16 +0000 (22:11 +0000)]
MFC SVN r290340: Fix typo in error message

Submitted by: git_johnko.ca (John Ko)
Sponsored by: Smule, Inc.
Differential Revision: https://reviews.freebsd.org/D3997

git-svn-id: svn://svn.freebsd.org/base/stable/10@335914 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r327317:
robak [Tue, 3 Jul 2018 14:57:11 +0000 (14:57 +0000)]
MFC r327317:

humanize_number(3): fix math edge case in rounding large numbers

Fix for remainder overflow, when in rare cases adding remainder to divider
exceeded 1 and turned the total to 1000 in final formatting, taking up
the space for the unit character.

The fix continues the division of the original number if the above case
happens -- added the appropriate check to the for loop performing
the division. This lowers the value shown, to make it fit into the buffer
space provided (1.0M for 4+1 character buffer, as used by ls).

Add test case for the reported bug and extend test program to support
providing buffer length (ls -lh uses 5, tests hard-coded 4).

PR: 224498

git-svn-id: svn://svn.freebsd.org/base/stable/10@335891 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335641:
brooks [Thu, 28 Jun 2018 21:23:05 +0000 (21:23 +0000)]
MFC r335641:

Fix a stack overflow in mount_smbfs when hostname is too long.

The local hostname was blindly copied into the to the nn_name array.
When the hostname exceeded 16 bytes, it would overflow.  Truncate the
hostname to 15 bytes plus a 0 terminator which is the "workstation name"
suffix.

Use defensive strlcpy() when filling nn_name in all cases.

PR: 228354
Reported by: donald.buchholz@intel.com
Reviewed by: jpaetzel,  ian (prior version)
Discussed with: Security Officer (gtetlow)
Security: Stack overflow with the hostname.
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15936

git-svn-id: svn://svn.freebsd.org/base/stable/10@335781 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoAdd mergeinfo for MFC r335607
dteske [Thu, 28 Jun 2018 07:01:56 +0000 (07:01 +0000)]
Add mergeinfo for MFC r335607

This is a direct commit on stable/10 accounting for missing mergeinfo from
SVN r335744. Difficulties with dealing with 'stand' vs 'sys/boot' in MFCs.

Reported by: kevans
Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335758 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335607: check-password.4th(8): Fix manual [in]accuracy
dteske [Wed, 27 Jun 2018 21:22:00 +0000 (21:22 +0000)]
MFC r335607: check-password.4th(8): Fix manual [in]accuracy

SVN r280384 updated the maximum password length from 16 bytes to 255. The
manual was not updated to reflect this.

Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335355:
cy [Wed, 27 Jun 2018 19:42:55 +0000 (19:42 +0000)]
MFC r335355:

Fix amq -i timestamp segmentation violation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335734 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r302776, r302799:
eadler [Wed, 27 Jun 2018 04:56:01 +0000 (04:56 +0000)]
MFC r302776, r302799:

mail(1): Bring some fixes from other BSDs.

- Use varargs properly
- Use pid_t
- Better handling of error conditions on forked jobs.
- Some prototype and warning cleanups.

Fix missing forked job changes from r302776 in wait_child().

git-svn-id: svn://svn.freebsd.org/base/stable/10@335694 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r325107, r335665:
gjb [Tue, 26 Jun 2018 16:16:08 +0000 (16:16 +0000)]
MFC r325107, r335665:
 r325107 (eadler, partial):
  Update the updating URL in UPDATING.

 r335665:
  Use the 'Updating from Source' Handbook section in UPDATING.

PR: 229345
Submitted by: Niels Bakker
Approved by: re (marius, insta-MFC)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@335670 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334002: uchcom: extend hardware support to version 0x30
avg [Mon, 25 Jun 2018 08:57:03 +0000 (08:57 +0000)]
MFC r334002: uchcom: extend hardware support to version 0x30

git-svn-id: svn://svn.freebsd.org/base/stable/10@335627 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334001: uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1
avg [Mon, 25 Jun 2018 08:55:19 +0000 (08:55 +0000)]
MFC r334001: uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1

git-svn-id: svn://svn.freebsd.org/base/stable/10@335625 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334000: uchcom: reject parity and double stop bits as unsupported
avg [Mon, 25 Jun 2018 08:53:30 +0000 (08:53 +0000)]
MFC r334000: uchcom: reject parity and double stop bits as unsupported

git-svn-id: svn://svn.freebsd.org/base/stable/10@335623 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333999: uchcom: add a hardware configuration tweak seen in Linux code
avg [Mon, 25 Jun 2018 08:50:46 +0000 (08:50 +0000)]
MFC r333999: uchcom: add a hardware configuration tweak seen in Linux code

git-svn-id: svn://svn.freebsd.org/base/stable/10@335621 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333998: uchcom: add DPRINTF-s to aid debugging of the driver
avg [Mon, 25 Jun 2018 08:49:13 +0000 (08:49 +0000)]
MFC r333998: uchcom: add DPRINTF-s to aid debugging of the driver

git-svn-id: svn://svn.freebsd.org/base/stable/10@335619 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333997: uchcom: report detected product based on USB product ID
avg [Mon, 25 Jun 2018 08:47:54 +0000 (08:47 +0000)]
MFC r333997: uchcom: report detected product based on USB product ID

git-svn-id: svn://svn.freebsd.org/base/stable/10@335617 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333667: followup to r332730/r332752: set kdb_why to "trap" for fatal traps
avg [Fri, 22 Jun 2018 11:16:17 +0000 (11:16 +0000)]
MFC r333667: followup to r332730/r332752: set kdb_why to "trap" for fatal traps

This change updates arm, arm64 and mips achitectures.  Additionally, it
removes redundant checks for kdb_active where it already results in
kdb_reenter() and adds kdb_reenter() calls where they were missing.

Some architectures check the return value of kdb_trap(), but some don't.
I haven't changed any of that.

Some trap handling routines have a return code.  I am not sure if I
provided correct ones for returns after kdb_reenter().  kdb_reenter
should never return unless kdb_jmpbufp is NULL for some reason.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoRevert r335546 as temporary pool name feature has not been merged
avg [Fri, 22 Jun 2018 10:13:15 +0000 (10:13 +0000)]
Revert r335546 as temporary pool name feature has not been merged

git-svn-id: svn://svn.freebsd.org/base/stable/10@335549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333630: Fix 'zpool create -t <tempname>'
avg [Fri, 22 Jun 2018 09:41:13 +0000 (09:41 +0000)]
MFC r333630: Fix 'zpool create -t <tempname>'

Creating a pool with a temporary name fails when we also specify custom
dataset properties: this is because we mistakenly call
zfs_set_prop_nvlist() on the "real" pool name which, as expected,
cannot be found because the SPA is present in the namespace with the
temporary name.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335546 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333269: amdsbwd: fix reboot status reporting
avg [Fri, 22 Jun 2018 09:26:05 +0000 (09:26 +0000)]
MFC r333269: amdsbwd: fix reboot status reporting

git-svn-id: svn://svn.freebsd.org/base/stable/10@335543 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333243: opensolaris system_taskq does not need to run at maximum priority
avg [Fri, 22 Jun 2018 09:23:06 +0000 (09:23 +0000)]
MFC r333243: opensolaris system_taskq does not need to run at maximum priority

git-svn-id: svn://svn.freebsd.org/base/stable/10@335541 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333212: amdsbwd: add suspend and resume methods
avg [Fri, 22 Jun 2018 09:20:50 +0000 (09:20 +0000)]
MFC r333212: amdsbwd: add suspend and resume methods

git-svn-id: svn://svn.freebsd.org/base/stable/10@335538 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333209: hpet: use macros instead of magic values for the timer mode
avg [Fri, 22 Jun 2018 09:09:59 +0000 (09:09 +0000)]
MFC r333209: hpet: use macros instead of magic values for the timer mode

git-svn-id: svn://svn.freebsd.org/base/stable/10@335534 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335308: bsdconfig: Fix a bug when editing users
dteske [Thu, 21 Jun 2018 15:02:17 +0000 (15:02 +0000)]
MFC r335308: bsdconfig: Fix a bug when editing users

The usermgmt API was stomping on a global ($user_gid to be specific)
so things would appear to work fine until you tried to make a second
pass into the API with the now-tainted variable contents.

Fixed by localizing menu-specific contents as to not leak outside API.

PR: bin/208774
Reported by: Martin Waschbuesch <martin@waschbuesch.de>
Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335487 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335133:
ae [Thu, 21 Jun 2018 11:24:20 +0000 (11:24 +0000)]
MFC r335133:
  In m_megapullup() use m_getjcl() to allocate 9k or 16k mbuf when requested.

  It is better to try allocate a big mbuf, than just silently drop a big
  packet. A better solution could be reworking of libalias modules to be
  able use m_copydata()/m_copyback() instead of requiring the single
  contiguous buffer.

  PR: 229006

git-svn-id: svn://svn.freebsd.org/base/stable/10@335474 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r335072, r335089, r335131, r335132:
kib [Wed, 20 Jun 2018 18:51:38 +0000 (18:51 +0000)]
MFC r335072, r335089, r335131, r335132:
Enable eager FPU context switch on i386 and amd64.

CVE:  CVE-2018-3665
Tested by: emaste (smoke boot)

git-svn-id: svn://svn.freebsd.org/base/stable/10@335455 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agodpv(3): MFC r330943, r335264
dteske [Wed, 20 Jun 2018 05:50:54 +0000 (05:50 +0000)]
dpv(3): MFC r330943, r335264

r330943:
Fix bad error messages from dpv(3)

Before = dpv: <__func__>: posix_spawnp(3): No such file or directory
 After = dpv: <path/cmd>: No such file or directory

Most notably, show the 2nd argument being passed to posix_spawnp(3)
so we know what path/cmd failed.

Also, we don't need to have "posix_spawnp(3)" in the error message
nor the function because that can [a] change and [b] traversed using
a debugger if necessary.

r335264:
Fix comparison between pointer and char literal

PR: misc/204252
Reported by: David Binderman <dcb314@hotmail.com>
Sponsored by: Smule, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@335407 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoFollow-up to r335289, which merged r334948 from head, to really fix the
dim [Mon, 18 Jun 2018 20:42:53 +0000 (20:42 +0000)]
Follow-up to r335289, which merged r334948 from head, to really fix the
bxe build on i386.  In the stable/10 branch, the rman functions still
use u_long instead of uintmax_t (this was changed in r294883 and
r297000), so these have to be printed using the l modifier instead.

Pointy hat to: me
Noticed by: gjb

git-svn-id: svn://svn.freebsd.org/base/stable/10@335340 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334948:
dim [Sun, 17 Jun 2018 17:28:27 +0000 (17:28 +0000)]
MFC r334948:

Fix build of bxe with base gcc on i386

Casting from rman_res_t to a pointer results in "cast to pointer from
integer of different size" warnings with base gcc on i386, so print
these without casting.  The kva field of struct bxe_bar is of type
vm_offset_t, which can be 32 or 64 bit, so cast it to uintmax_t before
printing.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D15733

git-svn-id: svn://svn.freebsd.org/base/stable/10@335289 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334876:
kp [Sat, 16 Jun 2018 11:42:27 +0000 (11:42 +0000)]
MFC r334876:

pf: Fix deadlock with route-to

If a locally generated packet is routed (with route-to/reply-to/dup-to) out of
a different interface it's passed through the firewall again. This meant we
lost the inp pointer and if we required the pointer (e.g. for user ID matching)
we'd deadlock trying to acquire an inp lock we've already got.

Pass the inp pointer along with pf_route()/pf_route6().

PR: 228782

git-svn-id: svn://svn.freebsd.org/base/stable/10@335252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333374:
gjb [Mon, 11 Jun 2018 17:22:27 +0000 (17:22 +0000)]
MFC r333374:
 Use vYYYYMMDD in the timestamp suffix for Google Compute Engine
 snapshot images for consistency with other OSes.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@334963 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r334158:
hselasky [Thu, 7 Jun 2018 07:33:46 +0000 (07:33 +0000)]
MFC r334158:
Add function to wait for USB ethernet attach to complete.

Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@334758 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333580
rmacklem [Wed, 6 Jun 2018 22:18:24 +0000 (22:18 +0000)]
MFC: r333580
Fix a slow leak of session structures in the NFSv4.1 server.

For a fairly rare case of a client doing an ExchangeID after a hard reboot,
the old confirmed clientid still exists, but some clients use a new
co_verifier. For this case, the server was not freeing up the sessions on
the old confirmed clientid.
This patch fixes this case. It also adds two LIST_INIT() macros, which are
actually no-ops, since the structure is malloc()d with M_ZERO so the pointer
is already set to NULL.
It should have minimal impact, since the only way I could exercise this
code path was by doing a hard power cycle (pulling the plus) on a machine
running Linux with a NFSv4.1 mount on the server.
Originally spotted during testing of the ESXi 6.5 client.

PR: 228497

git-svn-id: svn://svn.freebsd.org/base/stable/10@334741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334396
rmacklem [Wed, 6 Jun 2018 01:30:48 +0000 (01:30 +0000)]
MFC: r334396
Strengthen locking for the NFSv4.1 server DestroySession operation.

If a client did a DestroySession on a session while it was still in use,
the server might try to use the session structure after it is free'd.
I think the client has violated RFC5661 if it does this, but this patch
makes DestroySession block all other nfsd threads so no thread could
be using the session when it is free'd. After the DestroySession, nfsd
threads will not be able to find the session. The patch also adds a check
for nd_sessionid being set, although if that was not the case it would have
been all 0s and unlikely to have a false match.
This might fix the crashes described in PR#228497 for the FreeNAS server.

PR: 228497

git-svn-id: svn://svn.freebsd.org/base/stable/10@334699 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r334252
rmacklem [Mon, 4 Jun 2018 20:55:25 +0000 (20:55 +0000)]
MFC: r334252
Fix the sleep event for layout recall.

The sleep for I/O completion during an NFSv4.1 pNFS layout recall used
the wrong event value and could result in the "[nfscl]" thread hung
for the mount.
This patch fixes the event to be the correct.
This bug will only affect NFSv4.1 pnfs mounts and only when the server
does a layout recall callback, so it won't affect many. Without the patch,
a mount without the "pnfs" option will avoid the problem.
Found during testing of the pNFS server.

git-svn-id: svn://svn.freebsd.org/base/stable/10@334635 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC: r333592
rmacklem [Mon, 4 Jun 2018 20:40:22 +0000 (20:40 +0000)]
MFC: r333592
Fix the eir_server_scope reply argument for NFSv4.1 ExchangeID.

In the reply to an ExchangeID operation, the NFSv4.1 server returns a
"scope" value (eir_server_scope). If this value is the same, it indicates
that two servers share state, which is never the case for FreeBSD servers.
As such, the value needs to be unique and it was without this patch.
However, I just found out that it is not supposed to change when the
server reboots and without this patch, it did change.
This patch fixes eir_server_scope so that it does not change when the
server is rebooted.
The only affect not having this patch has is that Linux clients don't
reclaim opens and locks after a server reboot, which meant they lost
any byte range locks held before the server rebooted.
It only affects NFSv4.1 mounts and the FreeBSD NFSv4.1 client was not
affected by this bug.

git-svn-id: svn://svn.freebsd.org/base/stable/10@334633 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333098:
delphij [Mon, 4 Jun 2018 05:47:15 +0000 (05:47 +0000)]
MFC r333098:

Don't bail out from the check if readboot() returns !FSFATAL.

This can happen when the fsinfo signature is invalid, and the
user have choose to fix it, in which case the code would return
FSBOOTMOD (not FSOK but not FSFATAL either).

All other (fatal) cases would return FSFATAL.

Obtained from: Android Open Source Project
Obtained from: https://android.googlesource.com/platform/external/fsck_msdos/+/d8775a29ea7eac2e5f1504dd21da3725b93b3036

git-svn-id: svn://svn.freebsd.org/base/stable/10@334606 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r292268, r334176
brooks [Thu, 31 May 2018 16:10:44 +0000 (16:10 +0000)]
MFC r292268, r334176

r292268:
Remove sys/types.h due to STANDARDS and unistd.h also includes
sys/types.h.

r334176:
Indicate the brk/sbrk are deprecated and not portable.

More firmly suggest mmap(2) instead.

Include the history of arm64 and riscv shipping without brk/sbrk.

Mention that sbrk(0) produces unreliable results.

Reviewed by: emaste, Marcin Cieślak
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15535

git-svn-id: svn://svn.freebsd.org/base/stable/10@334440 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoActivate Wake On Lan features for Ice Lake and Cannon Lake devices.
sbruno [Sat, 26 May 2018 21:58:43 +0000 (21:58 +0000)]
Activate Wake On Lan features for Ice Lake and Cannon Lake devices.

This is a direct commit to stable/10 as its not needed in -current.

PR: 228302
Submitted by: Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>

git-svn-id: svn://svn.freebsd.org/base/stable/10@334251 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333392-r333393, r333427
cy [Fri, 25 May 2018 06:26:07 +0000 (06:26 +0000)]
MFC r333392-r333393, r333427

r333392:
Fix memory leak. (CID 1199373).

r333393:
Document intentional fallthrough. (CID 976535)

r333427:
Fix style error introduced in r333393.

Reported by: jhb, imp, phk

git-svn-id: svn://svn.freebsd.org/base/stable/10@334202 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r326074: filter all passwords (not only changed) from periodic passwd backup
emaste [Wed, 23 May 2018 14:05:56 +0000 (14:05 +0000)]
MFC r326074: filter all passwords (not only changed) from periodic passwd backup

The periodic 200.backup-passwd script outputs any differences it finds
in master.passwd, relative to the previous backup.  It intends to elide
the encrypted password field, but previously did so only for changed
lines (i.e., those beginning with - or + in the diff).

Apply the sed expression also to unchanged lines to also elide their
passwords.

PR: 223461
Reported by: Andre Albsmeier
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@334097 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agosys/modules: don't build bxe,qlxgbe if the user objects to sourceless ucode
emaste [Wed, 23 May 2018 13:59:37 +0000 (13:59 +0000)]
sys/modules: don't build bxe,qlxgbe if the user objects to sourceless ucode

MFC of r322682 and r322684

PR: 204747
Submitted by: Fabian Keil
Obtained from: ElectroBSD

git-svn-id: svn://svn.freebsd.org/base/stable/10@334096 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r303848
sbruno [Tue, 15 May 2018 13:19:00 +0000 (13:19 +0000)]
MFC r303848

Repair trivial panic in ng_uncallout.  Fixes bugzilla #211031

PR: 211031

git-svn-id: svn://svn.freebsd.org/base/stable/10@333629 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333239:
pfg [Mon, 14 May 2018 19:21:57 +0000 (19:21 +0000)]
MFC r333239:
msdosfs: long names of files are created incorrectly.

This fixes a regression that happened in r120492 (2003) where libkiconv
was introduced and we went from checking unlen to checking for '\0'.

PR: 111843
Patch by: Damjan Jovanovic

git-svn-id: svn://svn.freebsd.org/base/stable/10@333611 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333473:
gjb [Mon, 14 May 2018 17:44:02 +0000 (17:44 +0000)]
MFC r333473:
 Add a special GCE_LICENSE variable to Makefile.gce, which when set,
 will include license metadata in the resultant GCE image.

 GCE_LICENSE is unset by default, as it primarily pertains to images
 produced by the FreeBSD Project, but for downstream FreeBSD consumers,
 it can be set in the make(1) environment in the format of:

   --licenses="projects/PROJECT_ID/global/licenses/LICENSE_NAME"

 The "license" is not a license, per se, but required metadata that
 is required by the GCE marketplace.  For the FreeBSD Project, the
 license name is simply 'freebsd', with the description of 'FreeBSD'.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@333608 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333004
davidcs [Wed, 9 May 2018 20:18:23 +0000 (20:18 +0000)]
MFC r333004
Fix Issue with adding MUltiCast Addresses. When multicast addresses are
added/deleted, the delete the multicast addresses previously programmed
in HW and reprogram the new set of multicast addresses.

Submitted by:Vaishali.Kulkarni@cavium.com

git-svn-id: svn://svn.freebsd.org/base/stable/10@333431 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333003
davidcs [Wed, 9 May 2018 18:35:49 +0000 (18:35 +0000)]
MFC r333003
Upgraded FW Related Files to version 5.4.67

git-svn-id: svn://svn.freebsd.org/base/stable/10@333422 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoBelatedly bump copyright year.
gjb [Tue, 8 May 2018 18:03:08 +0000 (18:03 +0000)]
Belatedly bump copyright year.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@333377 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoDocument EN-18:05, EN-18:06, SA-18:06.
gjb [Tue, 8 May 2018 17:59:25 +0000 (17:59 +0000)]
Document EN-18:05, EN-18:06, SA-18:06.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@333376 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

5 years agoMFC r333368: Prepare DB# handler for deferred trigger of watchpoints.
emaste [Tue, 8 May 2018 17:05:39 +0000 (17:05 +0000)]
MFC r333368: Prepare DB# handler for deferred trigger of watchpoints.

Prepare DB# handler for deferred trigger of watchpoints.

Since pop %ss/mov %ss instructions defer all interrupts and exceptions
for the next instruction, it is possible that the userspace watchpoint
trap executes on the first instruction of the kernel entry for
syscall/bpt.

In this case, DB# should be treated similarly to NMI: on amd64 we must
always load GSBASE even if the trap comes from kernel mode, and load
the kernel page table root into %cr3.  Moreover, the trap must
use the dedicated stack, because we are still on the user stack when
trapped on syscall entry.

For i386, we must reload %cr3.  The syscall instruction is not configured,
so there is no issue with executing on user stack when trapping.

Due to some CPU erratas it is not always possible to detect that the
userspace watchpoint triggered by inspecting %dr6.  In trap(), compare the
trap %rip with the known unsafe entry points and if matched pretend that
the watchpoint did not fire at all.

Thank you to the MSRC Incident Response Team, and in particular Greg
Lenti and Nate Warfield, for coordinating the response to this issue
across multiple vendors.

Thanks to Computer Recycling at The Working Center of Kitchener for
making hardware available to allow us to test the patch on additional
CPU families.

Reviewed by: jhb
Discussed with: Matthew Dillon
Tested by: emaste
Security: CVE-2018-8897
Security: FreeBSD-SA-18:06.debugreg
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@333370 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f