DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-01-22 00:45:38

fvdw
Member
Registered: 2009-12-19
Posts: 33

loop device

@mijzelf
the loop device seems not be present by default in the kernel from zyyxel
On the other forum I found a psot from you with a loop.ko kernel module and how to use it.
I used that and the module is accepted by the insmod command and also creating a device nod seems to work

But when trying to mount a file system image (ext3) on the loop device the command seems to fail.
The mount command does not finish and in the process list it remains visible forever.
this is the line in the process list

2508 root       1464 D   mount -o loop /i-data/md0/fvdw/fvdw5-1.img /fvdw

The nsa won't let you kill this process (kill -9 2508 or killall -9 mount are executed but the process remains present in the list).

Is the loop.ko kernel module you compiled suitable for the 3.22 kernel ?

thks for your comments

fvdw

Offline

 

#2 2010-01-22 14:05:56

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: loop device

AFAIK yes. The kernel is the same, except some minor details (disk spindown stuff), and so is the compiler. Does dmesg give some more info?
BTW, when I remember well the mount I used (don't know if it was ffp or firmware) didn't accept -o loop, stating that it was done automatically.

Try to split the command:
losetup /dev/loop0 /i-data/md0/fvdw/fvdw5-1.img
mount /dev/loop0 /fvdw

Offline

 

#3 2010-01-22 22:01:56

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

thks for responding
I tried both the mount command from zyxel and in /ffp/bin, indeed the /ffp one don't want the -o loop option but the result is the same, never get the command prompt back after the mount command.

output dmesg after insmod command

Code:

~ # /sbin/insmod /i-data/md0/loop.ko

~ # dmesg
...
Adding 524280k swap on /i-data/.zyxel/swap_ul6545p.  Priority:-2 extents:5 across:524788k
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Hard 0, counter 1
Hard 0, counter 2
Hard 1, counter 1
loop: loaded (max 8 devices)
~ #

so loop module seems to be loaded ok.
then create the device node, checking that it is created ok and the mount command (hangs) + dmesg output obtained from second putty terminal

Code:

~ # mknod -m640 /dev/loop0 b 7 0
~ # ls -l /dev/loop*
brw-r-----    1 root     root       7,   0 Jan 22 20:46 /dev/loop0

~ # /ffp/bin/mount /i-data/md0/fvdw/fvdw5-1.img /fvdw

~ # dmesg
...
Unable to handle kernel NULL pointer dereference at virtual address 00000001
pgd = c0004000
[00000001] *pgd=00000000
Internal error: Oops: 1 [#1]
Modules linked in: loop nfsd exportfs bsd_comp pppoe pppox ppp_deflate ppp_async             ppp_synctty ppp_mppe ppp_generic slhc usbhid lm85 hwmon_vid fuse isofs udf ntfs             vfat msdos fat reiserfs ahci libata
CPU: 0
PC is at loop_thread+0x114/0x3a8 [loop]
LR is at 0xc2f19c04
pc : [<bf109934>]    lr : [<c2f19c04>]    Not tainted
sp : c7badf98  ip : c2bcfb88  fp : c7badff4
r10: 00000000  r9 : 00000000  r8 : c0643000
r7 : c2cc5180  r6 : 00000000  r5 : 00000000  r4 : 00000000
r3 : 00000000  r2 : 000200d2  r1 : c0643108  r0 : 00000001
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: B005317F  Table: 00728000  DAC: 00000015
Process loop0 (pid: 2559, stack limit = 0xc7bac250)
Stack: (0xc7badf98 to 0xc7bae000)
df80:                                                       00000000 00000000
dfa0: 00000000 c7badfb0 c0026f24 00000001 c06430f8 c0643000 bf109820 c0062a50
dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
dfe0: 00000000 00000000 00000000 c7badff8 c0062a50 bf109830 47335231 47454733
Backtrace:
[<bf109820>] (loop_thread+0x0/0x3a8 [loop]) from [<c0062a50>] (do_exit+0x0/0x838            )
Code: e59e3034 e5970038 e59820e8 e1a03a23 (e490c004)

in process list the following process is visible that can not be killed
2543 root        308 D   /ffp/bin/mount /i-data/md0/fvdw/fvdw5-1.img /fvdw

I will reboot it now and try with losetup but I think that won't solve it looking to this message in dmesg output...

Offline

 

#4 2010-01-23 00:19:13

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

I tried to split up the command as you suggested, the losetup command gives a command prompt but when looking in dmesg output the same oops error is given. Performing then the mount command again keeps hanging.
Think the kernel module is not ok for this kernel 3.22 kernel (linux 2.6.18.6) or ?

Offline

 

#5 2010-01-23 12:13:09

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: loop device

FW 2.10 also has a 2.6.18.6 kernel. Maybe the ´minor details´ I mentioned are the problem. You could try to compile a module using the plus 3.12 gplsources. Sala states it's the same kernel as the non-plus version.

BTW, did you try another diskimage? Don't know if it's possible that a wrong formed disk image can crash the loopdevice. On my system

Code:

dd if=/dev/mtdblock1 of=/path/to/file
mount -t squashfs /path/to/file /path/to/mountpoint

works.

Last edited by Mijzelf (2010-01-23 12:16:07)

Offline

 

#6 2010-01-23 13:41:57

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

its an image of an ext3 partition and it mounts fine on other system. But I tried your suggestion making one from /dev/mtdblock1. However it gives the same error.
Maybe the loop kernel module I downloaded is corrupted, could you post the one you are currently using once more ?

Offline

 

#7 2010-01-23 14:08:08

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: loop device

The module I'm using now will not work. My current kernel is compiled with a different compiler. However, I attached my original loop.ko


Attachments:
Attachment Icon loop.tgz, Size: 8,662 bytes, Downloads: 519

Offline

 

#8 2010-01-23 14:26:28

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

thks Mijzelf, I compared the files but they are 100% identical, so thats not the problem.
I could try to compile it again but I doubt if it will work, maybe some changes have been made in this 3.22 kernel that prevent it from working. I mean just compiling the module using the linux tar bal will probably give the same module as you made. Why should it be different its the same linux kernel.
Is there way to find out if this kernel supports loading loop as a module ? I can not find the kernel config file in the sources

Offline

 

#9 2010-01-23 14:42:07

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: loop device

? The kernelconfig file is linux-2.6.18.6.tar.gz/linux-2.6.18.6/.config. The size of my tarbal is the same as the one on the Zyxel server. So I suppose the .config is where it belongs.

Why should it be different its the same linux kernel.

There were some changes in disk suspending. (The 2.10 kernel didn't have a /proc/d_suspdtime). Maybe this somehow interferes with the loop module. Or maybe there are also other changes. Without doing a diff on the complete kernelsources and examining it, it's hard to say. (All files in the tarbal have the same timestamp, may 11 2009)

Offline

 

#10 2010-01-23 15:27:27

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

mmm..the config file shows

Code:

#
# Block devices
#
# CONFIG_BLK_CPQ_DA is not set
# CONFIG_BLK_CPQ_CISS_DA is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
# CONFIG_BLK_DEV_LOOP is not set
# CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=32768
CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
CONFIG_BLK_DEV_INITRD=y
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set

that means to me that loop device in principle can not be loaded as module or am I wrong ?

To compile a kernel module will also require compiling the kernel, I don't like that, its not always straight forward when doing a cross compile.
Do you know if the linux tarbal as prvided by zyxel already contains the necessary kernel patches or must they be applied before compiling it. In other words can I use the tarball as it is without any patch and cross compile it ?

Offline

 

#11 2010-01-23 18:29:54

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: loop device

fvdw wrote:

that means to me that loop device in principle can not be loaded as module or am I wrong ?

Don't know what it ought to be. But in practice you can just build the module and it works.
For the original 2.10 firmware I just did a 'make menuconfig', added some kernelmodules, and did a 'make modules'. This worked among others for loop, cifs, smbfs, nfsd (several modules needed). It didn't work for ipv6 (module couldn't load due to unresolved functions) and usbsound. (modules loads, but system crashed as soon as the first sound sample stopped).

Do you know if the linux tarbal as prvided by zyxel already contains the necessary kernel patches or must they be applied before compiling it. In other words can I use the tarball as it is without any patch and cross compile it ?

I don't think so. Sala reported that the kernel as provided didn't run the firmware. I compiled this kernel too, (well, different compiler and some other config flags) and the kernel only boots after a warm reboot. So I still use the firmware kernel for the initial 2 boots.

If you like you can try if my kernel will load on your system using the reload module. The whole boot stuff is in /boot of my Debian package, and I added a great bunch of modules in /lib/modules.

Offline

 

#12 2010-01-24 13:26:23

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

think I will give it a try to compile the modules. If that not works then reloading your kernel is a good option, nothing to loose to try that.
But in fact I only need this loop device, for the rest the kernel seems to fulfill my current needs. You wonder what the zyxel engineers were thinking when they decided not to included a basic device like the loop device. Of course if you only access the nsa220 via the web interface and its servers you will never need it and it is a way the make the kernel smaller...

Offline

 

#13 2010-01-25 02:03:26

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

succes, problem solved

I cross compiled the loop kernel module, it appeared to be different from the one from you mijzelf when comparing it (binary). This one loaded fine and also mounted my image without a problem

see output of dmesg

Code:

loop: loaded (max 8 devices)
Hard 1, counter 1
kjournald starting.  Commit interval 5 seconds
EXT3-fs warning: checktime reached, running e2fsck is recommended
EXT3 FS on loop0, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
Hard 1, counter 2
/ #

PS. I used the montavista toolkit from zyxel as it was in the nsa220plus source codes (3.12),
I changed the config file for the kernel to let it build the loop device as a kernel module and adapted the path in the makefile so it could find the cross compiler.
Initially I ran into an error when firing up de cross compiler, in a certain script in the very beginning it tried to find some versions. Thats the kind of trouble I was referring to and I don't like, before you know it you spend another day in finding the reasons and corrective measures. I look at the script and judged it was not important for the kernel modules. So in this case I just decided to add the -i switch to the make command line to let it contine despite of this error and see what happens before spending hours trying to find the reason and I only want the kernel modules. Fortunate those where compiled fine and build without errors. And the loop.ko build does work for this kernel (3.22)

Offline

 

#14 2010-01-25 23:32:48

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

for those interested, attached the compiled loop kernel module that works with kernel 3.22 (tested on my system)
It probably also works for kernel 3.12 as it compiled using the sources of 3.12 kernel.


Attachments:
Attachment Icon loop-3_12-3_22.zip, Size: 8,461 bytes, Downloads: 518

Offline

 

#15 2010-02-24 21:36:27

fvdw
Member
Registered: 2009-12-19
Posts: 33

Re: loop device

Hi mijzelf, i have send you a pm can you have a look at that, thks

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB