]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMFC r348776
Christian S.J. Peron [Mon, 24 Feb 2020 02:11:54 +0000 (02:11 +0000)]
MFC r348776

Teach readelf about some OpenBSD ELF program headers

Discussed with: emaste
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D20548

4 years agoMFC r357714-r357715: cron(8): rip out some legacy bits
Kyle Evans [Sun, 23 Feb 2020 03:13:38 +0000 (03:13 +0000)]
MFC r357714-r357715: cron(8): rip out some legacy bits

r357714: cron(8): convert vfork() usage to fork()

vfork() is error-prone, and the usage here definitely grew to not be
clearly OK given vfork-semantics; e.g. setusercontext(3) within the child.

Rip out vfork() and the rest of the references to it. fork is heavier, but
it's unclear that the difference will be all that obvious.

Reported by: Andrew Gierth and sigsys@gmail.com

r357715: cron(8): rip out do_univ

This was an old Dynix hack, the function is a NOP on FreeBSD. We have no
need to retain this; Dynix was discontinued long ago.

4 years agoMFC r358109: kdump: decode SHM_ANON as first arg to legacy shm_open(2)
Kyle Evans [Sat, 22 Feb 2020 21:44:00 +0000 (21:44 +0000)]
MFC r358109: kdump: decode SHM_ANON as first arg to legacy shm_open(2)

The first argument to shm_open(2) as well as shm_open2(2) may be a path or
SHM_ANON. Decode SHM_ANON, at least- paths will show up as namei results in
kdump output, which may be sufficient; in those cases, we'll have printed an
address.

4 years agoMFC r357984:
Konstantin Belousov [Sat, 22 Feb 2020 10:55:49 +0000 (10:55 +0000)]
MFC r357984:
sem_remove(): fix the loop that compacts sem array on semaphores removal.

4 years agoMFC r357983:
Konstantin Belousov [Sat, 22 Feb 2020 10:54:11 +0000 (10:54 +0000)]
MFC r357983:
sem_remove(): add some asserts.

4 years agoMFC r357982:
Konstantin Belousov [Sat, 22 Feb 2020 10:48:42 +0000 (10:48 +0000)]
MFC r357982:
Use designated initializers for seminfo.

4 years agoMFC r357685: Bind CTL backends taskqueues to the CTL process.
Alexander Motin [Sat, 22 Feb 2020 04:49:32 +0000 (04:49 +0000)]
MFC r357685: Bind CTL backends taskqueues to the CTL process.

4 years agoMFC r358074:
Dimitry Andric [Fri, 21 Feb 2020 22:11:14 +0000 (22:11 +0000)]
MFC r358074:

Fix the following -Werror warning from clang 10.0.0:

sys/arm/allwinner/clkng/aw_clk_mipi.c:144:6: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                                        m++;
                                        ^
sys/arm/allwinner/clkng/aw_clk_mipi.c:142:5: note: previous statement is here
                                if (best == *fout)
                                ^

Move the increment operations into the for loop headers instead.

Discussed with: manu

4 years agoMFC r358044:
Dimitry Andric [Fri, 21 Feb 2020 22:08:45 +0000 (22:08 +0000)]
MFC r358044:

Merge r358030 from the clang1000-import branch:

Work around new clang 10.0.0 -Werror warning:

sys/arm/allwinner/aw_cir.c:208:41: error: converting the result of '<<' to a boolean; did you mean '((1 & 255) << 23) != 0'? [-Werror,-Wint-in-bool-context]
        active_delay = (AW_IR_ACTIVE_T + 1) * (AW_IR_ACTIVE_T_C ? 128 : 1);
                                               ^
sys/arm/allwinner/aw_cir.c:130:39: note: expanded from macro 'AW_IR_ACTIVE_T_C'
#define AW_IR_ACTIVE_T_C                ((1 & 0xff) << 23)
                                                    ^

Add the != 0 part to indicate that we indeed want to compare against
zero.

4 years agoMFC r358046:
Dimitry Andric [Fri, 21 Feb 2020 21:57:24 +0000 (21:57 +0000)]
MFC r358046:

Merge r358042 from the clang1000-import branch:

Add casts and L suffixes to libc quad support, to work around various
-Werror warnings from clang 10.0.0, such as:

lib/libc/quad/fixdfdi.c:57:12: error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
                if (x >= QUAD_MAX)
                      ~~ ^~~~~~~~
/usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/sys/limits.h:89:19: note: expanded from macro 'QUAD_MAX'
#define QUAD_MAX        (__QUAD_MAX)    /* max value for a quad_t */
                         ^~~~~~~~~~
/usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:91:20: note: expanded from macro '__QUAD_MAX'
#define __QUAD_MAX      __LLONG_MAX     /* max value for a quad_t */
                        ^~~~~~~~~~~
/usr/obj/usr/src/powerpc.powerpc/tmp/usr/include/machine/_limits.h:75:21: note: expanded from macro '__LLONG_MAX'
#define __LLONG_MAX     0x7fffffffffffffffLL    /* max value for a long long */
                        ^~~~~~~~~~~~~~~~~~~~

and many instances of:

lib/libc/quad/fixunsdfdi.c:73:17: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
        toppart = (x - ONE_HALF) / ONE;
                       ^~~~~~~~
lib/libc/quad/fixunsdfdi.c:45:19: note: expanded from macro 'ONE_HALF'
#define ONE_HALF        (ONE_FOURTH * 2.0)
                         ^~~~~~~~~~
lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH'
#define ONE_FOURTH      (1 << (LONG_BITS - 2))
                           ^  ~~~~~~~~~~~~~~~
lib/libc/quad/fixunsdfdi.c:73:29: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
        toppart = (x - ONE_HALF) / ONE;
                                   ^~~
lib/libc/quad/fixunsdfdi.c:46:15: note: expanded from macro 'ONE'
#define ONE             (ONE_FOURTH * 4.0)
                         ^~~~~~~~~~
lib/libc/quad/fixunsdfdi.c:44:23: note: expanded from macro 'ONE_FOURTH'
#define ONE_FOURTH      (1 << (LONG_BITS - 2))
                           ^  ~~~~~~~~~~~~~~~

4 years agoMFC r358045:
Dimitry Andric [Fri, 21 Feb 2020 21:54:03 +0000 (21:54 +0000)]
MFC r358045:

Merge r358034 from the clang1000-import branch:

Disable new clang 10.0.0 warnings about misleading indentation in
sys/contrib/ncsw/Peripherals/FM/fman_ncsw.c.

This is horribly formatted contributed code, and fixing it is not worth
the effort.

4 years agoMFC r357862 (by emaste):
Mark Johnston [Fri, 21 Feb 2020 14:45:48 +0000 (14:45 +0000)]
MFC r357862 (by emaste):
addr2line: use stdbool.h header for bool

4 years agoRevert r350515 for now.
Mark Johnston [Fri, 21 Feb 2020 14:40:08 +0000 (14:40 +0000)]
Revert r350515 for now.

It seems to cause build failures when Capsicum support is disabled in
src.conf.

PR: 244258
Reported by: rozhuk.im@gmail.com, Giacomo Olgeni <olgeni@olgeni.com>

4 years agoMFC r357861 and r357898:
Hans Petter Selasky [Fri, 21 Feb 2020 08:30:34 +0000 (08:30 +0000)]
MFC r357861 and r357898:
Improve USB gaming keyboard support.

Add support for decoding pressed keys as a bitmap. The keys in the
bitmap are described in the interface specific HID descriptor. Some
keyboards even have multiple input interfaces, only using the bitmap
method when the event array is full. That typically means when more
than seven keys are pressed simultaneously.

The internals of the USB keyboard driver have been slightly reworked
to keep track of all keys in a single bitmap having 256 bits. This
bitmap is then divided into blocks of 64-bits as an optimisation.

Simplify automatic key repeat logic, because only the last key pressed
can be repeated.

PR: 224592
PR: 233884
Tested by: Alex V. Petrov <alexvpetrov@gmail.com>
Sponsored by: Mellanox Technologies

4 years agoMFC r357414, r357415, r357417, r357423, r357424, r357587, r357655:
Pedro F. Giffuni [Fri, 21 Feb 2020 04:48:25 +0000 (04:48 +0000)]
MFC r357414, r357415, r357417, r357423, r357424, r357587, r357655:
ethernet: add some more Ethertypes.

Add some types based on other BSDs and also add EtherCat, PROFINET, Powerlink
and Sercos III which are IEC standards.

There is a public list (CSV format) at:
https://standards.ieee.org/products-services/regauth/

Spacing cleanups.
No functional change.

4 years agoMFC r357845: efiloader: don't execute hooks when setting currdev/loaddev
Kyle Evans [Fri, 21 Feb 2020 04:42:16 +0000 (04:42 +0000)]
MFC r357845: efiloader: don't execute hooks when setting currdev/loaddev

We still need to set the hooks to prevent improper manipulations thereafter
at the loader prompt, but as it is we're actively preventing loaddev from
being set correctly in some circumstances (ZFS in particular) and doing more
work than needed with currdev -- that hook in particular validates it as a
correct device, which we can assume isn't needed in this context.

4 years agoMFC r357840: sys/kern sysent: re-add dependency on capabilities.conf
Kyle Evans [Fri, 21 Feb 2020 04:41:22 +0000 (04:41 +0000)]
MFC r357840: sys/kern sysent: re-add dependency on capabilities.conf

r356868 inadvertently removed this, so changes to capabilities.conf were no
longer considered for being outdated.

4 years agoMFC r347445, r353961: dtc build issues
Kyle Evans [Fri, 21 Feb 2020 04:38:59 +0000 (04:38 +0000)]
MFC r347445, r353961: dtc build issues

r347445:
Fix build issue with clang 8.0.1

The algorithm header is needed to use std::remove_if

r353961:
exit requires stdlib.h to be included to use.

FreeBSD 10.3 requires this, and dtc is a bootstrap tool so it needs to
compile
there.

4 years agoMFC r357923-r357924: dtc fixes for /memreserve/ and -I/-O defaults
Kyle Evans [Fri, 21 Feb 2020 04:34:54 +0000 (04:34 +0000)]
MFC r357923-r357924: dtc fixes for /memreserve/ and -I/-O defaults

r357923:
Pull in latest fixes from dtc, up to 0060471

This includes a small battery of /memreserve/ fixes to make sure dtc is
properly writing these regions into the output file and reading them back
out.

As of this update, dtc will now also assume common defaults for -I/-O if
only one is specified; namely, dts for one implies dtb for the other and
vice versa (Requested by: jhibbits, preserves GPL dtc behavior too).

r357924:
dtc: re-apply r353961, r354115

I missed in final review of r357923's diff that these ones hadn't yet been
sent upstream and inadvertently reverted them. =-( Re-apply now.

4 years agoMFC r357657: Remove duplicate dbufs accounting.
Alexander Motin [Fri, 21 Feb 2020 04:33:14 +0000 (04:33 +0000)]
MFC r357657: Remove duplicate dbufs accounting.

Since AVL already has embedded element counter, use dn_dbufs_count
only for dbufs not counted there (bonus buffers) and just add them.
This removes two atomics per dbuf life cycle.

According to profiler it reduces time spent by dbuf_destroy() inside
bottlenecked dbuf_evict_thread() from 13.36% to 9.20% of the core.

This counter is used only on illumos, so for FreeBSD it was just a
waste of time.

4 years agoMFC r357903: ncurses: correct check for gcc >= 5.0
Kyle Evans [Fri, 21 Feb 2020 04:31:30 +0000 (04:31 +0000)]
MFC r357903: ncurses: correct check for gcc >= 5.0

The hack in question is intended to workaround seemingly bogus #line markers
in cpp output. As far as I can tell, llvm cpp doesn't do this by default, so
there's no reason to add -P.

In our /bin/sh, the main incantation should be placed in a sub-shell in
order to properly pipe the output to fgrep.

The main motivation for this change is admittedly to stop emitting the noise
about clang not being gcc in make -s buildworld

4 years agoMFC r357899: u_char -> vm_prot_t in a couple of places, NFC
Kyle Evans [Fri, 21 Feb 2020 04:30:21 +0000 (04:30 +0000)]
MFC r357899: u_char -> vm_prot_t in a couple of places, NFC

The latter is a typedef of the former; the typedef exists and these bits are
representing vmprot values, so use the correct type.

4 years agoMFC r357920: Add support for Hygon NTB PCI device in ntb_hw_amd driver.
Alexander Motin [Fri, 21 Feb 2020 04:29:50 +0000 (04:29 +0000)]
MFC r357920: Add support for Hygon NTB PCI device in ntb_hw_amd driver.

4 years agoMFC r357919: Add Hygon PCI ID and description for AHCI SATA controller.
Alexander Motin [Fri, 21 Feb 2020 04:28:42 +0000 (04:28 +0000)]
MFC r357919: Add Hygon PCI ID and description for AHCI SATA controller.

4 years agoMFC r357827: lualoader: disable autoboot on high-level interpreter errors
Kyle Evans [Fri, 21 Feb 2020 04:25:10 +0000 (04:25 +0000)]
MFC r357827: lualoader: disable autoboot on high-level interpreter errors

If we hit an error at this level, we are almost certainly not in any kind
of sane state where autoboot can do the right thing. Instead of letting it
try and probably failing, disable autoboot so they immediately get kicked
into a loader prompt for manual remediation/diagnosis.

4 years agoMFC r358069:
Cy Schubert [Fri, 21 Feb 2020 04:23:54 +0000 (04:23 +0000)]
MFC r358069:

strchr() returns a pointer not an int.

Reported by: bjk
Approved by: des (blanket, implicit)

4 years agoMFC r358067:
Cy Schubert [Fri, 21 Feb 2020 04:22:29 +0000 (04:22 +0000)]
MFC r358067:

There is no pam(8) man page, it is pam(3).

Approved by: des (implicit, blanket)

4 years agoMFC r358068:
Cy Schubert [Fri, 21 Feb 2020 04:20:10 +0000 (04:20 +0000)]
MFC r358068:

Add missing SYNOPSIS section.

Reported by: ports/textproc/igor

4 years agoMFC: r356963
Jung-uk Kim [Fri, 21 Feb 2020 00:33:21 +0000 (00:33 +0000)]
MFC: r356963

Install man5 and man7 for OpenSSL.

4 years agoMFC r357846
Vincenzo Maffione [Thu, 20 Feb 2020 21:52:36 +0000 (21:52 +0000)]
MFC r357846

bhyve: move virtio-net header processing to pci_virtio_net

This patch cleans up the API between the net frontends (e1000,
virtio-net) and the net backends (tap and netmap).
We move the virtio-net header stripping/prepending to the
virtio-net code, where this functionality belongs.
In this way, the netbe_send() and netbe_recv() signatures
can have const struct iov * rather than struct iov *.

Reviewed by:    grehan, bcr, aleksandr.fedorov@itglobal.com
Differential Revision:  https://reviews.freebsd.org/D23342

4 years agoMFC r356523
Vincenzo Maffione [Thu, 20 Feb 2020 21:48:36 +0000 (21:48 +0000)]
MFC r356523

bhyve: add wrapper for debug printf statements

Add printf() wrapper to use CR/CRLF terminators depending on whether
stdio is mapped to a tty open in raw mode.
Try to use the wrapper everywhere.
For now we leave the custom DPRINTF/WPRINTF defined by device
models, but we may remove them in the future.

Reviewed by:    grehan, jhb
Differential Revision:  https://reviews.freebsd.org/D22657

4 years agoMFC r357871:
Konstantin Belousov [Thu, 20 Feb 2020 01:45:55 +0000 (01:45 +0000)]
MFC r357871:
hyperv: Add Hygon Dhyana support.

4 years agoMFC r357870:
Konstantin Belousov [Thu, 20 Feb 2020 01:44:50 +0000 (01:44 +0000)]
MFC r357870:
ecc_inject: Add Hygon Dhyana support.

4 years agoMFC r357869:
Konstantin Belousov [Thu, 20 Feb 2020 01:42:11 +0000 (01:42 +0000)]
MFC r357869:
amdsbwd, intpm: Add Hygon Dhyana support.

4 years agoMFC r357868:
Konstantin Belousov [Thu, 20 Feb 2020 01:41:12 +0000 (01:41 +0000)]
MFC r357868:
amdpm: Add Hygon Dhyana support.

4 years agoMFC r357866:
Konstantin Belousov [Thu, 20 Feb 2020 01:39:48 +0000 (01:39 +0000)]
MFC r357866:
bhyve, bhyvectl: Add Hygon Dhyana support.

4 years agoMFC r357865:
Konstantin Belousov [Thu, 20 Feb 2020 01:38:56 +0000 (01:38 +0000)]
MFC r357865:
vmm: Add Hygon Dhyana support.

4 years agoMFC r358022:
Konstantin Belousov [Thu, 20 Feb 2020 01:34:29 +0000 (01:34 +0000)]
MFC r358022:
pciconf: List names of all known extended PCIe capabilities.

4 years agoMFC r357895, r357910:
Konstantin Belousov [Thu, 20 Feb 2020 01:27:35 +0000 (01:27 +0000)]
MFC r357895, r357910:
Handle non-plt IRELATIVE relocations, at least for x86.

4 years agoMFC r357894:
Konstantin Belousov [Thu, 20 Feb 2020 01:23:39 +0000 (01:23 +0000)]
MFC r357894:
Return success, instead of ESRCH, from pthread_cancel(3) applied to the
exited but not yet joined thread.

4 years agoMFC r358021:
Konstantin Belousov [Thu, 20 Feb 2020 01:16:42 +0000 (01:16 +0000)]
MFC r358021:
Fix typo.

4 years agoMFC r357639: Reduce number of atomic_add() calls in aggsum.
Alexander Motin [Thu, 20 Feb 2020 01:03:44 +0000 (01:03 +0000)]
MFC r357639: Reduce number of atomic_add() calls in aggsum.

Previous code used 4 atomics to do aggsum_flush_bucket() and 2 more to
re-borrow after the flush.  But since asc_borrowed and asc_delta are
accessed only while holding asc_lock, it makes no any sense to modify
as_lower_bound and as_upper_bound in multiple steps.  Instead of that
the new code uses only 2 atomics in all the cases, one per as_*_bound
variable.  I think even that is overkill, simple atomic store and
load could be used here, since all modifications are done under the
as_lock, but there are no such primitives in ZFS code now.

While there, make borrow code consider previous borrow value, so that
on mixed request patterns reduce chance of needing to borrow again if
much larger request follows tiny one that needed borrow.

Also reduce as_numbuckets from uint64_t to u_int.  It makes no sense
to use so large division operation on every aggsum_add().

4 years agoMFC r357576:
Mark Johnston [Wed, 19 Feb 2020 16:17:51 +0000 (16:17 +0000)]
MFC r357576:
Fix a use of an uninitialized pointer in xdr_rpcbs_rmtcalllist().

PR: 243759

4 years agoMFC r352385:
Baptiste Daroussin [Wed, 19 Feb 2020 14:51:39 +0000 (14:51 +0000)]
MFC r352385:

Do not use our custom completion function, it is not needed anymore

4 years agoMFC r352136, r352204, r352275, r352341
Baptiste Daroussin [Wed, 19 Feb 2020 14:49:32 +0000 (14:49 +0000)]
MFC r352136, r352204, r352275, r352341

r352136:
Import libedit 2019-09-10

Compared to current version in base:
- great improvements on the Unicode support
- full support for filename completion including quoting
  which means we do not need anymore our custom addition)
- Improved readline compatiblity

Upgrading libedit has been a pain in the past, because somehow we never
managed to properly cleanup the tree in lib/libedit and each merge has always
been very painful. After years of fighting give up and refresh a merge from
scrarch properly in contrib.

Note that the switch to this version will be done in another commit.

r352204:
Readd _el_fn_sh_complete for backward compatibility

This function is not needed anymore, it allows old sh binary to continue
to run and avoid breaking backward compatibility.
Note that is now just calls the regular _el_fn_complete which does a proper
job at quoting.

Discussed with: jilles

r352275:
Update libedit to a snapshot from 2019-09-10

This version bring many fixes regarding unicode support
It also adds proper support for filename completion (we do not need our custom
patches anymore)
Improves the libreadline compatibility

Note that the same work was done by Yuichiro Naito in
https://reviews.freebsd.org/D21196 the main difference is in this case we have
reimported libedit in contrib to fix a long standing mess in the previous merges
which prevented a proper update workflow. (discussed long ago with pfg@)

The only difference with upstream libedit is we have added a compatibility shim
for the _elf_fn_sh_complete function which we previously added to support quoting
in filename completion and is not needed anymore.
This was added to continue supported old /bin/sh binaries and not break backward
compatibility (as discussed with jilles@)

Reviewed by: Yuichiro Naito <naito.yuichiro_gmail.com>
Differential Revision: https://reviews.freebsd.org/D21584

r352341:
Fix arm and aarch64 builds of libedit after r352275

On arm and arm64, where chars are unsigned by default, buildworld dies
with:

--- terminal.o ---
/usr/src/contrib/libedit/terminal.c:569:41: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     el->el_cursor.v][where & 0370] !=
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/src/contrib/libedit/terminal.c:659:28: error: comparison of
integers of different signs: 'wint_t' (aka 'int') and 'wchar_t' (aka
'unsigned int') [-Werror,-Wsign-compare]
                                     [el->el_cursor.h] == MB_FILL_CHAR)
                                     ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~

Fix this by making MB_FILL_CHAR a wint_t, so no casting is needed.

Note that in https://reviews.freebsd.org/D21584 this was also proposed
by Yuichiro Naito <naito.yuichiro_gmail.com>.

Reviewed by: bapt
Subscribers: naito.yuichiro_gmail.com, ml_vishwin.info
X-MFC-With: r352275
Differential Revision: https://reviews.freebsd.org/D21657

4 years agoMFC r352242, r352249
Baptiste Daroussin [Wed, 19 Feb 2020 14:42:21 +0000 (14:42 +0000)]
MFC r352242, r352249

r352242:
Remove usesless readline compat includes which will reinclude readline.h
itself.

This simplifies the upcoming update to newer libedit.

r352249:
Get the readline header from the installed header instead of the from the source
location.

4 years agoMFC r352247-r352248
Baptiste Daroussin [Wed, 19 Feb 2020 14:37:56 +0000 (14:37 +0000)]
MFC r352247-r352248

r352247:
Remove useless extra definition of libedit flags

Note that all the line editor part is done in the libntp

r352248:
Get the readline header from the installed header instead of the from the source
location.

With newer import of libedit, the path to be able to access readline/readline.h
will also include header which name will conflict with some expected by ntp in
another path and end up breaking the build.

4 years agoMFC r352274:
Baptiste Daroussin [Wed, 19 Feb 2020 14:29:47 +0000 (14:29 +0000)]
MFC r352274:

Insert proper copyright/license headers

Those scripts are without copyright and license assignement since their creation
After grabbing information from The various authors and contributors assign
proper license header and copyrights.

This has been reported by yuripv in his work on integrating those in Illumos!

Reported by: yuripv
Discussed with: marino, edwin

4 years agoMFC r356918:
Baptiste Daroussin [Wed, 19 Feb 2020 14:26:27 +0000 (14:26 +0000)]
MFC r356918:

The ports tree now accepts /usr/local/share/man as a directory for manpage
and will slowly transition from /usr/local/man to it. To reflect this remove
the documentation of the manpages being an exception in the layout of /usr/local

Reported by: Dan Nelson <dnelson_1901@yahoo.com> (via IRC)

4 years agoMFC r353100:
Baptiste Daroussin [Wed, 19 Feb 2020 14:24:05 +0000 (14:24 +0000)]
MFC r353100:

Do not remove the locale directory when building a system without locales

This directory is actually needed during make installworld and will prevent
to reinstall a system after make delete-old is done.

PR: 226137
Reported by: rakuco

4 years agoMFC r356212,r356366,r356416,r357785
Martin Matuska [Wed, 19 Feb 2020 01:46:43 +0000 (01:46 +0000)]
MFC r356212,r356366,r356416,r357785
Update libarchive to version 3.4.2

Relevant vendor changes (r356212):
  Issue #351: Refactor and implement private state logic for write filters
  PR #1252: RAR5 reader - verify window size for solid files (OSS-Fuzz 15482)
  PR #1255: zip writer - don't append unused NUL for directories
  PR #1260: Fix sparse file offset overflow on 32-bit systems
  PR #1263: UNICODE filename support for reading lha/lzh format
  Issue #1276: Bugfix and optimize archive_wstring_append_from_mbs()
  PR #1288: Add the "xattrhdr" option to pax write options
  PR #1295: 7z reader - fix reading archives with digests in PackInfo
  PR #1296: RAR5 reader - verify window size for multivolume archives
  PR #1297: ZIP reader - support LZMA_STREAM_END marker in 'lzma alone' files
  Issue #1298: Fix a heap-buffer-overflow in archive_string_append_from_wcs()
  OSS-Fuzz 19360, 19362: LHA reader - plug two memory leaks on error
  Fix possible off-by-one when dealing with readlink(2)

Relevant vendor changes (r356366):
  Issue #1302: Plug memory leak on failure of archive_write_client_open()

Relevant vendor changes (r356416):
  Issue #1302: Re-do fix for archive_write_client_open()

Relevant vendor changes (r357785):
  PR #1289: atomic extraction support (bsdtar -x --safe-writes)
  PR #1308: big endian fix for UTF16 support in LHA reader
  PR #1326: reject RAR5 files that declare invalid header flags
  Issue #987: fix support 7z archive entries with Delta filter
  Issue #1317: fix compression output buffer handling in XAR writer
  Issue #1319: fix uname or gname longer than 32 characters in pax writer
  Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
  Use localtime_r() and gmtime_r() instead of localtime() and gmtime()

4 years agoMFC r357788:
Brooks Davis [Tue, 18 Feb 2020 21:36:54 +0000 (21:36 +0000)]
MFC r357788:

Mark hme(4) as deprecated.

It was saved from the initial purge of drivers in fcp-101 due to being
the onboard Ethernet device on a number of sparc64 machines.  Now that
sparc64 is gone, it serves little purpose (PCI cards exist, but are rare
and are unlikely to have been deployed outside Sun systems).

4 years agoMFC r357976:
Dimitry Andric [Tue, 18 Feb 2020 18:17:03 +0000 (18:17 +0000)]
MFC r357976:

Merge r357970 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in hptmv(4):

sys/dev/hptmv/ioctl.c:240:4: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation]
                        _vbus_p=pArray->pVBus;
                        ^
sys/dev/hptmv/ioctl.c:237:10: note: previous statement is here
                if(!mIsArray(pArray))
                ^

This is because the return statement after the if statement was not
indented.  (Note that this file has been idented assuming 4-space tabs.)

4 years agoMFC r357873:
Dimitry Andric [Tue, 18 Feb 2020 18:15:33 +0000 (18:15 +0000)]
MFC r357873:

Merge r357864 from the clang1000-import branch:

Fix the following -Werror warning from clang 10.0.0 in sconfig:

sbin/sconfig/sconfig.c:909:5: error: misleading indentation; statement is not part of the previous 'else' [-Werror,-Wmisleading-indentation]
                                exit (-1);
                                ^
sbin/sconfig/sconfig.c:907:6: note: previous statement is here
                        } else
                          ^

The intent was to group the exit() call with the previous fprintf()
call.

4 years agoMFC r357874:
Dimitry Andric [Tue, 18 Feb 2020 18:13:08 +0000 (18:13 +0000)]
MFC r357874:

Merge r357872 from the clang1000-import branch:

Disable new clang 10.0.0 warnings about misleading indentation in ce(4)
and cp(4).

These are false positives, since some of the driver source has been
deliberately obfuscated.

4 years agoMFC r357661:
Dimitry Andric [Tue, 18 Feb 2020 18:03:04 +0000 (18:03 +0000)]
MFC r357661:

Correctly recognize linker versions greater than 10.0.

4 years agoMFC r357502: Few microoptimizations to dbuf layer.
Alexander Motin [Tue, 18 Feb 2020 01:21:56 +0000 (01:21 +0000)]
MFC r357502: Few microoptimizations to dbuf layer.

Move db_link into the same cache line as db_blkid and db_level.
It allows significantly reduce avl_add() time in dbuf_create() on
systems with large RAM and huge number of dbufs per dnode.

Avoid few accesses to dbuf_caches[].size, which is highly congested
under high IOPS and never stays in cache for a long time.  Use local
value we are receiving from zfs_refcount_add_many() any way.

Remove cache_size_bytes_max bump from dbuf_evict_one().  I don't see
a point to do it on dbuf eviction after we done it on insertion in
dbuf_rele_and_unlock().

4 years agoMFC r357453: Unblock kstat.zfs.misc.dbufstats sysctls.
Alexander Motin [Tue, 18 Feb 2020 01:19:32 +0000 (01:19 +0000)]
MFC r357453: Unblock kstat.zfs.misc.dbufstats sysctls.

It is not so much broken to hide it after we wasted time to collect it.

4 years agoMFC r357850:
Ryan Moeller [Tue, 18 Feb 2020 00:01:18 +0000 (00:01 +0000)]
MFC r357850:
Add myself (freqlabs) as a src committer

Approved by:    mav (mentor)

4 years agoMFC: r357149
Rick Macklem [Mon, 17 Feb 2020 19:32:54 +0000 (19:32 +0000)]
MFC: r357149
Fix a crash in the NFSv4 server.

The PR reported a crash that occurred when a file was removed while
client(s) were actively doing lock operations on it.
Since nfsvno_getvp() will return NULL when the file does not exist,
the bug was obvious and easy to fix via this patch. It is a little
surprising that this wasn't found sooner, but I guess the above
case rarely occurs.

PR: 242768

4 years agoMFC r357450, r357462:
Mark Johnston [Mon, 17 Feb 2020 18:40:00 +0000 (18:40 +0000)]
MFC r357450, r357462:
addr2line: Cache CU DIEs upon a successful address lookup.

4 years agoMFC r350515:
Mark Johnston [Mon, 17 Feb 2020 18:39:38 +0000 (18:39 +0000)]
MFC r350515:
Capsicumize addr2line(1).

4 years agoMFC r356597:
Hans Petter Selasky [Mon, 17 Feb 2020 09:58:55 +0000 (09:58 +0000)]
MFC r356597:
Define the XHCI endpoint states.

Sponsored by: Mellanox Technologies

4 years agoMFC r357726:
Hans Petter Selasky [Mon, 17 Feb 2020 09:57:03 +0000 (09:57 +0000)]
MFC r357726:
Add USB host controller PCI ID's for Hygon.

Differential Revision: https://reviews.freebsd.org/D23564
Sponsored by: Mellanox Technologies

4 years agoMFC r357801:
Hans Petter Selasky [Mon, 17 Feb 2020 09:53:23 +0000 (09:53 +0000)]
MFC r357801:
Add support for disabling and polling MSIX interrupts in mlx5core.

Sponsored by: Mellanox Technologies

4 years agoSkip sys.geom.class.multipath.misc.fail_on_error on stable/12
Li-Wen Hsu [Sun, 16 Feb 2020 09:13:05 +0000 (09:13 +0000)]
Skip sys.geom.class.multipath.misc.fail_on_error on stable/12

The required feature is not in stable/12 yet.

PR: 244158
Sponsored by: The FreeBSD Foundation

4 years agoMFC r356000: Remove unused includes.
Xin LI [Sun, 16 Feb 2020 07:06:25 +0000 (07:06 +0000)]
MFC r356000: Remove unused includes.

4 years agoMFC r357420: Remove unused include.
Xin LI [Sun, 16 Feb 2020 06:34:45 +0000 (06:34 +0000)]
MFC r357420: Remove unused include.

4 years agoMFC r357663
Vincenzo Maffione [Sat, 15 Feb 2020 11:42:13 +0000 (11:42 +0000)]
MFC r357663

netmap: improve netmap(4) and vale(4) man pages

Clean up obsolete sysctl descriptions and add missing ones.

PR:             243838
Reviewed by:    bcr
Differential Revision:  https://reviews.freebsd.org/D23546

4 years agoMFC r357813:
Konstantin Belousov [Sat, 15 Feb 2020 00:48:44 +0000 (00:48 +0000)]
MFC r357813:
Fix indent.

4 years agoMFC r357670:
Konstantin Belousov [Fri, 14 Feb 2020 13:26:45 +0000 (13:26 +0000)]
MFC r357670:
pmc: Add Hygon Dhyana support.

4 years agoMFC r357669:
Konstantin Belousov [Fri, 14 Feb 2020 13:25:37 +0000 (13:25 +0000)]
MFC r357669:
acpi_hpet: Add Hygon Dhyana support.

4 years agoMFC r357668:
Konstantin Belousov [Fri, 14 Feb 2020 13:10:52 +0000 (13:10 +0000)]
MFC r357668:
linux futex_put(): do not touch futex after dropping our reference.

4 years agoMFC r353022:
Colin Percival [Fri, 14 Feb 2020 02:31:20 +0000 (02:31 +0000)]
MFC r353022:

Switch EC2 AMIs from using the dual-dhclient script to using the new
dual-dhclient-daemon daemon. This makes it possible to stop/restart
the dhclients.

4 years agoMFC r357756: backup-passwd: mask out all passwords in the diff
Kyle Evans [Fri, 14 Feb 2020 02:27:01 +0000 (02:27 +0000)]
MFC r357756: backup-passwd: mask out all passwords in the diff

The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

4 years agoMFC r357235:
Alan Somers [Thu, 13 Feb 2020 20:49:45 +0000 (20:49 +0000)]
MFC r357235:

Speed up "zpool import" in the presence of many zvols

By default, zpools may not be backed by zvols (that can be changed with the
"vfs.zfs.vol.recursive" sysctl). When that sysctl is set to 0, the kernel
does not attempt to read zvols when looking for vdevs. But the zpool command
still does. This change brings the zpool command into line with the kernel's
behavior. It speeds "zpool import" when an already imported pool has many
zvols, or a zvol with many snapshots.

PR: 241083
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>
Reviewed by: mav, Ryan Moeller <ryan@freqlabs.com>
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22077

4 years agoMFC r357211:
Alan Somers [Thu, 13 Feb 2020 20:46:05 +0000 (20:46 +0000)]
MFC r357211:

geli: add a test case for attaching multiple providers with 1 command

Reviewed by: cem
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D23400

4 years agoMFC r356809:
Alan Somers [Thu, 13 Feb 2020 20:45:32 +0000 (20:45 +0000)]
MFC r356809:

setextattr: Increase stdin buffer size to 4096

Extended attribute values can potentially be quite large. One test for ZFS
is supposed to set a 200MB xattr. However, the buffer size for reading
values from stdin with setextattr -i is so small that the test times out
waiting for tiny chunks of data to be buffered and appended to an sbuf.

Increasing the buffer size should help alleviate some of the burden of
reallocating larger sbufs when writing large extended attributes.

Submitted by: Ryan Moeller <ryan@freqlabs.com>
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23211

4 years agoMFC r355488-r355489
Alan Somers [Thu, 13 Feb 2020 20:41:20 +0000 (20:41 +0000)]
MFC r355488-r355489

r355488:
lio_listio(2): add a HISTORY section

r355489:
clock_gettime(2): add a HISTORY section

4 years agoMFC r355430:
Alan Somers [Thu, 13 Feb 2020 20:40:36 +0000 (20:40 +0000)]
MFC r355430:

ses: sanitize illegal strings in SES element descriptors

The SES4r3 standard requires that element descriptors may only contain ASCII
characters in the range 0x20 to 0x7e.  Some SuperMicro expanders violate
that rule.  This patch adds a sanity check to ses(4).  Descriptors in
violation will be replaced by "<invalid>".

This patch fixes "sesutil --libxo xml" on such systems.  Previously it would
generate non-well-formed XML output.

PR: 241929
Reviewed by: allanjude
Sponsored by: Axcient

4 years agoMFC r355431:
Alan Somers [Thu, 13 Feb 2020 20:32:05 +0000 (20:32 +0000)]
MFC r355431:

gmultipath: add ATF tests

Add ATF tests for most gmultipath operations. Add some dtrace probes too,
primarily for configuration changes that happen in response to provider
errors.

PR: 178473
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D22235

4 years agoMFC r354234:
Alan Somers [Thu, 13 Feb 2020 18:26:07 +0000 (18:26 +0000)]
MFC r354234:

geli: raise WARNS to 6

Sponsored by: Axcient

4 years agoMFC r357284, r357419: stdio unlocked
Kyle Evans [Thu, 13 Feb 2020 03:13:29 +0000 (03:13 +0000)]
MFC r357284, r357419: stdio unlocked

r357284:
stdio: provide _unlocked variants of fflush, fputc, fputs, fread, fwrite

fflush_unlocked is currently desired in ports by sysutils/metalog, and
redefined as the locked fflush.

fputc_unlocked, fputs_unlocked, fread_unlocked, and fwrite_unlocked are
currently desired in ports by devel/elfutils, and redefined as the locked
fputs, fread, and fwrite respectively.

r357419:
libc: provide fputc_unlocked

Among the same justification as the other stdio _unlocked; in addition to an
inline version in <stdio.h>, we must provide a function in libc as well for
the functionality. This fixes the lang/gcc* builds, which want to use the
symbol from libc.

4 years agoMFC r356942:
Brooks Davis [Wed, 12 Feb 2020 18:40:29 +0000 (18:40 +0000)]
MFC r356942:

Correct a misleading indent.

This dates to before the beginning of our repo and was found by clang 10.

Sponsored by: DARPA

4 years agoMFC r357575:
Mark Johnston [Wed, 12 Feb 2020 15:51:29 +0000 (15:51 +0000)]
MFC r357575:
Improve validation of the sockaddr length in iruserok_sa().

PR: 243747

4 years agoMFC r357573:
Mark Johnston [Wed, 12 Feb 2020 15:46:33 +0000 (15:46 +0000)]
MFC r357573:
Fix map locking in the CLEAR_PKRU sysarch(2) handler.

4 years agoMFC r357665: geli taste: allow GELIBOOT tagged providers as well
Kyle Evans [Wed, 12 Feb 2020 02:17:20 +0000 (02:17 +0000)]
MFC r357665: geli taste: allow GELIBOOT tagged providers as well

Currently the installer will tag geliboot partitions with both BOOT and
GELIBOOT; the former allows the kernel to taste it at boot, while the latter
is what loaders keys off of.

However, it seems reasonable to assume that if a provider's been tagged with
GELIBOOT that the kernel should also take that as a hint to taste/attach at
boot. This would allow us to stop tagging GELIBOOT partitions with BOOT in
bsdinstall, but I'm not sure that there's a compelling reason to do so any
time soon.

4 years agoMFC r357563: env(1): grow -L user/class and -U user/class options
Kyle Evans [Wed, 12 Feb 2020 02:09:12 +0000 (02:09 +0000)]
MFC r357563: env(1): grow -L user/class and -U user/class options

This allows one to set the environment of the specified user either from
login.conf alone (-L) or both login.conf and ~/.login_conf if present (-U).

This is a supporting feature to allow service(8) to pull in the environment
of the "daemon" class before invoking the rc script.

4 years agoMFC r354450: Add -0 option to ENV(1)
Kyle Evans [Wed, 12 Feb 2020 02:07:37 +0000 (02:07 +0000)]
MFC r354450: Add -0 option to ENV(1)

With the -0 option added to ENV(1), some ports will no longer require genv
from sysutils/coreutils.

4 years agoMFC r357560, r357707: login.conf(5) mail capability
Kyle Evans [Wed, 12 Feb 2020 02:04:03 +0000 (02:04 +0000)]
MFC r357560, r357707: login.conf(5) mail capability

r357560:
login.conf(5): split MAIL env var out into a "mail" capability

This allows it to be easily suppressed in, e.g., the "daemon" class where it
will not be properly expanded.

This is a part of D21481.

Submitted by: Andrew Gierth <andrew_tao173.riddles.org.uk>

r357707:
login.conf(5): update commented-out standard, too

MAIL now has a mail capability, instead, as of r357560.

4 years agoMFC r357512:
Konstantin Belousov [Tue, 11 Feb 2020 12:14:22 +0000 (12:14 +0000)]
MFC r357512:
Add sys/systm.h to several places that use vm headers.

4 years agoMFC r357511:
Konstantin Belousov [Tue, 11 Feb 2020 12:13:21 +0000 (12:13 +0000)]
MFC r357511:
tmpfs_mount update: simplify, cache the value of VFS_TO_TMPFS() calculation.

4 years agoMFC r357678:
Konstantin Belousov [Tue, 11 Feb 2020 12:05:59 +0000 (12:05 +0000)]
MFC r357678:
Correct the function name in the comment.

4 years agoMFC r357537, r357538:
Mark Johnston [Tue, 11 Feb 2020 05:15:35 +0000 (05:15 +0000)]
MFC r357537, r357538:
elfcopy: Coverity fixups.

4 years agoMFC r357531, r357532, r357533, r357534:
Mark Johnston [Tue, 11 Feb 2020 05:14:36 +0000 (05:14 +0000)]
MFC r357531, r357532, r357533, r357534:
libdwarf: Coverity fixups.

4 years agoMFC r357542:
Mark Johnston [Tue, 11 Feb 2020 05:13:35 +0000 (05:13 +0000)]
MFC r357542:
readelf: Don't leak memory when dwarf_get_fde_info_for_all_regs() fails.

4 years agoMFC r357539:
Mark Johnston [Tue, 11 Feb 2020 05:11:52 +0000 (05:11 +0000)]
MFC r357539:
size: Avoid returning a stack pointer from xlatetom().

4 years agoMFC r357535, r357536:
Mark Johnston [Tue, 11 Feb 2020 05:11:27 +0000 (05:11 +0000)]
MFC r357535, r357536:
libelftc: Fix memory leaks in the C++ demanglers.

4 years agoMFC r357525:
Mark Johnston [Tue, 11 Feb 2020 03:37:42 +0000 (03:37 +0000)]
MFC r357525:
Correct the malloc tag used when freeing the temporary semop(2) buffer.

4 years agoMFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688
Kyle Evans [Sun, 9 Feb 2020 22:15:35 +0000 (22:15 +0000)]
MFC O_SEARCH: r357412, r357461, r357580, r357584, r357636, r357671, r357688

r357412:
Provide O_SEARCH

O_SEARCH is defined by POSIX [0] to open a directory for searching, skipping
permissions checks on the directory itself after the initial open(). This is
close to the semantics we've historically applied for O_EXEC on a directory,
which is UB according to POSIX. Conveniently, O_SEARCH on a file is also
explicitly undefined behavior according to POSIX, so O_EXEC would be a fine
choice. The spec goes on to state that O_SEARCH and O_EXEC need not be
distinct values, but they're not defined to be the same value.

This was pointed out as an incompatibility with other systems that had made
its way into libarchive, which had assumed that O_EXEC was an alias for
O_SEARCH.

This defines compatibility O_SEARCH/FSEARCH (equivalent to O_EXEC and FEXEC
respectively) and expands our UB for O_EXEC on a directory. O_EXEC on a
directory is checked in vn_open_vnode already, so for completeness we add a
NOEXECCHECK when O_SEARCH has been specified on the top-level fd and do not
re-check that when descending in namei.

[0] https://pubs.opengroup.org/onlinepubs/9699919799/

r357461:
namei: preserve errors from fget_cap_locked

Most notably, we want to make sure we don't clobber any capabilities-related
errors. This is a regression from r357412 (O_SEARCH) that was picked up by
the capsicum tests.

r357580:
O_SEARCH test: drop O_SEARCH|O_RDWR local diff

In FreeBSD's O_SEARCH implementation, O_SEARCH in conjunction with O_RDWR or
O_WRONLY is explicitly rejected. In this case, O_RDWR was not necessary
anyways as the file will get created with or without it.

This was submitted upstream as misc/54940 and committed in rev 1.8 of the
file.

r357584:
Record-only MFV of r357583: netbsd-tests: import upstreamed changes

The changes in question originated in FreeBSD/head; no further action is
required.

r357636:
MFV r357635: imnport v1.9 of the O_SEARCH tests

The RCSID data was wrong, so this is effectively a record-only merge
with correction of said data. No further changes should be needed in this
area, as we've now upstreamed our local changes to this specific test.

r357671:
O_SEARCH test: mark revokex an expected fail on NFS

The revokex test does not work when the scratch directory is created on NFS.
Given the nature of NFS, it likely can never work without looking like a
security hole since O_SEARCH would rely on the server knowing that the
directory did have +x at the time of open and that it's OK for it to have
been revoked based on POSIX specification for O_SEARCH.

This does mean that O_SEARCH is only partially functional on NFS in general,
but I suspect the execute bit getting revoked in the process is likely not
common.

r357688:
MFV r357687: Import NFS fix for O_SEARCH tests

The version that ended upstream was ultimately slightly different than the
version committed here; notably, statvfs() is used but it's redefined
appropriately to statfs() on FreeBSD since we don't provide the fstypename
for the former interface.