Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use mmap by default. #579

Commits on Aug 22, 2017

  1. Do not use mmap by default.

    Reading memory-mapped files is inherently insecure because no safe
    mechanism exists to prevent out-of-bounds reads if the file gets
    truncated. The POSIX standard says “An implementation may deliver
    SIGBUS signals when a reference would cause an error in the mapped
    object, such as out-of-space condition.” so it seems safer to disable
    mmap by default.
    
    The bug is simply triggered using this command:
    
        # dd of=zob count=0 seek=16G; (sleep 0.1; truncate -s1 zob)&; rg -a lol zob
        [2]    15028 bus error  rg -a lol zob
    samhocevar committed Aug 22, 2017
    Configuration menu
    Copy the full SHA
    ca72540 View commit details
    Browse the repository at this point in the history