git: DragonFly_RELEASE_4_4 sbin/hammer: Don't access beyond 16KB of HAMMER userspace buffer

Tomohiro Kusumi tkusumi at
Sun Mar 20 07:54:08 PDT 2016

commit d30b24e65b830560fa2874bb2919caca2725abee
Author: Tomohiro Kusumi <kusumi.tomohiro at>
Date:   Sat Mar 5 01:08:46 2016 +0900

    sbin/hammer: Don't access beyond 16KB of HAMMER userspace buffer
    HAMMER userspace only supports upto 16KB buffer size while HAMMER
    filesystem itself supports both 16KB and 64KB. This means even if
    a leaf node elm says the record data is >16KB, HAMMER userspace can
    only retrieve the first 16KB of the record data. Anything beyond
    16KB is not supported (not malloc'd in userspace).
    print_record() in hammer show is passing a pointer to maximum 16KB
    buffer to hexdump(3), but is also passing data_len which is taken
    from elm->leaf.data_len. This becomes an issue when the file size
    is >1MB where HAMMER starts to use 64KB buffer for data beyond 1MB.
    elm->leaf.data_len will typically say the length is 64KB, but
    the maximum HAMMER userspace can handle is still 16KB regardless
    of what the leaf node elm says. hammer show needs to omit anything
    beyond 16KB (for now).
     # hammer -vvvv -f /dev/da1:/dev/da2:/dev/da3 show > /dev/null
     zsh: segmentation fault (core dumped)  hammer -vvvv -f /dev/da1:/dev/da2:/dev/da3 show > /dev/null
    (cherry picked from commit 7d0dab482a8621fa2fcb8ae0d5f27e62aed4c9f4)

Summary of changes:
 sbin/hammer/cmd_show.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list