]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMerge ^/head r363583 through r364040.
Dimitry Andric [Fri, 7 Aug 2020 19:33:54 +0000 (19:33 +0000)]
Merge ^/head r363583 through r364040.

3 years agoFix clang 11 inline asm constraint error when building powerpc GENERIC64
Dimitry Andric [Fri, 7 Aug 2020 19:32:54 +0000 (19:32 +0000)]
Fix clang 11 inline asm constraint error when building powerpc GENERIC64
kernels:

sys/powerpc/aim/mmu_radix.c:728:19: error: invalid operand for inline asm constraint 'i'
        __asm __volatile(PPC_TLBIEL(%0, %1, %2, %3, 1)
                         ^
sys/powerpc/aim/mmu_radix.c:149:3: note: expanded from macro 'PPC_TLBIEL'
         __XSTRING(.long PPC_INST_TLBIEL | \
         ^
sys/sys/cdefs.h:161:22: note: expanded from macro '__XSTRING'
#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
                        ^
sys/sys/cdefs.h:160:21: note: expanded from macro '__STRING'
#define __STRING(x)     #x              /* stringify without expanding x */
                        ^
<scratch space>:112:1: note: expanded from here
".long 0x7c000224 | (((%0) & 0x1f) << 11) | (((%1) & 0x1f) << 21) | (((%2) & 0x3) << 18) | (((%3) & 0x1) << 17) | (((1) & 0x1) << 16)"
^

This is solved by making the affected inline functions __always_inline.

Suggested by: jhibbits
MFC after: 3 days

3 years agoscript: Put the terminal in raw mode when playing back a session.
Mark Johnston [Fri, 7 Aug 2020 18:48:56 +0000 (18:48 +0000)]
script: Put the terminal in raw mode when playing back a session.

Otherwise recorded sessions of some interactive programs do not play
back properly.

PR: 248377
Submitted by: Soumendra Ganguly <0.gangzta@gmail.com>
MFC after: 1 week

3 years agoEnable hw.pci.enable_aspm tunable by default.
Alexander Motin [Fri, 7 Aug 2020 18:40:56 +0000 (18:40 +0000)]
Enable hw.pci.enable_aspm tunable by default.

While effects on power saving is only a guess, effects on hot-plug are
clearly visible.  Lets try to enable it and see what happen.

MFC after: 3 months

3 years agoAdd some more checks to make APEI driver more robust.
Alexander Motin [Fri, 7 Aug 2020 18:38:10 +0000 (18:38 +0000)]
Add some more checks to make APEI driver more robust.

MFC after: 5 days

3 years agoRemove obsolete part of comment. It was cut and pasted from the old version of
Warner Losh [Fri, 7 Aug 2020 18:21:48 +0000 (18:21 +0000)]
Remove obsolete part of comment. It was cut and pasted from the old version of
this function, and was never relevant to the new version.

3 years agoMerge ^/head r363989 through r364034.
Dimitry Andric [Fri, 7 Aug 2020 18:14:41 +0000 (18:14 +0000)]
Merge ^/head r363989 through r364034.

3 years agoRe-add generated arm_neon.h header, which was accidentally dropped while
Dimitry Andric [Fri, 7 Aug 2020 18:12:37 +0000 (18:12 +0000)]
Re-add generated arm_neon.h header, which was accidentally dropped while
refactoring lib/clang/headers/Makefile in r363984.

3 years agosetlocale(3): Add an EXAMPLES section and add LANG category
Gordon Bergling [Fri, 7 Aug 2020 17:25:56 +0000 (17:25 +0000)]
setlocale(3): Add an EXAMPLES section and add LANG category

PR: 41824
Submitted by: Slaven Rezic <eserte atvran dot herceg dot de>
Obtained from: NetBSD
MFC after: 1 week

3 years agombsrtowcs(3): Clarify the RETURN VALUES section
Gordon Bergling [Fri, 7 Aug 2020 16:56:43 +0000 (16:56 +0000)]
mbsrtowcs(3): Clarify the RETURN VALUES section

PR: 215848
Submitted by: Andrew Stevenson <andrew at ugh dot net dot au>
MFC after: 1 week

3 years agoThe practice of creating symbolic links is somewhat fragile. Always
Warner Losh [Fri, 7 Aug 2020 16:26:56 +0000 (16:26 +0000)]
The practice of creating symbolic links is somewhat fragile. Always
make copies instead.

There's too many times that we can't run the new binaries with old
libraries. Making the links when things are known to be 'safe' is a
nice optimization, but a copy of all the binaries is only 30MB, so
saving the copies at the cost of increased support when new symbols
are added and used as part of the bootstrap seems to be unwise.

There may be additional optimizations possible here, especially for
!FreeBSD hosts. However, that's beyond the scope of the problem I'm
trying to fix with make failing mid-way through an installworld across
change r363679. This optimization there caused us to run a new binary
with an old library once a new make was installed due to the symbolic
link. One could just copy make, but then other binaries fail as well,
so rather than play whack-a-mole, I opted to take us back to the old
way.  Before r340157 or so we did copies (thogh of a lot fewer
artifacts), and we didn't have issues like this.

Reviewed by: arichards@
Differential Revision: https://reviews.freebsd.org/D25967

3 years agotmpnam(3): Also mention tmpfile in the ENVIRONMENT section
Gordon Bergling [Fri, 7 Aug 2020 16:20:07 +0000 (16:20 +0000)]
tmpnam(3): Also mention tmpfile in the ENVIRONMENT section

PR: 181785
Submitted by: Kevin P. Neal <kpneal atpobox dot com>
MFC after: 1 week

3 years agoImplement radix_tree_store() in the LinuxKPI for use with the coming
Hans Petter Selasky [Fri, 7 Aug 2020 16:15:44 +0000 (16:15 +0000)]
Implement radix_tree_store() in the LinuxKPI for use with the coming
extensible arrays implementation.

While at it add some more comments explaining the current
radix_tree_insert() function and make sure to clean the root node when
the radix tree reaches the maximum height. This can happen if the
index passed is too big when the tree is empty.

The radix_tree_store() function is basically a copy of the
radix_tree_insert() function with some added functionality.

The radix_tree_store() function is local to FreeBSD and does not yet
exist in Linux.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoFix linker error in libuutil with recent LLVM
Alex Richardson [Fri, 7 Aug 2020 16:04:21 +0000 (16:04 +0000)]
Fix linker error in libuutil with recent LLVM

Not marking the function as static can result in a linker error:
undefined reference to __assfail [--no-allow-shlib-undefined]
I noticed this error after updating our CHERI LLVM to the latest upstream
LLVM HEAD revision.

This change effectively reverts r329984 and marks dmu_buf_init_user as
static (which keeps the GCC build happy).

Reviewed By: #zfs, asomers, freqlabs, mav
Differential Revision: https://reviews.freebsd.org/D25663

3 years agoFix duplicate assignment of _localedef in Makefile.inc1
Alex Richardson [Fri, 7 Aug 2020 16:04:15 +0000 (16:04 +0000)]
Fix duplicate assignment of _localedef in Makefile.inc1

The same .if exists a few lines below.

3 years agoDon't link against libdialog/ncurses when bootstrapping tzsetup
Alex Richardson [Fri, 7 Aug 2020 16:04:10 +0000 (16:04 +0000)]
Don't link against libdialog/ncurses when bootstrapping tzsetup

3 years agomakefs: Drop unnecessary sys/clock.h include
Alex Richardson [Fri, 7 Aug 2020 16:04:06 +0000 (16:04 +0000)]
makefs: Drop unnecessary sys/clock.h include

This breaks the build on macOS where this header doesn't exist. I could
also add a compat header to tools/build/cross-build but since it's not
needed removing it seems like the better solution.

3 years agoAlways install usr.bin/grep as grep when bootstrapping
Alex Richardson [Fri, 7 Aug 2020 16:04:01 +0000 (16:04 +0000)]
Always install usr.bin/grep as grep when bootstrapping

We have to bootstrap grep when cross-building from macOS/Linux.

3 years agoFix cddl tools bootstrapping on macOS and Linux
Alex Richardson [Fri, 7 Aug 2020 16:03:55 +0000 (16:03 +0000)]
Fix cddl tools bootstrapping on macOS and Linux

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D25979

3 years agogrep(1): correct typos for 'if a name patches' to 'if a name matches'
Gordon Bergling [Fri, 7 Aug 2020 16:01:05 +0000 (16:01 +0000)]
grep(1): correct typos for 'if a name patches' to 'if a name matches'

PR: 237635
Submitted by: durin42 <raf atdurin42 dot com>
Reviewed by: kevans
Approved by: kevans
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25994

3 years agoAdd full support support for dynamic allocation and freeing of epoch's.
Hans Petter Selasky [Fri, 7 Aug 2020 15:32:42 +0000 (15:32 +0000)]
Add full support support for dynamic allocation and freeing of epoch's.

Make sure to reclaim epoch structures when they are freed to support
dynamic allocation and freeing of epoch structures.

While at it, move the 64 supported epoch control structures to the
static memory domain. This overall simplifies the management and
debugging of system epoch's.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D25960
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoIPV6_PKTINFO support for v4-mapped IPv6 sockets
Bjoern A. Zeeb [Fri, 7 Aug 2020 15:13:53 +0000 (15:13 +0000)]
IPV6_PKTINFO support for v4-mapped IPv6 sockets

When using v4-mapped IPv6 sockets with IPV6_PKTINFO we do not
respect the given v4-mapped src address on the IPv4 socket.
Implement the needed functionality. This allows single-socket
UDP applications (such as OpenVPN) to work better on FreeBSD.

Requested by: Gert Doering (gert greenie.net), pfsense
Tested by: Gert Doering (gert greenie.net)
Reviewed by: melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24135

3 years agoAllow ACPI APEI driver build without PCI.
Alexander Motin [Fri, 7 Aug 2020 13:35:34 +0000 (13:35 +0000)]
Allow ACPI APEI driver build without PCI.

On x86 it seems difficult to build ACPI without PCI, but some aarch64
users appears to be doing it.

MFC after: 3 days

3 years agolib80211: fix indentation of comments for some netbands.
Bjoern A. Zeeb [Fri, 7 Aug 2020 12:47:00 +0000 (12:47 +0000)]
lib80211: fix indentation of comments for some netbands.

Whitespace only; no functional changes.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agonet80211/ifconfig: print hardware device name for wlan interfaces
Bjoern A. Zeeb [Fri, 7 Aug 2020 12:24:23 +0000 (12:24 +0000)]
net80211/ifconfig: print hardware device name for wlan interfaces

Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig
to print the parent interface again. This functionality was lost
around r287197. It helps in case of multiple wlan interfaces and
multiple underlying hardware devices to keep track which wlan
interface belongs to which physical device.

Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Reviewed by: adrian, Idwer Vollering
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25832

3 years agopkgbase: We can't easily have a package with either a - or a _
Emmanuel Vadot [Fri, 7 Aug 2020 12:19:21 +0000 (12:19 +0000)]
pkgbase: We can't easily have a package with either a - or a _

Rename iscsi_legacy to iscsilegacy, having - or _ in a package name cause
problems when we process them and generate the ucl.

3 years agopkgbase: Fix dependancies
Emmanuel Vadot [Fri, 7 Aug 2020 10:20:39 +0000 (10:20 +0000)]
pkgbase: Fix dependancies

The package name is converted with _ instead of - as we have some variables
that cannot contain -
Convert back the dependancies with - instead of _

3 years agoAdd a .Pp to separate description and sample code for readability.
Li-Wen Hsu [Fri, 7 Aug 2020 08:57:31 +0000 (08:57 +0000)]
Add a .Pp to separate description and sample code for readability.

3 years agotelnet(1): Document -P option
Gordon Bergling [Fri, 7 Aug 2020 08:41:14 +0000 (08:41 +0000)]
telnet(1): Document -P option

PR: 248157
Submitted by: Juraj Lutter <juraj at lutter dot sk>
Reviewed by: bcr
Approved by: bcr
Obtained from: NetBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25794

3 years agoAll the other printf() calls cast to (void) here, do the two newer ones for
Warner Losh [Fri, 7 Aug 2020 02:48:19 +0000 (02:48 +0000)]
All the other printf() calls cast to (void) here, do the two newer ones for
consistency.

3 years agoiflib: netmap: drop redundant check
Vincenzo Maffione [Thu, 6 Aug 2020 21:37:38 +0000 (21:37 +0000)]
iflib: netmap: drop redundant check

The validity of head is already checked by nm_rxsync_prologue().

MFC after: 2 weeks

3 years agoiflib: netmap: don't increment ifl_cidx on the wrong free list
Vincenzo Maffione [Thu, 6 Aug 2020 21:32:25 +0000 (21:32 +0000)]
iflib: netmap: don't increment ifl_cidx on the wrong free list

Netmap only uses free list 0 to keep it consistent with its
one-to-one mapping between each netmap ring and a device RX
(or TX) queue.
However, the current iflib_netmap_rxsync() routine was
mistakenly updating the ifl_cidx field of both free lists.

PR: 248494
MFC after: 2 weeks

3 years agoem(4): honor vlanhwtag offload
Vincenzo Maffione [Thu, 6 Aug 2020 21:01:26 +0000 (21:01 +0000)]
em(4): honor vlanhwtag offload

The FreeBSD em driver fails to properly reset the VME flag
in the e1000 CTRL register oneg the following ifconfig command

ifconfig em1 -vlanhwtag

Tested on the e1000 device emulated by QEMU, and on a real
NIC (chip=0x10d38086).

PR: 236584
Submitted by:  murat@sunnyvalley.io
Reported by:  murat@sunnyvalley.io
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25286

3 years agoPut clang/lib/Tooling/Core/Replacement.cpp under SRCS_MIN, since it is
Dimitry Andric [Thu, 6 Aug 2020 20:55:18 +0000 (20:55 +0000)]
Put clang/lib/Tooling/Core/Replacement.cpp under SRCS_MIN, since it is
required by both the static analyzer (MK_CLANG_FULL) and clang-format
(MK_CLANG_FORMAT). We could also invent yet another SRCS variant, but
that seems a bit overkill.

3 years agostand: use portable ln -n instead of ln -h
Alex Richardson [Thu, 6 Aug 2020 20:46:18 +0000 (20:46 +0000)]
stand: use portable ln -n instead of ln -h

This fixes the build on Linux

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

3 years agoAllow bootstrapping pwd_mkdb on Linux/macOS
Alex Richardson [Thu, 6 Aug 2020 20:46:13 +0000 (20:46 +0000)]
Allow bootstrapping pwd_mkdb on Linux/macOS

We need to provide a struct passwd that is compatible with the target
system and this is not the case when cross-building from macOS/Linux.
It should also be a problem when bootstrapping for an i386 target from a
FreeBSD amd64 host since time_t does not match across those systems.
However, pwd_mkdb always truncates integer values to 32-bit so this
difference does not result in different databases.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D25931

3 years agoctfmerge: Fix missing pthread_cond_init()
Alex Richardson [Thu, 6 Aug 2020 20:44:40 +0000 (20:44 +0000)]
ctfmerge: Fix missing pthread_cond_init()

This does not appear to matter on FreeBSD or Linux, but when building an
amd64 kernel on macOS I was seeing infinite loops in ctfmerge.
It turns out the loop in wip_save_work() was looping forever due to
pthread_cond_wait() always returning -EINVAL.

Reviewed By: markj, brooks
Differential Revision: https://reviews.freebsd.org/D25973

3 years agoMerge ^/head r363583 through r363988.
Dimitry Andric [Thu, 6 Aug 2020 20:33:17 +0000 (20:33 +0000)]
Merge ^/head r363583 through r363988.

3 years agoFix clang 11 -Wformat warnings in yp_mkdb:
Dimitry Andric [Thu, 6 Aug 2020 20:31:50 +0000 (20:31 +0000)]
Fix clang 11 -Wformat warnings in yp_mkdb:

usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
                        ~~~~                         ^~~~~~~~
usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                    data.data);
                    ^~~~~~~~~

MFC after: 3 days

3 years agoMerge ^/head r363739 through r363986.
Dimitry Andric [Thu, 6 Aug 2020 19:34:55 +0000 (19:34 +0000)]
Merge ^/head r363739 through r363986.

3 years agoApply tentative fix for clang 11 warning in pam_exec(8):
Dimitry Andric [Thu, 6 Aug 2020 19:31:52 +0000 (19:31 +0000)]
Apply tentative fix for clang 11 warning in pam_exec(8):

lib/libpam/modules/pam_exec/pam_exec.c:222:56: error: format specifies type 'char *' but the argument has type 'const void *' [-Werror,-Wformat]
               if (asprintf(&envstr, "%s=%s", pam_item_env[i].name, item) < 0)
                                         ~~                         ^~~~

3 years agoTentatively update UPDATING and ObsoleteFiles.inc for 11.0.0.
Dimitry Andric [Thu, 6 Aug 2020 19:30:39 +0000 (19:30 +0000)]
Tentatively update UPDATING and ObsoleteFiles.inc for 11.0.0.

3 years agoUpdate Makefiles under lib/clang and usr.bin/clang for 11.0.0 builds,
Dimitry Andric [Thu, 6 Aug 2020 19:30:00 +0000 (19:30 +0000)]
Update Makefiles under lib/clang and usr.bin/clang for 11.0.0 builds,
and also bump the version in the mtree files.

3 years agoRegenerate lib/clang/liblldb/LLDBWrapLua.cpp with swig 4.0.2.
Dimitry Andric [Thu, 6 Aug 2020 19:28:00 +0000 (19:28 +0000)]
Regenerate lib/clang/liblldb/LLDBWrapLua.cpp with swig 4.0.2.

3 years agoUpdate generated llvm-project related version headers, config.h files
Dimitry Andric [Thu, 6 Aug 2020 19:27:03 +0000 (19:27 +0000)]
Update generated llvm-project related version headers, config.h files
and add a newly generated lldb Plugins.def file too.

3 years agoReapply r362235 (by kp):
Dimitry Andric [Thu, 6 Aug 2020 19:24:17 +0000 (19:24 +0000)]
Reapply r362235 (by kp):

llvm: Default to -mno-relax on RISC-V

Compiling on a RISC-V system fails with 'relocation R_RISCV_ALIGN
requires unimplemented linker relaxation; recompile with -mno-relax'.

Our default linker (ld.lld) doesn't support relaxation, so default to
no-relax so we don't generate object files the linker can't handle.

Reviewed by: mhorne
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D25210

3 years agoReapply r360852 (by cem):
Dimitry Andric [Thu, 6 Aug 2020 19:23:00 +0000 (19:23 +0000)]
Reapply r360852 (by cem):

clang: Reject %n for __attribute__((format(__freebsd_kprintf__)))

A follow-up to r360849.

Reported by: imp
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D24786

3 years agoAdd CTL support for REPORT IDENTIFYING INFORMATION command.
Alexander Motin [Thu, 6 Aug 2020 19:16:11 +0000 (19:16 +0000)]
Add CTL support for REPORT IDENTIFYING INFORMATION command.

It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

MFC after: 1 week
Sponsored by: iXsystems, Inc.

3 years agoReapply r359582 (by emaste):
Dimitry Andric [Thu, 6 Aug 2020 19:15:31 +0000 (19:15 +0000)]
Reapply r359582 (by emaste):

lldb: use lua as the default script language

In the FreeBSD base system we do not have Python support in lldb, but
will have Lua support.  Make Lua the default.

This needs to be made into a configure-time option; that is being
discussed upstream and will appear in a future lldb import.  For now
carry this change as a tiny patch to our copy of lldb.

3 years agor356104 | jhibbits | 2019-12-27 00:06:28 +0100 (Fri, 27 Dec 2019) | 25 lines
Dimitry Andric [Thu, 6 Aug 2020 19:11:24 +0000 (19:11 +0000)]
r356104 | jhibbits | 2019-12-27 00:06:28 +0100 (Fri, 27 Dec 2019) | 25 lines

[PowerPC] enable atomic.c in compiler_rt and do not check and forces
lock/lock_free decisions in compiled time

Summary:
Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime
decision about lock/lock_free.  At compiling time, if clang can't decide if
atomic operation can be lock free, it emits calls to external functions  like
`__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and
`__atomic_always_lock_free`, postponing decision to a runtime check.  According
to LLVM code documentation, the mechanism exists due to differences between
x86_64 processors that can't be decided at runtime.

On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock
free, so we force the decision at compile time and avoid having to implement it
in an external library.

This patch was made after 32 bit users testing the PowePC32 bit ISO reported
llvm could not be compiled with in-base llvm due to `__atomic_load8` not
implemented.

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: jhibbits, dim

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

3 years agoReapply r355803 (by mmel):
Dimitry Andric [Thu, 6 Aug 2020 19:08:28 +0000 (19:08 +0000)]
Reapply r355803 (by mmel):

Fix LLVM libunwnwind _Unwind_Backtrace symbol version for ARM.
In original  GNU libgcc, _Unwind_Backtrace is published with GCC_3.3 version
for all architectures but ARM. For ARM should be publishes with GCC_4.3.0
version. This was originally omitted in r255095, fixed in r318024 and omitted
aging in LLVM libunwind implementation in r354347.

For ARM _Unwind_Backtrace should be published as default with GCC_4.3.0
version , (because this is right original version) and again as
normal(not-default) with GCC_3.3 version (to maintain ABI compatibility
compiled/linked with wrong pre r318024 libgcc)

PR: 233664

3 years agoReapply r354347 (by cem):
Dimitry Andric [Thu, 6 Aug 2020 19:05:59 +0000 (19:05 +0000)]
Reapply r354347 (by cem):

Fix llvm-libunwind userspace build on ARM

GCC's libgcc exports a few ARM-specific symbols for ARM EABI, AEABI, or
EHABI or whatever it's called.  Export the same ones from LLVM-libunwind's
libgcc_s, on ARM.  As part of this, convert libgcc_s from a direct
Version.map to one constructed from component Symbol.map files.  This allows
the ARM-specific Symbol.map to be included only on ARM.

Fix ARM-only oddities in struct name/aliases in LLVM-libunwind to match
non-ARM definitions and ARM-specific expectations in libcxxrt /
libcompiler_rt.

No functional change intended for non-ARM architectures.

This commit does not actually flip the switch for ARM defaults from libgcc
to llvm-libunwind, but makes it possible (to compile, anyway).

3 years ago[POWERPC] Fix ppc64 makecontext() parameter overflow handling.
Brandon Bergren [Thu, 6 Aug 2020 17:49:19 +0000 (17:49 +0000)]
[POWERPC] Fix ppc64 makecontext() parameter overflow handling.

On ELFv2, the overflow parameters in the stack frame are at a different offset
from sp than ELFv1. Adjust code to use the correct offset in all cases.

This had resulted in argv[8] and up being copied to the incorrect address
in the new context's initial stack frame.

This is not necessarily the only bug in this function, I need to do a full
review still and ensure the rest of the math is sane for ELFv2 stack frames.

Reported by: pherde (Probably. My notes are a bit unclear.)
Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.

3 years agoReapply r351662 (by emaste):
Dimitry Andric [Thu, 6 Aug 2020 16:44:24 +0000 (16:44 +0000)]
Reapply r351662 (by emaste):

lldb: shorten thread names to make logs easier to follow

lldb prepends the thread name to log entries, and the existing thread
name for the FreeBSD ProcessMonitor thread was longer than the kernel's
supported thread name length, and so was truncated.  This made logs hard
to read, as the truncated thread name ran into the log message.  Shorten
"lldb.process.freebsd.operation" to just "freebsd.op" so that logs are
more readable.

(Upstreaming to lldb still to be done).

3 years agoReapply r349876:
Dimitry Andric [Thu, 6 Aug 2020 16:42:48 +0000 (16:42 +0000)]
Reapply r349876:

Apply a workaround to be able to build clang 8.0.0 headers with clang
3.4.1, which is still in the stable/10 branch.

It looks like clang 3.4.1 implements static_asserts by instantiating a
temporary static object, and if those are in an anonymous union, it
results in "error: anonymous union can only contain non-static data
members".

To work around this implementation limitation, move the static_asserts
in question out of the anonymous unions.

This should make building the latest stable/11 from stable/10 possible
again.

Reported by: Mike Tancsa <mike@sentex.net>

3 years agoReapply r344852:
Dimitry Andric [Thu, 6 Aug 2020 16:27:24 +0000 (16:27 +0000)]
Reapply r344852:

Put in a temporary workaround for what is likely a gcc 6 bug (it does
not occur with gcc 7 or later).  This should prevent the following error
from breaking the head-amd64-gcc CI builds:

In file included from /workspace/src/contrib/llvm/tools/lldb/source/API/SBMemoryRegionInfo.cpp:14:0:
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: 'template<class _InputIterator> lldb_private::MemoryRegionInfos::MemoryRegionInfos(_InputIterator, _InputIterator, const allocator_type&)' inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'
   using std::vector<lldb_private::MemoryRegionInfo>::vector;
                                                      ^~~~~~
/workspace/src/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h:128:54: error: conflicts with version inherited from 'std::__1::vector<lldb_private::MemoryRegionInfo>'

Reported by: CI

3 years agoReapply r343111 (partially, by mckusick):
Dimitry Andric [Thu, 6 Aug 2020 16:25:56 +0000 (16:25 +0000)]
Reapply r343111 (partially, by mckusick):

Create new EINTEGRITY error with message "Integrity check failed".

An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765

3 years agoReapply r332965 (by emaste):
Dimitry Andric [Thu, 6 Aug 2020 16:20:45 +0000 (16:20 +0000)]
Reapply r332965 (by emaste):

lldb: remove assertion that target_arch is FreeBSD

The target is not necessarily a FreeBSD binary - for example, it may be
a Linux binary running under the linuxulator.  Basic ptrace (live)
debugging already worked in this case, except for the assertion.

Sponsored by: Turing Robotic Industries Inc.

3 years agoPreserve ASLR vm_map flags across fork
Brooks Davis [Thu, 6 Aug 2020 16:20:20 +0000 (16:20 +0000)]
Preserve ASLR vm_map flags across fork

In the most common case (fork+execve) this doesn't matter, but further
attempts to apply entropy would fail in (e.g.) a pre-fork server.

Reported by: Alfredo Mazzinghi
Reviewed by: kib, markj
Obtained from: CheriBSD
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25966

3 years agopkgbase: Add the possibility to choose the output dir
Emmanuel Vadot [Thu, 6 Aug 2020 16:14:43 +0000 (16:14 +0000)]
pkgbase: Add the possibility to choose the output dir

The output dir is set to ${REPODIR}/${PKG_ABI}/${PKG_VERSION} now.
Add the possibility to specify the last componant and set it by default
to ${PKG_VERSION} as before.
This is useful for tests and also for building packages with the same
PKG_VERSION provided to check differences.

3 years agopkgbase: Add a new variable PKG_TIMESTAMP
Emmanuel Vadot [Thu, 6 Aug 2020 16:13:54 +0000 (16:13 +0000)]
pkgbase: Add a new variable PKG_TIMESTAMP

libarchive uses the SOURCE_DATE_EPOCH env variable to set the date of file
in an archive, this is useful for reproducibility.
Add a variable name PKG_TIMESTAMP that take a epoch time and set SOURCE_DATE_EPOCH
to this. By default it is the current time so no changes here.

3 years agoReapply r329859 (partially, by imp):
Dimitry Andric [Thu, 6 Aug 2020 16:12:13 +0000 (16:12 +0000)]
Reapply r329859 (partially, by imp):

Do not include float interfaces when using libsa.

We don't support float in the boot loaders, so don't include
interfaces for float or double in systems headers. In addition, take
the unusual step of spiking double and float to prevent any more
accidental seepage.

3 years agopkgbase: Remove vcs revision from kernel and runtime comment
Emmanuel Vadot [Thu, 6 Aug 2020 16:11:30 +0000 (16:11 +0000)]
pkgbase: Remove vcs revision from kernel and runtime comment

This is not needed and we don't do that for other packages.

3 years agoReapply r327151 (partially):
Dimitry Andric [Thu, 6 Aug 2020 15:46:39 +0000 (15:46 +0000)]
Reapply r327151 (partially):

For our lldb customizations, instead of commenting out lines, use #ifdef
LLDB_ENABLE_ALL / #endif preprocess directives instead, so our diffs
against upstream only consist of added lines.

(Note that upstream has largely reshuffled the way optional lldb plugins
are handled, so we need a lot less of these #ifdefs. However, not all of
them can be dropped, unless we re-import several sources that we have
always skipped.)

3 years agoClean up reassignbuf() and buf_vlist_remove() a bit.
Mark Johnston [Thu, 6 Aug 2020 15:43:15 +0000 (15:43 +0000)]
Clean up reassignbuf() and buf_vlist_remove() a bit.

- Convert panic() calls to INVARIANTS-only assertions.  The PCTRIE code
  provides some of the same protection since it will panic upon an
  attempt to remove a non-resident buffer.
- Update the comment above reassignbuf() to reflect reality.

Reviewed by: cem, kib, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25965

3 years agoRemove the vfs.reassignbufcalls counter and sysctl.
Mark Johnston [Thu, 6 Aug 2020 15:42:59 +0000 (15:42 +0000)]
Remove the vfs.reassignbufcalls counter and sysctl.

As the 20-year old comment above it suggests, the counter is of dubious
value.  Moreover, the (global) counter was not updated precisely and
hurts scalability.

Reviewed by: cem, kib, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25965

3 years agoAdd Intel Apollo Lake AHCI ID.
Alexander Motin [Thu, 6 Aug 2020 15:17:44 +0000 (15:17 +0000)]
Add Intel Apollo Lake AHCI ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

3 years agocp2112: driver for the namesake GPIO and I2C master gadget
Andriy Gapon [Thu, 6 Aug 2020 13:41:42 +0000 (13:41 +0000)]
cp2112: driver for the namesake GPIO and I2C master gadget

Documentation:
- CP2112 Datasheet
  https://www.silabs.com/documents/public/data-sheets/cp2112-datasheet.pdf
- AN495: CP2112 Interface Specification
  https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
- CP2112 Errata
  https://www.silabs.com/documents/public/errata/cp2112-errata.pdf

The logic is implemented as three sub-drivers.
The parent driver claims the USB device and creates two child devices.
One acts as a GPIO controller and the other is an I2C controller.

Tested with CP2112 revision F02.
Both features seem to work.
HTU21 sensor was used as an I2C slave.

Reviewed by: adrian, hselasky
MFC after: 2 weeks
Relnotes: maybe
Differential Revision: https://reviews.freebsd.org/D25359

3 years agoAdd new USB ID.
Hans Petter Selasky [Thu, 6 Aug 2020 13:25:04 +0000 (13:25 +0000)]
Add new USB ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoMove dmar_domain_unload_task to busdma_iommu.c.
Ruslan Bukin [Thu, 6 Aug 2020 12:49:25 +0000 (12:49 +0000)]
Move dmar_domain_unload_task to busdma_iommu.c.

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

3 years agoccu_sun8i_r: minor comment update
Andriy Gapon [Thu, 6 Aug 2020 11:18:06 +0000 (11:18 +0000)]
ccu_sun8i_r: minor comment update

MFC after: 1 week

3 years agoAdd iommu_domain constructor and destructor.
Ruslan Bukin [Thu, 6 Aug 2020 08:48:23 +0000 (08:48 +0000)]
Add iommu_domain constructor and destructor.

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

3 years agommccam: Unhold the periph when we add the device
Emmanuel Vadot [Thu, 6 Aug 2020 08:21:33 +0000 (08:21 +0000)]
mmccam: Unhold the periph when we add the device

Otherwise the device node aren't created.

Pointy hat to:      manu
Reported by: bz

3 years agocache: add more predicts for failing conditions
Mateusz Guzik [Thu, 6 Aug 2020 04:20:14 +0000 (04:20 +0000)]
cache: add more predicts for failing conditions

3 years agocache: plug unititalized variable use
Mateusz Guzik [Thu, 6 Aug 2020 04:19:47 +0000 (04:19 +0000)]
cache: plug unititalized variable use

CID: 1431128

3 years agomac: even up all entry points to the same scheme
Mateusz Guzik [Thu, 6 Aug 2020 00:23:06 +0000 (00:23 +0000)]
mac: even up all entry points to the same scheme

- use a macro for checking whether the site is enabled
- expand it to 0 if mac is not compiled in to begin with

3 years agoarm64: fix uintfptr_t
Mateusz Guzik [Wed, 5 Aug 2020 22:09:57 +0000 (22:09 +0000)]
arm64: fix uintfptr_t

Fixes compilation after r363932

3 years agoriscv: fix uintfptr_t
Mateusz Guzik [Wed, 5 Aug 2020 22:09:40 +0000 (22:09 +0000)]
riscv: fix uintfptr_t

Fixes compilation after r363932

3 years agopmcstat: fix build on non-64 bit platforms
Mateusz Guzik [Wed, 5 Aug 2020 20:42:08 +0000 (20:42 +0000)]
pmcstat: fix build on non-64 bit platforms

3 years agovfs hash: annotate the lock with __exclusive_cache_line
Mateusz Guzik [Wed, 5 Aug 2020 19:34:13 +0000 (19:34 +0000)]
vfs hash: annotate the lock with __exclusive_cache_line

Note the code does not scale in the current form.

3 years agopipe: reduce atime precision
Mateusz Guzik [Wed, 5 Aug 2020 19:15:59 +0000 (19:15 +0000)]
pipe: reduce atime precision

The routine is called on successful write and read, which on pipes happens a
lot and for small sizes.

Precision provided by default seems way bigger than necessary and it causes
problems in vms on amd64 (it rdtscp's which vmexits). getnanotime seems to
provide the level roughly in lines of Linux so we should be good here.

Sample result from will-it-scale pipe1_processes -t 1 (ops/s):
before: 426464
after: 3247421

Note the that atime handling for named pipes is broken with and without the
patch. The filesystem code is never used for updating atime and never looks
at the updated field. Consequently, while there are no provisions added to
handle named pipes separately, the change is a nop for that case.

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

3 years agoo Add machine/iommu.h and include MD iommu headers from it,
Ruslan Bukin [Wed, 5 Aug 2020 19:11:31 +0000 (19:11 +0000)]
o Add machine/iommu.h and include MD iommu headers from it,
  so we don't ifdef for every arch in busdma_iommu.c;
o No need to include specialreg.h for x86, remove it.

Requested by: andrew
Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25957

3 years agopmcstat: implement showing offsets into symbols in top mode
Mateusz Guzik [Wed, 5 Aug 2020 19:05:49 +0000 (19:05 +0000)]
pmcstat: implement showing offsets into symbols in top mode

The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

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

3 years agoAdd clocks for ethernet controllers on RK3328
Oleksandr Tymoshenko [Wed, 5 Aug 2020 18:22:24 +0000 (18:22 +0000)]
Add clocks for ethernet controllers on RK3328

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D25918

3 years agoAdd flag for SYSCON-controlled clocks on Rockhip platform
Oleksandr Tymoshenko [Wed, 5 Aug 2020 18:21:22 +0000 (18:21 +0000)]
Add flag for SYSCON-controlled clocks on Rockhip platform

Ethernet clocks on RK3328 are controlled by SYSCON registers, so add
RK_CLK_COMPOSITE_GRF flag to indicate that clock node should access grf
registers instead of CRU's

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D25918

3 years agoFix the smrstress build after r358400.
Mark Johnston [Wed, 5 Aug 2020 17:26:20 +0000 (17:26 +0000)]
Fix the smrstress build after r358400.

Reported by: pho

3 years agoFix a TOCTOU vulnerability in freebsd32_copyin_control().
Mark Johnston [Wed, 5 Aug 2020 17:06:14 +0000 (17:06 +0000)]
Fix a TOCTOU vulnerability in freebsd32_copyin_control().

PR: 248257
Reported by: m00nbsd working with Trend Micro Zero Day Initiative
Reviewed by: kib
Security: SA-20:23.sendmsg
Security: CVE-2020-7460
Security: ZDI-CAN-11543

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
Cy Schubert [Wed, 5 Aug 2020 15:33:32 +0000 (15:33 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoUpgrade to version 3.1.5
Stefan Eßer [Wed, 5 Aug 2020 15:20:07 +0000 (15:20 +0000)]
Upgrade to version 3.1.5

This version fixes some entries in the chinese message catalogs which could
lead to program crashes when used.

3 years agoMFOpenZFS: Add support for boot environment data to be stored in the label
Toomas Soome [Wed, 5 Aug 2020 14:32:20 +0000 (14:32 +0000)]
MFOpenZFS: Add support for boot environment data to be stored in the label

We are building new bootonce mechanism (previously zfs bootnext) and it is
based on this OpenZFS change. Since this patch is nicely self contained,
I am commiting it as is, and we can stack our changes.

Original patch description follows:

Modern bootloaders leverage data stored in the root filesystem to
enable some of their powerful features. GRUB specifically has a grubenv
file which can store large amounts of configuration data that can be
read and written at boot time and during normal operation. This allows
sysadmins to configure useful features like automated failover after
failed boot attempts. Unfortunately, due to the Copy-on-Write nature
of ZFS, the standard behavior of these tools cannot handle writing to
ZFS files safely at boot time. We need an alternative way to store
data that allows the bootloader to make changes to the data.

This work is very similar to work that was done on Illumos to enable
similar functionality in the FreeBSD bootloader. This patch is different
in that the data being stored is a raw grubenv file; this file can store
arbitrary variables and values, and the scripting provided by grub is
powerful enough that special structures are not required to implement
advanced behavior.

We repurpose the second padding area in each label to store the grubenv
file, protected by an embedded checksum. We add two ioctls to get and
set this data, and libzfs_core and libzfs functions to access them more
easily. There are no direct command line interfaces to these functions;
these will be added directly to the bootloader utilities.

Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes #10009

Obtained from: OpenZFS
Sponsored by: Netflix, Klara Inc.

3 years agozfs_keys_nextboot array is missing ZPOOL_CONFIG_POOL_GUID and ZPOOL_CONFIG_GUID
Toomas Soome [Wed, 5 Aug 2020 14:08:44 +0000 (14:08 +0000)]
zfs_keys_nextboot array is missing ZPOOL_CONFIG_POOL_GUID and ZPOOL_CONFIG_GUID

As we do check the incomint nvlist, we either need to list all possible
keys or use wildcard.

PR: 248462
Reported by: larafercue@gmail.com
Sponsored by: Netflix, Klara Inc.

3 years agoAdd DDB_CTF to the arm64 and riscv kernel configs
Andrew Turner [Wed, 5 Aug 2020 11:54:51 +0000 (11:54 +0000)]
Add DDB_CTF to the arm64 and riscv kernel configs

This allows DTrace fbt probes to find arguments.

Sponsored by: Innovate UK

3 years agoSynchronize definitions in mbuf.d with values from mbuf.h
Andrey V. Elsukov [Wed, 5 Aug 2020 11:54:02 +0000 (11:54 +0000)]
Synchronize definitions in mbuf.d with values from mbuf.h

Obtained from: Yandex LLC
Sponsored by: Yandex LLC

3 years agoenviron(7): Update the description and include some more environment variables
Gordon Bergling [Wed, 5 Aug 2020 11:41:41 +0000 (11:41 +0000)]
environ(7): Update the description and include some more environment variables

- Add a better introduction to the DESCRIPTION section
- Add a description for MANPATH and POSIXLY_CORRECT
- Asorted improvements for the usage of some macros

PR: 43823
Submitted by: Lyndon Nerenberg <lyndon at orthanc dot ab dot ca>
Reviewed by: 0mp, bcr
Approved by: 0mp, bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25912

3 years agoAdd m__getjcl SDT probe.
Andrey V. Elsukov [Wed, 5 Aug 2020 11:39:09 +0000 (11:39 +0000)]
Add m__getjcl SDT probe.

Obtained from: Yandex LLC
MFC after: 1 week
Sponsored by: Yandex LLC

3 years agogpiokeys: add a basic manual page
Andriy Gapon [Wed, 5 Aug 2020 11:38:33 +0000 (11:38 +0000)]
gpiokeys: add a basic manual page

Reviewed by: manu, bjk, 0mp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25939

3 years agoFix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.
Andrey V. Elsukov [Wed, 5 Aug 2020 11:26:49 +0000 (11:26 +0000)]
Fix SIGSEGV in ipfw(8) when NAT64 prefix length is omitted.

Submitted by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25734

3 years agoDo not describe portsnap(8) as a way to manage /usr/ports
Mateusz Piotrowski [Wed, 5 Aug 2020 11:26:14 +0000 (11:26 +0000)]
Do not describe portsnap(8) as a way to manage /usr/ports

3 years agoFix typo.
Andrey V. Elsukov [Wed, 5 Aug 2020 10:27:11 +0000 (10:27 +0000)]
Fix typo.

Submitted by: Evgeniy Khramtsov <evgeniy at khramtsov org>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25932

3 years agoUpgrade to version 3.1.5
Stefan Eßer [Wed, 5 Aug 2020 10:07:43 +0000 (10:07 +0000)]
Upgrade to version 3.1.5

This version fixes a bug that only occurs when with chinese locale settings.