Go to file
Rob Norris 30ea442961 zfs_log: add flex array fields to log record structs
ZIL log record structs (lr_XX_t) are frequently allocated with extra
space after the struct to carry variable-sized "payload" items.

Linux 6.10+ compiled with CONFIG_FORTIFY_SOURCE has been doing runtime
bounds checking on memcpy() calls. Because these types had no indicator
that they might use more space than their simple definition,
__fortify_memcpy_chk will frequently complain about overruns eg:

    memcpy: detected field-spanning write (size 7) of single field
        "lr + 1" at zfs_log.c:425 (size 0)
    memcpy: detected field-spanning write (size 9) of single field
        "(char *)(lr + 1)" at zfs_log.c:593 (size 0)
    memcpy: detected field-spanning write (size 4) of single field
        "(char *)(lr + 1) + snamesize" at zfs_log.c:594 (size 0)
    memcpy: detected field-spanning write (size 7) of single field
        "lr + 1" at zfs_log.c:425 (size 0)
    memcpy: detected field-spanning write (size 9) of single field
        "(char *)(lr + 1)" at zfs_log.c:593 (size 0)
    memcpy: detected field-spanning write (size 4) of single field
        "(char *)(lr + 1) + snamesize" at zfs_log.c:594 (size 0)
    memcpy: detected field-spanning write (size 7) of single field
        "lr + 1" at zfs_log.c:425 (size 0)
    memcpy: detected field-spanning write (size 9) of single field
        "(char *)(lr + 1)" at zfs_log.c:593 (size 0)
    memcpy: detected field-spanning write (size 4) of single field
        "(char *)(lr + 1) + snamesize" at zfs_log.c:594 (size 0)

To fix this, this commit adds flex array fields to all lr_XX_t structs
that require them, and then uses those fields to access that
end-of-struct area rather than more complicated casts and pointer
addition.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <robn@despairlabs.com>
Closes #16501
Closes #16539
2024-11-04 10:34:48 -08:00
.github Move nodes into correct subgraphs 2024-01-29 14:53:29 -08:00
cmd zfs_log: add flex array fields to log record structs 2024-11-04 10:34:48 -08:00
config Linux 6.11: avoid passing "end" sentinel to register_sysctl() 2024-08-22 15:42:14 -07:00
contrib contrib: link zpool to zfs in bash-completion (#16376) 2024-08-26 15:10:16 -07:00
etc etc/init.d: decide which variant to use at build time. 2024-04-22 09:28:06 -07:00
include zfs_log: add flex array fields to log record structs 2024-11-04 10:34:48 -08:00
lib Use memset to zero stack allocations containing unions 2024-07-17 14:54:47 -07:00
man Enable L2 cache of all (MRU+MFU) metadata but MFU data only 2024-08-27 14:53:03 -07:00
module zfs_log: add flex array fields to log record structs 2024-11-04 10:34:48 -08:00
rpm contrib: link zpool to zfs in bash-completion (#16376) 2024-08-26 15:10:16 -07:00
scripts disable automatic dependency tracking for dkms builds 2024-07-17 14:54:47 -07:00
tests ZTS: fix zfs_copies_006_pos test on Ubuntu 20.04 (#16409) 2024-08-26 15:10:16 -07:00
udev udev: correctly handle partition #16 and later 2024-04-22 09:23:23 -07:00
.cirrus.yml CI: add FreeBSD build with Cirrus CI 2023-10-07 09:08:20 -07:00
.editorconfig
.gitignore Packaging: Auto-generate changelog during configure (#15528) 2023-11-16 14:23:03 -08:00
.gitmodules
.mailmap AUTHORS: refresh with recent new contributors (#16362) 2024-07-23 11:58:49 -07:00
AUTHORS AUTHORS: refresh with recent new contributors (#16362) 2024-07-23 11:58:49 -07:00
autogen.sh
CODE_OF_CONDUCT.md Documentation corrections 2022-12-22 11:34:28 -08:00
configure.ac Packaging: Auto-generate changelog during configure (#15528) 2023-11-16 14:23:03 -08:00
copy-builtin
COPYRIGHT
LICENSE
Makefile.am
META Tag zfs-2.2.6 2024-08-27 14:53:03 -07:00
NEWS
NOTICE
README.md FreeBSD: Fix the build on FreeBSD 12 2023-11-28 15:19:07 -08:00
RELEASES.md
TEST
zfs.release.in

img

OpenZFS is an advanced file system and volume manager which was originally developed for Solaris and is now maintained by the OpenZFS community. This repository contains the code for running OpenZFS on Linux and FreeBSD.

codecov coverity

Official Resources

Installation

Full documentation for installing OpenZFS on your favorite operating system can be found at the Getting Started Page.

Contribute & Develop

We have a separate document with contribution guidelines.

We have a Code of Conduct.

Release

OpenZFS is released under a CDDL license. For more details see the NOTICE, LICENSE and COPYRIGHT files; UCRL-CODE-235197

Supported Kernels

  • The META file contains the officially recognized supported Linux kernel versions.
  • Supported FreeBSD versions are any supported branches and releases starting from 12.4-RELEASE.