lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85e7c2fc0806180743ob7f5c21pc1ca8684322ef1ad@mail.gmail.com>
Date:	Wed, 18 Jun 2008 22:43:25 +0800
From:	"Bob Zhang" <zhanglinbao@...il.com>
To:	"Jared Hulbert" <jaredeh@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Does anyone run AXFS in 2.4 version of kernel ? I am trying my best to apply AXFS patches into 2.4.18

Good news , AXFS XIP has already worked well in 2.4.21 kernel .
Till now , in 2.4.21 , AXFS compressed and XIP both work well.
it can be said that balanced XIP is OK.

all files related with AXFS have been ported to 2.4.21 kernel .

My rootfs is a simple file system consisted fo busybox .
I have set most pages data of /bin/busybox to be XIP and some pages of
/bin/busybox are set to be compressed  , and /strace is no XIP ,full
compressed .
I will execute ifconfig(linked to busybox) and strace to keep them distinct .


1 , Preparation

In fact , the information from profiling data is engough to create a
Input xml file .
Through reading the source code of mkfs.axfs.c ( source code of
generating the axfs img ) , I know that.

in 2.4.21 kernel , our profiling data is like this : complete file can
be found at attachement named "axfs_profiling_data.txt"
<<axfs_profiling_data.txt>>

/ $ cat /proc/axfs/volume0
#filename      offset   refer_count
you can put the offset into xml file needed by mkfs.axfs.c
./bin/busybox,0,7
./bin/busybox,28672,2
./bin/busybox,53248,4
./bin/busybox,143360,1
./bin/busybox,147456,1
./bin/busybox,151552,6
./bin/busybox,155648,9
./bin/busybox,159744,4
./bin/busybox,163840,7
./bin/busybox,167936,4
./bin/busybox,204800,3
./bin/busybox,233472,2
./bin/busybox,237568,2
./bin/busybox,241664,2
./bin/busybox,245760,2
./bin/busybox,249856,2

so our Input file is like this , complete file can be found at
attachment "axfs.xml"   <<axfs.xml>>
Note : the size is all "4096".
<xipfsmap>
        <file>
                <name>./bin/busybox</name>
                <chunk>
                        <size>4096</size>
                        <offset>0</offset>
                </chunk>

                <chunk>
                        <size>4096</size>
                        <offset>28672</offset>
                </chunk>

                <chunk>
                        <size>4096</size>
                        <offset>53248</offset>
                </chunk>
                .....
</xipfsmap>

Note: in fact <size>? </size> ,  must it be 4096 ? Certainly not , if
you find some contiguous pages are called frequently , for example ,
0~8191

you can write it like this:
<chunk>
        <size>8192</size>
        <offset>  0   </offset>
</chunk>


Create a new partially XIP rootfs image .
mkfs.axfs -i axfs.xml root_fs balanced_xip.img

Detailed log can be found at attachment named "create_xip_image.log"
<<create_xip_image.log>>
because of debugging info added by me , so you only need to pay
attention to such words
"set_page_stat"
"node_type = XIP"
"node_index[375] = 7"

number of files:                        325
number of 4KB nodes:                    648
number of 4KB xip nodes:                39   //XIP pages number . you
can how many "chunk" items in the xml file
number of xip files:                    1               // because I
only set some pages of /bin/busybox to XIP, no setting other files .


2,  testing and verifying

At last , my kernel-2.4.21 with axfs 's booting info is like this ,
complete file can be found at attachment named xip_booting.txt
<<xip_booting.txt>>

because I added debug info , so booting messages is too large .
but you only need to pay attention to such words

<<  --------- Reading XIP page ------------ >>
///  --------- Reading Compressed page ------------ ///
node_type = XIP
node_type = Compressed

For diffent kind of pages , kernel will call respective routines to handle.

XIP page:  axfs_file_read->xip_file_read->axfs_get_xip_page()
Compressed Page:  axfs_file_read->generic_file_read->axfs_readpage

static struct address_space_operations axfs_aops = {
        .readpage = axfs_readpage,  //for compressed page
        .get_xip_page = axfs_get_xip_page,  //specially for XIP page reading
};



>From source code :

node_type = AXFS_GET_NODE_TYPE(sbi->metadata, array_index);
                bkdmsg("node_type = %s\n",node_type == Compressed?"Compressed":
                                                  node_type ==
Byte_Aligned?"Byte_Aligned":
                                                  node_type ==
XIP?"XIP":"No this type");

                if (AXFS_GET_NODE_TYPE(sbi->metadata, array_index) == XIP) {
                        printk("\n\n <<  --------- Reading XIP page
------------ >> \n");
                        size_read = xip_file_read(filp, buf, readlength, ppos);
                } else { //for compressed and Byte_Aligned
                        printk("\n\n \/\/\/  --------- Reading
Compressed page ------------ \/\/\/ \n");
                        size_read =
                            //do_sync_read(filp, buf, readlength,
ppos);        //bob modify it
                            generic_file_read(filp, buf, readlength,
ppos); //2.4 don't support AIO
                }




for example ,
when you execute the command "ifconfig" , you will see output like this :

Test Case 1:

/ $ ifconfig       ( ifconfig is linked to /bin/busybox , I have set
parts of pages of busybox to XIP , some pages are of Compressed)

in sys_execve() , filename=/proc/self/exe
File:[exec.c],  at line:[412],  [kernel_read()]  will call
file->f_op->read() function
File:[axfs_inode.c],  at line:[815],  [axfs_file_read()]
axfs_inode_number = 20
File:[axfs_inode.c],  at line:[818],  [axfs_file_read()]  array_index=336
File:[axfs_inode.c],  at line:[828],  [axfs_file_read()]  node_type = XIP



 <<  --------- Reading XIP page ------------ >>
File:[filemap_xip.c],  at line:[134],  [xip_file_read()]
File:[filemap_xip.c],  at line:[69],  [do_xip_mapping_read()]  calling
get_xip_page() function pointer

File:[axfs_inode.c],  at line:[996],  [axfs_get_xip_page()]
File:[axfs_inode.c],  at line:[1000],  [axfs_get_xip_page()]
axfs_get_xip_page:based on
axfs_inode_number:(20)array_index=(1443109011456)

File:[axfs_inode.c],  at line:[1002],  [axfs_get_xip_page()]
axfs_get_xip_page:array_index=336
File:[exec.c],  at line:[920],  [do_execve()]  retval of prepare_binprm() = 128
File:[exec.c],  at line:[925],  [do_execve()]  retval of
copy_strings_kernel() = 0
File:[exec.c],  at line:[935],  [do_execve()]  retval of copy_strings 2 = 0
File:[exec.c],  at line:[412],  [kernel_read()]  will call
file->f_op->read() function
File:[axfs_inode.c],  at line:[815],  [axfs_file_read()]
axfs_inode_number = 20
File:[axfs_inode.c],  at line:[818],  [axfs_file_read()]  array_index=336
File:[axfs_inode.c],  at line:[828],  [axfs_file_read()]  node_type = XIP



 <<  --------- Reading XIP page ------------ >>
File:[filemap_xip.c],  at line:[134],  [xip_file_read()]
File:[filemap_xip.c],  at line:[69],  [do_xip_mapping_read()]  calling
get_xip_page() function pointer

File:[axfs_inode.c],  at line:[996],  [axfs_get_xip_page()]
File:[axfs_inode.c],  at line:[1000],  [axfs_get_xip_page()]
axfs_get_xip_page:based on
axfs_inode_number:(20)array_index=(1443109011456)

File:[axfs_inode.c],  at line:[1002],  [axfs_get_xip_page()]
axfs_get_xip_page:array_index=336
File:[axfs_inode.c],  at line:[476],  [axfs_mmap()]
bob:file->f_mapping address = c0199734
File:[axfs_inode.c],  at line:[477],  [axfs_mmap()]
bob:file->f_mapping address->a_ops = c00e5e58
File:[binfmt_elf.c],  at line:[752],  [load_elf_binary()]  bob
commentted padzero(elf_bss)
File:[exec.c],  at line:[940],  [do_execve()]  retval of
search_binary_handler() = 0
File:[sys_arm.c],  at line:[273],  [sys_execve()]  do_execve return 0
ifconfig: no usable address families found
ifconfig: socket: Address family not supported by protocol





Test Case 2:   (fully Compressed pages ,no XIP,you will see no
./strace in axfs.xml)

/ $ ./strace -h
/ $
/ $ ./strace
in sys_execve() , filename=./strace
File:[exec.c],  at line:[412],  [kernel_read()]  will call
file->f_op->read() function
File:[axfs_inode.c],  at line:[815],  [axfs_file_read()]
axfs_inode_number = 13
File:[axfs_inode.c],  at line:[818],  [axfs_file_read()]  array_index=107
File:[axfs_inode.c],  at line:[828],  [axfs_file_read()]  node_type =
Compressed



 ///  --------- Reading Compressed page ------------ ///
File:[exec.c],  at line:[920],  [do_execve()]  retval of prepare_binprm() = 128
File:[exec.c],  at line:[925],  [do_execve()]  retval of
copy_strings_kernel() = 0
File:[exec.c],  at line:[935],  [do_execve()]  retval of copy_strings 2 = 0
File:[exec.c],  at line:[412],  [kernel_read()]  will call
file->f_op->read() function
File:[axfs_inode.c],  at line:[815],  [axfs_file_read()]
axfs_inode_number = 13
File:[axfs_inode.c],  at line:[818],  [axfs_file_read()]  array_index=107
File:[axfs_inode.c],  at line:[828],  [axfs_file_read()]  node_type =
Compressed



 ///  --------- Reading Compressed page ------------ ///
File:[axfs_inode.c],  at line:[476],  [axfs_mmap()]
bob:file->f_mapping address = c1f68994
File:[axfs_inode.c],  at line:[477],  [axfs_mmap()]
bob:file->f_mapping address->a_ops = c00e5e58
File:[binfmt_elf.c],  at line:[752],  [load_elf_binary()]  bob
commentted padzero(elf_bss)
File:[exec.c],  at line:[940],  [do_execve()]  retval of
search_binary_handler() = 0
File:[sys_arm.c],  at line:[273],  [sys_execve()]  do_execve return 0




./strace: -c and -ff are mutually exclusive options
/ $
/ $


Examples above can show that my XIP and compressed both work well.

Best Regards,
Bob

View attachment "axfs.xml" of type "text/xml" (3092 bytes)

View attachment "axfs_profiling_data.txt" of type "text/plain" (1597 bytes)

Download attachment "create_xip_image.log" of type "application/octet-stream" (42316 bytes)

View attachment "xip_booting.txt" of type "text/plain" (36438 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ