chkdirs shows errormessage for empty files on squashfs

You can report problems, make suggestions, about the new BETA versions in this forum. For stuff related to final releases, please post a message in other forums
Post Reply
gernot
Posts: 1130
Joined: 07 Apr 2010, 16:19

chkdirs shows errormessage for empty files on squashfs

Post by gernot » 08 Mar 2011, 06:52

stat and chkdirs read the blockcount wrong if they stat a empty file on squashfs.
The result are errormessages using chkrootkit.

"chkdirs /" show "lstat(/usr/.keep): Value too large for defined data type"

"stat /usr/.keep" show
File: `/usr/.keep'
Size: 0 Blocks: 36028797018963969 IO Block: 1024 regular empty file

I think this files are compiled with a other headerfile because strace look good:

lstat64("/usr/.keep", {st_dev=makedev(0, 18), st_ino=46639, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=1, st_size=0, st_atime=2008/06/11-17:44:52, st_mtime=2008/06/11-17:44:52, st_ctime=2008/06/11-17:44:52}) = 0

tested with sysrcd 2.1.0beta4

Gernot

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Re: chkdirs shows errormessage for empty files on squashfs

Post by admin » 08 Mar 2011, 19:57

It could also be a problem with aufs, can you try on /livemnt/squashfs directly ?
squashfs packs small files together to optimize compression, so in that case it cannot provide a real number of blocks.
This is because if you compress 1000 files of 256 bytes each, it's a lot better to compress one block of 256KB instead.
So I suspect it's broken by design

gernot
Posts: 1130
Joined: 07 Apr 2010, 16:19

Re: chkdirs shows errormessage for empty files on squashfs

Post by gernot » 08 Mar 2011, 21:16

The Problem exist also on /livemnt/squashfs.
If the file is replaced from /livemnt/memory stat shows the correct blockcount.
Stat works well on squashfs for files containing data. Only empty files are shown wrong.

if /usr/.keep is stored on memory:
%stat /usr/.keep
File: `/usr/.keep'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file

Code: Select all

lstat64("/usr/.keep", {st_dev=makedev(0, 18), st_ino=10894, st_mode=S_IFREG|0644,
st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=0, st_size=0,
st_atime=2011/03/08-22:22:00, st_mtime=2011/03/08-22:22:00, st_ctime=2011/03
/08-22:22:00}) = 0
if /usr/.keep is stored on squashfs or opend direct there:

File: `/livemnt/squashfs/usr/.keep'
Size: 0 Blocks: 36028797018963969 IO Block: 1024 regular empty file

Code: Select all

lstat64("/livemnt/squashfs/usr/.keep", {st_dev=makedev(7, 0), st_ino=25083,
st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024, st_blocks=1,
st_size=0, st_atime=2008/06/11-17:44:52, st_mtime=2008/06/11-17:44:52, st_ctime=2008/06/11-17:44:52}) = 0
just as test that the design is not so bad

File: `/livemnt/squashfs/usr/bin/zip'
Size: 152232 Blocks: 299 IO Block: 1024 regular file

Code: Select all

lstat64("/livemnt/squashfs/usr/bin/zip", {st_dev=makedev(7, 0), st_ino=51466,
st_mode=S_IFREG|0755, st_nlink=1, st_uid=0, st_gid=0, st_blksize=1024,
st_blocks=299, st_size=152232, st_atime=2010/12/25-11:59:17, st_mtime=2010/12
/25-11:59:17, st_ctime=2010/12/25-11:59:17}) = 0
 
I think the problem is in stat. Tomorrow i take a look on the stat sourcecode.

Gernot

gernot
Posts: 1130
Joined: 07 Apr 2010, 16:19

Re: chkdirs shows errormessage for empty files on squashfs

Post by gernot » 09 Mar 2011, 18:40

Now i compiled stat.c (coreutils-8.7) with some debugmessages.
The wrong value comes from libc while data length is ok.
36028797018963969 in decimal is 80 0000 0000 0001 in Hex.
Looks like strace is wrong and show not all bits.

I think you are right that its a bug in squashfs.
When i find time i try to debug this.

Gernot

p.s ls shows the blockcount wrong too

Post Reply