Adrian Bunk wrote:
<-- snip --> ... LD .tmp_vmlinux1 lib/built-in.o: In function `lzo1x_1_compress': (.text+0x13eae): multiple definition of `lzo1x_1_compress' fs/built-in.o:(.text+0x117075): first defined here make[1]: *** [.tmp_vmlinux1] Error 1 <-- snip --> AFAIR, we once had a patch in -mm changing reiser4 to use the LZO code that is now in the kernel? cu Adrian
Sorry, guys, I am not happy with the modified LZO: the compressor tries to test bytes which are out of bounds. The attached module testlzo.c causes an oops in the second pass: AFAIK, both, @m and @m_pos should be in [wrkmem, wrkmem + 64K); I have attached trace.txt with their actual values. Not ready to migrate to this library. Any ideas? Thanks, Edward. P.S. kernel: 2.6.23-rc1-mm1 box: x86
#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/lzo.h> #include <linux/vmalloc.h> MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Compress 64K zeroed chunk"); #define CHUNK_SIZE 65536 #define NR_PASSES 2 static int __init lkp_init( void ) { int i; int ret; void * wrkmem; unsigned char * src_buf; unsigned char * dst_buf; size_t src_len; size_t dst_len; src_len = CHUNK_SIZE; dst_len = lzo1x_worst_compress(src_len); printk("<1> Testing LZO: start...\n"); wrkmem = vmalloc(LZO1X_1_MEM_COMPRESS); if (!wrkmem) goto enomem; src_buf = vmalloc(src_len); if (!src_buf) { vfree(wrkmem); goto enomem; } memset(src_buf, 0, src_len); dst_buf = vmalloc(dst_len); if (!dst_buf) { vfree(wrkmem); vfree(src_buf); goto enomem; } for (i = 0; i < NR_PASSES; i++) { size_t out_len; ret = lzo1x_1_compress(src_buf, src_len, dst_buf, &out_len, wrkmem); if (ret) break; printk("pass %d: compressed to %d bytes\n", i, out_len); } vfree(wrkmem); vfree(src_buf); vfree(dst_buf); return ret; enomem: printk("vmalloc failed\n"); return -ENOMEM; } static void __exit lkp_cleanup( void ) { printk("<1>Testing LZO : finish\n"); } module_init(lkp_init); module_exit(lkp_cleanup);
Program received signal SIGSEGV, Segmentation fault. 0xc02efec8 in _lzo1x_1_do_compress (in=0xe08c9000 "", in_len=Variable "in_len" is not available. ) at lzo1x_compress.c:130 130 ip++; (gdb) p m $2 = (const unsigned char *) 0xe08d9000 <Address 0xe08d9000 out of bounds> (gdb) p wrkmem $3 = (void *) 0xe08b8000 (gdb) p m - wrkmem $4 = 135168 (gdb) p m_pos $5 = (const unsigned char *) 0xe08c9005 "" (gdb) p m_pos - wrkmem $6 = 69637