]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agokern_environment: use any provided environments, evict hintmode/envmode
kevans [Thu, 5 Jul 2018 16:30:32 +0000 (16:30 +0000)]
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
  the chain of environments (or dynamic environment) without relying on
  global state
- All three environments will be searched if they actually have valid hints
  to use, rather than just choosing the first environment that actually had
  a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15953

5 years agoRevert r335995 due to accidental changes snuck in
kevans [Thu, 5 Jul 2018 16:28:43 +0000 (16:28 +0000)]
Revert r335995 due to accidental changes snuck in

5 years agoIn x86 pmap_extract_and_hold(), there is no need to recalculate the
kib [Thu, 5 Jul 2018 16:27:34 +0000 (16:27 +0000)]
In x86 pmap_extract_and_hold(), there is no need to recalculate the
physical address, which is readily available after sucessfull
vm_page_pa_tryrelock().

Noted and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16085

5 years agokern_environment: use any provided environments, evict hintmode/envmode
kevans [Thu, 5 Jul 2018 16:25:48 +0000 (16:25 +0000)]
kern_environment: use any provided environments, evict hintmode/envmode

At the moment, hintmode and envmode are used to indicate whether static
hints or static env have been provided in the kernel config(5) and the
static versions are mutually exclusive with loader(8)-provided environment.
hintmode *can* be reconfigured later to pull from the dynamic environment,
thus taking advantage of the loader(8) or post-kmem environment setting.

This changeset fixes both problems at once to move us from a semi-confusing
state to a consistent state: if an environment file, hints file, or
loader(8) environment are provided, we use them in a well-known order of
precedence:

- loader(8) environment
- static environment
- static hints file

Once the dynamic environment is setup this becomes a moot point. The
loader(8) and static environments are merged (respecting the above order of
precedence), and the static hints are merged in on an as-needed basis after
the dynamic environment has been setup.

Hints lookup are changed to respect all of the above. Before the dynamic
environment is setup, lookups use the above-mentioned order and fallback to
the next environment if a matching hint is not found. Once the dynamic
environment is setup, that is used on its own since it captures all of the
above information plus any dynamic kenv settings that came up later in boot.

The following tangentially related changes were made to res_find:

- A hintp cookie is now passed in so that related searches continue using
  the chain of environments (or dynamic environment) without relying on
  global state
- All three environments will be searched if they actually have valid hints
  to use, rather than just choosing the first environment that actually had
  a hint and rolling with that only

The hintmode sysctl has been ripped out. static_{env,hints}.disabled are
still honored and will disable their respective environments from being used
for hint lookups and from being merged into the dynamic environment, as
expected.

MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15953

5 years agoAdd jsm in committers-ports.dot with mentor/mentee
jsm [Thu, 5 Jul 2018 16:18:05 +0000 (16:18 +0000)]
Add jsm in committers-ports.dot with mentor/mentee

Approved by: miwi (mentor)
Differential Revision:https://reviews.freebsd.org/D16143

5 years agoWith the introduction of reapers and reaplists in r275800,
bz [Thu, 5 Jul 2018 16:16:28 +0000 (16:16 +0000)]
With the introduction of reapers and reaplists in r275800,
proc0 and init are setup as a circular dependency.

create_init() calls fork1() which calls do_fork(). There the
newproc (initproc) is setup with a reaper of proc0 who's reaper
points to itself. The newproc (initproc) is then put on its
reaper's (proc0) p_reaplist (initproc is a descendants of proc0
for proc0 to reap). Upon return to create_init(), proc0 is
added to initproc's p_reaplist (which would mean proc0 is a
descendant of init, for init to reap). This creates a
circular dependency which eventually leads to LIST corruptions
when trying to kill init and a proc0.

For the base system we never really hit this case during reboot.
The problem only became visible after adding more virtual process
spaces which could go away cleanly (work existing in an experimental
branch).

Reviewed by: kib
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D15924

5 years agoRevert r335983.
brooks [Thu, 5 Jul 2018 16:03:03 +0000 (16:03 +0000)]
Revert r335983.

The bfd linker in tree doesn't support multiple names for the same
symbol (at least with current flags).

5 years agoDetach all children before beginning to tear down the hardware, instead of
ian [Thu, 5 Jul 2018 16:00:58 +0000 (16:00 +0000)]
Detach all children before beginning to tear down the hardware, instead of
doing it last.  Also, remove the local tracking of whether usb's busdma
memory allocation got done, because it's safe to call the free_all
function even if it wasn't.

5 years agoAdd a missing call to usb_bus_mem_free_all() when detaching.
ian [Thu, 5 Jul 2018 15:52:26 +0000 (15:52 +0000)]
Add a missing call to usb_bus_mem_free_all() when detaching.

5 years agoUpdate with the members of the 10th core team, core.x.
seanc [Thu, 5 Jul 2018 15:40:14 +0000 (15:40 +0000)]
Update with the members of the 10th core team, core.x.

5 years agoRemove a test and early-out which just can't possibly be right. It causes
ian [Thu, 5 Jul 2018 15:34:16 +0000 (15:34 +0000)]
Remove a test and early-out which just can't possibly be right.  It causes
detach() to do nothing if attach() succeeded, which is the opposite of
what's needed.  Also, move device_delete_children() from the end to the
beginning of detach(), so that children won't be trying to make use of the
hardware we're in the process of shutting down.

PR: 229510

5 years agoGet rid of netbsd_lchown and netbsd_msync syscall entries.
brooks [Thu, 5 Jul 2018 14:12:56 +0000 (14:12 +0000)]
Get rid of netbsd_lchown and netbsd_msync syscall entries.

No valid FreeBSD binary ever called them (they would call lchown and
msync directly) and we haven't supported NetBSD binaries in ages.

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

5 years agoFix an out-of-bounds array access... the irq data for teardown is in two
ian [Thu, 5 Jul 2018 14:09:48 +0000 (14:09 +0000)]
Fix an out-of-bounds array access... the irq data for teardown is in two
arrays, as elements 0 and 1 of one array and elements 1 and 2 of the other.
Run the loop 0..1 instead of 1..2 and use named constants to offset into
one of the arrays.

PR: 229508

5 years agoSilence warnings about unused variables when RACCT is defined but RCTL
kib [Thu, 5 Jul 2018 13:37:31 +0000 (13:37 +0000)]
Silence warnings about unused variables when RACCT is defined but RCTL
is not.

Reported by: Dries Michiels <driesm.michiels@gmail.com>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoMake struct xinpcb and friends word-size independent.
brooks [Thu, 5 Jul 2018 13:13:48 +0000 (13:13 +0000)]
Make struct xinpcb and friends word-size independent.

Replace size_t members with ksize_t (uint64_t) and pointer members
(never used as pointers in userspace, but instead as unique
idenitifiers) with kvaddr_t (uint64_t). This makes the structs
identical between 32-bit and 64-bit ABIs.

On 64-bit bit systems, the ABI is maintained. On 32-bit systems,
this is an ABI breaking change. The ABI of most of these structs
was previously broken in r315662.  This also imposes a small API
change on userspace consumers who must handle kernel pointers
becoming virtual addresses.

PR: 228301 (exp-run by antoine)
Reviewed by: jtl, kib, rwatson (various versions)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15386

5 years agoFix mandoc -Tlint warning introduced in r335977.
trasz [Thu, 5 Jul 2018 11:50:59 +0000 (11:50 +0000)]
Fix mandoc -Tlint warning introduced in r335977.

Reported by: 0mp@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd trivial usage example to ports(7).
trasz [Thu, 5 Jul 2018 11:03:11 +0000 (11:03 +0000)]
Add trivial usage example to ports(7).

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a name for the MSR controlling standard extended features report on AMD.
kib [Thu, 5 Jul 2018 10:44:18 +0000 (10:44 +0000)]
Add a name for the MSR controlling standard extended features report on AMD.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years agoOrder the portion of the AMD-specific MSRs names definitions numerically.
kib [Thu, 5 Jul 2018 10:34:01 +0000 (10:34 +0000)]
Order the portion of the AMD-specific MSRs names definitions numerically.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years ago- Add bhyve NVMe device emulation.
araujo [Thu, 5 Jul 2018 03:33:58 +0000 (03:33 +0000)]
- Add bhyve NVMe device emulation.

The initial work on bhyve NVMe device emulation was done by the GSoC student
Shunsuke Mie and was heavily modified in performan, functionality and
guest support by Leon Dang.

bhyve:
-s <n>,nvme,devpath,maxq=#,qsz=#,ioslots=#,sectsz=#,ser=A-Z

accepted devpath:
/dev/blockdev
/path/to/image
ram=size_in_MiB

Tested with guest OS: FreeBSD Head, Linux Fedora fc27, Ubuntu 18.04,
                      OpenSuse 15.0, Windows Server 2016 Datacenter.
Tested with all accepted device paths: Real nvme, zdev and also with ram.
Tested on: AMD Ryzen Threadripper 1950X 16-Core Processor and
           Intel(R) Xeon(R) CPU E5-2609 v2 @ 2.50GHz.

Tests at: https://people.freebsd.org/~araujo/bhyve_nvme/nvme.txt

Submitted by: Shunsuke Mie <sux2mfgj_gmail.com>,
Leon Dang <leon_digitalmsx.com>
Reviewed by: chuck (early version), grehan
Relnotes: Yes
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D14022

5 years agomxge: replace 65536 with IP_MAXPACKET in tso settings.
gallatin [Thu, 5 Jul 2018 02:43:10 +0000 (02:43 +0000)]
mxge: replace 65536 with IP_MAXPACKET in tso settings.

5 years agoAllow callers to vm_phys_split_pages() to specify whether insertion should
alc [Thu, 5 Jul 2018 02:08:57 +0000 (02:08 +0000)]
Allow callers to vm_phys_split_pages() to specify whether insertion should
occur at the head or the tail of the page queues.

5 years agoAs of r335784, if pmap_enter() replaces a managed mapping by an unmanaged
alc [Thu, 5 Jul 2018 02:04:18 +0000 (02:04 +0000)]
As of r335784, if pmap_enter() replaces a managed mapping by an unmanaged
mapping, then it leaks the unlinked PV entry.  This change eliminates that
leak, freeing the PV entry.

Reviewed by: kib, markj
X-MFC with: r335784
Differential Revision: https://reviews.freebsd.org/D16130

5 years agoepoch(9): make nesting assert in epoch_wait_preempt more specific
mmacy [Wed, 4 Jul 2018 21:34:08 +0000 (21:34 +0000)]
epoch(9): make nesting assert in epoch_wait_preempt more specific

Reported by: markj

5 years agoIn x86 pmap_extract_and_hold()s, handle the case of PHYS_TO_VM_PAGE()
kib [Wed, 4 Jul 2018 21:21:59 +0000 (21:21 +0000)]
In x86 pmap_extract_and_hold()s, handle the case of PHYS_TO_VM_PAGE()
returning NULL.

vm_fault_quick_hold_pages() can be legitimately called on userspace
mappings backed by fictitious pages created by unmanaged device and sg
pagers.

Note that other architectures pmap_extract_and_hold() might need
similar fix, but I postponed the examination.

Reported by: bde
Discussed with: alc
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16085

5 years agoFix the pNFS server so that it handles the "#mds_path" check for mirrors.
rmacklem [Wed, 4 Jul 2018 19:46:26 +0000 (19:46 +0000)]
Fix the pNFS server so that it handles the "#mds_path" check for mirrors.

The recently added feature of the pNFS server will set an fsid for the
MDS file system to define the file system a DS should store files for.
For a case where a DS handling all file systems has failed, it was possible
for the code to check for a mirror with a specified fs, even though
nfsdev_mdsisset was 0, possibly causing a false successful check for a mirror.
This patch adds a check for nfsdev_mdsisset != 0 to avoid this.
It only affects the pNFS server for a rare case. Found via code inspection.

5 years agomxge: choose appropriate values for hw tso
gallatin [Wed, 4 Jul 2018 19:29:06 +0000 (19:29 +0000)]
mxge: choose appropriate values for hw tso

5 years agomxge: Add SIOCGI2C support for devices with SFP/XFP cages
gallatin [Wed, 4 Jul 2018 18:54:44 +0000 (18:54 +0000)]
mxge: Add SIOCGI2C support for devices with SFP/XFP cages

5 years agoWITHOUT_SERVICESDB:
sbruno [Wed, 4 Jul 2018 17:18:35 +0000 (17:18 +0000)]
WITHOUT_SERVICESDB:

Add src.conf knob to disable the installation of /var/db/services.db

Default to leaving services.db in place, but allow the removal of the
file and its creation with a src.conf knob.

This file ends up being 2MB in size.  For small systems this is a waste
of space but its a tradeoff.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D9655

5 years agofix locking within tcp_ipsec_pcbctl() to match ipsec4_pcbctl(), ipsec4_pcbctl()
sbruno [Wed, 4 Jul 2018 17:10:07 +0000 (17:10 +0000)]
fix locking within tcp_ipsec_pcbctl() to match ipsec4_pcbctl(), ipsec4_pcbctl()

IPSEC_PCBCTL() functions, which include tcp_ipsec_pcbctl(),
ipsec4_pcbctl(), and ipsec6_pcbctl(), should all have matching locking
semantics.

ipsec4_pcbctl() and ipsec6_pcbctl() expect the inp to be unlocked on
entry and exit and appear to be correctly implemented as such. But
tcp_ipsec_pcbctl() had other semantics. This patch fixes the semantics
for tcp_ipsec_pcbctl().

Submitted by: Jason Eggleston <jason@eggnet.com>
MFH: 2 weeks
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D14623

5 years agoAdd description to debug.ncores sysctl.
oshogbo [Wed, 4 Jul 2018 17:06:51 +0000 (17:06 +0000)]
Add description to debug.ncores sysctl.

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

5 years agoepoch(9): Fix man page typo
mmacy [Wed, 4 Jul 2018 17:06:23 +0000 (17:06 +0000)]
epoch(9): Fix man page typo

Submitted by: se
Reported by: se

5 years agoComplete my vertex even though edges were in place.
seanc [Wed, 4 Jul 2018 16:50:51 +0000 (16:50 +0000)]
Complete my vertex even though edges were in place.

Reported by: swills
Approved by: swills (mentor, implicit)

5 years agofix 335919 - check "last" not "inp" where appropriate
mmacy [Wed, 4 Jul 2018 16:34:07 +0000 (16:34 +0000)]
fix 335919 - check "last" not "inp" where appropriate

Submitted by: ae
Reported by: cy

5 years agomxge: fix panic at module unload
gallatin [Wed, 4 Jul 2018 14:25:38 +0000 (14:25 +0000)]
mxge: fix panic at module unload

r333175 (multicast changes) exposed a bug where
mxge was not checking to see if the driver was being
unloaded while handing ioctls that touch hardware.
As a result, now that in6m_disconnect() is run from
an async gtaskq, it was busy-waiting in mxge_send_cmd()
while the mcast list was destroyed.

5 years agoAdd a semaphore ping benchmark.
trasz [Wed, 4 Jul 2018 14:20:19 +0000 (14:20 +0000)]
Add a semaphore ping benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a very simple memcpy benchmark.
trasz [Wed, 4 Jul 2018 14:18:12 +0000 (14:18 +0000)]
Add a very simple memcpy benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSort the benchmarks even more.
trasz [Wed, 4 Jul 2018 14:15:48 +0000 (14:15 +0000)]
Sort the benchmarks even more.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoRename "dup" and "fstat_shmfd" to "shmfd_dup" and "shmfd_fstat" for consistency.
trasz [Wed, 4 Jul 2018 14:14:00 +0000 (14:14 +0000)]
Rename "dup" and "fstat_shmfd" to "shmfd_dup" and "shmfd_fstat" for consistency.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoSort the benchmarks; no functional changes intended.
trasz [Wed, 4 Jul 2018 14:11:49 +0000 (14:11 +0000)]
Sort the benchmarks; no functional changes intended.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoDisable pipepingtd benchmarks, to make it not depend on libthr.
trasz [Wed, 4 Jul 2018 13:52:13 +0000 (13:52 +0000)]
Disable pipepingtd benchmarks, to make it not depend on libthr.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoMake the pipeping benchmarks work with larger buffer sizes.
trasz [Wed, 4 Jul 2018 13:45:29 +0000 (13:45 +0000)]
Make the pipeping benchmarks work with larger buffer sizes.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd threaded pipe ping benchmark.
trasz [Wed, 4 Jul 2018 13:39:48 +0000 (13:39 +0000)]
Add threaded pipe ping benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agomuge(4): remove DTB MAC addr from TODO list after r335925
emaste [Wed, 4 Jul 2018 13:38:02 +0000 (13:38 +0000)]
muge(4): remove DTB MAC addr from TODO list after r335925

Also replace numbered list with - bulleted so the list entries do not
need to be renumbered as tasks are completed.

Sponsored by: The FreeBSD Foundation

5 years agoAdd a trivial "pipe ping" (two processes) benchmark.
trasz [Wed, 4 Jul 2018 13:34:43 +0000 (13:34 +0000)]
Add a trivial "pipe ping" (two processes) benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoMake syscall_timing(1) build with WARNS=6.
trasz [Wed, 4 Jul 2018 13:31:55 +0000 (13:31 +0000)]
Make syscall_timing(1) build with WARNS=6.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd setproctitle_fast(3) for frequent callers.
kib [Wed, 4 Jul 2018 13:31:16 +0000 (13:31 +0000)]
Add setproctitle_fast(3) for frequent callers.

Some applications, notably PostgreSQL, want to call setproctitle()
very often.  It's slow.  Provide an alternative cheap way of updating
process titles without making any syscalls, instead requiring other
processes (top, ps etc) to do a bit more work to retrieve the data.
This uses a pre-existing code path inherited from ancient BSD, which
always did it that way.

Submitted by: Thomas Munro
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D16111

5 years agoAdd getprogname(3) (ie null) benchmark.
trasz [Wed, 4 Jul 2018 13:28:43 +0000 (13:28 +0000)]
Add getprogname(3) (ie null) benchmark.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agotop: do not fall to the thread name if kernel cache of the process
kib [Wed, 4 Jul 2018 13:28:16 +0000 (13:28 +0000)]
top: do not fall to the thread name if kernel cache of the process
args is empty.

Instead, use kvm_getargv() unconditionally to obtain the process
arguments.  It means that one additional sysctl(2) is performed there.

Submitted by: Thomas Munro
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16111

5 years agoUse a macro for iteration.
trasz [Wed, 4 Jul 2018 13:26:47 +0000 (13:26 +0000)]
Use a macro for iteration.

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL

5 years agoAdd a way for the process to request cleanup of the kernel cache of
kib [Wed, 4 Jul 2018 13:22:48 +0000 (13:22 +0000)]
Add a way for the process to request cleanup of the kernel cache of
the process arguments.  New arguments length zero causes the drop of
the pargs instead of allocation of useless zero-length buffer.

Submitted by: Thomas Munro
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D16111

5 years agoremove unneeded inclusion of sys/interrupt.h from several files
avg [Wed, 4 Jul 2018 09:07:18 +0000 (09:07 +0000)]
remove unneeded inclusion of sys/interrupt.h from several files

It's likely that the header was needed in the past for swi(9).
But now that code does not use swi(9) or any other interfaces defined
in sys/interrupt.h.

MFC after: 1 week

5 years agoloader: fdt: Try to load every possible DTB from u-boot
manu [Wed, 4 Jul 2018 07:37:45 +0000 (07:37 +0000)]
loader: fdt: Try to load every possible DTB from u-boot

U-Boot setup a few variables :

 - fdt_addr which is the board static dtb (most of the time loaded before
   u-boot or coming from some hardware like a ROM)
 - fdt_addr_r which is a location in RAM that holds the DTB loaded by
   u-boot or before u-boot

In the case of u-boot + rpi firmware the DTB is loaded in RAM but the location
still end up in the fdt_addr variable and the fdt_addr_r variable exist.

Change the behavior so we test that a DTB exists for every possible variable :

 - fdt_addr_r is checked first as if u-boot needed to modify it the
   correct DTB will live there.
 - fdt_addr is checked second as if we run on a hardware with DTB in ROM
   it means that we what/need to run that
 - fdtaddr looks like a FreeBSD-ism but since I'm not sure leave it.

Reviewed by: gonzo
Differential Revision: https://reviews.freebsd.org/D16101

5 years ago- Fix a double unlock in inp_block_unblock_source() and
hrs [Wed, 4 Jul 2018 06:47:34 +0000 (06:47 +0000)]
- Fix a double unlock in inp_block_unblock_source() and
  lock leakage in inp_leave_group() which caused a panic.
- Make order of CTR1() and IN_MULTI_LIST_LOCK() consistent
  around inm_merge().

5 years agoepoch(9): update in_epoch() description as well
mmacy [Wed, 4 Jul 2018 03:54:39 +0000 (03:54 +0000)]
epoch(9): update in_epoch() description as well

5 years agoFreeBSD_version: update for epoch(9) r335924 KPI change
mmacy [Wed, 4 Jul 2018 03:46:23 +0000 (03:46 +0000)]
FreeBSD_version: update for epoch(9) r335924 KPI change

5 years agoepoch(9): update man page for r335924
mmacy [Wed, 4 Jul 2018 03:44:36 +0000 (03:44 +0000)]
epoch(9): update man page for r335924

5 years agoRevert r335833.
will [Wed, 4 Jul 2018 03:36:46 +0000 (03:36 +0000)]
Revert r335833.

Several third-parties use at least some of these ioctls.  While it would be
better for regression testing if they were used in base (or at least in the
test suite), it's currently not worth the trouble to push through removal.

Submitted by: antoine, markj

5 years agomuge(4): add DTB blob as one more possible source of MAC address
gonzo [Wed, 4 Jul 2018 03:02:53 +0000 (03:02 +0000)]
muge(4): add DTB blob as one more possible source of MAC address

On FDT-enabled platforms check if DTB blob has MAC address configured by
a boot loader. This information passed as a "local-mac-address" or
"mac-address" property of the device node. For USB NICs node
can be found by looking for compatibility string "usbVVV,PPP" where
VVV - vendor id (hex) and PPP - product id (hex)

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D16117

5 years agoepoch(9): allow preemptible epochs to compose
mmacy [Wed, 4 Jul 2018 02:47:16 +0000 (02:47 +0000)]
epoch(9): allow preemptible epochs to compose

- Add tracker argument to preemptible epochs
- Inline epoch read path in kernel and tied modules
- Change in_epoch to take an epoch as argument
- Simplify tfb_tcp_do_segment to not take a ti_locked argument,
  there's no longer any benefit to dropping the pcbinfo lock
  and trying to do so just adds an error prone branchfest to
  these functions
- Remove cases of same function recursion on the epoch as
  recursing is no longer free.
- Remove the the TAILQ_ENTRY and epoch_section from struct
  thread as the tracker field is now stack or heap allocated
  as appropriate.

Tested by: pho and Limelight Networks
Reviewed by: kbowling at llnw dot com
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D16066

5 years agoMETA_MODE: Fix wanting a meta file in source tree.
bdrewery [Wed, 4 Jul 2018 00:18:40 +0000 (00:18 +0000)]
META_MODE: Fix wanting a meta file in source tree.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoUse OBJS_DEPEND_GUESS for forced opt_global.h dependency.
bdrewery [Wed, 4 Jul 2018 00:18:36 +0000 (00:18 +0000)]
Use OBJS_DEPEND_GUESS for forced opt_global.h dependency.

MFC after: 2 weeks
Sponsored by: Dell EMC

5 years agoAllow jail names (not just IDs) to be specified for: cpuset(1), ipfw(8),
jamie [Tue, 3 Jul 2018 23:47:20 +0000 (23:47 +0000)]
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
MFC after: 3 days
Differential Revision: D16047

5 years agoopensolaris compat: fix compile error
mmacy [Tue, 3 Jul 2018 23:45:02 +0000 (23:45 +0000)]
opensolaris compat: fix compile error

when opensolaris/sys/types.h is included before stddef.h ptrdiff_t
would be typedef'd twice

5 years agoudp6_input: validate inpcb before use
mmacy [Tue, 3 Jul 2018 23:30:53 +0000 (23:30 +0000)]
udp6_input: validate inpcb before use

When traversing pcbinfo lists (rather than calling lookup) we need to
explicitly validate an inpcb before use.

5 years agodocument MODULE_TIED behavior change
mmacy [Tue, 3 Jul 2018 23:09:09 +0000 (23:09 +0000)]
document MODULE_TIED behavior change

5 years agoEnable MODULE_TIED by default for modules compiled with the kernel
mmacy [Tue, 3 Jul 2018 23:05:42 +0000 (23:05 +0000)]
Enable MODULE_TIED by default for modules compiled with the kernel

Requested by: jhb

5 years agoUse 'e' instead of 'i' constraints with 64-bit atomic operations on amd64.
jhb [Tue, 3 Jul 2018 22:03:28 +0000 (22:03 +0000)]
Use 'e' instead of 'i' constraints with 64-bit atomic operations on amd64.

The ADD, AND, OR, and SUB instructions take at most a 32-bit
sign-extended immediate operand.  64-bit constants that do not fit into
that constraint need to be loaded into a register.  The 'i' constraint
tells the compiler it can pass any integer constant to the assembler,
whereas the 'e' constrain only permits constants that fit into a 32-bit
sign-extended value.  This fixes using
atomic_add/clear/set/subtract_long/64 with constants that do not fit into
a 32-bit sign-extended immediate.

Reported by: several folks
Tested by: Pete Wright <pete@nomadlogic.org>
MFC after: 2 weeks

5 years agoFix .depend.foo.o tracking for sys/conf/files defined compilations.
bdrewery [Tue, 3 Jul 2018 21:29:04 +0000 (21:29 +0000)]
Fix .depend.foo.o tracking for sys/conf/files defined compilations.

Some example files:
  ia32_genassym.o
  acpi_wakecode.o

The old mkdep method also lacked tracking these files.

Objects defined in sys/conf/files with no-obj and no-implicit-rule get their
own targets defined in the kernel Makefile but lack having their objects added
to DEPENDOBJS so never get a .depend file generated.  Normally if an object is
in OBJS it will get a .depend file.

Fix this by looking for .o files in CLEAN and ensuring they are part of
the -MD filtering and .depend loading.  This is a hack.  Other solutions
could exist involving sys/conf/files or config(8) to auto add these to
DEPENDFILES/DEPENDOBJS but this method seems reliable enough without being
intrusive or error-prone for new files.

Reported by: bde
MFC after: 3 weeks
Sponsored by: Dell EMC

5 years agoNeed offset.inc generated early if MODULE_TIED is defined.
bdrewery [Tue, 3 Jul 2018 21:15:47 +0000 (21:15 +0000)]
Need offset.inc generated early if MODULE_TIED is defined.

5 years agoAll genassym.sh usage need offset.inc
bdrewery [Tue, 3 Jul 2018 21:02:25 +0000 (21:02 +0000)]
All genassym.sh usage need offset.inc

5 years agogenoffset.c is not generated
bdrewery [Tue, 3 Jul 2018 21:02:21 +0000 (21:02 +0000)]
genoffset.c is not generated

5 years agoFix r335906+r335907 to not pass multiple source files to genoffset_test.o target.
bdrewery [Tue, 3 Jul 2018 20:03:19 +0000 (20:03 +0000)]
Fix r335906+r335907 to not pass multiple source files to genoffset_test.o target.

This is working around a bug with the FAST_DEPEND logic with custom targets
that use .ALLSRC.

Reported by: mmacy

5 years agoHandle .depend for genoffset_test.o
bdrewery [Tue, 3 Jul 2018 19:24:52 +0000 (19:24 +0000)]
Handle .depend for genoffset_test.o

5 years agoNo need to make a copy to build genoffset_test.o
bdrewery [Tue, 3 Jul 2018 19:24:44 +0000 (19:24 +0000)]
No need to make a copy to build genoffset_test.o

5 years agorup: Fix -Wcast-align warnings
jilles [Tue, 3 Jul 2018 19:09:46 +0000 (19:09 +0000)]
rup: Fix -Wcast-align warnings

Fix possible strict aliasing issue (if time_t is the same size as int but
not int but for example long) which also resulted in a false positive
warning on systems with 64-bit time_t. Pointer casts are bad; we can just
copy the time_t.

Elsewhere, avoid casting char * to int * by using memcpy().

Reviewed by: eadler
Differential Revision: https://reviews.freebsd.org/D16075

5 years agoFix module build when MODULE_TIED=1 is set.
bdrewery [Tue, 3 Jul 2018 18:45:04 +0000 (18:45 +0000)]
Fix module build when MODULE_TIED=1 is set.

5 years agoexplain the purpose of genoffset_test
mmacy [Tue, 3 Jul 2018 18:39:43 +0000 (18:39 +0000)]
explain the purpose of genoffset_test

5 years agoensure that offset.inc is generated first
mmacy [Tue, 3 Jul 2018 18:20:42 +0000 (18:20 +0000)]
ensure that offset.inc is generated first

5 years agoRegen after 335900.
oshogbo [Tue, 3 Jul 2018 18:18:29 +0000 (18:18 +0000)]
Regen after 335900.

PR: 228671

5 years agocapsicum: add getdirentries to the freebsd32 compact
oshogbo [Tue, 3 Jul 2018 18:17:19 +0000 (18:17 +0000)]
capsicum: add getdirentries to the freebsd32 compact

There is a getdirentries syscall in freebsd32 and it's
capability ready so allow calling it in the capability mode.

PR: 228671

5 years agoauditd(8): register signal handlers interrutibly
asomers [Tue, 3 Jul 2018 17:37:16 +0000 (17:37 +0000)]
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
MFC after: 2 weeks
Differential Revision: https://github.com/openbsm/openbsm/pull/36

5 years agoClean up the vcs ID strings in libc's gen/ directory.
jhb [Tue, 3 Jul 2018 17:31:45 +0000 (17:31 +0000)]
Clean up the vcs ID strings in libc's gen/ directory.

- Move CSRG IDs into __SCCSID().
- When a file has been copied, consistently use 'From: <tag>' for strings
  referencing the version of the source file copied from in the license
  block comment.
- Some of the 'From:' tags were using $FreeBSD$ that was being expanded on
  each checkout.  Fix those to hardcode the FreeBSD tag from the file that
  was copied at the time of the copy.
- When multiple strings are present list them in "chronological" order,
  so CSRG (__SCCSID) before FreeBSD (__FBSDID).  If a file came from
  OtherBSD and contains a CSRG ID from the OtherBSD file, use the order
  CSRG -> OtherBSD -> FreeBSD.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D15831

5 years agoStrip __RCSID() and __SCCSID() strings by default when building libc.
jhb [Tue, 3 Jul 2018 16:45:49 +0000 (16:45 +0000)]
Strip __RCSID() and __SCCSID() strings by default when building libc.

This is in preparation for changes to update the various ID strings in
libc's source.  CSRG ID strings will use __SCCSID() and there are some
existing uses of __RCSID() for NetBSD ID strings already.  These are
generally under either an explicit #if 0 or an #ifdef LIBC_SCCS so are
off by default and this change preserves that existing behavior.

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

5 years agoReset indentiation of ata_suspend() such that its clear we fall through
sbruno [Tue, 3 Jul 2018 16:17:59 +0000 (16:17 +0000)]
Reset indentiation of ata_suspend() such that its clear we fall through
this function and that we aren't supposed to be controlled by the first
if() conditional.  Found with gcc.

No functional change is intended with this commit.

5 years agoFix the fstab entries for tests that have an efi partition in slice 1 and
ian [Tue, 3 Jul 2018 16:07:04 +0000 (16:07 +0000)]
Fix the fstab entries for tests that have an efi partition in slice 1 and
put the rootfs on s2.

5 years agoReset indentation of this flag. No functional change intended.
sbruno [Tue, 3 Jul 2018 15:56:22 +0000 (15:56 +0000)]
Reset indentation of this flag. No functional change intended.
Found with gcc.

sys/dev/ata/chipsets/ata-siliconimage.c: In function 'ata_cmd_ch_attach':
sys/dev/ata/chipsets/ata-siliconimage.c:187:5:
 warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (ctlr->chip->cfg2 & SII_INTR)
     ^~
sys/dev/ata/chipsets/ata-siliconimage.c:190:2:
note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  ch->flags |= ATA_NO_ATAPI_DMA;

5 years agoRevert 335888 ("Ensure va_list is declared by including stdarg.h.")
br [Tue, 3 Jul 2018 15:48:34 +0000 (15:48 +0000)]
Revert 335888 ("Ensure va_list is declared by including stdarg.h.")

The issue was caused by header pollution brought by GCC 8.1.

We now have to remove include-fixed headers in the GCC installation
directory.

Sponsored by: DARPA, AFRL
Pointed out by: jhb

5 years agoDon't specify the desired march/mabi for RISC-V in ACFLAGS.
jhb [Tue, 3 Jul 2018 15:24:09 +0000 (15:24 +0000)]
Don't specify the desired march/mabi for RISC-V in ACFLAGS.

ACFLAGS is only used in addition to CFLAGS, so setting the options in
both was redundant.  However, ACFLAGS is added to the command line
after CFLAGS, so the settings from ACFLAGS were applied for assembly
files in kernel modules after the kernel-specific march/abi in CFLAGS.
As a result, the hard-float ACFLAGS in bsd.cpu.mk was overriding the
soft-float CFLAGS.gcc in sys/conf/kern.mk.  In particular,
dtrace_asm.o was compiled as hard-float and the linker refused to link
dtrace.ko since its object files contained a mix of hard and soft
float.

Reviewed by: br
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D16054

5 years agoFix build: utf8strvisx() does signed data comparisons, but 'char' type
br [Tue, 3 Jul 2018 14:32:15 +0000 (14:32 +0000)]
Fix build: utf8strvisx() does signed data comparisons, but 'char' type
is unsigned in riscv GCC, so use guaranted signed char type.

Sponsored by: DARPA, AFRL

5 years agoo Ensure va_list is declared by including stdarg.h.
br [Tue, 3 Jul 2018 13:53:54 +0000 (13:53 +0000)]
o Ensure va_list is declared by including stdarg.h.
o Also move printf.h to go after it since it does require declaration
  of va_list.

This fixes build with latest RISC-V GNU Toolchain with GCC 8.1

Sponsored by: DARPA, AFRL

5 years agoAdd GCC 8.1.0 compiler warning flags.
br [Tue, 3 Jul 2018 10:51:59 +0000 (10:51 +0000)]
Add GCC 8.1.0 compiler warning flags.

Sponsored by: DARPA, AFRL

5 years agopfctl: Don't retrieve interface list if '-n' is set
kp [Tue, 3 Jul 2018 08:50:49 +0000 (08:50 +0000)]
pfctl: Don't retrieve interface list if '-n' is set

If '-n' is set we don't use the list of skip interfaces, so don't retrieve it.
This fixes issues if 'pfctl -n' is used before the pf module is loaded. This
was broken by r333181.

Reported by: Jakub Chromy <hicks AT cgi.cz>
MFC after: 1 week

5 years agoUpdate bsnmp to version 1.13. This does not bring user-visible changes.
harti [Tue, 3 Jul 2018 08:44:40 +0000 (08:44 +0000)]
Update bsnmp to version 1.13. This does not bring user-visible changes.
For developers gensnmptree can now generate functions for enums to convert
between enums and strings and to check the validity of a value.
The sources in FreeBSD are now in sync with the upstream which allows to
bring in IPv6 modifications.

5 years agoensure that offset.inc is generated before ia32_genassym.c is compiled
mmacy [Tue, 3 Jul 2018 05:56:23 +0000 (05:56 +0000)]
ensure that offset.inc is generated before ia32_genassym.c is compiled

5 years agostand/common/disk.c: dev->d_offset still needs to be set to 0
allanjude [Tue, 3 Jul 2018 05:53:27 +0000 (05:53 +0000)]
stand/common/disk.c: dev->d_offset still needs to be set to 0

With r335868, I thought this was no longer necessary. I was wrong.

Reported by: ian
Sponsored by: Klara Systems

5 years agoexpose sched_{pin,unpin}_lite to tied modules
mmacy [Tue, 3 Jul 2018 04:02:40 +0000 (04:02 +0000)]
expose sched_{pin,unpin}_lite to tied modules

5 years agoWhen toggling the display using the "m" command to toggle from 'cpu'
cy [Tue, 3 Jul 2018 02:54:32 +0000 (02:54 +0000)]
When toggling the display using the "m" command to toggle from 'cpu'
mode to 'io' mode, an artifact remains because the buffer is not
"finished" with a NULL terminator using sbuf_finish().

An example of this is, when the "m" command is entered, the title line
will contain COMMANDND instead of COMMAND. This commit fixes this.

5 years agoexpose thread_lite definition to tied modules
mmacy [Tue, 3 Jul 2018 02:50:07 +0000 (02:50 +0000)]
expose thread_lite definition to tied modules

5 years agomake critical_{enter, exit} inline
mmacy [Tue, 3 Jul 2018 01:55:09 +0000 (01:55 +0000)]
make critical_{enter, exit} inline

Avoid pulling in all of the <sys/proc.h> dependencies by
automatically generating a stripped down thread_lite exporting
only the fields of interest. The field declarations are type checked
against the original and the offsets of the generated result is
automatically checked.

kib has expressed disagreement and would have preferred to simply
use genassym style offsets (which loses type check enforcement).
jhb has expressed dislike of it due to header pollution and a
duplicate structure. He would have preferred to just have defined
thread in _thread.h. Nonetheless, he admits that this is the only
viable solution at the moment.

The impetus for this came from mjg's D15331:
"Inline critical_enter/exit for amd64"

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D16078