hasse69 / rar2fs

FUSE file system for reading RAR archives
https://hasse69.github.io/rar2fs/
GNU General Public License v3.0
279 stars 27 forks source link

rar2fs quits with "illegal operation" #96

Closed wabkia closed 6 years ago

wabkia commented 6 years ago

i'm able to successfully mount a directory with rar2fs but when i go to enumerate the files via LS rar2fs exits. using the -f -d options shows that many options succeed but once ls tries to open the directory rar2fs quits with "illegal operation"

debug output

ginuwinegroove@gruvstor:~ % sudo rar2fs -f -d -o allow_other /stor/home /mnt/rar2fs rar2fs[93752]: mounted /mnt/rar2fs unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 93753 INIT: 7.8 flags=0x00000000 max_readahead=0x00010000 INIT: 7.19 flags=0x00000010 max_readahead=0x00010000 max_write=0x00020000 max_background=0 congestion_threshold=0 unique: 1, success, outsize: 40 unique: 2, opcode: GETATTR (3), nodeid: 1, insize: 40, pid: 93754 getattr / unique: 2, success, outsize: 112 unique: 3, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 93754 opendir flags: 0x0 / opendir[34410213376] flags: 0x0 / unique: 3, success, outsize: 32 unique: 4, opcode: STATFS (17), nodeid: 1, insize: 40, pid: 93754 statfs / unique: 4, success, outsize: 96 unique: 5, opcode: GETATTR (3), nodeid: 1, insize: 40, pid: 93754 getattr / unique: 5, success, outsize: 112 unique: 6, opcode: READDIR (28), nodeid: 1, insize: 64, pid: 93754 readdir[34410213376] from 0 Illegal instruction

rar2fs daemon running before ls, not running after

ginuwinegroove@gruvstor:~ % sudo ps aux | grep rar2fs root 93770 0.0 0.1 40000 5380 - Ss 02:19 0:00.00 rar2fs -o allow_other /stor/home /mnt/rar2fs ginuwinegroove 93772 0.0 0.0 14828 2460 0 S+ 02:19 0:00.00 grep rar2fs ginuwinegroove@gruvstor:~ % sudo ps aux | grep rar2fs ginuwinegroove 93777 0.0 0.0 14828 2460 0 S+ 02:19 0:00.00 grep rar2fs

uname -a;freebsd-version

FreeBSD gruvstor 11.1-RELEASE-p11 FreeBSD 11.1-RELEASE-p11 #0: Thu Jun 21 03:46:08 UTC 2018 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 11.1-RELEASE-p11

rar2fs --version

rar2fs v1.26.0 (DLL version 8) Copyright (C) 2009 Hans Beckerus This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see http://www.gnu.org/licenses/ for details. FUSE library version: 2.9.5 mount_fusefs [fuse4bsd] version: 0.3.9-pre1 using FUSE kernel interface version 7.19

hasse69 commented 6 years ago

Thanks for the issue report. This is a rather severe problem you observed, unfortunately there is not much that can be done from rar2fs side. What you see is not really an "illegal operation", but rather an "illegal instruction" crash. This is more than likely caused by the fact that you are running something not really built for you architecture/platform. I guess this is not a version of rar2fs you built yourself? We could dig deeper of course to figure out exactly what instruction it is, but I am not 100% sure if that would really be of any help to you. The offending instruction might be anywhere; in rar2fs. in FreeBSD FUSE support or libunrar. In any case you must first make sure that the binary you are using is in fact supporting your current CPU instruction set. Could be a build optimized for something your CPU does not support natively.

wabkia commented 6 years ago

I installed rar2fs and fuse from freebsd's pkg repository. I will try building everything from scratch. good to know that i'm not just doing something wrong.

this is running on a q6600 (yes from like 2006) so it could very well be a cpu instruction mismatch! is it possible to point me in the right (or any) direction on where i can look for what the mismatch might be?

hasse69 commented 6 years ago

First run rar2fs in gdb and force it to crash. That would at least give us a hint if it is rar2fs itself that is built too aggressively or something it is using.

hasse69 commented 6 years ago

Also, I think you should contact (or file a report to) the FreeBSD package maintainer of rar2fs. Maybe he/she is already aware of this problem and might have some alternative builds available.

wabkia commented 6 years ago

I went to troubleshoot this again today and its working. there was an upgrade from 1.26 to 1.27 for rar2fs and some other things, once installed the folder mounted and i was able to read it. thanks!

wabkia commented 6 years ago

Hello,

i was able to view some directories just fine but other (large) directories still cause the same 'illegal instruction' error. initially i thought this was because of faulty hardware. the hardware has been replaced (new cpu, motherboard, ram) and unfortunately I still encounter this error. I've sent an email to the freebsd port maintainer but im hoping we can try and dig into this? how can i see where this instruction issue is coming from? maybe its from fuse?

hasse69 commented 6 years ago

Best bet is to run it through gdb. It will stop at the address causing the exception.

wabkia commented 6 years ago

ok, my only guess is that this directory its trying to open has a compressed rar file, but i would think that it would be skipped. maybe this isnt the case and i've wasted time?

hasse69 commented 6 years ago

Compressed RAR files is not the problem. List operations on those works just fine. You should never crash on an illegal instruction. That means the compiled binary is using an instruction set your architecture cannot handle. I suggest you build your own version of rar2fs and see if that makes a difference. But, as you say, it might very well be some other library, even libunrar, that has been optimized too aggressively.

hasse69 commented 6 years ago

Since it actually seems to be related to compressed archives it leans towards libunrar.so. For compressed archives most operations use functions from that library rather than rar2fs itself. Building latest version of rar2fs and libunrar (which by default links statically and does not depend on an external version of libunrar.so) might confirm that.

wabkia commented 6 years ago

i will check out what youve posted here tonight and post what i discover. thank you for the direction!

hasse69 commented 6 years ago

Will close this since the issue is not caused by a problem in rar2fs but rather the platform specific build/package.