Thank you for the review! I've updated the wiki page based on your comments,
https://fedoraproject.org/wiki/LiveOS_image
Documenting that a temporary overlay is a 0.5 GiB sparse file in a RAM filesystem gave me the idea to try using an overlay size greater than available memory, and hope that kernel out-of-memory warnings would intervene before the device-mapper filesystem invalidation.
I modified
/usr/sbin/dmsquash-live-root in the initramfs to create a temporary 500 GiB sparse overlay:
dd if=/dev/null of=/overlay bs=1024 count=1 seek=$((512*1024*1024)) 2> /dev/null
Then after booting an updated, Fedora 18 Live desktop, LiveUSB read only and running your failure demo,
time dd if=/dev/zero of=/fooI got out-of-memory warnings after a file of about 450 MiB was written and the command returned--no crash!
Some post test output:
[root@localhost ~]# dmsetup status
live-osimg-min: 0 8388608 snapshot 2584/2584 24
live-rw: 0 8388608 snapshot 921720/1073741824 3600
top - 18:11:53 up 17 min, 3 users, load average: 0.68, 0.75, 0.57
Tasks: 182 total, 2 running, 180 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.6 us, 1.6 sy, 0.0 ni, 96.5 id, 0.0 wa, 0.2 hi, 0.0 si, 0.0 st
KiB Mem: 3339812 total, 3260284 used, 79528 free, 316384 buffers
KiB Swap: 3341308 total, 0 used, 3341308 free, 1948108 cachedYou might test this method in your systems and let us know how it works.
--Fred