]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoMerge ^/vendor/llvm-project/release-10.x up to its last change (upstream
dim [Thu, 5 Mar 2020 18:11:47 +0000 (18:11 +0000)]
Merge ^/vendor/llvm-project/release-10.x up to its last change (upstream
commit llvmorg-10.0.0-rc3-1-gc290cb61fdc), and bump versions.

4 years agoRevert r357259, after the merge from head which added linker scripts for
dim [Thu, 5 Mar 2020 18:09:19 +0000 (18:09 +0000)]
Revert r357259, after the merge from head which added linker scripts for
stand/i386 boot:

Revert upstream lld r371957 (git commit 06bb7dfbd) by Fangrui Song:

  [ELF] Map the ELF header at imageBase

  If there is no readonly section, we map:

  * The ELF header at imageBase+maxPageSize
  * Program headers at imageBase+maxPageSize+sizeof(Ehdr)
  * The first section .text at imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)

  Due to the interaction between Writer<ELFT>::fixSectionAlignments and
  LinkerScript::allocateHeaders,
  `alignDown(p_vaddr(R PT_LOAD)) = alignDown(p_vaddr(RX PT_LOAD))`.
  The RX PT_LOAD will override the R PT_LOAD at runtime, which is not ideal:

  ```
  // PHDR at 0x401034, should be 0x400034
    PHDR           0x000034 0x00401034 0x00401034 0x000a0 0x000a0 R   0x4
  // R PT_LOAD contains just Ehdr and program headers.
  // At 0x401000, should be 0x400000
    LOAD           0x000000 0x00401000 0x00401000 0x000d4 0x000d4 R   0x1000
    LOAD           0x0000d4 0x004010d4 0x004010d4 0x00001 0x00001 R E 0x1000
  ```

  * createPhdrs allocates the headers to the R PT_LOAD.
  * fixSectionAlignments assigns `imageBase+maxPageSize+sizeof(Ehdr)+sizeof(program headers)` (formula: `alignTo(dot, maxPageSize) + dot % config->maxPageSize`) to addrExpr of .text
  * allocateHeaders computes the minimum address among SHF_ALLOC sections, i.e. addr(.text)
  * allocateHeaders sets address of ELF header to `addr(.text)-sizeof(Ehdr)-sizeof(program headers) = imageBase+maxPageSize`

  The main observation is that when the SECTIONS command is not used, we
  don't have to call allocateHeaders. This requires an assumption that
  the presence of PT_PHDR and addresses of headers can be decided
  regardless of address information.

  This may seem natural because dot is not manipulated by a linker script.
  The other thing is that we have to drop the special rule for -T<section>
  in `getInitialDot`. If -Ttext is smaller than the image base, the headers
  will not be allocated with the old behavior (allocateHeaders is called)
  but always allocated with the new behavior.

  The behavior change is not a problem. Whether and where headers are
  allocated can vary among linkers, or ld.bfd across different versions
  (--enable-separate-code or not). It is thus advised to use a linker
  script with the PHDRS command to have a consistent behavior across
  linkers. If PT_PHDR is needed, an explicit --image-base can be a simpler
  alternative.

  Differential Revision: https://reviews.llvm.org/D67325

  llvm-svn: 371957

4 years agoVendor import of llvm-project branch release/10.x
dim [Thu, 5 Mar 2020 18:05:37 +0000 (18:05 +0000)]
Vendor import of llvm-project branch release/10.x
llvmorg-10.0.0-rc3-1-gc290cb61fdc.

4 years agoMerge ^/head r358466 through r358677.
dim [Thu, 5 Mar 2020 17:55:36 +0000 (17:55 +0000)]
Merge ^/head r358466 through r358677.

4 years agobuffer pager: deref ucred immediately after read.
kib [Thu, 5 Mar 2020 15:52:34 +0000 (15:52 +0000)]
buffer pager: deref ucred immediately after read.

Ucred is passed to bread(9) so that non-local filesystems use proper
credentials.  But, since clean buffer might be cached unless
buf_pager_relbuf is not enabled, it makes credentials to have extra
reference until buffer is reclaimed.  Ucred reference would prevent
jail from destroying if creds are jailed.

Dereferencing the read credentials on the valid buffer avoid that, and
should be fine because the buffer is valid and does not need re-read.

PR: 238032
Reported by: bz
Reproduced and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23775

4 years agoumtx_op.2: correct typo
emaste [Thu, 5 Mar 2020 15:51:44 +0000 (15:51 +0000)]
umtx_op.2: correct typo

PR: 244611
Submitted by: John F. Carr <jfc@mit.edu>
MFC after: 3 days

4 years agoftw.3: Add examples
0mp [Thu, 5 Mar 2020 14:52:24 +0000 (14:52 +0000)]
ftw.3: Add examples

PR: 173448 [1]
Submitted by: fernape@ (previous version) [1]
Reviewed by: jilles
Approved by: bcr (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D21750

4 years agoMove compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
tijl [Thu, 5 Mar 2020 14:41:27 +0000 (14:41 +0000)]
Move compat.linux.map_sched_prio sysctl definition to linux_mib.c so it is
only defined by linux_common kernel module and not both linux and linux64
modules.

Reported by: Yuri Pankov <ypankov@fastmail.com>

4 years ago[PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07
alfredo [Thu, 5 Mar 2020 14:13:22 +0000 (14:13 +0000)]
[PowerPC64] restrict memcpy/bcopy optimization to POWER ISA >=V2.07

VSX instructions were added in POWER ISA V2.06 (POWER7), but it
requires data to be word-aligned. Such requirement was removed in
ISA V2.07B (POWER8).

Since current memcpy/bcopy optimization relies on VSX instructions
handling misalignment transparently, and kernel doesn't currently
implement an alignment error handler, this optimzation should be
restrict to ISA V2.07 onwards.

SIGBUS on stxvd2x instruction was reproduced in POWER7+ CPU.

Reviewed by: luporl, jhibbits, bdragon
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D23958

4 years ago[PowerPC64] fix uma_small_free panic
alfredo [Thu, 5 Mar 2020 12:24:48 +0000 (12:24 +0000)]
[PowerPC64] fix uma_small_free panic

Fix panic "Freeing UMA block at 0xn with no associated page".
Also replaces pmap_remove call by pmap_kremove, for symmetry.

Reviewed by: jhibbits
Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D23931

4 years agoMark the arm64 machdep.h as kernel only
andrew [Thu, 5 Mar 2020 10:52:16 +0000 (10:52 +0000)]
Mark the arm64 machdep.h as kernel only

None of this is useful for userspace.

Sponsored by: Innovate UK

4 years agoAll paths lead to xpt_done, so move it after the switch.
imp [Thu, 5 Mar 2020 06:21:00 +0000 (06:21 +0000)]
All paths lead to xpt_done, so move it after the switch.

4 years agoxpt_async is submitting a CCB, not finishing it up, so use xpt_action() instead
imp [Thu, 5 Mar 2020 06:20:17 +0000 (06:20 +0000)]
xpt_async is submitting a CCB, not finishing it up, so use xpt_action() instead
of xpt_done(). Add the missing XPT_ASYNC case to xpt_action_default. xpt_async
wants to use the side-effect of the xpt_done() routine to queue this to the
camisr thread so it can be done in that context. However, this breaks the
symmetry that you create a ccb and call xpt_action() for it to be
dispatched. Restore that symmetry by having it go through that path. As far as I
can tell, this is the only CCB that we create and call xpt_done() on directly.

4 years agoAdd a missing bktr header.
glebius [Wed, 4 Mar 2020 23:49:20 +0000 (23:49 +0000)]
Add a missing bktr header.

4 years agoFix spelling of "dropped".
glebius [Wed, 4 Mar 2020 22:32:40 +0000 (22:32 +0000)]
Fix spelling of "dropped".

Submitted by: Lutz Donnerhacke
Differential Revision: https://reviews.freebsd.org/D23954

4 years agoRemove unused function.
glebius [Wed, 4 Mar 2020 22:31:41 +0000 (22:31 +0000)]
Remove unused function.

4 years agoWhen a machine boots the NFS mounting script is executed after
glebius [Wed, 4 Mar 2020 22:27:16 +0000 (22:27 +0000)]
When a machine boots the NFS mounting script is executed after
interfaces are configured, but for many interfaces (e.g. all Intel)
ifconfig causes link renegotiation, so the first attempt to mount
NFS always fails. After that mount_nfs sleeps for 30 seconds, while
only a couple seconds are actually required for interface to get up.

Instead of sleeping, do select(2) on routing socket and check if
some interface became UP and in this case retry immediately.

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D23934

4 years agoRemove an #include erroneously added in r358432.
markj [Wed, 4 Mar 2020 22:23:24 +0000 (22:23 +0000)]
Remove an #include erroneously added in r358432.

Reported by: erj

4 years agoMFV r358616:
cy [Wed, 4 Mar 2020 21:45:12 +0000 (21:45 +0000)]
MFV r358616:

Update ntp-4.2.8p13 --> 4.2.8p14.

The advisory can be found at:
http://support.ntp.org/bin/view/Main/SecurityNotice#\
March_2020_ntp_4_2_8p14_NTP_Rele

No CVEs have been documented yet.

MFC after: now
Security: http://support.ntp.org/bin/view/Main/NtpBug3610
http://support.ntp.org/bin/view/Main/NtpBug3596
http://support.ntp.org/bin/view/Main/NtpBug3592

4 years agoIntroduce kern_mmap_req().
brooks [Wed, 4 Mar 2020 21:27:12 +0000 (21:27 +0000)]
Introduce kern_mmap_req().

This presents an extensible interface to the generic mmap(2)
implementation via a struct pointer intended to use a designated
initializer or compount literal.  We take advantage of the mandatory
zeroing of fields not listed in the initializer.

Remove kern_mmap_fpcheck() and use kern_mmap_req().

The motivation for this change is a desire to keep the core
implementation from growing an ever-increasing number of arguments
that must be specified in the correct order for the lowest-level
implementations.  In CheriBSD we have already added two more arguments.

Reviewed by: kib
Discussed with: kevans
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D23164

4 years agoLink stand/i386 components using a linker script
dim [Wed, 4 Mar 2020 21:01:22 +0000 (21:01 +0000)]
Link stand/i386 components using a linker script

LLD 10.0.0 changed the behavior of the -Ttext option, so that using
-Ttext=0x0 now causes linking of the loaders to fail with:

ld: error: output file too large: 18446744073707016908 bytes

I reported this in https://bugs.llvm.org/show_bug.cgi?id=44715, and
initially reverted the upstream change in r357259 to work around it.

However, after some discussion with Fangrui Song in the upstream ticket,
I think we can classify this as an unfortunate interaction between using
-Ttext=0 in combination with --no-rosegment.  (We added the latter
in r332090, because btxld does not correctly handle input with more
than 2 PT_LOAD segments.)

Fangrui suggested to use a linker script instead, and Warner was already
attempting this in r305353, but had to revert it due to "crypto-using
boot problems" (not sure what those were :).

This review updates the stand/i386/boot.ldscript to handle more
sections, inserts some symbols like _edata and such that we use in
libsa, and also discards any .interp section.

It uses ORG which is defined on the linker command line using
--defsym ORG=value to set the start of all the sections.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23952

4 years agoreadelf: simplify namesz / descsz checks
emaste [Wed, 4 Mar 2020 20:41:45 +0000 (20:41 +0000)]
readelf: simplify namesz / descsz checks

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoreadelf: check note namesz and descsz
emaste [Wed, 4 Mar 2020 20:29:49 +0000 (20:29 +0000)]
readelf: check note namesz and descsz

Previously corrupt note namesz or descsz (perhaps caused by readelf's
current lack of endian support for notes) resulted in a crash.  Check
that namesz and descsz do not extend beyond the end of the buffer before
trying to access name and desc data.

Reported by: jhb
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agodwmmc: Rework the DMA engine
manu [Wed, 4 Mar 2020 20:01:03 +0000 (20:01 +0000)]
dwmmc: Rework the DMA engine

Each segment can be up to 4096 bytes in chain structure according to the
RK3399 TRM Part 2.
Set the buffers in full ring where the last one point to the first one.
Correctly reports the MMC_IVAR_MAX_DATA.
Use CACHE_LINE_SIZE for bus_dma alignment.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23894

4 years agoexecve: use LOCKSHARED when looking up the interpreter
mjg [Wed, 4 Mar 2020 19:52:34 +0000 (19:52 +0000)]
execve: use LOCKSHARED when looking up the interpreter

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23956

4 years agonullfs: don't pre lock exclusive in nullfs_root
mjg [Wed, 4 Mar 2020 19:52:00 +0000 (19:52 +0000)]
nullfs: don't pre lock exclusive in nullfs_root

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23955

4 years agoloader: crc32 is provided by libsa
tsoome [Wed, 4 Mar 2020 18:38:09 +0000 (18:38 +0000)]
loader: crc32 is provided by libsa

Seems like leftover from moving crc32.c to libsa.

4 years agoReserve WXNEEDED ELF feature control flag
emaste [Wed, 4 Mar 2020 18:21:30 +0000 (18:21 +0000)]
Reserve WXNEEDED ELF feature control flag

This will be used to tag binaries that require W+X mappings, in advance
of the ability to prevent W^X in mmap/mprotect.

There is still some discussion about the flag's name, but the ABI won't
change even if the name does (as kib pointed out in the review).

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

4 years agobnxt(4): Fix ioctls when user addresses are inaccessable.
brooks [Wed, 4 Mar 2020 17:55:57 +0000 (17:55 +0000)]
bnxt(4): Fix ioctls when user addresses are inaccessable.

Check copyin's error code (differ adding copyout checks at this time).

Don't directly access user memory in the switch statement.

Since bnxt_ioctl_data isn't all that big, use a stack allocation.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23933

4 years agoImplement a detaching flag for the sound(4) subsystem to take
hselasky [Wed, 4 Mar 2020 17:23:20 +0000 (17:23 +0000)]
Implement a detaching flag for the sound(4) subsystem to take
appropriate actions when we are trying to detach an audio device,
but cannot because someone is using it.

This avoids applications having to wait for the DSP read data
timeout before they receive any error indication.
Tested with virtual_oss(8).

Remove some unused definitions while at it.

PR: 194727
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement optional table entry limits for if_llatbl.
bz [Wed, 4 Mar 2020 17:17:02 +0000 (17:17 +0000)]
Implement optional table entry limits for if_llatbl.

Implement counting of table entries linked on a per-table base
with an optional (if set > 0) limit of the maximum number of table
entries.

For that the public lltable_link_entry() and lltable_unlink_entry()
functions as well as the internal function pointers change from void
to having an int return type.

Given no consumer currently sets the new llt_maxentries this can be
committed on its own.  The moment we make use of the table limits,
the callers of the link function must check the return value as
it can change and entries might not be added.

Adjustments for IPv6 (and possibly IPv4) will follow.

Sponsored by: Netflix (originally)
Reviewed by: melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D22713

4 years agomlx5en: Support 50GBase-KR4 media type in mlx5en driver.
kib [Wed, 4 Mar 2020 17:13:35 +0000 (17:13 +0000)]
mlx5en: Support 50GBase-KR4 media type in mlx5en driver.

Submitted by: Adam Peace <adam.e.peace@gmail.com>
Reviewed by: hselasky
Sponsored by: Mellanox Technologies
MFC after: 1 week

4 years agoelfctl: check read return value
emaste [Wed, 4 Mar 2020 16:57:23 +0000 (16:57 +0000)]
elfctl: check read return value

CID: 14202121420213
Reported by: Coverity Scan
Sponsored by: The FreeBSD Foundation

4 years agoelfctl: style(9): use C99 uintX_t types
emaste [Wed, 4 Mar 2020 16:53:49 +0000 (16:53 +0000)]
elfctl: style(9): use C99 uintX_t types

Sponsored by: The FreeBSD Foundation

4 years agoWhen using automatically generated flow labels and using TCP SYN
tuexen [Wed, 4 Mar 2020 16:41:25 +0000 (16:41 +0000)]
When using automatically generated flow labels and using TCP SYN
cookies, use the same flow label for the segments sent during the
handshake and after the handshake.
This fixes a bug by making sure that sc_flowlabel is always stored in
network byte order.

Reviewed by: bz@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D23957

4 years agoAdd new ICMPv6 counters for Anti-DoS limits.
bz [Wed, 4 Mar 2020 16:20:59 +0000 (16:20 +0000)]
Add new ICMPv6 counters for Anti-DoS limits.

Add four new counters for ND6 related Anti-DoS measures.
We split these out into a separate upfront commit so that we only
change the struct size one time.  Implementations using them will
follow.

PR: 157410
Reviewed by: melifaro
MFC after: 2 weeks
X-MFC: cannot really MFC this without breaking netstat
Sponsored by: Netflix (initially)
Differential Revision: https://reviews.freebsd.org/D22711

4 years agoUpdate ismt(4) man page for r358595.
jhibbits [Wed, 4 Mar 2020 14:56:32 +0000 (14:56 +0000)]
Update ismt(4) man page for r358595.

Submitted by: Dmitry Luhtionov
X-MFC-With: r358595
Sponsored by: Juniper Networks, Inc

4 years agoImport ntp-4.2.8p14.
cy [Wed, 4 Mar 2020 13:59:29 +0000 (13:59 +0000)]
Import ntp-4.2.8p14.

4 years agoDon't send an uninitilised traffic class in the IPv6 header, when
tuexen [Wed, 4 Mar 2020 12:22:53 +0000 (12:22 +0000)]
Don't send an uninitilised traffic class in the IPv6 header, when
sending a TCP segment from the TCP SYN cache (like a SYN-ACK).
This fix initialises it to zero. This is correct for the ECN bits,
but is does not honor the DSCP what an application might have set via
the IPPROTO_IPV6 level socket options IPV6_TCLASS. That will be
fixed separately.

Reviewed by: Richard Scheffenegger
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D23900

4 years ago[aacraid] Add missing unmap call for SYNC mode
luporl [Wed, 4 Mar 2020 12:21:38 +0000 (12:21 +0000)]
[aacraid] Add missing unmap call for SYNC mode

This issue was observed on a PowerPC64 machine with an Adaptec RAID Controller
with PCI device ID 0x028d. After several read/write operations, the kernel was
panic'ing in bus_dmamap_sync(). This was due to a missing aac_unmap_command()
in the SYNC path.

PR: 237463
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D23668

4 years agoRestart the USB keyboard repeat timer at every valid key-press.
hselasky [Wed, 4 Mar 2020 09:46:42 +0000 (09:46 +0000)]
Restart the USB keyboard repeat timer at every valid key-press.

This fixes a regression issue after r357861.

Reported by: James Wright <james.wright@jigsawdezign.com>
PR: 224592
PR: 233884
MFC after: 3 days
Sponsored by: Mellanox Technologies

4 years agoif vm_pager_get_pages_async() returns an error, release the sfio->nios
chs [Wed, 4 Mar 2020 00:22:50 +0000 (00:22 +0000)]
if vm_pager_get_pages_async() returns an error, release the sfio->nios
refcount that we took earlier that represents the I/O that ended up
not being started.

Reviewed by: glebius
Approved by: imp (mentor)
Sponsored by: Netflix

4 years agosys/signalvar.h: Fix opposite boolean sense in comment
cem [Tue, 3 Mar 2020 23:15:30 +0000 (23:15 +0000)]
sys/signalvar.h: Fix opposite boolean sense in comment

Correct the sense of the comment describing sigsetmasked() to match the
code.  It was exactly backwards.

While here, convert the type/values of the predicate from pre-C99 int/1/0 to
bool/true/false.  No functional change.

4 years agoAdd Atom C3000 (Denverton) SMT PCI ID
jhibbits [Tue, 3 Mar 2020 22:23:56 +0000 (22:23 +0000)]
Add Atom C3000 (Denverton) SMT PCI ID

MFC after: 3 days
Sponsored by: Juniper Networks, Inc

4 years agodumpon: skip size check if using zstd
vangyzen [Tue, 3 Mar 2020 22:14:23 +0000 (22:14 +0000)]
dumpon: skip size check if using zstd

As with gzip, let the dump device be smaller than physical memory
when using zstd and full dumps.

Also print the error message if the size check fails, even if -v
is not specified.  Failing silently is not friendly.

Reviewed by: cem markj
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D23923

4 years agoUse ifr_data_get_ptr() consistently.
brooks [Tue, 3 Mar 2020 18:58:43 +0000 (18:58 +0000)]
Use ifr_data_get_ptr() consistently.

4 years agoExpose ifr_buffer_get_(buffer|length) outside if.c.
brooks [Tue, 3 Mar 2020 18:05:11 +0000 (18:05 +0000)]
Expose ifr_buffer_get_(buffer|length) outside if.c.

This is a preparatory commit for D23933.

Reviewed by: jhb

4 years agoGet rid of silly /* FALLTHROUGH */ lines
imp [Tue, 3 Mar 2020 17:40:29 +0000 (17:40 +0000)]
Get rid of silly /* FALLTHROUGH */ lines

Consistently omit /* FALLTHROUGH */ when we have a case statement that does
nothing. Since compilers don't warn about stacked case statements, and we were
inconsistent, resolve by removing extras.

4 years agoSkip if_epair regression test if module doesn't exist
olivier [Tue, 3 Mar 2020 17:35:15 +0000 (17:35 +0000)]
Skip if_epair regression test if module doesn't exist

Approved by: kp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D23876

4 years agoWhen closing a LinuxKPI file always use the real release function to avoid
hselasky [Tue, 3 Mar 2020 15:49:34 +0000 (15:49 +0000)]
When closing a LinuxKPI file always use the real release function to avoid
resource leakage when destroying a LinuxKPI character device.

Submitted by: Andrew Boyer <aboyer@pensando.io>
Reviewed by: kib@
PR: 244572
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix dynamic redrects by adding forgotten RTF_HOST flag.
melifaro [Tue, 3 Mar 2020 15:33:43 +0000 (15:33 +0000)]
Fix dynamic redrects by adding forgotten RTF_HOST flag.
Improve tests to verify the generated route flags.

Reported by: jtl
MFC after: 2 weeks

4 years agoFix the spelling of aliasing.
andrew [Tue, 3 Mar 2020 15:31:40 +0000 (15:31 +0000)]
Fix the spelling of aliasing.

Sponsored by: Innovate UK

4 years agoMove the arm64 cache identification to identcpu.c
andrew [Tue, 3 Mar 2020 15:25:01 +0000 (15:25 +0000)]
Move the arm64 cache identification to identcpu.c

This allows us to call it on a per-CPU basis and to warn if the details
are different across CPUs.

While here read the L1 I-Cache type and store this for use later by pmap.

Sponsored by: Innovate UK

4 years agoIncrease number of write completion threads, matching ZoL.
mav [Tue, 3 Mar 2020 15:05:13 +0000 (15:05 +0000)]
Increase number of write completion threads, matching ZoL.

Our iSCSI benchmarks on a large 80-core system show that previous limit
of 8 threads can be a bottleneck.  At some points this change increases
write IOPS by as much as 50%.  I am still not sure that so many threads
is really required, but we tested lower amounts and got no significant
benefits, while latencies were a bit worse, so decided to not diverge.

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

4 years agotcp_hpts: make RSS kernel compile again.
bz [Tue, 3 Mar 2020 14:15:30 +0000 (14:15 +0000)]
tcp_hpts: make RSS kernel compile again.

Add proper #includes, and #ifdefs and some style fixes to make RSS
kernels compile again.  There are still possible issues with uin16_t
vs. uint_t cpuid which I am not going near.

Reviewed by: gallatin
Differential Revision: https://reviews.freebsd.org/D23726

4 years agoupic_ktrls: make RSS compile again here
bz [Tue, 3 Mar 2020 14:07:44 +0000 (14:07 +0000)]
upic_ktrls: make RSS compile again here

The results of ktls_get_cpu() are stored in u_int and NETISR_CPUID_NONE
requires u_int.  Adjust uint16_t to uint_t in order to make RSS kernels
compile some more again.

HPTS still has to be fixed, which is a bit more complicated.

Reviewed by: jhb, gallatin, rrs
Differential Revision: https://reviews.freebsd.org/D23726

4 years agoip6: retire in6_selectroute_fib() as promised 8 years ago
bz [Tue, 3 Mar 2020 13:48:12 +0000 (13:48 +0000)]
ip6: retire in6_selectroute_fib() as promised 8 years ago

In r231852 I added in6_selectroute_fib() as a compat function with the
fibnum as an extra argument compared to in6_selectroute() to keep the
KPI stable.
Way too late retire this function again and add the fib to in6_selectroute()
which also only has a single consumer now and was an orphan function before.

4 years agopowerd.8: Improve style & fix typos
0mp [Tue, 3 Mar 2020 13:25:08 +0000 (13:25 +0000)]
powerd.8: Improve style & fix typos

- Sort options.
- Do not use macros (like .Ar) to specify width for Bl (macros within that
  string are not expanded).
- Use Cm instead of Ar for mode names.
- Fix some typos reported by mandoc.
- Move the documentation of the PID file from the -P flag description to
  the FILES section.

Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D23941

4 years agoFix the spelling of the VIPT cache type field
andrew [Tue, 3 Mar 2020 12:50:45 +0000 (12:50 +0000)]
Fix the spelling of the VIPT cache type field

Sponsored by: Innovate UK

4 years agoip6_output: use new routing KPI when not passed a cached route
bz [Tue, 3 Mar 2020 11:32:47 +0000 (11:32 +0000)]
ip6_output: use new routing KPI when not passed a cached route

Implement the equivalent of r347375 (IPv4) for the IPv6 output path.
In IPv6 we get passed a cached route (and inp) by udp6_output()
depending on whether we acquired a write lock on the INP.
In case we neither bind nor connect a first UDP packet would come in
with a cached route (wlocked) and all further packets would not.
In case we bind and do not connect we never write-lock the inp.

When we do not pass in a cached route, rather than providing the
storage for a route locally and pass it over the old lookup code
and down the stack, use the new route lookup KPI and acquire all
details we need to send the packet.

Compared to the IPv4 code the IPv6 code has a couple of possible
complications: given an option with a routing hdr/caching route there,
and path mtu (ro_pmtu) case which now equally has to deal with the
possibility of having a route which is NULL passed in, and the
fwd_tag in case a firewall changes the next hop (something to
factor out in the future).

Sponsored by: Netflix
Reviewed by: glebius
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23886

4 years agothr_self.2: Fix some typos in the thread identifier range
0mp [Tue, 3 Mar 2020 09:51:53 +0000 (09:51 +0000)]
thr_self.2: Fix some typos in the thread identifier range

Reported by: kaktus
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D23936

4 years agoin6_fib: return nh_ia in the ext interface as we do for IPv4
bz [Tue, 3 Mar 2020 09:50:33 +0000 (09:50 +0000)]
in6_fib: return nh_ia in the ext interface as we do for IPv4

Like for IPv4 add nh_ia to the ext interface and return rt_ifa
in order to be used for, e.g., packet/octets accounting purposes.

Reviewed by: melifaro
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D23873

4 years agofib6_rte_to_nh_*: return a link-local gw address with scope embedded
bz [Tue, 3 Mar 2020 09:45:16 +0000 (09:45 +0000)]
fib6_rte_to_nh_*: return a link-local gw address with scope embedded

In fib6_rte_to_nh_* when returning a link-local gateway address
currently we do clear the scope. That could be recovered using
the ifp returned as well, but the code in general seems to
expect a link-local address with scope embeedded as otherwise
the "dst" (gw) passed to the output routines will not include
scope and not send the packet out (the right interface).

Do not clear the scope when returning a link-local address and
allow packets to go out (the right interface).

Remove the (now) extra scope recovery in the IPv6 fast-fwd code.

Sponsored by: Netflix
Reviewed by: melifaro, ae
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23872

4 years agoStore the boot exception level on arm64 so it can be queried later
andrew [Tue, 3 Mar 2020 08:28:16 +0000 (08:28 +0000)]
Store the boot exception level on arm64 so it can be queried later

A hypervisor, e.g. bhyve, will need to know what exception levelthe kernel
was in when it started booting. If it was EL2 we can then enable said
hypervisor.

Store the boot exception level and allow the kernel to later query it.

Obtained from: https://github.com/FreeBSD-UPB/freebsd (earlier version)
Sponsored by: Innovate UK

4 years agopowerpc/powernv: powernv_node_numa_domain() fix non-NUMA case
jhibbits [Tue, 3 Mar 2020 03:22:00 +0000 (03:22 +0000)]
powerpc/powernv: powernv_node_numa_domain() fix non-NUMA case

If NUMA is not enabled in the kernel config, or is disabled at boot, this
function should just return domain 0 regardless of what's in the device
tree.

Fixes a panic in iflib with NUMA disabled.

Reported by: luporl

4 years agoIn r358471, we interrupted the case block that would eventually lead
csjp [Tue, 3 Mar 2020 01:46:35 +0000 (01:46 +0000)]
In r358471, we interrupted the case block that would eventually lead
to the path related tokens not being processed. Restore this behavior and
and move AUE_JAIL_SET in this block, as it may conditionally contain a
path token.

Discovered by: kevans
PR: 244537
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D23929

4 years agoFix the malloc type used in sys_shm_unlink() after r354808.
markj [Tue, 3 Mar 2020 00:28:37 +0000 (00:28 +0000)]
Fix the malloc type used in sys_shm_unlink() after r354808.

PR: 244563
Reported by: swills

4 years agoAdd extremely useful calendar(1) application to FreeBSD
cem [Tue, 3 Mar 2020 00:20:08 +0000 (00:20 +0000)]
Add extremely useful calendar(1) application to FreeBSD

It does extremely useful things like execute sendmail and spew dubiously
accurate factoids.

From the feedback, it seems like it is an essential utility in a modern unix
and not at all a useless bikeshed.  How do those Linux people live without it?
Reverts r358561.

4 years agoFix typo in r278616
cem [Mon, 2 Mar 2020 23:37:47 +0000 (23:37 +0000)]
Fix typo in r278616

FreeBSD isn't an encyclopedia.

4 years agoRetire macros:
cy [Mon, 2 Mar 2020 23:25:02 +0000 (23:25 +0000)]
Retire macros:

BSD_GE_YEAR
BSD_GT_YEAR
BSD_LT_YEAR

MFC after: 3 days

4 years agoRemove the now unused FREEBSD_GE_REV, FREEBSD_GT_REV, and FREEBSD_LT_REV
cy [Mon, 2 Mar 2020 23:24:58 +0000 (23:24 +0000)]
Remove the now unused FREEBSD_GE_REV, FREEBSD_GT_REV, and FREEBSD_LT_REV
macros.

MFC after: 3 days

4 years agoContinuing the effort started in r343701, #ifdef cleanup, checking for
cy [Mon, 2 Mar 2020 23:24:53 +0000 (23:24 +0000)]
Continuing the effort started in r343701, #ifdef cleanup, checking for
__FreeBSD_version > 3.0 and 5.0 is redundant.

MFC after: 3 days

4 years agoAdd support for the TFTP windowsize option described in RFC 7440.
jhb [Mon, 2 Mar 2020 22:19:30 +0000 (22:19 +0000)]
Add support for the TFTP windowsize option described in RFC 7440.

The windowsize option permits multiple blocks to be transmitted
before the receiver sends an ACK improving throughput for larger
files.

Reviewed by: asomers
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23836

4 years agocpufreq_dt: Improve multiple opp support
manu [Mon, 2 Mar 2020 21:19:51 +0000 (21:19 +0000)]
cpufreq_dt: Improve multiple opp support

When looking for cpu with the same OPP starts from the root /cpus node
so each instance of cpufreq_dt will now each cpu with the same operating
point.
Also test that the node we are testing have the property "device_type" set
to be equal to "cpu".
While here add more debug printfs (off by defaults).

MFC after: 2 weeks

4 years agoAdd deprecation notices to ctau and cx drivers
emaste [Mon, 2 Mar 2020 20:14:27 +0000 (20:14 +0000)]
Add deprecation notices to ctau and cx drivers

These support outdated or obsolete ISA WAN (T1/E1) sync serial cards,
and these drivers haven't really been touched (other than in tree-wide
sweeps to keep them building) for 15+ years.

Related PCI devices ce and cp are still in the tree, with deprecation
proposed in D23928.

MFC after: 1 week
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

4 years agohexdump: tests: take into account byte order
kevans [Mon, 2 Mar 2020 18:40:34 +0000 (18:40 +0000)]
hexdump: tests: take into account byte order

Hexdump test was failling on big endian systems when testing decimal, octal
and hexa outputs as the tests were designed on a little endian system. This
revision adds the two distinct flavors of output expected and determines at
runtime which to compare against.

Submitted by: Renato Riolino <renato.riolino_eldorado.org.br>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23191

4 years ago[aacraid] Prevent sense data from causing a buffer overflow
luporl [Mon, 2 Mar 2020 16:11:25 +0000 (16:11 +0000)]
[aacraid] Prevent sense data from causing a buffer overflow

This issue was observed on a PowerPC64 machine with an Adaptec RAID
Controller with PCI device ID 0x028d, where sense data was causing a
buffer overflow because of wrong max sense length logic.

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

4 years agopkgbase: remove logic for _profile packages
kevans [Mon, 2 Mar 2020 15:58:50 +0000 (15:58 +0000)]
pkgbase: remove logic for _profile packages

We don't produce these anymore as of r356797, remove the remnant in
generate-ucl.sh that accounted for them. This isn't strictly necessary, but
future work is needed for the various packages that can be generated on a
lib build.

Namely, we may produce -development packages for private/internal libs that
should be installed but won't have the base FreeBSD-libfoo pkg to depend on
because it's internal (e.g. liby, libpmcstat, libifconfig) but we want the
headers installed. It may be a better move to just shove these into
-runtime-development instead, but if not then we've just simplified the
cases that need to take private/internal libs into account.

4 years agosys/: Document few more sysctls.
kaktus [Mon, 2 Mar 2020 15:30:52 +0000 (15:30 +0000)]
sys/: Document few more sysctls.

Submitted by: Antranig Vartanian <antranigv@freebsd.am>
Reviewed by: kaktus
Commented by: jhb
Approved by: kib (mentor)
Sponsored by: illuria security
Differential Revision: https://reviews.freebsd.org/D23759

4 years agoAdd a space missed in r358545
andrew [Mon, 2 Mar 2020 14:36:15 +0000 (14:36 +0000)]
Add a space missed in r358545

Sponsored by: Innovate UK

4 years agoelfctl: tiny style(9) cleanup, use bool where appropriate
emaste [Mon, 2 Mar 2020 14:34:26 +0000 (14:34 +0000)]
elfctl: tiny style(9) cleanup, use bool where appropriate

4 years agoGenerate the offsets for struct arm64_bootparams and use it in locore.S
andrew [Mon, 2 Mar 2020 14:06:50 +0000 (14:06 +0000)]
Generate the offsets for struct arm64_bootparams and use it in locore.S

This removes one place with hard coded offsets in locore.S

Sponsored by: Innovate UK

4 years agoRemove old contrib/libstdc++, unused since r358454
emaste [Mon, 2 Mar 2020 14:04:09 +0000 (14:04 +0000)]
Remove old contrib/libstdc++, unused since r358454

Sponsored by: The FreeBSD Foundation

4 years agoExpose the ACPI power button, sleep button and LID state as evdev's.
hselasky [Mon, 2 Mar 2020 09:45:06 +0000 (09:45 +0000)]
Expose the ACPI power button, sleep button and LID state as evdev's.

This allows libinput to disable touchpads when the lid is closed and
various desktop environments can show power-off dialogs when the power
button is pressed. While the latter is doable with devd a
cross-platform solution is nicer.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D23863
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoMFV r358511,r358532:
mm [Mon, 2 Mar 2020 08:44:58 +0000 (08:44 +0000)]
MFV r358511,r358532:

Sync libarchive with vendor.

Relevant vendor changes:
  Issue #1257: Add testcase for ZIPX files with LZMA_STREAM_END marker
  PR #1331: cpio.5: fix hard link description
  Issue #1335: archive_read.c: fix UBSan warning about undefined behavior
  Issue #1338: XAR reader: fix UBSan warning about undefined behavior
  Issue #1339: bsdcpio_test: fix datatype in from_hex()
  Issue #1341: Safe writes: delete temporary file if rename fails.
  Issue #1341: Safe writes: improve error handling

MFC after: 1 week

4 years agoelfctl: initialize features
kevans [Mon, 2 Mar 2020 04:22:38 +0000 (04:22 +0000)]
elfctl: initialize features

GCC points out a couple levels down in convert_to_features that this may be
used uninitialized. Indeed, this is true- initialize it to NULL so that we
at least deref a null pointer.

4 years agoif_edsc: generate an arbitrary MAC address
kevans [Mon, 2 Mar 2020 02:45:57 +0000 (02:45 +0000)]
if_edsc: generate an arbitrary MAC address

When generating an cloned interface instance in edsc_clone_create(),
generate a MAC address from the FF OUI with ether_gen_addr(). This allows us
to have unique local-link addresses. Previously, the MAC address was zero.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D23842

4 years agoMove ELF feature note tool to usr.bin/elfctl
emaste [Mon, 2 Mar 2020 02:36:41 +0000 (02:36 +0000)]
Move ELF feature note tool to usr.bin/elfctl

elfctl is a tool for modifying the NT_FREEBSD_FEATURE_CTL ELF note,
which contains a set of flags for enabling or disabling vulnerability
mitigations and other features.

Reviewed by: csjp, kib
MFC after: 2 weeks
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23910

4 years agoUpdate vendor/libarchive/dist to git 85b9f665b6a2d4397fdd38992152d011265e374b
mm [Mon, 2 Mar 2020 02:12:53 +0000 (02:12 +0000)]
Update vendor/libarchive/dist to git 85b9f665b6a2d4397fdd38992152d011265e374b

Relevant vendor changes:
  Issue #1257: Add testcase for ZIPX files with LZMA_STREAM_END marker
  PR #1331: cpio.5: fix hard link description
  Issue #1335: archive_read.c: fix UBSan warning about undefined behavior
  Issue #1338: XAR reader: fix UBSan warning about undefined behavior
  Issue #1339: bsdcpio_test: fix datatype in from_hex()
  Issue #1341: Safe writes: delete temporary file if rename fails

4 years agoRemove BROOKTREE_ALLOC_PAGES now that bktr is now gone.
imp [Mon, 2 Mar 2020 00:23:31 +0000 (00:23 +0000)]
Remove BROOKTREE_ALLOC_PAGES now that bktr is now gone.

4 years agoRemove obsolete old-freebsd version compat shim.
imp [Sun, 1 Mar 2020 23:01:51 +0000 (23:01 +0000)]
Remove obsolete old-freebsd version compat shim.

4 years agoRemove pre-FreeBSD 11 compat code.
imp [Sun, 1 Mar 2020 23:01:47 +0000 (23:01 +0000)]
Remove pre-FreeBSD 11 compat code.

4 years agoRemove stale FreeBSD_version checks.
imp [Sun, 1 Mar 2020 23:01:37 +0000 (23:01 +0000)]
Remove stale FreeBSD_version checks.

4 years agoRemove comment about Blackthorn winds, apparently imported from 4.4BSD
grog [Sun, 1 Mar 2020 22:10:37 +0000 (22:10 +0000)]
Remove comment about Blackthorn winds, apparently imported from 4.4BSD
Lite.  Nowadays it's trivial to find the explanation, such as at
https://www.deseret.com/2000/2/27/19493013/blackthorn-winds-make-bushes-bud.
It doesn't seem appropriate to replace it with an explanation.

4 years agoAvoid doubly wiring a newly allocated page in vm_page_grab_valid().
markj [Sun, 1 Mar 2020 22:09:11 +0000 (22:09 +0000)]
Avoid doubly wiring a newly allocated page in vm_page_grab_valid().

This fixes a regression from r358363.

Reported by: manu, jbeich
Tested by: jbeich

4 years agovfs: stop taking additional refs on root vnode during lookup
mjg [Sun, 1 Mar 2020 21:54:28 +0000 (21:54 +0000)]
vfs: stop taking additional refs on root vnode during lookup

They are spurious since introduction of struct pwd, which provides them
implicitly.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23885

4 years agofd: move vnodes out of filedesc into a dedicated structure
mjg [Sun, 1 Mar 2020 21:53:46 +0000 (21:53 +0000)]
fd: move vnodes out of filedesc into a dedicated structure

The new structure is copy-on-write. With the assumption that path lookups are
significantly more frequent than chdirs and chrooting this is a win.

This provides stable root and jail root vnodes without the need to reference
them on lookup, which in turn means less work on globally shared structures.
Note this also happens to fix a bug where jail vnode was never referenced,
meaning subsequent access on lookup could run into use-after-free.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23884

4 years agofd: make fgetvp_rights work without the filedesc lock
mjg [Sun, 1 Mar 2020 21:50:13 +0000 (21:50 +0000)]
fd: make fgetvp_rights work without the filedesc lock

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D23883

4 years agovm: add debug to uma_zone_set_smr
mjg [Sun, 1 Mar 2020 21:49:16 +0000 (21:49 +0000)]
vm: add debug to uma_zone_set_smr

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D23902

4 years agoFinish removal of bktr
imp [Sun, 1 Mar 2020 20:37:42 +0000 (20:37 +0000)]
Finish removal of bktr

Remove the old ioctl .h files
Remove copying/linking ioctl .h files in instasllworld
Remove bktr from lint
Add now-removed files with ObsoleteFiles