• FreeBSD Errata Notice FreeBSD-EN-23:08.vnet

    From FreeBSD Errata Notices@21:1/5 to All on Thu Aug 3 02:00:04 2023
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA512

    ============================================================================= FreeBSD-EN-23:08.vnet Errata Notice
    The FreeBSD Project

    Topic: VNET and DPCPU module panic on arm64

    Category: core
    Module: kernel
    Announced: 2023-08-01
    Affects: FreeBSD 13.2
    Corrected: 2023-07-26 18:03:46 UTC (stable/13, 13.2-STABLE)
    2023-08-01 19:50:47 UTC (releng/13.2, 13.2-RELEASE-p2)

    For general information regarding FreeBSD Errata Notices and Security Advisories, including descriptions of the fields above, security
    branches, and the following sections, please visit <URL:https://security.FreeBSD.org/>.

    I. Background

    VNET is the name of a technique to virtualize the network stack. It changes global resources, most notably variables, into per network stack resources
    and handles them in the context of the correct instance. VNET is enabled by default in GENERIC kernels on all architectures except 32-bit ARM.

    DPCPU is a dynamic per-CPU memory allocator which can instantiate one
    instance of a global variable with each CPU in the system. Dynamically allocated per-CPU variables can be defined with custom names and types.
    DPCPU is always enabled.

    II. Problem Description

    After FreeBSD 13.1 was released, the contributed LLVM components (LLVM,
    clang, compiler-rt, libc++, libunwind, lld, lldb and openmp) were
    upgraded to upstream version 14.0.5. The new version of lld, the llvm
    linker, got additional optimizations for arm64 in the form of so-called relocation relaxations.

    These relaxations are fine for regular userland applications, as the
    dynamic linker can handle the optimized relocations. However, due to the
    way the VNET and DPCPU features are implemented, the optimized
    relocations can cause panics if they are used in kernel modules.

    III. Impact

    On arm64 systems, loading kernel modules that use VNET or DPCPU features can cause panics. A known example is the WireGuard kernel module, if_wg(4).

    IV. Workaround

    No workaround is available.

    V. Solution

    Upgrade your system to a supported FreeBSD stable or release / security
    branch (releng) dated after the correction date.

    A reboot is required, because the kernel and several kernel modules are updated.

    Perform one of the following:

    1) To update your system via a binary patch:

    Systems running a RELEASE version of FreeBSD on the amd64, i386, or
    (on FreeBSD 13 and later) arm64 platforms can be updated via the freebsd-update(8) utility:

    # freebsd-update fetch
    # freebsd-update install

    A reboot is required, because the kernel and several kernel modules are updated.

    2) To update your system via a source code patch:

    The following patches have been verified to apply to the applicable
    FreeBSD release branches.

    a) Download the relevant patch from the location below, and verify the
    detached PGP signature using your PGP utility.

    # fetch https://security.FreeBSD.org/patches/EN-23:08/vnet.patch
    # fetch https://security.FreeBSD.org/patches/EN-23:08/vnet.patch.asc
    # gpg --verify vnet.patch.asc

    b) Apply the patch. Execute the following commands as root:

    # cd /usr/src
    # patch < /path/to/patch

    c) Recompile your kernel as described in <URL:https://www.FreeBSD.org/handbook/kernelconfig.html> and reboot the
    system.

    VI. Correction details

    This issue is corrected by the corresponding Git commit hash or Subversion revision number in the following stable and release branches:

    Branch/path Hash Revision
    - ------------------------------------------------------------------------- stable/13/ 98e7f836e65e stable/13-n255888 releng/13.2/ e3e6fc371322 releng/13.2-n254623
    - -------------------------------------------------------------------------

    Run the following command to see which files were modified by a
    particular commit:

    # git show --stat <commit hash>

    Or visit the following URL, replacing NNNNNN with the hash:

    <URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

    To determine the commit count in a working tree (for comparison against
    nNNNNNN in the table above), run:

    # git rev-list --count --first-parent HEAD

    VII. References

    <URL:https://github.com/ARM-software/abi-aa/blob/844a79fd4c77252a11342709e3b27b2c9f590cf1/aaelf64/aaelf64.rst#relocation-optimization>

    <URL:https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264094> <URL:https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264115>

    The latest revision of this advisory is available at <URL:https://security.FreeBSD.org/advisories/FreeBSD-EN-23:08.vnet.asc> -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmTJd+EACgkQbljekB8A Gu+2XRAAnIRnEfyWHe8XQa3ElzCx3gwyldIkZJqjqEX1hWm1uhASJGV3Zk/xj6gv 6yyr8P5nij6rbblpo/YpUzwFeRVUX3foMU+R4blTB0nriJuW6P1vMiHpD1w52oS5 OWpsyAouJ4/IsDh73jCqrJk3M7ZKOkfQ5tHn/E+bLl20ASQy/5S/t3G9QU8o8TeH Ak+zakq8Gf13BA6vMyq0beA34A0zT0niznKhbTqAc3czdsd18Rkeg/9txXU2iOkV 8VBqnN2kJQ/gBfM79PtUOfz8uK/7tIWMpNoept4Kp0XlDPpJUhqBwjjmTBsuxB8w fpYpfNF5ADX50L1nzm24oxBjFsbA+YUNXzO1VHCQZeWNxI2cubZWFtzu7WoxT7QQ trdhUWlSI28jtRJSg5eBwfSI/iT/iESIH9f5wFdVo3iORPXe28CrW6EtEHXhVk37 JQaQdIPr48n2IfsEzuogQyEMAWuD6hSUDksfZsArkPcS9QJFBzv1xkiTXmInn1CL JQK4XaVXSELKh0JWgnGTA3/Xsi/DRXcPbN+1saKi8Dp5LzwaMN26UmvWzMFYpQuY hrfFDpk3IP9iacvnnObuMretppd1LdwFx3O2Pq4Fs0nRYIKSU3OVpIVzu75otiwE GtArfSeRWgwy9moWd8W4wSWNFosTkFMFbZONS0n9SfEYzabpCzM=
    =0mU9
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)