You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is caused by the optimization where if the binary blob to cache is no more than 512KB, then it is written via mmap. Since the file obtained from tempfile may be sparse, writing to it may result in allocation of more blocks on the fs and failure with SIGBUS (I'm not sure this is standard/defined behavior or not, it seems legit though - what else can the OS do?). The call to std::fs::File::set_len only results in calling the truncate syscall, which does not guarantee file allocation and does not return an error on not enough space on device.
Calling posix_fallocate on the fd of the file obtained from tempfile fixes the issue for me, but I am not sure posix_fallocate guarantees file allocation or it just happens to work ok.
The text was updated successfully, but these errors were encountered:
cacache-11.5.2 crashes a program with SIGBUS when working under disk-full conditions on linux.
Running ubuntu-19.10 with linux-5.3.0-64-generic.
Reproduction:
mkdir /tmp/ram && mount -ttmpfs -osize=5m tmpfs /tmp/ram
The problem is caused by the optimization where if the binary blob to cache is no more than 512KB, then it is written via mmap. Since the file obtained from
tempfile
may be sparse, writing to it may result in allocation of more blocks on the fs and failure with SIGBUS (I'm not sure this is standard/defined behavior or not, it seems legit though - what else can the OS do?). The call tostd::fs::File::set_len
only results in calling thetruncate
syscall, which does not guarantee file allocation and does not return an error on not enough space on device.Calling
posix_fallocate
on the fd of the file obtained fromtempfile
fixes the issue for me, but I am not sureposix_fallocate
guarantees file allocation or it just happens to work ok.The text was updated successfully, but these errors were encountered: