neurodroid/cryptonite

0.7.12 - EncFS crashes after some fileoperations

Opened this issue · 21 comments

Hi,
i'm mounting this:
encfs -dv --public /storage/sdcard1/.myenc/enc1 /storage/sdcard1/enc1
(/storage/sdcard1 is ext4)

Everything looks fine at first but when i copy some files (maybe 3-4 files - 100MB each) with 'Root Explorer' it suddenly just stops (usually happens after 2-3 minutes). The copy operation just freezes. The debug log just hangs at 'getattr' line. No error or similar. I then kill the encfs process with kill -9 and unmount the target folder (as it is still mounted as fuse). No other system process seems crashed and i can remount with encfs again.

Sometimes the encfs process just vanishes with ("Aborted") as last debug output entry. The fuse mount is still there but folder is empty.

Looks like its unstable and crashes. Anything i can do to help debug this? Did you ever encounter this bug?

Cyanogenmod 11
Galaxy S4-LTE (Snapdragon 800) QuadCore 2.3GHz

Configuration file (.encfs6.xml).
<version>20100713</version>
<creator>EncFS 1.7.5</creator>
<cipherAlg class_id="1" tracking_level="0" version="0">
<name>ssl/aes</name>
<major>3</major>
<minor>0</minor>
</cipherAlg>
<nameAlg>
<name>nameio/block</name>
<major>3</major>
<minor>0</minor>
</nameAlg>
<keySize>256</keySize>
<blockSize>1024</blockSize>
<uniqueIV>1</uniqueIV>
<chainedNameIV>0</chainedNameIV>
<externalIVChaining>0</externalIVChaining>
<blockMACBytes>0</blockMACBytes>
<blockMACRandBytes>0</blockMACRandBytes>
<allowHoles>1</allowHoles>
<encodedKeySize>52</encodedKeySize>
<encodedKeyData>
...
</encodedKeyData>
<saltLen>20</saltLen>
<saltData>
...
</saltData>
<kdfIterations>43686</kdfIterations>
<desiredKDFDuration>500</desiredKDFDuration>

FUSE debug output (first lines):
FUSE library version: 2.8.5
nullpath_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56
INIT: 7.18
flags=0x0000047b
max_readahead=0x00020000
INIT: 7.12
flags=0x00000011
max_readahead=0x00020000
max_write=0x00020000

I'm suspecting this has something to do with the latest changes to the compiler flags. Do you have the same issues if you use an older version of the encfs binary? There's one available here for instance (encfs-armv7a).

No, a first test shows no problems indeed. It also seems to encode much faster. Will test some more...

No issues with 1.7.4 after 2 days running. Seems stable.

Try release v0.7.13. I've reverted PIE compilation.

Tested. The bug is still there.

Please revert that revert ;-) Without PIE encfs is unusable on Android 5.0

@xmikos did you test 0.7.13 and it didn't work on Android 5.0?

Yes, I have tested it, encfs from v0.7.13 doesn't work on Android 5.0 (you can't run non-PIE binaries on Android >= 5.0)

PIE isn't the culprit here anyway. For everything below JellyBean an ARMv6 build probably is the best tradeoff.
The old encfs binary v1.7.4 works properly so far as a workaround beside some minor annoyances like buggy --extpass function (that has been fixed in later version already).

Can you point me to the commit that fixes --extpass?

Not sure. I'm currently judging by practical testing.
On 1.7.5 this works properly:
encfs $folder2 $folder --public --extpass="gscript-input text-entry title text"

On 1.7.4 it throws this error:
Internal error: failed to exec program: No such file or directory

I think its related to this bug: #30

I've found the bug in v1.7.4 (see above link) but i would prefer a fixed 1.7.5 version. Any other ideas what could be wrong or what you've changed in the meantime?

On Lollipop, GT-I9505 (Galaxy S4) with the Resurrection Remix ROM, after opening some files, i can't open any files and every files disappear. need to re-mount to have again access to files, and it's crashing again. it's really unusable for me since it crashes after like 30sec of use :/

i think we are experiencing the same problem (using v0.7.12 because it's the only one compatible with Lollipop)

I've compiled some encfs 1.7.4 binaries to see if that addresses the issue:
https://github.com/neurodroid/cryptonite/releases/tag/v0.7.14
Please test

I've tested encfs-armv7 on CM12. Seems to work properly. Also 'extpass' is OK.
Is 1.7.5 update not important or why do you focus on 1.7.4?

@BlueMax There might be several reasons for the issue that is reported here. One of them is that the updated ndk/gcc causes the issue (the version of the encfs 1.7.4 binary that is available on Google code was produced with an ancient ndk/gcc). Alternatively, some changes in encfs 1.7.5 may cause the problems. Your report that 1.7.4 compiled with the latest ndk/gcc appears to run fine supports the former hypothesis. If everyone else can confirm that encfs 1.7.4 compiled with the latest ndk/gcc runs fine, including on Android L systems, we can narrow down the problem to encfs 1.7.5.

I've tested the first 1.7.5 PIE build again. I previously tested it on CM11 where it did not run properly (the reason i started this thread). Now, on CM12 i cannot see any crashes nor speed impacts anymore. This could be an individual isolated runtime/code problem indeed (fuse/bionic/compiler..) but the binaries are obviously not compiled under the same conditions. The 1.7.5 binary is 8.7MB compared to the new PIE 1.7.4 (1.5MB). One might be a static build whereas the other is not (or something like this..). To get same test conditions you might give the 1.7.5 binary with smaller file size a shot again.

Nah, not true. Crashed again. Old 1.7.5 is definitely buggy. The new 1.7.4 binary stress testing is still standing. Already passed 4GB transfered data. Usually it crashed way before... Will keep on pumping some more to make sure. You might want to try the smaller filesize binaries nevertheless.

@BlueMax Good point - never realized that the encfs 1.7.5 binaries compiled for v0.7.12 were so fat. I've just re-compiled them (with PIE enabled) and they are now back to ~1.5MB. Please test:
https://github.com/neurodroid/cryptonite/releases/tag/v0.7.15
No idea what went wrong in v0.7.12 - probably some bizarre combination of compiler flags.

No, unfortunately doesn't work. Crashes as well. Seems to be a different bug.

Reverting back to 1.7.4 then.
https://github.com/neurodroid/cryptonite/releases/tag/v0.7.16
If no one complains I'll release 0.7.16 to Google Play.

I'm still running into this issue on Android 4.4.2 with Cryptonite 0.7.17. I'd be happy to give any more information that might be helpful.