]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agovm_fault: Shoot down multiply mapped COW source page mappings
Mark Johnston [Tue, 6 Apr 2021 18:56:37 +0000 (14:56 -0400)]
vm_fault: Shoot down multiply mapped COW source page mappings

Reviewed by: kib, rlibby
Discussed with: alc
Approved by: so
Security: CVE-2021-29626
Security: FreeBSD-SA-21:08.vm

(cherry picked from commit 304a533fd2ec6d61805eb7c991b3e9ce502fc730)

3 years agoMFC r364480:
Dimitry Andric [Sat, 31 Oct 2020 18:42:03 +0000 (18:42 +0000)]
MFC r364480:

Merge commit 1ce07cd614be from llvm git (by me):

  Instantiate Error in Target::GetEntryPointAddress() only when
  necessary

  When Target::GetEntryPointAddress() calls
  exe_module->GetObjectFile()->GetEntryPointAddress(), and the returned
  entry_addr is valid, it can immediately be returned.

  However, just before that, an llvm::Error value has been setup, but
  in this case it is not consumed before returning, like is done
  further below in the function.

  In https://bugs.freebsd.org/248745 we got a bug report for this,
  where a very simple test case aborts and dumps core:

  * thread #1, name = 'testcase', stop reason = breakpoint 1.1
      frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5
     1    int main(int argc, char *argv[])
     2    {
  -> 3        return 0;
     4    }
  (lldb) p argc
  Program aborted due to an unhandled Error:
  Error value was Success. (Note: Success values must still be checked prior to being destroyed).

  Thread 1 received signal SIGABRT, Aborted.
  thr_kill () at thr_kill.S:3
  3       thr_kill.S: No such file or directory.
  (gdb) bt
  #0  thr_kill () at thr_kill.S:3
  #1  0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52
  #2  0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67
  #3  0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112
  #4  0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267
  #5  0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67
  #6  0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114
  #7  0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97
  #8  0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604
  #9  0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347
  #10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383
  #11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301
  #12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331
  #13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190
  #14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372
  #15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414
  #16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646
  #17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003
  #18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762
  #19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760
  #20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548
  #21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903
  #22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946
  #23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169
  #24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675
  #25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890

  Fix the incorrect error catch by only instantiating an Error object
  if it is necessary.

  Reviewed By: JDevlieghere

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

This should fix lldb aborting as described in the scenario above.

Reported by: dmgk
PR: 248745
Approved by: so
Security: FreeBSD-EN-21:07.lldb

(cherry picked from commit eb41eed03c084bd6eefe91992b0f704caa0fb58b)

3 years agoMFC r368588:
Kristof Provost [Tue, 15 Dec 2020 08:29:45 +0000 (08:29 +0000)]
MFC r368588:

pf: Allow net.pf.request_maxcount to be set from loader.conf

Mark request_maxcount as RWTUN so we can set it both at runtime and from
loader.conf. This avoids users getting caught out by the change from tunable to
run time configuration.

Suggested by: Franco Fichtner
Approved by: so
Security: FreeBSD-EN-21:06.pf

(cherry picked from commit 08d13750ebdae45bcdb73d52665b823e9ba93db1)

3 years agoaccept_filter: Fix filter parameter handling
Mark Johnston [Thu, 25 Mar 2021 21:55:20 +0000 (17:55 -0400)]
accept_filter: Fix filter parameter handling

For filters which implement accf_create, the setsockopt(2) handler
caches the filter name in the socket, but it also incorrectly frees the
buffer containing the copy, leaving a dangling pointer.  Note that no
accept filters provided in the base system are susceptible to this, as
they don't implement accf_create.

Reported by: Alexey Kulaev <alex.qart@gmail.com>
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Approved by: so
Security: CVE-2021-29627
Security: FreeBSD-SA-21:09.accept_filter

(cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee)
(cherry picked from commit 6008a5fad3c110c4ec03cc3fe60ce41c4e548b98)

3 years agoFix multiple OpenSSL vulnerabilities. Add UPDATING and bump version.
Gordon Tetlow [Thu, 25 Mar 2021 23:42:19 +0000 (23:42 +0000)]
Fix multiple OpenSSL vulnerabilities. Add UPDATING and bump version.

Approved by: so
Security: FreeBSD-SA-21:07.openssl
Security: CVE-2021-3449
Security: CVE-2021-3450

3 years agoAdd UPDATING entry and bump version
Mark Johnston [Tue, 23 Feb 2021 23:00:02 +0000 (18:00 -0500)]
Add UPDATING entry and bump version

Approved by: so

3 years agopam_login_access: Fix negative entry matching logic
Mark Johnston [Tue, 23 Feb 2021 22:01:29 +0000 (17:01 -0500)]
pam_login_access: Fix negative entry matching logic

PR: 252194
Approved by: so
Security: CVE-2020-25580
Security: FreeBSD-SA-21:03.pam_login_access

(cherry picked from commit 6ab923cbca8759503a08683a5978b9ebf5efd607)
(cherry picked from commit c99e3e2d96935ae4d61948bf7660e9b9c2afb4d9)

3 years agoxen-blkback: fix leak of grant maps on ring setup failure
Roger Pau Monné [Wed, 20 Jan 2021 18:40:51 +0000 (19:40 +0100)]
xen-blkback: fix leak of grant maps on ring setup failure

Multi page rings are mapped using a single hypercall that gets passed
an array of grants to map. One of the grants in the array failing to
map would lead to the failure of the whole ring setup operation, but
there was no cleanup of the rest of the grant maps in the array that
could have likely been created as a result of the hypercall.

Add proper cleanup on the failure path during ring setup to unmap any
grants that could have been created.

This is part of XSA-361.

Approved by: so
Security: CVE-2021-26932
Security: FreeBSD-SA-21:06.xen
Security: XSA-361
Sponsored by: Citrix Systems R&D

(cherry picked from commit 808d4aad1022a2a33d222663b0c9badde30b9d45)
(cherry picked from commit dfb372f5d38c302953a6a4e2838179cd0a1a6438)

3 years agoMFC r368555: caroot: update bundle
Kyle Evans [Tue, 15 Dec 2020 21:50:05 +0000 (21:50 +0000)]
MFC r368555: caroot: update bundle

Summary:
- One (1) added
- Ten (10) removed

Approved by: so
Security: FreeBSD-EN-21:07.caroot

(cherry picked from commit e4e8ecaf63ba6f2767680a7b4666461243d88749)

3 years agoMFC freebsd-update: unconditionally regenerate passwd/login.conf files
Kyle Evans [Thu, 17 Dec 2020 03:42:54 +0000 (03:42 +0000)]
MFC freebsd-update: unconditionally regenerate passwd/login.conf files

The existing logic is nice in theory, but in practice freebsd-update will
not preserve the timestamps on these files. When doing a major upgrade, e.g.
from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and
we clobber the timestamp several times in the process of packaging up the
existing system into /var/db/freebsd-update/files and extracting for
comparisons. This leads to these files not getting regenerated when they're
most likely to be needed.

Measures could be taken to preserve timestamps, but it's unclear whether
the complexity and overhead of doing so is really outweighed by the marginal
benefit.

I observed this issue when pkg subsequently failed to install a package that
wanted to add a user, claiming that the user was removed in the process.
bapt@ pointed to this pre-existing bug with freebsd-update as the cause.

PR: 234014, 232921
Approved by: so
Security: FreeBSD-EN-21:08.freebsd-update

(cherry picked from commit ebebc41e4cfe44b8e8fd881badf2fa2c4be65aa4)
(cherry picked from commit 5cf1ba21eebaf89cf4d8639a18345dc49116d1d5)

3 years agoFree microcode memory later.
Konstantin Belousov [Fri, 17 May 2019 17:11:01 +0000 (17:11 +0000)]
Free microcode memory later.

Approved by: so
Security: FreeBSD-EN-21:06.microcode

(cherry picked from commit 8f7f38457f940798c149ae40b73e0d20672812de)
(cherry picked from commit 79bee465de342b82fa300293d04f155f2d6a6183)

3 years agoMFC jail: Change both root and working directories in jail_attach(2)
Jamie Gritton [Fri, 19 Feb 2021 22:13:35 +0000 (14:13 -0800)]
MFC jail: Change both root and working directories in jail_attach(2)

jail_attach(2) performs an internal chroot operation, leaving it up to
the calling process to assure the working directory is inside the jail.

Add a matching internal chdir operation to the jail's root.  Also
ignore kern.chroot_allow_open_directories, and always disallow the
operation if there are any directory descriptors open.

Approved by: so
Security: CVE-2020-25582
Security: FreeBSD-SA-21:05.jail_chdir
Reported by:    mjg
Approved by:    markj, kib

(cherry picked from commit d4380c0cdd0517dc038403dd5c99242ce78bdeb5)
(cherry picked from commit ca9ab8ea17748a1758701fde262cb272fb757989)

3 years agoMFC jail: Handle a possible race between jail_remove(2) and fork(2)
Jamie Gritton [Tue, 16 Feb 2021 19:19:13 +0000 (11:19 -0800)]
MFC jail: Handle a possible race between jail_remove(2) and fork(2)

jail_remove(2) includes a loop that sends SIGKILL to all processes
in a jail, but skips processes in PRS_NEW state.  Thus it is possible
the a process in mid-fork(2) during jail removal can survive the jail
being removed.

Add a prison flag PR_REMOVE, which is checked before the new process
returns.  If the jail is being removed, the process will then exit.
Also check this flag in jail_attach(2) which has a similar issue.

Approved by: so
Security: CVE-2020-25581
Security: FreeBSD-SA-21:04.jail_remove
Reported by: mjg
Approved by: kib

(cherry picked from commit cc7b73065302005ebc4a19503188c8d6d5eb923d)
(cherry picked from commit f7007a7d05255a6859dea0982b1f0a6d695e8881)

3 years agoAdd UPDATING entry and bump version
Ed Maste [Fri, 29 Jan 2021 01:09:12 +0000 (20:09 -0500)]
Add UPDATING entry and bump version

Approved by: so

3 years agoxen: allow limiting the amount of duplicated pending xenstore watches
Roger Pau Monné [Wed, 25 Nov 2020 11:34:38 +0000 (12:34 +0100)]
xen: allow limiting the amount of duplicated pending xenstore watches

Xenstore watches received are queued in a list and processed in a
deferred thread. Such queuing was done without any checking, so a
guest could potentially trigger a resource starvation against the
FreeBSD kernel if such kernel is watching any user-controlled xenstore
path.

Allowing limiting the amount of pending events a watch can accumulate
to prevent a remote guest from triggering this resource starvation
issue.

For the PV device backends and frontends this limitation is only
applied to the other end /state node, which is limited to 1 pending
event, the rest of the watched paths can still have unlimited pending
watches because they are either local or controlled by a privileged
domain.

The xenstore user-space device gets special treatment as it's not
possible for the kernel to know whether the paths being watched by
user-space processes are controlled by a guest domain. For this reason
watches set by the xenstore user-space device are limited to 1000
pending events. Note this can be modified using the
max_pending_watch_events sysctl of the device.

This is XSA-349.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

(cherry picked from commit 4e4e43dc9e1afc863670a031cc5cc75eb5e668d6)
(cherry picked from commit 2d194dc219892049dd03564c4083080cac1aa688)

Approved by: so
Security: XSA-349, CVE-2020-29568

3 years agoxen/xenstore: remove unused functions
Roger Pau Monné [Thu, 26 Nov 2020 08:57:47 +0000 (09:57 +0100)]
xen/xenstore: remove unused functions

Those helpers are not used, so remove them. No functional change.

Sponsored by: Citrix Systems R&D
MFC after: 3 days

(cherry picked from commit 2ae75536d370c238f77ad09e5e994d2b8bdf010c)
(cherry picked from commit af4ed05c3dd25c957b657f92f953bd9f00f818a8)

Approved by: so

3 years agomsdosfs: Fix a leak of dirent padding bytes
Mark Johnston [Sun, 27 Dec 2020 21:52:30 +0000 (16:52 -0500)]
msdosfs: Fix a leak of dirent padding bytes

This was missed in r340856 / commit
6d2e2df764199f0a15fd743e79599391959cc17d.  Three bytes from the kernel
stack may be leaked when reading directory entries.

Reported by: Syed Faraz Abrar <faraz@elttam.com>

(cherry picked from commit 599f90446376370eb365a0fde857ea2b5766873a)
(cherry picked from commit 5ece34669c27a61f78cd0f6e0759c17f7787aebb)

Approved by: so
Security: CVE-2020-25579

3 years agoEnsure that dirent's d_off field is initialized
Mark Johnston [Sun, 3 Jan 2021 16:32:30 +0000 (11:32 -0500)]
Ensure that dirent's d_off field is initialized

We have the d_off field in struct dirent for providing the seek offset
of the next directory entry.  Several filesystems were not initializing
the field, which ends up being copied out to userland.

Reported by: Syed Faraz Abrar <faraz@elttam.com>
Reviewed by: kib

(cherry picked from commit 90f580b954090e669da234f6c8e8d0379ff9d8bc)
(cherry picked from commit acaac0eefa1f2675dfc49faa077e3fb10949d540)

Approved by: so
Security: CVE-2020-25578

3 years agoFix error merging r354116 from OpenZFS
Alan Somers [Tue, 1 Dec 2020 15:15:18 +0000 (15:15 +0000)]
Fix error merging r354116 from OpenZFS

When we merged 4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 from OpenZFS (svn
r354116), there were some merge conflicts.  One of those was resolved
incorrectly, causing "zfs receive" to fail to delete snapshots that a "zfs
send -R" stream has deleted.

This change corrects that merge conflict, and also reduces some harmless
diffs vis-a-vis OpenZFS that were also introduced by the same revision.
Direct commit to stable/12 because head has moved on to OpenZFS.

PR: 249438
Reported by: Dmitry Wagin <dmitry.wagin@ya.ru>
Reviewed by: mmacy
Sponsored by: Axcient
(cherry picked from commit 861515418ac385f4198c38c28f6203135d72e651)

Approved by: so

3 years agoMFC r368237: if: Fix panic when destroying vnet and epair simultaneously
Kristof Provost [Sat, 12 Sep 2020 16:33:05 +0000 (16:33 +0000)]
MFC r368237: if: Fix panic when destroying vnet and epair simultaneously

When destroying a vnet and an epair (with one end in the vnet) we often
panicked. This was the result of the destruction of the epair, which destroys
both ends simultaneously, happening while vnet_if_return() was moving the
struct ifnet to its home vnet. This can result in a freed ifnet being re-added
to the home vnet V_ifnet list. That in turn panics the next time the ifnet is
used.

Prevent this race by ensuring that vnet_if_return() cannot run at the same time
as if_detach() or epair_clone_destroy().

PR: 238870, 234985, 244703, 250870
Sponsored by: Modirum MDPay
Approved by: so

3 years agocontrib/tzdata: import tzdata 2021a
Philip Paeps [Mon, 25 Jan 2021 00:18:14 +0000 (08:18 +0800)]
contrib/tzdata: import tzdata 2021a

Merge commit '4cd7e1071de16a7392b0e466287f13e9e6f2081a'

Changes: https://github.com/eggert/tz/blob/2021a/NEWS

(cherry picked from commit 8c5bef2eb24cb191c87712a56a9860d8c29415a0)
(cherry picked from commit 085997e8f05e69c66a8ffc0804b275a386ba1ca8)

Approved by: so

3 years agoMFC: contrib/tzdata: import tzdata 2020f
Philip Paeps [Wed, 30 Dec 2020 04:50:26 +0000 (12:50 +0800)]
MFC: contrib/tzdata: import tzdata 2020f

Merge commit '96b88ac701b35ce68425046d4be8f51cb75b5d5b' into main

Changes: https://github.com/eggert/tz/blob/2020f/NEWS

(cherry picked from commit e35a01eec6926bfb5c088ca8961079b51a067bf3)
(cherry picked from commit ce87312019a18e6bd0c97c50e5762b38ffc21e76)

Approved by: so

3 years agoMFC: contrib/tzdata: import tzdata 2020e
Philip Paeps [Fri, 25 Dec 2020 15:16:38 +0000 (23:16 +0800)]
MFC: contrib/tzdata: import tzdata 2020e

Changes: https://github.com/eggert/tz/blob/2020e/NEWS

(cherry picked from commit dc505d53dcc15636aea9df8c03298f8c32147fa9)
(cherry picked from commit 1a8f8af03320165b33526d44de4f12360aa5440a)

Approved by: so

3 years agoFix OpenSSL NULL pointer de-reference.
Gordon Tetlow [Tue, 8 Dec 2020 19:10:40 +0000 (19:10 +0000)]
Fix OpenSSL NULL pointer de-reference.

Approved by: so
Security: FreeBSD-SA-20:33.openssl
Security: CVE-2020-1971

3 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 1 Dec 2020 19:40:58 +0000 (19:40 +0000)]
Add UPDATING entries and bump version.

Approved by: so

3 years agoFix multiple vulnerabilities in rtsold.
Gordon Tetlow [Tue, 1 Dec 2020 19:39:44 +0000 (19:39 +0000)]
Fix multiple vulnerabilities in rtsold.

Approved by: so
Security: FreeBSD-SA-20:32.rtsold
Security: CVE-2020-25577

3 years agoFix ICMPv6 use-after-free in error message handling.
Gordon Tetlow [Tue, 1 Dec 2020 19:38:52 +0000 (19:38 +0000)]
Fix ICMPv6 use-after-free in error message handling.

Approved by: so
Security: FreeBSD-SA-20:31.icmp6
Security: CVE-2020-7469

3 years agoFix race condition in callout CPU migration.
Gordon Tetlow [Tue, 1 Dec 2020 19:37:33 +0000 (19:37 +0000)]
Fix race condition in callout CPU migration.

Approved by: so
Security: FreeBSD-EN-20:22.callout

3 years agoFix uninitialized variable in ipfw.
Gordon Tetlow [Tue, 1 Dec 2020 19:36:36 +0000 (19:36 +0000)]
Fix uninitialized variable in ipfw.

Approved by: so
Security: FreeBSD-EN-20:21.ipfw

3 years agoUpdate timezone database information.
Gordon Tetlow [Tue, 1 Dec 2020 19:35:48 +0000 (19:35 +0000)]
Update timezone database information.

Approved by: so
Security: FreeBSD-EN-20:20.tzdata

3 years agoFix execve/fexecve system call auditing.
Gordon Tetlow [Tue, 1 Dec 2020 19:34:45 +0000 (19:34 +0000)]
Fix execve/fexecve system call auditing.

Approved by: so
Security: FreeBSD-EN-20:19.audit

3 years ago- Switch releng/12.2 from RC3 to RELEASE.
Glen Barber [Fri, 23 Oct 2020 00:00:52 +0000 (00:00 +0000)]
- Switch releng/12.2 from RC3 to RELEASE.
- Add the anticipated 12.2-RELEASE date to UPDATING.  Fix
  a missing colon in the previous UPDATING entry while here.
- Set a static __FreeBSD_version.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoUpdate releng/12.2 to RC3 as part of the 12.2-RELEASE cycle.
Glen Barber [Fri, 16 Oct 2020 00:01:01 +0000 (00:01 +0000)]
Update releng/12.2 to RC3 as part of the 12.2-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoZFS: whitelist zstd and encryption in the loader
Allan Jude [Thu, 15 Oct 2020 15:07:25 +0000 (15:07 +0000)]
ZFS: whitelist zstd and encryption in the loader

MFC r364787:
MFS r366593:

Please note that neither zstd nor encryption is
supported by the loader at this instant. This
change makes it safe to use those features in
one's root pool, but not in one's root dataset.

Approved by: re (gjb)

3 years agoMFS r365964:
Ganael LAPLANCHE [Wed, 14 Oct 2020 06:25:55 +0000 (06:25 +0000)]
MFS r365964:
Allow slow USB devices to be given more time to return their USB descriptors,
like Logitech HD Pro Webcam C920.

PR: 248926
Approved by: re (gjb), hselasky

3 years agoMFS12: r366422 r366588
Warner Losh [Wed, 14 Oct 2020 01:47:00 +0000 (01:47 +0000)]
MFS12: r366422 r366588

r366588: fixes video display heuristic that prevented byhve and vmware
from detecting dual consoles.

r366422: Report the kernel console on the boot screen
Report what console the boot loader is telling the kernel to use and allow
toggling between them.

Approved by: re@ (gjb)

3 years agoUpdate releng/12.2 to RC2 as part of the 12.2-RELEASE cycle.
Glen Barber [Thu, 8 Oct 2020 23:59:58 +0000 (23:59 +0000)]
Update releng/12.2 to RC2 as part of the 12.2-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoUpdate the 12.2 pkg_repos/release-dvd.conf file to use the
Glen Barber [Thu, 8 Oct 2020 02:56:11 +0000 (02:56 +0000)]
Update the 12.2 pkg_repos/release-dvd.conf file to use the
release_2 set for dvd1.iso builds for reproducibility.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFS r366360,r366361:
Mitchell Horne [Wed, 7 Oct 2020 20:09:26 +0000 (20:09 +0000)]
MFS r366360,r366361:
MFC r366271:
arm64: set the correct HWCAP

Approved by: re (gjb)

3 years agoMFS12 r366180, r366341:
Glen Barber [Tue, 6 Oct 2020 15:17:41 +0000 (15:17 +0000)]
MFS12 r366180, r366341:
 r366180 (asomers):
  Fix resuming receive stream to dataset with mounted clone

 r366341 (asomers):
  Fix "zfs receive" of interrupted stream without "-F"

Approved by: re (kib)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFS r366438:
Navdeep Parhar [Mon, 5 Oct 2020 16:39:38 +0000 (16:39 +0000)]
MFS r366438:
cxgbe(4): set up the firmware flowc for the tid before send_abort_rpl.

Approved by: re@ (gjb@)
Sponsored by: Chelsio Communications

3 years agoMFS r366395: Fix Typo in ng_hci_le_connection_complete_ep struct.
Kyle Evans [Sun, 4 Oct 2020 01:39:29 +0000 (01:39 +0000)]
MFS r366395: Fix Typo in ng_hci_le_connection_complete_ep struct.

Approved by: re (gjb)

3 years agoRename releng/12.2 to RC1 as part of the 12.2-RELEASE cycle.
Glen Barber [Fri, 2 Oct 2020 01:08:11 +0000 (01:08 +0000)]
Rename releng/12.2 to RC1 as part of the 12.2-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFS r366305: MFC r366064, r366065, r366215
Xin LI [Thu, 1 Oct 2020 18:58:06 +0000 (18:58 +0000)]
MFS r366305: MFC r366064, r366065, r366215

sbin/fsck_msdosfs: Fix an integer overflow on 32-bit platforms

Approved by: re (gjb)

3 years agoMFS r366324:
Michael Tuexen [Thu, 1 Oct 2020 18:17:56 +0000 (18:17 +0000)]
MFS r366324:
Improve the handling of receiving unordered and unreliable user
messages using DATA chunks. Don't use fsn_included when not being
sure that it is set to an appropriate value. If the default is
used, which is -1, this can result in SCTP associaitons not
making any user visible progress.

Thanks to Yutaka Takeda for reporting this issue for the the
userland stack in https://github.com/pion/sctp/issues/138.

MFS r366329:
Improve the input validation and processing of cookies.
This avoids setting the association in an inconsistent
state, which could result in a use-after-free situation.
This can be triggered by a malicious peer, if the peer
can modify the cookie without the local endpoint recognizing
it.
Thanks to Ned Williamson for reporting the issue.

Approved by: re (gjb)

3 years agoMFS 366297: Revert most of r360179.
John Baldwin [Thu, 1 Oct 2020 17:30:38 +0000 (17:30 +0000)]
MFS 366297: Revert most of r360179.

I had failed to notice that sgsendccb() was using cam_periph_mapmem()
and thus was not passing down user pointers directly to drivers.  In
practice this broke requests submitted from userland.

PR: 249395
Approved by: re (gjb)

3 years agoMFS r365996:
Mitchell Horne [Wed, 30 Sep 2020 22:41:24 +0000 (22:41 +0000)]
MFS r365996:
MFC r365304:
arm64: update the set of HWCAP definitions

MFC r365459:
arm64: fix incorrect HWCAP definitions

Approved by: re (gjb)

3 years agoMFC r357530/MFS r357530:
Konstantin Belousov [Wed, 30 Sep 2020 16:11:37 +0000 (16:11 +0000)]
MFC r357530/MFS r357530:
Remove unneeded assert for curproc.  Simplify.

Approved by: re (gjb)

3 years agoMF stable/12 r366258:
Niclas Zeising [Tue, 29 Sep 2020 17:22:14 +0000 (17:22 +0000)]
MF stable/12 r366258:

bsdconfig, bsdinstall: Prune dead mirrors

Prune dead mirrors from the list of mirrors in bsdconfig and bsdinstall.
All these return NXDOMAIN when trying to resolve them.

Approved by: re (gjb), emaste

3 years agoMFS: r366238
Rick Macklem [Tue, 29 Sep 2020 15:09:38 +0000 (15:09 +0000)]
MFS: r366238
Bjorn reported a problem where the Linux NFSv4.1 client is
using an open_to_lock_owner4 when that lock_owner4 has already
been created by a previous open_to_lock_owner4. This caused the NFS server
to reply NFSERR_INVAL.

For NFSv4.0, this is an error, although the updated NFSv4.0 RFC7530 notes
that the correct error reply is NFSERR_BADSEQID (RFC3530 did not specify
what error to return).

For NFSv4.1, it is not obvious whether or not this is allowed by RFC5661,
but the NFSv4.1 server can handle this case without error.
This patch changes the NFSv4.1 (and NFSv4.2) server to handle multiple
uses of the same lock_owner in open_to_lock_owner so that it now correctly
interoperates with the Linux NFS client.
It also changes the error returned for NFSv4.0 to be NFSERR_BADSEQID.

Thanks go to Bjorn for diagnosing this and testing the patch.
He also provided a program that I could use to reproduce the problem.

PR: 249567
Approved by: re (gjb)

3 years agoMFS r366028: Spawn the DHCPv6 client in EC2 instances via rtsold.
Colin Percival [Mon, 28 Sep 2020 17:32:18 +0000 (17:32 +0000)]
MFS r366028: Spawn the DHCPv6 client in EC2 instances via rtsold.

Approved by: re (gjb)
Sponsored by: https://www.patreon.com/cperciva

3 years agoMF12 r366218:
Stefan Eßer [Mon, 28 Sep 2020 14:47:36 +0000 (14:47 +0000)]
MF12 r366218:

Add documentation of the build options WITH_GH_BC and WITHOUT_GH_BC to
optionally replace the traditional implementation of bc(1) and dc(1) with
the new implementation that has become the default version in -CURRENT.

The man-page differs from the one in -CURRENT due to different default
values of that build option.

Approved by:  re (gjb)

3 years agoMFS r366220:
Mark Johnston [Mon, 28 Sep 2020 12:14:38 +0000 (12:14 +0000)]
MFS r366220:
MFC r366167:
ng_l2tp: Fix callout synchronization in the rexmit timeout handler

PR: 241133
Approved by: re (gjb)

3 years agoMFS r366178: Move finalize_components_config from get_params to cmd_*.
Colin Percival [Mon, 28 Sep 2020 00:54:50 +0000 (00:54 +0000)]
MFS r366178: Move finalize_components_config from get_params to cmd_*.

This eliminates spurious emails from `freebsd-update cron` when the src
component is listed in freebsd-update.conf but is not present.

Approved by: re (delphij)
Sponsored by: https://www.patreon.com/cperciva

3 years agoMFS r366179: Make nvmecontrol work with nda like it does with nvd, and
Colin Percival [Mon, 28 Sep 2020 00:53:45 +0000 (00:53 +0000)]
MFS r366179: Make nvmecontrol work with nda like it does with nvd, and
associated bits.

Approved by: re (delphij)
Sponsored by: https://www.patreon.com/cperciva

3 years agoMFS r366009: Include ebsnvme-id in arm64 AMIs.
Colin Percival [Mon, 28 Sep 2020 00:52:16 +0000 (00:52 +0000)]
MFS r366009: Include ebsnvme-id in arm64 AMIs.

Approved by: re (delphij)
Sponsored by: https://www.patreon.com/cperciva

3 years agoMF stable/12 r366190:
Alan Somers [Mon, 28 Sep 2020 00:23:59 +0000 (00:23 +0000)]
MF stable/12 r366190:

fusefs: fix mmap'd writes in direct_io mode

If a FUSE server returns FOPEN_DIRECT_IO in response to FUSE_OPEN, that
instructs the kernel to bypass the page cache for that file. This feature
is also known by libfuse's name: "direct_io".

However, when accessing a file via mmap, there is no possible way to bypass
the cache completely. This change fixes a deadlock that would happen when
an mmap'd write tried to invalidate a portion of the cache, wrongly assuming
that a write couldn't possibly come from cache if direct_io were set.

Arguably, we could instead disable mmap for files with FOPEN_DIRECT_IO set.
But allowing it is less likely to cause user complaints, and is more in
keeping with the spirit of open(2), where O_DIRECT instructs the kernel to
"reduce", not "eliminate" cache effects.

PR: 247276
Approved by: re (gjb)
Reported by: trapexit@spawn.link
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D26485

3 years agoMFS of 366163 from stable/12 which is MFC of 365992 from head.
Kirk McKusick [Sat, 26 Sep 2020 21:45:33 +0000 (21:45 +0000)]
MFS of 366163 from stable/12 which is MFC of 365992 from head.

Update check-hash when doing large UFS filesystem expansions.

Approved by:  re@ (Glen Barber)
Sponsored by: Netflix

3 years agoMFS: r366176
Jung-uk Kim [Fri, 25 Sep 2020 22:43:14 +0000 (22:43 +0000)]
MFS: r366176

Merge OpenSSL 1.1.1h.

Approved by: re (gjb)

3 years agoMFS r366154:
Mark Johnston [Fri, 25 Sep 2020 16:34:42 +0000 (16:34 +0000)]
MFS r366154:
MFC r366005:
udf: Validate the full file entry length

PR: 248613
Approved by: re (gjb)

3 years agoUpdate releng/12.2 to BETA3 as part of the 12.2-RELEASE cycle.
Glen Barber [Fri, 25 Sep 2020 00:36:59 +0000 (00:36 +0000)]
Update releng/12.2 to BETA3 as part of the 12.2-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFS r365987: certctl rehash upon install/distribute
Kyle Evans [Thu, 24 Sep 2020 18:36:31 +0000 (18:36 +0000)]
MFS r365987: certctl rehash upon install/distribute

r365829:
installworld: run `certctl rehash` after installation completes

This was originally introduced back in r360833, and subsequently reverted
because it was broken for -DNO_ROOT builds and it may not have been the
correct place for it.

While debatably this may still not be 'the correct place,' it's much cleaner
than scattering rehashes all throughout the tree. brooks has fixed the issue
with -DNO_ROOT by properly writing to the METALOG in r361397.

Do note that this is different than what was originally committed; brooks
had revisions in D24932 that made it actually use the revised unprivileged
mode and write to METALOG, along with being a little more friendly to
foreign crossbuilds and just using the certctl in-tree.

With this change, I believe we should now have a populated /etc/ssl/certs in
the VM images.

r365837:
Promote the installworld `certctl rehash` to distributeworld

Contrary to my belief, installworld is not sufficient for getting certs
installed into VM images. Promote the rehash to both installworld and
distributeworld (notably: not stageworld) and rehash the base distdir so we
end up with /etc/ssl/certs populated in the base dist archive. A future
commit will remove the rehash from bsdinstall, which doesn't really need to
happen if they're installed into base.txz.

While here, fix a minor typo: s/CERTCLTFLAGS/CERTCTLFLAGS/

r365852:
Revert r361257: bsdinstall: do a `certctl rehash` upon installation [...]

As of r365829, any given base distribution set will now include the /etc/ssl
symlinks that this rehash would've otherwise installed. This extra step is
no longer required.

Approved by: re (gjb)

3 years agoMFS: r366050, r366117
Rick Macklem [Thu, 24 Sep 2020 16:21:30 +0000 (16:21 +0000)]
MFS: r366050, r366117
Fix a LOR between the NFS server and server side krpc.

Recent testing of the NFS-over-TLS code found a LOR between the mutex lock
used for sessions and the sleep lock used for server side krpc socket
structures.
The code in nfsrv_checksequence() and nfsrv_bindconnsess() would call
SVC_RELEASE() with mutex(es) held.  Normally this is ok, since
all that happens is SVC_RELEASE() decrements the reference count.
However, if the socket has just been shut
down, SVC_RELEASE() drops the reference count to 0 and acquires a sleep
lock during destruction of the server side krpc structure.

This patch fixes the problem by moving the SVC_RELEASE() call in
nfsrv_checksequence() and nfsrv_bindconnsess() down a few lines to
below where the mutex(es) are released.

Approved by: re (gjb)

3 years agoMFS: r365703
Rick Macklem [Thu, 24 Sep 2020 14:59:10 +0000 (14:59 +0000)]
MFS: r365703
Fix a case where the NFSv4.0 server might crash if delegations are enabled.

asomers@ reported a crash on an NFSv4.0 server with a backtrace of:
kdb_backtrace
vpanic
panic
nfsrv_docallback
nfsrv_checkgetattr
nfsrvd_getattr
nfsrvd_dorpc
nfssvc_program
svc_run_internal
svc_thread_start
fork_exit
fork_trampoline
where the panic message was "docallb", which indicates that a callback
was attempted when the ClientID is unconfirmed.
This would not normally occur, but it is possible to have an unconfirmed
ClientID structure with delegation structure(s) chained off it if the
client were to issue a SetClientID with the same "id" but different
"verifier" after acquiring delegations on the previously confirmed ClientID.

The bug appears to be that nfsrv_checkgetattr() failed to check for
this uncommon case of an unconfirmed ClientID with a delegation structure
that no longer refers to a delegation the client knows about.

This patch adds a check for this case, handling it as if no delegation
exists, which is the case when the above occurs.
Although difficult to reproduce, this change should avoid the panic().

PR: 249127
Approved by: re (gjb)

3 years agoMFS r365983
Eric Joyner [Wed, 23 Sep 2020 23:56:49 +0000 (23:56 +0000)]
MFS r365983

Contains fixes for issues in em(4)/igb(4):
- Fix define and includes with RSS option enabled
- Properly retain promisc flag in init

PR: 249191, 248869
Approved by: re (gjb@)

3 years agoMFS r365986: caroot: update base store
Kyle Evans [Wed, 23 Sep 2020 17:42:19 +0000 (17:42 +0000)]
MFS r365986: caroot: update base store

Count:
- Two (2) removed
- Three (3) added

Approved by: re (gjb)

3 years agoMFS r365979:
Mark Johnston [Tue, 22 Sep 2020 01:35:55 +0000 (01:35 +0000)]
MFS r365979:
Mark sysctls added in r365689 as MPSAFE.

Approved by: re (gjb)

3 years agoMFS r365937, which merged r365861 and r365872 from head to stable/12.
Navdeep Parhar [Mon, 21 Sep 2020 18:19:48 +0000 (18:19 +0000)]
MFS r365937, which merged r365861 and r365872 from head to stable/12.

r365861:
cxgbe(4): Update T4/5/6 firmwares to 1.25.0.0.

r365872:
cxgbe(4): add the firmware binaries instead of the empty files that were added
in r365861.

Approved by: re@ (gjb@)

3 years agoMFS r365667,r365920: extend kern.geom.part.check_integrity to work on GPT
Eugene Grosbein [Mon, 21 Sep 2020 12:37:41 +0000 (12:37 +0000)]
MFS r365667,r365920: extend kern.geom.part.check_integrity to work on GPT

There are multiple USB/SATA bridges on the market that unconditionally
cut some LBAs off connected media. This could be a problem
for pre-partitioned drives so GEOM complains and does not create
devices in /dev for slices/partitions preventing access to existing data.

We have a knob kern.geom.part.check_integrity that allows us to correct
partitioning if changed from default 1 to 0 but it works for MBR only.
If backup copy of GPT is unavailable due to decreased number of LBAs,
the kernel does not give access to partitions still and prints to dmesg:

GEOM: md0: corrupt or invalid GPT detected.
GEOM: md0: GPT rejected -- may not be recoverable.

This change makes it work for GPT too, so it created partitions in /dev
and prints to dmesg this instead:

GEOM: md0: the secondary GPT table is corrupt or invalid.
GEOM: md0: using the primary only -- recovery suggested.

Then "gpart recover" re-creates backup copy of GPT
and allows further manipulations with partitions.

This change is no-op for default configuration having
kern.geom.part.check_integrity=1

Reported by: Alex Korchmar
Approved by: re (gjb)

3 years agoMFS r365928:
Mark Johnston [Mon, 21 Sep 2020 00:31:06 +0000 (00:31 +0000)]
MFS r365928:
MFC r365841:
Increase the default vm.max_user_wired value.

Approved by: re (gjb)

3 years agoMFS r365689,r365808,r365860
Allan Jude [Sat, 19 Sep 2020 20:46:56 +0000 (20:46 +0000)]
MFS r365689,r365808,r365860

MFOpenZFS: Introduce read/write kstats per dataset

The following patch introduces a few statistics on reads and writes
grouped by dataset. These statistics are implemented as kstats
(backed by aggregate sums for performance) and can be retrieved by
using the dataset objset ID number. The motivation for this change is
to provide some preliminary analytics on dataset usage/performance.

Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
openzfs/zfs@a448a2557ec4938ed6944c7766fe0b8e6e5f6456

Also contains parts of:
MFOpenZFS: Connect dataset_kstats for FreeBSD

Example output:
kstat.zfs.mypool.dataset.objset-0x10b.nread: 150528
kstat.zfs.mypool.dataset.objset-0x10b.reads: 48
kstat.zfs.mypool.dataset.objset-0x10b.nwritten: 134217728
kstat.zfs.mypool.dataset.objset-0x10b.writes: 1024
kstat.zfs.mypool.dataset.objset-0x10b.dataset_name: mypool/datasetname

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed by: Sean Eric Fagan <sef@ixsystems.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Allan Jude <allan@klarasystems.com>
openzfs/zfs@4547fc4e071ceb1818b3a46c3035b923e06e5390

Approved by: re (gjb)
Relnotes: yes
Sponsored by: Klara Inc.

3 years agoMFS r365891: certctl: fix unprivileged mode
Kyle Evans [Sat, 19 Sep 2020 02:12:04 +0000 (02:12 +0000)]
MFS r365891: certctl: fix unprivileged mode

The first issue was lack of quoting around INSTALLFLAGS, which set it
incorrectly and produced an error on -M.

The second issue was that we weren't actually doing the install in
unprivileged mode, making it effectively useless. This was designed to pass
through the proper metalog/unpriv flags to install(1), so just let it
happen.

Approved by: re (gjb)

3 years agoRename releng/12.2 to BETA2 as part of the 12.2-RELEASE cycle.
Glen Barber [Fri, 18 Sep 2020 00:02:58 +0000 (00:02 +0000)]
Rename releng/12.2 to BETA2 as part of the 12.2-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFS12 r365838:
Glen Barber [Thu, 17 Sep 2020 16:31:19 +0000 (16:31 +0000)]
MFS12 r365838:
 MFC r365646, r365720:
 r365646:
  Enclose BRANCH_OVERRIDE in quotes in order to fix an issue with
  freebsd-update(8) builds, where BRANCH is suffixed with -p0 for
  builds.

 r365720 (gordon):
  Partially revert r346018 and use the if/then construct instead of
  shell.

Approved by: re (kib)
Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoAdd UPDATING entries and bump version.
Gordon Tetlow [Tue, 15 Sep 2020 21:48:24 +0000 (21:48 +0000)]
Add UPDATING entries and bump version.

Approved by: so
Approved by: re (implicit for releng/12.2)

3 years agoFix ftpd privilege escalation via ftpchroot.
Gordon Tetlow [Tue, 15 Sep 2020 21:47:44 +0000 (21:47 +0000)]
Fix ftpd privilege escalation via ftpchroot.

Approved by: so
Approved by: re (implicit for releng/12.2)
Security: FreeBSD-SA-20:30.ftpd
Security: CVE-2020-7468

3 years agoFix bhyve SVM guest escape.
Gordon Tetlow [Tue, 15 Sep 2020 21:46:39 +0000 (21:46 +0000)]
Fix bhyve SVM guest escape.

This actually has a patch to sys/amd64/vmm/amd/svm.c that was accidentally
committed as part of r365779.

Approved by: so
Approved by: re (implicit for releng/12.2)
Security: FreeBSD-SA-20:29.bhyve_svm
Security: CVE-2020-7467

3 years agoFix bhyve privilege escalation via VMCS access.
Gordon Tetlow [Tue, 15 Sep 2020 21:43:41 +0000 (21:43 +0000)]
Fix bhyve privilege escalation via VMCS access.

Approved by: so
Approved by: re (implicit for releng/12.2)
Security: FreeBSD-SA-20:28.bhyve_vmcs
Security: CVE-2020-24718

3 years agoFix ure device driver susceptible to packet-in-packet attack.
Gordon Tetlow [Tue, 15 Sep 2020 21:42:05 +0000 (21:42 +0000)]
Fix ure device driver susceptible to packet-in-packet attack.

Approved by: so
Approved by: re (implicit for releng/12.2)
Security: FreeBSD-SA-20:27.ure
Security: CVE-2020-7464

3 years agoMFC r365606 and MF12 r365744:
Li-Wen Hsu [Tue, 15 Sep 2020 12:34:01 +0000 (12:34 +0000)]
MFC r365606 and MF12 r365744:

urndis(4): Add support of Inseego/Novatel Wireless MiFi 8800/8000

PR: 245152
Submitted by: rootless@gmail.com
Reviewed by: hselasky

Approved by: re (gjb)

3 years agoMFS r365647: ixl powerpc64 fixes
Eric Joyner [Mon, 14 Sep 2020 23:49:17 +0000 (23:49 +0000)]
MFS r365647: ixl powerpc64 fixes

PR: 249254
Approved by: re (gjb@)

3 years agoice(4): Add Intel 100GbE Ethernet Driver to kernel
Eric Joyner [Mon, 14 Sep 2020 22:42:17 +0000 (22:42 +0000)]
ice(4): Add Intel 100GbE Ethernet Driver to kernel

This also adds the "package" file that's loaded by the device for
configuration, used in the included ice_ddp kernel module.

MFS of r365612 and r365731.

Approved by: re (gjb@)
Relnotes: yes
Sponsored by: Intel Corporation

3 years agoMFS r365718:
Mark Johnston [Mon, 14 Sep 2020 17:21:52 +0000 (17:21 +0000)]
MFS r365718:
MFC r365437:
vm_object_split(): Handle orig_object type changes.

Approved by: re (gjb)

3 years agoMF12 r365662:
Dimitry Andric [Mon, 14 Sep 2020 14:53:09 +0000 (14:53 +0000)]
MF12 r365662:

MFC r365371:

Turn MALLOC_PRODUCTION into a regular src.conf(5) option

For historical reasons, defining MALLOC_PRODUCTION in /etc/make.conf has
been used to turn off potentially expensive debug checks and statistics
gathering in the implementation of malloc(3).

It seems more consistent to turn this into a regular src.conf(5) option,
e.g. WITH_MALLOC_PRODUCTION / WITHOUT_MALLOC_PRODUCTION. This can then
be toggled similar to any other source build option, and turned on or
off by default for e.g. stable branches.

Reviewed by: imp, #manpages
Differential Revision: https://reviews.freebsd.org/D26337

MFC r365373:

Follow-up r365371 by removing sentences which indicate the state of the
MK_MALLOC_PRODUCTION option on -CURRENT.

Also, for the sake of backwards compatibility, support the old way of
enabling 'production malloc', e.g. by adding a define in make.conf(5).

MF12 r365671:

Follow-up r365662 (MFC of r365371 and r365373) by correctly setting
WITH_MALLOC_PRODUCTION for stable branches. Also add a note to UPDATING,
to inform users about the new setting.

Direct commit to stable/{11,12} as this does not apply to head.

Noticed by: imp, Ronald Klop <ronald-lists@klop.ws>

MF12 r365672:

Follow-up r365662 (MFC of r365371 and r365373) by also removing the
header hack from jemalloc_FreeBSD.h, which rendered any make.conf
MALLOC_PRODUCTION or src.conf WITH/WITHOUT_MALLOC_PRODUCTION irrelevant.

Direct commit to stable/{11,12} as this does not apply to head.

Noticed by: kevans

Approved by: re (gjb)

3 years agoMF12 r365661:
Dimitry Andric [Mon, 14 Sep 2020 14:52:22 +0000 (14:52 +0000)]
MF12 r365661:

MFC r364753:

Add atomic and bswap functions to libcompiler_rt

There have been several mentions on our mailing lists about missing
atomic functions in our system libraries (e.g. __atomic_load_8 and
friends), and recently I saw __bswapdi2 and __bswapsi2 mentioned too.

To address this, add implementations for the functions from compiler-rt
to the system compiler support libraries, e.g. libcompiler_rt.a and and
libgcc_s.so.

This also needs a small fixup in compiler-rt's atomic.c, to ensure that
32-bit mips can build correctly.

Bump __FreeBSD_version to make it easier for port maintainers to detect
when these functions were added.

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

MFC r364782:

After r364753, there should be no need to suppress -Watomic-alignment
warnings anymore for compiler-rt's atomic.c. This occurred because the
IS_LOCK_FREE_8 macro was not correctly defined to 0 for mips, and this
caused the compiler to emit a runtime call to __atomic_is_lock_free(),
and that triggers the warning.

MFC r365509:

Follow-up r364753 by enabling compiler-rt's atomic implementation only
for clang, as it uses clang specific builtins, and does not compile
correctly with gcc. Note that gcc packages usually come with their own
libatomic, providing these primitives.

MFC r365588:

Follow-up r364753 by only using arm's stdatomic.c implementation, as it
already covers the functions in compiler-rt's atomic.c, leading to
conflicts when linking.

PR: 230888
Approved by: re (gjb)

3 years agoMFC r360229, r363255
Allan Jude [Sun, 13 Sep 2020 23:51:07 +0000 (23:51 +0000)]
MFC r360229, r363255
MFS r365614

r360229:
Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend

This will advertise support for TRIM to the guest virtio-blk driver and
perform the DIOCGDELETE ioctl on the backing storage if it supports it.

Thanks to Jason King and others at Joyent and illumos for expanding on
my original patch, adding improvements including better error handling
and making sure to following the virtio spec.

r363255:
Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver

If the hypervisor advertises support for the DISCARD command then the
guest can perform TRIM commands, freeing space on the backing store.

If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE

Tested with FreeBSD guests on bhyve and KVM

Approved by: re (gjb)
Relnotes: yes
Sponsored by: Klara Inc.

3 years agoMFS r365682: getlogin_r: fix the type of len
Kyle Evans [Sun, 13 Sep 2020 02:17:57 +0000 (02:17 +0000)]
MFS r365682: getlogin_r: fix the type of len

getlogin_r is specified by POSIX to to take a size_t len, not int. Fix our
version to do the same, bump the symbol version due to ABI change and
provide compat.

This was reported to break compilation of Ruby 2.8.

Some discussion about the necessity of the ABI compat did take place in the
review. While many 64-bit platforms would likely be passing it in a 64-bit
register and zero-extended and thus, not notice ABI breakage, some do
sign-extend (e.g. mips).

PR: 247102
Approved by: re (gjb)

3 years agoMFS r365681: certctl: fix hashed link generation with duplicate subjects
Kyle Evans [Sun, 13 Sep 2020 02:17:17 +0000 (02:17 +0000)]
MFS r365681: certctl: fix hashed link generation with duplicate subjects

Currently, certctl rehash will just keep clobbering .0 rather than
incrementing the suffix upon encountering a duplicate. Do this, and do it
for blacklisted certs as well.

This also improves the situation with the blacklist to be a little less
flakey, comparing cert fingerprints for all certs with a matching subject
hash in the blacklist to determine if the cert we're looking at can be
installed.

Future work needs to completely revamp the blacklist to align more with how
it's described in PR 246614. In particular, /etc/ssl/blacklisted should go
away to avoid potential confusion -- OpenSSL will not read it, it's
basically certctl internal.

PR: 246614
Approved by: re (gjb)

3 years agoMFS r365630 (markj, bz)
Bjoern A. Zeeb [Sat, 12 Sep 2020 21:50:25 +0000 (21:50 +0000)]
MFS r365630 (markj, bz)

   - Capsicumize rtsol(8) and rtsold(8).
   - Avoid relying on pollution from libcasper.h.
   - Add script for "M bit".

Approved by: re (gjb)

3 years agoMFS r365608:
Bjoern A. Zeeb [Sat, 12 Sep 2020 19:33:25 +0000 (19:33 +0000)]
MFS r365608:

Merge WiFi net80211, drivers, and management in order to support better 11n
  and upcoming 11ac.

  This includes an ath(4) update, some run(4) 11n support, 11n for otus(4),
  A-MPDU, A-MSDU, A-MPDU+A-MSDU and Fast frames options, scanning fixes,
  enhanced PRIV checks for jails, restored parent device name printing,
  improvements for upcoming VHT support, lots of under-the-hood infrastructure
  improvements, new device ID, debug tools updates, some whitespace changes
  (to make future MFCs easier).

  This does not include (most) epoch(9) related changes as too much other
  infrastructure was not merged for that.

  Tested on: some ath(4) AP, run(4) STA, and rtwn(4) STA
  Discussed with: adrian (extremely briefly)
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") [partially]

Approved by: re (gjb)
Relnotes: yes

3 years agoMFC r365457:
Kristof Provost [Sat, 12 Sep 2020 18:58:36 +0000 (18:58 +0000)]
MFC r365457:

net: mitigate vnet / epair cleanup races

There's a race where dying vnets move their interfaces back to their original
vnet, and if_epair cleanup (where deleting one interface also deletes the other
end of the epair). This is commonly triggered by the pf tests, but also by
cleanup of vnet jails.

As we've not yet been able to fix the root cause of the issue work around the
panic by not dereferencing a NULL softc in epair_qflush() and by not
re-attaching DYING interfaces.

This isn't a full fix, but makes a very common panic far less likely.

PR: 244703, 238870
Approved by: re (gjb)

3 years agoMFC r342852 (by cem): powerpc: Fix regression introduced in r342771
Alexander Motin [Fri, 11 Sep 2020 15:30:47 +0000 (15:30 +0000)]
MFC r342852 (by cem): powerpc: Fix regression introduced in r342771

In r342771, I introduced a regression in Power by abusing the platform
smp_topo() method as a shortcut for providing the MI information needed for
the stated sysctls.  The smp_topo() method was already called later by
sched_ule (under the name cpu_topo()), and initializes a static array of
scheduler topology information.  I had skimmed the smp_topo_foo() functions
and assumed they were idempotent; empirically, they are not (or at least,
detect re-initialization and panic).

Do the cleaner thing I should have done in the first place and add a
platform method specifically for core- and thread-count probing.

PR: 249250
Approved by: re (gjb)

3 years ago- Copy stable/12@r365545 to releng/12.2 as part of the 12.2-RELEASE
Glen Barber [Thu, 10 Sep 2020 23:56:59 +0000 (23:56 +0000)]
- Copy stable/12@r365545 to releng/12.2 as part of the 12.2-RELEASE
  cycle.
- Update from PRERELEASE to BETA1.
- Set the default pkg(7) repository to 'quarterly'.
- Bump __FreeBSD_version.
- Prune svn:mergeinfo from the new branch.

Approved by: re (implicit)

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFC r365284:
Brooks Davis [Wed, 9 Sep 2020 23:11:55 +0000 (23:11 +0000)]
MFC r365284:

Always report ENOSYS in init

While rare, encountering an unimplemented system call early in init is
catastrophic and difficult to debug.  Even after a SIGSYS handler is
registered, such configurations are problematic.  As such, always report
such events for pid 1 (following kern.lognosys if non-zero).

Reviewed by: kevans, imp
Obtained from: CheriBSD (plus suggestions from kevans)
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26288

3 years agoMFC r365016 | imp | 2020-08-31 17:48:23 -0600 (Mon, 31 Aug 2020) | 2 lines
Warner Losh [Wed, 9 Sep 2020 23:06:35 +0000 (23:06 +0000)]
MFC r365016 | imp | 2020-08-31 17:48:23 -0600 (Mon, 31 Aug 2020) | 2 lines

Add documentation for ETHERNET events.

3 years agoMFC r365015:
Warner Losh [Wed, 9 Sep 2020 23:05:47 +0000 (23:05 +0000)]
MFC r365015:
r365015 | imp | 2020-08-31 17:31:16 -0600 (Mon, 31 Aug 2020) | 12 lines

Warn for the non pccard attachments

These devices have non-pccard attachments. Warn for those as well. Both an and
wi don't do the modern cyrpto needed to use these cards on secure wifi networks.
an needs firmware from Cisco, which I don't think was ever produced. wi could
in theory do it with raw frames and on-host encryption, but nobody has written
that in the 15 years since WEP was cracked.

MFC After: 3 days
Noticed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D26138

3 years agoMFC: r365009
Warner Losh [Wed, 9 Sep 2020 23:04:40 +0000 (23:04 +0000)]
MFC: r365009
r365009 | imp | 2020-08-31 15:04:00 -0600 (Mon, 31 Aug 2020) | 10 lines

Add deprecation notice for apm BIOS

Add deprecation notice for apm bios, aka the apm(4) device. The apm(8)
command will remain, at least for a while, since ACPI emulates the apm
ioctl interface.

Discussed on: arch@
Relnotes: yes
MFC After: 3 days

3 years agoMFC r364824:
Warner Losh [Wed, 9 Sep 2020 23:01:55 +0000 (23:01 +0000)]
MFC r364824:

r364824 | imp | 2020-08-26 11:06:16 -0600 (Wed, 26 Aug 2020) | 8 lines

Make sbuf_setpos match the implementation.

sbuf_setpos can only be used to truncate the buffer, never to make it
longer. Update the documentation to reflect this.

Reviewed By: allanjude, phk
Differential Revision: https://reviews.freebsd.org/D26198

3 years agoMFC r364725, r364726
Warner Losh [Wed, 9 Sep 2020 22:59:47 +0000 (22:59 +0000)]
MFC r364725, r364726

r364725 | imp | 2020-08-24 13:35:15 -0600 (Mon, 24 Aug 2020) | 9 lines

Change the resume notification event from 'kern' to 'kernel'

We have both a system of 'kern' and of 'kernel'. Prefer the latter and
convert this notification to use 'kernel' instead of 'kern'. As a
transition period, continue to also generate the 'kern' notification
until sometime after FreeBSD 13 is branched.

r364726 | imp | 2020-08-24 13:35:27 -0600 (Mon, 24 Aug 2020) | 4 lines

Document the kern -> kernel name change for resume events.

Relnotes: YES

3 years agoMFC: 364430:
Warner Losh [Wed, 9 Sep 2020 22:54:09 +0000 (22:54 +0000)]
MFC: 364430:
r364430 | imp | 2020-08-20 11:19:40 -0600 (Thu, 20 Aug 2020) | 6 lines

Tag pccard drivers with gone in 13.

MFC After: 3 days
Reviewed by: emaste, brooks, adrian (on twitter)
Differential Revision: https://reviews.freebsd.org/D26095