[OpenWrt-Devel] [RFC] fstools/overlayfs race condition
Roman Yeryomin
leroi.lists at gmail.com
Mon Mar 7 08:03:10 EST 2016
There is a race between `cp -a /tmp/root/* /rom/overlay` from
libfstools/overlay.c and a process creating new file(s) before
pivot(/rom, /mnt) occured.
That is a process can create a file and it will not be copied.
Currently I do additional copy after jffs2 is ready, which is kind of
cumbersome (see attached patch), but there are still few potentially
erroneous scenarios:
1. a process may recreate the file by the time second cp occurs
2. a process may delete a file (not existing at that moment) and
second cp will copy it again
3. a process may want to read created file before second cp occurs
If attached patch is the way to go I will properly submit it.
Otherwise there should be a more fundamental fix but I don't see a way
to fix this properly.
Regards,
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001-sync-overlay.patch
Type: text/x-diff
Size: 381 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20160307/dddeca3d/attachment.bin>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list