]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoUpdate libunwind custom frame register and deregister functions for
dim [Thu, 29 Aug 2019 18:53:00 +0000 (18:53 +0000)]
Update libunwind custom frame register and deregister functions for
FreeBSD: use the new doubly underscored names for unw_add_dynamic_fde
and unw_remove_dynamic_fde.

NOTE: this should be upstreamed...

4 years agoUpdate build glue for building libc++.
dim [Wed, 28 Aug 2019 20:05:55 +0000 (20:05 +0000)]
Update build glue for building libc++.

4 years agoUpdate build glue for a build of clang plus lldb (enabled via MK_LLDB).
dim [Mon, 26 Aug 2019 21:00:14 +0000 (21:00 +0000)]
Update build glue for a build of clang plus lldb (enabled via MK_LLDB).

4 years agoAdd lldb-tblgen tool.
dim [Mon, 26 Aug 2019 20:57:45 +0000 (20:57 +0000)]
Add lldb-tblgen tool.

4 years agoDisable UniversalMachO support in lldb's SystemInitializerFull.cpp,
dim [Mon, 26 Aug 2019 20:56:16 +0000 (20:56 +0000)]
Disable UniversalMachO support in lldb's SystemInitializerFull.cpp,
since we do not need it.

4 years agoUpdate FREEBSD-Xlist for lldb.
dim [Sun, 25 Aug 2019 20:36:52 +0000 (20:36 +0000)]
Update FREEBSD-Xlist for lldb.

4 years agoMerge missed sources for lldb-specific TableGen tool.
dim [Sun, 25 Aug 2019 20:36:02 +0000 (20:36 +0000)]
Merge missed sources for lldb-specific TableGen tool.

4 years agoImport missed sources for lldb-specific TableGen tool.
dim [Sun, 25 Aug 2019 20:29:50 +0000 (20:29 +0000)]
Import missed sources for lldb-specific TableGen tool.

4 years agoUpdate build glue for a build of clang plus lld (enabled via MK_LLD).
dim [Sat, 24 Aug 2019 22:07:38 +0000 (22:07 +0000)]
Update build glue for a build of clang plus lld (enabled via MK_LLD).

4 years agoUpdate build glue for a build of clang including the static analyzer
dim [Sat, 24 Aug 2019 21:04:29 +0000 (21:04 +0000)]
Update build glue for a build of clang including the static analyzer
(enabled via MK_CLANG_FULL).

4 years agoUpdate build glue for a build of clang plus the extra tools (enabled via
dim [Sat, 24 Aug 2019 19:21:11 +0000 (19:21 +0000)]
Update build glue for a build of clang plus the extra tools (enabled via
MK_CLANG_EXTRAS).

4 years agoUpdate build glue for a build of clang plus default base tools (llvm-ar,
dim [Sat, 24 Aug 2019 16:44:47 +0000 (16:44 +0000)]
Update build glue for a build of clang plus default base tools (llvm-ar,
llvm-nm, llvm-objdump, llvm-symbolizer).

4 years agoUpdate build glue for a minimal build of the clang executable.
dim [Fri, 23 Aug 2019 22:17:36 +0000 (22:17 +0000)]
Update build glue for a minimal build of the clang executable.

4 years agoRegenerate config and version headers.
dim [Fri, 23 Aug 2019 22:13:23 +0000 (22:13 +0000)]
Regenerate config and version headers.

4 years agoChange clang lib dir to 9.0.0.
dim [Fri, 23 Aug 2019 22:12:20 +0000 (22:12 +0000)]
Change clang lib dir to 9.0.0.

4 years agoMerge openmp trunk r366426, resolve conflicts, and add FREEBSD-Xlist.
dim [Thu, 22 Aug 2019 20:26:20 +0000 (20:26 +0000)]
Merge openmp trunk r366426, resolve conflicts, and add FREEBSD-Xlist.

4 years agoMerge libunwind trunk r366426, resolve conflicts, and add FREEBSD-Xlist.
dim [Thu, 22 Aug 2019 20:14:59 +0000 (20:14 +0000)]
Merge libunwind trunk r366426, resolve conflicts, and add FREEBSD-Xlist.

4 years agoMerge libc++ trunk r366426, resolve conflicts, and add FREEBSD-Xlist.
dim [Thu, 22 Aug 2019 19:49:51 +0000 (19:49 +0000)]
Merge libc++ trunk r366426, resolve conflicts, and add FREEBSD-Xlist.

4 years agoMerge compiler-rt trunk r366426, resolve conflicts, and add
dim [Thu, 22 Aug 2019 19:26:11 +0000 (19:26 +0000)]
Merge compiler-rt trunk r366426, resolve conflicts, and add
FREEBSD-Xlist.

4 years agoMerge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
dim [Thu, 22 Aug 2019 19:14:02 +0000 (19:14 +0000)]
Merge lldb trunk r366426, resolve conflicts, and update FREEBSD-Xlist.

4 years agoMerge lld trunk r366426, and resolve conflicts.
dim [Wed, 21 Aug 2019 20:44:42 +0000 (20:44 +0000)]
Merge lld trunk r366426, and resolve conflicts.

4 years agoMerge clang trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
dim [Wed, 21 Aug 2019 19:57:54 +0000 (19:57 +0000)]
Merge clang trunk r366426, resolve conflicts, and update FREEBSD-Xlist.

4 years agoMerge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist.
dim [Wed, 21 Aug 2019 18:13:02 +0000 (18:13 +0000)]
Merge llvm trunk r366426, resolve conflicts, and update FREEBSD-Xlist.

4 years agomakefs.8: update history
emaste [Tue, 20 Aug 2019 21:14:44 +0000 (21:14 +0000)]
makefs.8: update history

- ported to FreeBSD and first appeared in 8.0
- Christos Zoulas added the FAT support that I imported

4 years agoVendor import of stripped LLVM openmp trunk r366426 (just before the
dim [Tue, 20 Aug 2019 20:52:04 +0000 (20:52 +0000)]
Vendor import of stripped LLVM openmp trunk r366426 (just before the
release_90 branch point):

https://llvm.org/svn/llvm-project/openmp/trunk@366426

4 years agoVendor import of stripped lldb trunk r366426 (just before the release_90
dim [Tue, 20 Aug 2019 20:51:52 +0000 (20:51 +0000)]
Vendor import of stripped lldb trunk r366426 (just before the release_90
branch point):

https://llvm.org/svn/llvm-project/lldb/trunk@366426

4 years agoVendor import of stripped lld trunk r366426 (just before the release_90
dim [Tue, 20 Aug 2019 20:51:32 +0000 (20:51 +0000)]
Vendor import of stripped lld trunk r366426 (just before the release_90
branch point):

https://llvm.org/svn/llvm-project/lld/trunk@366426

4 years agoVendor import of stripped libc++ trunk r366426 (just before the release_90 branch
dim [Tue, 20 Aug 2019 20:51:16 +0000 (20:51 +0000)]
Vendor import of stripped libc++ trunk r366426 (just before the release_90 branch
point):

https://llvm.org/svn/llvm-project/libcxx/trunk@366426

4 years agoVendor import of stripped compiler-rt trunk r366426 (just before the release_90
dim [Tue, 20 Aug 2019 20:51:06 +0000 (20:51 +0000)]
Vendor import of stripped compiler-rt trunk r366426 (just before the release_90
branch point):

https://llvm.org/svn/llvm-project/compiler-rt/trunk@366426

4 years agoVendor import of stripped clang trunk r366426 (just before the
dim [Tue, 20 Aug 2019 20:50:49 +0000 (20:50 +0000)]
Vendor import of stripped clang trunk r366426 (just before the
release_90 branch point):

https://llvm.org/svn/llvm-project/cfe/trunk@366426

4 years agoVendor import of stripped llvm trunk r366426 (just before the release_90
dim [Tue, 20 Aug 2019 20:50:12 +0000 (20:50 +0000)]
Vendor import of stripped llvm trunk r366426 (just before the release_90
branch point):

https://llvm.org/svn/llvm-project/llvm/trunk@366426

4 years agomakefs: avoid "dereferencing 'void *' pointer" warnings
emaste [Tue, 20 Aug 2019 20:04:16 +0000 (20:04 +0000)]
makefs: avoid "dereferencing 'void *' pointer" warnings

On GCC 4.2.1 archs

MFC with: r351273
Sponsored by: The FreeBSD Foundation

4 years agoloader.efi: efipart should be more careful about constructing block device lists
tsoome [Tue, 20 Aug 2019 19:31:11 +0000 (19:31 +0000)]
loader.efi: efipart should be more careful about constructing block device lists

The cd handles should be collected as list of partitions. Some systems also
provide base name for block device (like PciRoot(0x0)/Pci(0x5,0x0)), we need
to be careful about those.

To make out life a bit easier, we prepare not just an array of handles, but we
allocate pdinfo struct for each handle and devicepath, then we can simplify
our work to sort the devices.

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

4 years agomakefs: add msdosfs (FAT) support
emaste [Tue, 20 Aug 2019 18:20:45 +0000 (18:20 +0000)]
makefs: add msdosfs (FAT) support

Add FAT support to makefs by copying some files from sys/fs/msdosfs/ and
updating others with changes from NetBSD.

The six files copied from sys/fs/msdosfs at r348251 and modified are:
denode.h direntry.h fat.h msdosfs_fat.c msdosfs_lookup.c msdosfsmount.h

I would prefer to avoid the duplication, but reluctance to doing so was
expressed in a previous review (D11197); for now copy the files and
revisit in the future.

Submitted by: Siva Mahadevan
Discussed with: cem, imp
MFC after: 1 month
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D16438

4 years agoRemove upstream files and directories from vendor/lldb/dist that we do
dim [Tue, 20 Aug 2019 18:01:57 +0000 (18:01 +0000)]
Remove upstream files and directories from vendor/lldb/dist that we do
not use.  This saves on repository space, and reduces the number of tree
conflicts when merging.

4 years agoRemove upstream files and directories from vendor/lld/dist that we do
dim [Tue, 20 Aug 2019 18:01:33 +0000 (18:01 +0000)]
Remove upstream files and directories from vendor/lld/dist that we do
not use.  This saves on repository space, and reduces the number of tree
conflicts when merging.

4 years agoRemove upstream files and directories from vendor/libc++/dist that we do
dim [Tue, 20 Aug 2019 18:01:01 +0000 (18:01 +0000)]
Remove upstream files and directories from vendor/libc++/dist that we do
not use.  This saves on repository space, and reduces the number of tree
conflicts when merging.

4 years agoRemove upstream files and directories from vendor/compiler-rt/dist that
dim [Tue, 20 Aug 2019 18:00:15 +0000 (18:00 +0000)]
Remove upstream files and directories from vendor/compiler-rt/dist that
we do not use.  This saves on repository space, and reduces the number
of tree conflicts when merging.

4 years agoRemove upstream files and directories from vendor/clang/dist that we do
dim [Tue, 20 Aug 2019 17:59:23 +0000 (17:59 +0000)]
Remove upstream files and directories from vendor/clang/dist that we do
not use.  This saves on repository space, and reduces the number of tree
conflicts when merging.

4 years agoRemove upstream files and directories from vendor/llvm/dist that we do
dim [Tue, 20 Aug 2019 17:58:59 +0000 (17:58 +0000)]
Remove upstream files and directories from vendor/llvm/dist that we do
not use.  This saves on repository space, and reduces the number of tree
conflicts when merging.

4 years agoUse a sleepable lock for midistat functions.
markj [Tue, 20 Aug 2019 17:52:12 +0000 (17:52 +0000)]
Use a sleepable lock for midistat functions.

Otherwise the mutex needs to be dropped when copying out the midistat
sbuf, leading to a race which allows one to read kernel memory beyond
the end of the sbuf buffer.

Reported and tested by: pho
Security: CVE-2019-5612

4 years agomqueuefs: fix compat32 struct file leak
emaste [Tue, 20 Aug 2019 17:44:03 +0000 (17:44 +0000)]
mqueuefs: fix compat32 struct file leak

In a compat32 error case we previously leaked a struct file.

Submitted by: Karsten König, Secfault Security
Security: CVE-2019-5603

4 years agoPull in r368867 from upstream libc++ trunk (by Marshall Clow):
dim [Tue, 20 Aug 2019 17:39:32 +0000 (17:39 +0000)]
Pull in r368867 from upstream libc++ trunk (by Marshall Clow):

  Rework recursive_timed_mutex so that it uses __thread_id instead of
  using the lower-level __libcpp_thread_id. This is prep for fixing
  PR42918. Reviewed as https://reviews.llvm.org/D65895

Pull in r368916 from upstream libc++ trunk (by Marshall Clow):

  Fix thread comparison by making sure we never pass our special 'not a
  thread' value to the underlying implementation. Fixes PR#42918.

This should fix std::thread::id::operator==() attempting to call
pthread_equal(3) with zero values.

Reported by: andrew@tao11.riddles.org.uk
PR: 239038, 239550
MFC after: 3 days

4 years agoRemove some compatability with Seventh Edition UNIX realloc().
brooks [Tue, 20 Aug 2019 16:07:17 +0000 (16:07 +0000)]
Remove some compatability with Seventh Edition UNIX realloc().

In Seventh Edition UNIX, the last pointer passed to free() was
guaranteed to not actually have been freed allowing memory to be
"compacted" via the following pattern:

free(foo);
foo = realloc(foo, newsize);

Further, Andrew Koenig reports in "C Traps and Pitfalls" that the
original realloc() implementation required this pattern.

The C standard is clear that this is Undefined Behavior. Modern
allocators don't support it and no portable code could rely on it so
remove this support.

Note: the removed implementation contains an off-by-one error and if
an item isn't found on the freelist, then twice as much memory as the
largest possible allocation will be copied.

Reviewed by: kib, imp
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21296

4 years agoUnbreak USB ethernet module builds
jhibbits [Tue, 20 Aug 2019 15:14:32 +0000 (15:14 +0000)]
Unbreak USB ethernet module builds

Sponsored by: Juniper Networks, Inc.

4 years agonetpfil tests: Add too many fragments test for pf, ipfw and ipf
kp [Tue, 20 Aug 2019 14:46:12 +0000 (14:46 +0000)]
netpfil tests: Add too many fragments test for pf, ipfw and ipf

Add test for checking that the packets are dropped if it is fragmented into
more than the defined value.

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21307

4 years agonetpfil tests: Add the set ToS test for ipfw and pf
kp [Tue, 20 Aug 2019 14:31:22 +0000 (14:31 +0000)]
netpfil tests: Add the set ToS test for ipfw and pf

This test tests the following:

 - The firewall is able to set the tos bits
 - The firewall is able to set the DSCP bits when EN bits is already set and
   the EN bits remains unchanged.
 - The firewall is able to drop the packets based on ToS value

Submitted by: Ahsan Barkati
Reviewed by: kp
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21305

4 years agopowerpc: Link Book-E kernels at the same address as AIM kernels
jhibbits [Tue, 20 Aug 2019 01:26:02 +0000 (01:26 +0000)]
powerpc: Link Book-E kernels at the same address as AIM kernels

Summary:
Reduce the diff between AIM and Book-E even more.  This also cleans up
vmparam.h significantly.

Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D21301

4 years agousb_ethernet.h includes a number of mii headers, but only does so in
stevek [Tue, 20 Aug 2019 01:06:43 +0000 (01:06 +0000)]
usb_ethernet.h includes a number of mii headers, but only does so in
order to have struct mii_data available. However, it only really needs
a forward declaration of struct mii_data for use in pointer form for
the return type of a function prototype.

Custom kernel configuration that have usb and fdt enabled, but no miibus,
end up with compilation failures because miibus_if.h will not get
generated.

Due to the above, the following changes have been made to usb_ethernet.h:
 * remove the inclusion of mii headers
 * forward-declare struct mii_data
 * include net/ifq.h to satify the need for complete struct ifqueue

Reviewed by: ian
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D21293

4 years agoUse an atomic reference count for paging in progress so that callers do not
jeff [Mon, 19 Aug 2019 23:09:38 +0000 (23:09 +0000)]
Use an atomic reference count for paging in progress so that callers do not
require the object lock.

Reviewed by: markj
Tested by: pho (as part of a larger branch)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21311

4 years agoFix stylistic nit in r351239
cem [Mon, 19 Aug 2019 23:01:59 +0000 (23:01 +0000)]
Fix stylistic nit in r351239

Meant to fix this before committing, but forgot.

4 years agogdb(4): Support "qC" query
cem [Mon, 19 Aug 2019 22:58:30 +0000 (22:58 +0000)]
gdb(4): Support "qC" query

Sometimes GDB gets confused about what the current thread is.  When it does,
it asks the remote: "Who am I?"

Answer it.

4 years agogdb(4): Pack 'info threads' responses into fewer packets
cem [Mon, 19 Aug 2019 22:57:03 +0000 (22:57 +0000)]
gdb(4): Pack 'info threads' responses into fewer packets

We suffer at least one round trip ACK latency every command / packet that
GDB has to send and receive, and the response format for 'info threads'
supports packing many threads IDs into a single packet, so do so.

Adds and uses a new API, gdb_txbuf_has_capacity(), which checks for a
certain number of bytes available in the outgoing txbuf.

On an example amd64 VM, the number of RTTs to transmit this list is reduced
by a factor of 110x.  This is especially beneficial with recent GDB, which
seems to request the list at least twice during attach.

4 years agolibkern: Implement strchrnul(3)
cem [Mon, 19 Aug 2019 22:53:05 +0000 (22:53 +0000)]
libkern: Implement strchrnul(3)

4 years agoPermit vm_pager_has_page() to run with a shared lock. Introduce
jeff [Mon, 19 Aug 2019 22:25:28 +0000 (22:25 +0000)]
Permit vm_pager_has_page() to run with a shared lock.  Introduce
VM_OBJECT_DROP/VM_OBJECT_PICKUP to handle functions that are called with
uncertain lock state.

Reviewed by: kib, markj
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21310

4 years agoPartially revert the previous commit.
jkim [Mon, 19 Aug 2019 21:45:25 +0000 (21:45 +0000)]
Partially revert the previous commit.

It was an experiment and not meant to be committed. :-(

4 years agomakefs.8: expand description of image size
emaste [Mon, 19 Aug 2019 21:38:10 +0000 (21:38 +0000)]
makefs.8: expand description of image size

Submitted by: ryan_freqlabs.com, Siva Mahadevan
Differential Revision: https://reviews.freebsd.org/D21316

4 years agoFix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH).
jkim [Mon, 19 Aug 2019 21:30:12 +0000 (21:30 +0000)]
Fix sound on headset jack for Lenovo Thinkpad X1 Carbon Gen 6 (model 20KH).

Note this commit was inspired by r350433.

MFC after: 2 weeks

4 years agomakefs.8: style updates from igor
emaste [Mon, 19 Aug 2019 21:21:32 +0000 (21:21 +0000)]
makefs.8: style updates from igor

Sponsored by: The FreeBSD Foundation

4 years agotuntap: belatedly add MODULE_VERSION for if_tun and if_tap
kevans [Mon, 19 Aug 2019 19:01:59 +0000 (19:01 +0000)]
tuntap: belatedly add MODULE_VERSION for if_tun and if_tap

When tun/tap were merged, appropriate MODULE_VERSION should have been added
for things like modfind(2) to continue to do the right thing with the old
names.

Reported by: jhb

4 years agomips: avoid empty mdproc struct
kevans [Mon, 19 Aug 2019 18:15:17 +0000 (18:15 +0000)]
mips: avoid empty mdproc struct

Compiling with a more modern toolchain than GCC 4.2 in base warns about the
empty struct. Take a hint and comment from r350902+r350953 by luporl@.

4 years agoFix uninitialized variable warnings when MK_CASPER=no
asomers [Mon, 19 Aug 2019 17:54:40 +0000 (17:54 +0000)]
Fix uninitialized variable warnings when MK_CASPER=no

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21322

4 years agoDon't set the string "unknown" as a device's location_str
scottph [Mon, 19 Aug 2019 17:51:06 +0000 (17:51 +0000)]
Don't set the string "unknown" as a device's location_str

Return an empty string when the location is unknown instead of the
string "unknown". This ensures that all location entries are of
the form key=val.

Suggested by: imp
Approved by: jhb (mentor)
MFC after: 1 week
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D21326

4 years agoTrim a spurious blank line I added in r348969.
jhb [Mon, 19 Aug 2019 17:28:12 +0000 (17:28 +0000)]
Trim a spurious blank line I added in r348969.

I did not bump .Dd since there is no content change.

MFC after: 3 days

4 years agoping: fix -Wformat-truncating warning with GCC
asomers [Mon, 19 Aug 2019 17:28:12 +0000 (17:28 +0000)]
ping: fix -Wformat-truncating warning with GCC

Increase buffer size for the string representation of n_time

ICMP timestamp is a 32-bit number. In pr_ntime(), number of minutes
and seconds is always 2 characters wide. Max. number of hours is 4
characters wide. The buffer size should be at least:

4 + 2 + 2 + 1 (':') + 1 (':') + 1 ('\0') = 11

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: 2 weeks
Sponsored by: Google, inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21325

4 years agolink ptnet(4) man page to the build system
vmaffione [Mon, 19 Aug 2019 17:26:04 +0000 (17:26 +0000)]
link ptnet(4) man page to the build system

Reported by: kevans
Reviewed by: kevans, bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21312

4 years agoif_tuntap: minor improvements
vmaffione [Mon, 19 Aug 2019 17:23:22 +0000 (17:23 +0000)]
if_tuntap: minor improvements

Rewrite a loop to avoid duplicating the exit condition.
Simplify mask processing in tunpoll().
Fix minor typos.

Reviewed by: kevans, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21302

4 years agoFix netdump buffering after r348473.
markj [Mon, 19 Aug 2019 16:29:51 +0000 (16:29 +0000)]
Fix netdump buffering after r348473.

nd_buf is used to buffer headers (for both the kernel dump itself and
for EKCD) before the final call to netdump_dumper(), which flushes
residual data in nd_buf.  As a result, a small portion of the residual
data would be corrupted.  This manifests when kernel dump compression
is enabled since both zstd and zlib detect the corruption during
decompression.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D21294

4 years agoti: sdhci: Correct voltage caps
manu [Mon, 19 Aug 2019 14:33:22 +0000 (14:33 +0000)]
ti: sdhci: Correct voltage caps

ti,dual-volt property say that the eMMC support 1.8V and 3.3V not 3.0V
Use the correct caps for the mmc stack.
Note that the MMCHS_SD_CAPA register can only be written once after bootup
so if one is using a u-boot compiled with eMMC support (this is the default)
this code is a no-op but just in case someone have u-boot compiled without
eMMC support this make eMMC works when the kernel is booted.

MFC after: 1 week

4 years agoarm64: a37x0_gpio: Use syscon instead of MMIO region
manu [Mon, 19 Aug 2019 14:28:54 +0000 (14:28 +0000)]
arm64: a37x0_gpio: Use syscon instead of MMIO region

The fdt node for this driver is a simple-mfd and syscon compatible one
meaning that simplemfd will be the driver attached for it. The gpio driver
is attached to the 'gpio' subnode so use syscon_get_handle_default to
obtain the handle of the syscon from the parent device and use this
to read/write to the memory region.

MFC after: 1 week

4 years agoping6: revert r350857
asomers [Mon, 19 Aug 2019 14:20:26 +0000 (14:20 +0000)]
ping6: revert r350857

Some socket options require root privileges to set.  The old code did indeed
drop privileges at the earliest opportunity.

Submitted by: Ján Sučan <sucanjan@gmail.com>
MFC after: Never
Sponsored by: Google, Inc. (Google Summer of Code 2019)
Differential Revision: https://reviews.freebsd.org/D21319

4 years agovfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS")
mjg [Mon, 19 Aug 2019 14:11:54 +0000 (14:11 +0000)]
vfs: fix up r351193 ("stop always overwriting ->mnt_stat in VFS_STATFS")

fs-specific part of vfs_statfs routines only fill in small portion of the
structure. Previous code was always copying everything at a higher layer to
acoomodate it and this patch does the same.

'df' (no arguments) worked fine because the caller uses mnt_stat itself as the
target buffer, making all the copying a no-op for its own case.
'df /' and similar use a different consumer which passes its own buffer and
this is where you can run into trouble.

Reported by: cy
Fixes: r351193
Sponsored by: The FreeBSD Foundation

4 years agoUse TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose().
ae [Mon, 19 Aug 2019 12:42:03 +0000 (12:42 +0000)]
Use TAILQ_FOREACH_SAFE() macro to avoid use after free in soclose().

PR: 239893
MFC after: 1 week

4 years agoassert that td_lk_slocks is not leaked upon return from kernel
avg [Mon, 19 Aug 2019 11:18:36 +0000 (11:18 +0000)]
assert that td_lk_slocks is not leaked upon return from kernel

This is similar to checks for td_sx_slocks and td_rw_rlocks.
Although td_lk_slocks is an implementation detail, it still makes sense
to validate it.

MFC after: 1 week
Sponsored by: Panzura

4 years agonetpfil tests: Move pft_ping.py and sniffer.py to the common test directory
kp [Mon, 19 Aug 2019 10:48:27 +0000 (10:48 +0000)]
netpfil tests: Move pft_ping.py and sniffer.py to the common test directory

The pft_ping.py and sniffer.py tool is moved from tests/sys/netpfil/pf to
tests/sys/netpfil/common directory because these tools are to be used in
common for all the firewalls.

Submitted by: Ahsan Barkati
Reviewed by: kp, thj
Sponsored by: Google, Inc. (GSoC 2019)
Differential Revision: https://reviews.freebsd.org/D21276

4 years agosys.kern.pdeathsig.signal_delivered_ptrace: fix startup.
kib [Mon, 19 Aug 2019 09:33:09 +0000 (09:33 +0000)]
sys.kern.pdeathsig.signal_delivered_ptrace: fix startup.

Inform D that C executed procctl(PROC_PDEATHSIG_CTL).  Otherwise D
might allow B to exit before C is set up to receive a signal on the
parent exit.  In this case, C waits forever for the signal and test
hangs.

PR: 237657
Reported and tested by: lwhsu
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agosys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach
kib [Mon, 19 Aug 2019 09:29:27 +0000 (09:29 +0000)]
sys.kern.pdeathsig.signal_delivered_ptrace: fix debugger detach

ptrace(PT_DETACH) requires stopped debuggee, otherwise it fails.  When
the call fails, the C process is left as debuggee of the process D,
and might be killed too early if process D exits occurs fast enough.

Since pipes are not closed in the forked children, this resulted in
the test hanging, since no write occured from C to wake A.

PR: 237657
Reported and tested by: lwhsu
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoUse calloc().
delphij [Mon, 19 Aug 2019 05:24:42 +0000 (05:24 +0000)]
Use calloc().

MFC after: 2 weeks

4 years agoRemove redundant check and wrong fix: fat.c checks already take care
delphij [Mon, 19 Aug 2019 04:28:12 +0000 (04:28 +0000)]
Remove redundant check and wrong fix: fat.c checks already take care
about cluster chains.

Obtained from: OpenBSD
MFC after: 2 weeks

4 years agoperiodic: replace "tty" with "test -t 0"
asomers [Mon, 19 Aug 2019 01:14:11 +0000 (01:14 +0000)]
periodic: replace "tty" with "test -t 0"

Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Reviewed by: cy
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D21318

4 years agoAdd an entry to RELNOTES for r351201.
rmacklem [Mon, 19 Aug 2019 00:46:31 +0000 (00:46 +0000)]
Add an entry to RELNOTES for r351201.

4 years agoAdd a vop_stdioctl() that performs a trivial FIOSEEKDATA/FIOSEEKHOLE.
rmacklem [Mon, 19 Aug 2019 00:29:05 +0000 (00:29 +0000)]
Add a vop_stdioctl() that performs a trivial FIOSEEKDATA/FIOSEEKHOLE.

Without this patch, when an application performed lseek(SEEK_DATA/SEEK_HOLE)
on a file in a file system that does not have its own VOP_IOCTL(), the
lseek(2) fails with errno ENOTTY. This didn't seem appropriate, since
ENOTTY is not listed as an error return by either the lseek(2) man page
nor the POSIX draft for lseek(2).
A discussion on freebsd-current@ seemed to indicate that implementing
a trivial algorithm that returns the offset argument for FIOSEEKDATA and
returns the file's size for FIOSEEKHOLE was the preferred fix.
http://docs.FreeBSD.org/cgi/mid.cgi?CAOtMX2iiQdv1+15e1N_r7V6aCx_VqAJCTP1AW+qs3Yg7sPg9wA
The Linux kernel appears to implement this trivial algorithm as well.

This patch adds a vop_stdioctl() that implements this trivial algorithm.
It returns errors consistent with vn_bmap_seekhole() and, as such, will
still return ENOTTY for non-regular files.

I have proposed a separate patch that maps errors not described by the
lseek(2) man page nor POSIX draft to EINVAL. This patch is under separate
review.

Reviewed by: kib
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D21299

4 years agoAllocate all per-cpu datastructures in domain correct memory.
jeff [Sun, 18 Aug 2019 23:44:23 +0000 (23:44 +0000)]
Allocate all per-cpu datastructures in domain correct memory.

Reviewed by: kib, gallatin (some objections)
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21242

4 years agoiwmbtfw(8): Fix compilation on platforms using gcc.
wulf [Sun, 18 Aug 2019 23:10:07 +0000 (23:10 +0000)]
iwmbtfw(8): Fix compilation on platforms using gcc.

X-MFC with: r351197

4 years agoAllocate amd64's page array using pages and page directory pages from the
jeff [Sun, 18 Aug 2019 23:07:56 +0000 (23:07 +0000)]
Allocate amd64's page array using pages and page directory pages from the
NUMA domain that the pages describe.  Patch original from gallatin.

Reviewed by: kib
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21252

4 years agoiwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices
wulf [Sun, 18 Aug 2019 22:20:28 +0000 (22:20 +0000)]
iwmbtfw: Firmware loader for Intel Wireless 8260 based Bluetooth USB devices

Currently supported models are: 8260, 8265, 9560, 9260 and 22161.
Firmware files can be installed with comms/iwmbt-firmware port.

PR: 237083
Reviewed by: hps, emax
X-MFC with: r351196
Differential Revision: https://reviews.freebsd.org/D21071

4 years agong_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode.
wulf [Sun, 18 Aug 2019 22:11:42 +0000 (22:11 +0000)]
ng_ubt(4): do not attach Intel Wireless 8260/8265 in bootloader mode.

Add helper function for synchronous execution of HCI commands at probe
stage and use this function to check firmware state of Intel Wireless
8260/8265 bluetooth devices found in many post 2016 year laptops.

Attempt to initialize FreeBSD bluetooth stack while such a device is in
bootloader mode locks the adapter hardly so it requires power on/off
cycle to restore.

This change blocks ng_ubt attachment unless operational firmware is
loaded thus preventing the lock up.

PR: 237083
Reviewed by: hps, emax
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21071

4 years agoFix an issue with executing tmpfs binary.
kib [Sun, 18 Aug 2019 20:36:11 +0000 (20:36 +0000)]
Fix an issue with executing tmpfs binary.

Suppose that a binary was executed from tmpfs mount, and the text
vnode was reclaimed while the binary was still running.  It is
possible during even the normal operations since tmpfs vnode'
vm_object has swap type, and no references on the vnode is held.  Also
assume that the text vnode was revived for some reason.  Then, on the
process exit or exec, unmapping of the text mapping tries to remove
the text reference from the vnode, but since it went from
recycle/instantiation cycle, there is no reference kept, and assertion
in VOP_UNSET_TEXT_CHECKED() triggers.

Fix this by keeping a use reference on the tmpfs vnode for each exec
reference.  This prevents the vnode reclamation while executable map
entry is active.

Do it by adding per-mount flag MNTK_TEXT_REFS that directs
vop_stdset_text() to add use ref on first vnode text use, and
per-vnode VI_TEXT_REF flag, to record the need on unref in
vop_stdunset_text() on last vnode text use going away.  Set
MNTK_TEXT_REFS for tmpfs mounts.

Reported by: bdrewery
Tested by: sbruno, pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoChange locking requirements for VOP_UNSET_TEXT().
kib [Sun, 18 Aug 2019 20:24:52 +0000 (20:24 +0000)]
Change locking requirements for VOP_UNSET_TEXT().

Require the vnode to be locked for the VOP_UNSET_TEXT() call.  This
will be used by the following bug fix for a tmpfs issue.

Tested by: sbruno, pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agovfs: stop always overwriting ->mnt_stat in VFS_STATFS
mjg [Sun, 18 Aug 2019 18:40:12 +0000 (18:40 +0000)]
vfs: stop always overwriting ->mnt_stat in VFS_STATFS

The struct is already populated on each mount (and remount). Fields are either
constant or not used by filesystem in the first place.

Some infrequently used functions use it to avoid having to allocate a new buffer
and are left alone.

The current code results in an avoidable copying single-threaded and significant
cache line bouncing multithreaded

While here deduplicate initial filling of the struct.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21317

4 years agoperiodic: fix anticongestion for scripts run after security
asomers [Sun, 18 Aug 2019 17:12:06 +0000 (17:12 +0000)]
periodic: fix anticongestion for scripts run after security

Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic.  The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation.  The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.

Fix this bug by delaying cleanup until the end of the original invocation.

PR: 236564
Submitted by: Yasuhiro KIMURA <yasu@utahime.org>
Reviewed by: imp
MFC after: 1 month

4 years agorandom(4): Reorder configuration of random source modules
cem [Sun, 18 Aug 2019 16:04:01 +0000 (16:04 +0000)]
random(4): Reorder configuration of random source modules

Move fast entropy source registration to the earlier
SI_SUB_RANDOM:SI_ORDER_FOURTH and move random_harvestq_prime after that.
Relocate the registration routines out of the much later randomdev module
and into random_harvestq.

This is necessary for the fast random sources to actually register before we
perform random_harvestq_prime() early in the kernel boot.

No functional change.

Reviewed by: delphij, markjm
Approved by: secteam(delphij)
Differential Revision: https://reviews.freebsd.org/D21308

4 years agoi386: Implement atomic_load_64(9) and atomic_store_64(9).
kib [Sun, 18 Aug 2019 15:58:44 +0000 (15:58 +0000)]
i386: Implement atomic_load_64(9) and atomic_store_64(9).

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoFix bug introduced by r351184.
mmel [Sun, 18 Aug 2019 15:37:19 +0000 (15:37 +0000)]
Fix bug introduced by r351184.
We should check the returned handle, not the pointer to it.

Noticed by: ian
X-MFC with: r351184
MFC after: 1 week

4 years agoAdd a blocking wait bit to refcount. This allows refs to be used as a simple
jeff [Sun, 18 Aug 2019 11:43:58 +0000 (11:43 +0000)]
Add a blocking wait bit to refcount.  This allows refs to be used as a simple
barrier.

Reviewed by: markj, kib
Discussed with: jhb
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21254

4 years agoImprove rk_pinctrl driver:
mmel [Sun, 18 Aug 2019 09:19:33 +0000 (09:19 +0000)]
Improve rk_pinctrl driver:
- add support for 'output-low', 'output-high', 'output-low' and
  'output-enable' properties. These are use in RK3288 DT files
- add support for RK3288
- to reduce overall file size, use local macros for initialization
  of pinctrl description structures.

MFC after: 2 weeks

4 years agoImprove rk_i2c driver:
mmel [Sun, 18 Aug 2019 09:11:43 +0000 (09:11 +0000)]
Improve rk_i2c driver:
- Properly handle IIC_M_NOSTOP and IIC_M_NOSTART flags.
- add polling mode, so driver can be used even if interrupts are not
  enabled (this is necessary for proper support of PMICs).
- add support for RK3288

MFC after: 2 weeks

4 years agoEnhance support of extres in dwmmc driver.
mmel [Sun, 18 Aug 2019 08:54:10 +0000 (08:54 +0000)]
Enhance support of extres in dwmmc driver.
Handle all clocks, regulators and resets defined by dwmmc bindings.

MFC after: 2 weeks

4 years agoAdd method for getting of syscon handle from parent device.
mmel [Sun, 18 Aug 2019 08:08:56 +0000 (08:08 +0000)]
Add method for getting of syscon handle from parent device.

If simple multifuction device also provides syscon interface, its
childern should be able to consume it. Due to this:
- declare coresponding method in syscon interface
- implement it in simple multifunction device driver

MFC after: 1 week

4 years agoRemove unnecessary debugging from r351181 that caused powerpc build to fail.
jeff [Sun, 18 Aug 2019 08:07:31 +0000 (08:07 +0000)]
Remove unnecessary debugging from r351181 that caused powerpc build to fail.

Tested by: make universe TARGETS=powerpc