rpms/kernel/devel kernel-2.6.spec, 1.2864, 1.2865 linux-2.6-squashfs.patch, 1.15, 1.16 linux-2.6-squashfs-s390-dirty-memory-fix.patch, 1.2, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Dec 13 05:44:28 UTC 2006


Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv5793

Modified Files:
	kernel-2.6.spec linux-2.6-squashfs.patch 
Removed Files:
	linux-2.6-squashfs-s390-dirty-memory-fix.patch 
Log Message:
squashfs robustness fixes from Phillip Lougher.


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2864
retrieving revision 1.2865
diff -u -r1.2864 -r1.2865
--- kernel-2.6.spec	12 Dec 2006 23:09:43 -0000	1.2864
+++ kernel-2.6.spec	13 Dec 2006 05:44:25 -0000	1.2865
@@ -408,7 +408,6 @@
 # Filesystem stuff.
 # Squashfs
 Patch1400: linux-2.6-squashfs.patch
-Patch1401: linux-2.6-squashfs-s390-dirty-memory-fix.patch
 
 # Misc bits.
 Patch1600: linux-2.6-module_version.patch
@@ -889,7 +888,6 @@
 # Filesystem patches.
 # Squashfs
 %patch1400 -p1
-%patch1401 -p1
 
 # Misc fixes
 # Add missing MODULE_VERSION tags to some modules.

linux-2.6-squashfs.patch:
 fs/squashfs/inode.c            | 2299 +++++++++++++++++++++++++++++++++++++++++
 fs/squashfs/squashfs.h         |   87 +
 fs/squashfs/squashfs2_0.c      |  757 +++++++++++++
 include/linux/squashfs_fs.h    |  934 ++++++++++++++++
 include/linux/squashfs_fs_i.h  |   45 
 include/linux/squashfs_fs_sb.h |   76 +
 6 files changed, 4198 insertions(+)

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.15 -r 1.16 linux-2.6-squashfs.patch
Index: linux-2.6-squashfs.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-squashfs.patch,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- linux-2.6-squashfs.patch	12 Dec 2006 15:03:47 -0000	1.15
+++ linux-2.6-squashfs.patch	13 Dec 2006 05:44:25 -0000	1.16
@@ -1,91 +1,7 @@
-diff --new-file -urp linux-2.6.15/fs/Kconfig linux-2.6.15-squashfs3.0/fs/Kconfig
---- linux-2.6.15/fs/Kconfig	2006-03-01 22:37:27.000000000 +0000
-+++ linux-2.6.15-squashfs3.0/fs/Kconfig	2006-03-07 21:12:37.000000000 +0000
-@@ -1151,6 +1151,71 @@
- 
- 	  If unsure, say N.
- 
-+config SQUASHFS
-+	tristate "SquashFS 3.0 - Squashed file system support"
-+	select ZLIB_INFLATE
-+	help
-+	  Saying Y here includes support for SquashFS 3.0 (a Compressed Read-Only File
-+	  System).  Squashfs is a highly compressed read-only filesystem for Linux.
-+	  It uses zlib compression to compress both files, inodes and directories.
-+	  Inodes in the system are very small and all blocks are packed to minimise
-+	  data overhead. Block sizes greater than 4K are supported up to a maximum of 64K.
-+	  SquashFS 3.0 supports 64 bit filesystems and files (larger than 4GB), full
-+	  uid/gid information, hard links and timestamps.
-+
-+	  Squashfs is intended for general read-only filesystem use, for archival
-+	  use (i.e. in cases where a .tar.gz file may be used), and in embedded
-+	  systems where low overhead is needed.  Further information and filesystem tools
-+	  are available from http://squashfs.sourceforge.net.
-+
-+	  If you want to compile this as a module ( = code which can be
-+	  inserted in and removed from the running kernel whenever you want),
-+	  say M here and read <file:Documentation/modules.txt>.  The module
-+	  will be called squashfs.  Note that the root file system (the one
-+	  containing the directory /) cannot be compiled as a module.
-+
-+	  If unsure, say N.
-+
-+config SQUASHFS_EMBEDDED
-+
-+	bool "Additional options for memory-constrained systems" 
-+	depends on SQUASHFS
-+	default n
-+	help
-+	  Saying Y here allows you to specify cache sizes and how Squashfs
-+	  allocates memory.  This is only intended for memory constrained
-+	  systems.
-+
-+	  If unsure, say N.
-+
-+config SQUASHFS_FRAGMENT_CACHE_SIZE
-+	int "Number of fragments cached" if SQUASHFS_EMBEDDED
-+	depends on SQUASHFS
-+	default "3"
-+	help
-+	  By default SquashFS caches the last 3 fragments read from
-+	  the filesystem.  Increasing this amount may mean SquashFS
-+	  has to re-read fragments less often from disk, at the expense
-+	  of extra system memory.  Decreasing this amount will mean
-+	  SquashFS uses less memory at the expense of extra reads from disk.
-+
-+	  Note there must be at least one cached fragment.  Anything
-+	  much more than three will probably not make much difference.
-+
-+config SQUASHFS_VMALLOC
-+	bool "Use Vmalloc rather than Kmalloc" if SQUASHFS_EMBEDDED
-+	depends on SQUASHFS
-+	default n
-+	help
-+	  By default SquashFS uses kmalloc to obtain fragment cache memory.
-+	  Kmalloc memory is the standard kernel allocator, but it can fail
-+	  on memory constrained systems.  Because of the way Vmalloc works,
-+	  Vmalloc can succeed when kmalloc fails.  Specifying this option
-+	  will make SquashFS always use Vmalloc to allocate the
-+	  fragment cache memory.
-+
-+	  If unsure, say N.
-+
- config VXFS_FS
- 	tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
- 	help
---- linux-2.6.15/fs/Makefile	2006-03-01 22:37:27.000000000 +0000
-+++ linux-2.6.15-squashfs3.0/fs/Makefile	2006-03-07 21:12:37.000000000 +0000
-@@ -55,6 +55,7 @@
- obj-$(CONFIG_JBD)		+= jbd/
- obj-$(CONFIG_EXT2_FS)		+= ext2/
- obj-$(CONFIG_CRAMFS)		+= cramfs/
-+obj-$(CONFIG_SQUASHFS)		+= squashfs/
- obj-$(CONFIG_RAMFS)		+= ramfs/
- obj-$(CONFIG_HUGETLBFS)		+= hugetlbfs/
- obj-$(CONFIG_CODA_FS)		+= coda/
---- linux-2.6.15/fs/squashfs/inode.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.15-squashfs3.0/fs/squashfs/inode.c	2006-03-07 21:12:37.000000000 +0000
-@@ -0,0 +1,2127 @@
+diff -urpN --exclude-from=/home/davej/.exclude vanilla/fs/squashfs/inode.c squash/fs/squashfs/inode.c
+--- vanilla/fs/squashfs/inode.c	1969-12-31 19:00:00.000000000 -0500
++++ squash/fs/squashfs/inode.c	2006-12-11 20:41:22.000000000 -0500
+@@ -0,0 +1,2299 @@
 +/*
 + * Squashfs - a compressed read only filesystem for Linux
 + *
@@ -114,6 +30,7 @@
 +#include <linux/module.h>
 +#include <linux/errno.h>
 +#include <linux/slab.h>
++#include <linux/zlib.h>
 +#include <linux/fs.h>
 +#include <linux/smp_lock.h>
 +#include <linux/slab.h>
@@ -124,7 +41,6 @@
 +#include <linux/init.h>
 +#include <linux/dcache.h>
 +#include <linux/wait.h>
-+#include <linux/zlib.h>
 +#include <linux/blkdev.h>
 +#include <linux/vmalloc.h>
 +#include <asm/uaccess.h>
@@ -144,15 +60,14 @@
 +static void destroy_inodecache(void);
 +static struct dentry *squashfs_lookup(struct inode *, struct dentry *,
 +				struct nameidata *);
-+static struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode);
++static int squashfs_read_inode(struct inode *i, squashfs_inode_t inode);
 +static long long read_blocklist(struct inode *inode, int index,
 +				int readahead_blks, char *block_list,
 +				unsigned short **block_p, unsigned int *bsize);
-+static struct super_block *squashfs_get_sb(struct file_system_type *, int,
-+				const char *, void *, struct vfsmount *);
-+
-+
-+static z_stream stream;
++static int squashfs_get_sb(struct file_system_type *,int, const char *, void *,
++				struct vfsmount *);
++static void vfs_read_inode(struct inode *i);
++static struct dentry *squashfs_get_parent(struct dentry *child);
 +
 +static struct file_system_type squashfs_fs_type = {
 +	.owner = THIS_MODULE,
@@ -166,11 +81,23 @@
 +	DT_UNKNOWN, DT_DIR, DT_REG, DT_LNK, DT_BLK, DT_CHR, DT_FIFO, DT_SOCK
 +};
 +
-+static struct super_operations squashfs_ops = {
++static struct super_operations squashfs_super_ops = {
++	.alloc_inode = squashfs_alloc_inode,
++	.destroy_inode = squashfs_destroy_inode,
++	.statfs = squashfs_statfs,
++	.put_super = squashfs_put_super,
++};
++
++static struct super_operations squashfs_export_super_ops = {
 +	.alloc_inode = squashfs_alloc_inode,
 +	.destroy_inode = squashfs_destroy_inode,
 +	.statfs = squashfs_statfs,
 +	.put_super = squashfs_put_super,
++	.read_inode = vfs_read_inode
++};
++
++struct export_operations squashfs_export_ops = {
++	.get_parent = squashfs_get_parent
 +};
 +
 +SQSH_EXTERN struct address_space_operations squashfs_symlink_aops = {
@@ -264,14 +191,15 @@
 +
 +SQSH_EXTERN unsigned int squashfs_read_data(struct super_block *s, char *buffer,
 +			long long index, unsigned int length,
-+			long long *next_index)
++			long long *next_index, int srclength)
 +{
 +	struct squashfs_sb_info *msblk = s->s_fs_info;
++	struct squashfs_super_block *sblk = &msblk->sblk;
 +	struct buffer_head *bh[((SQUASHFS_FILE_MAX_SIZE - 1) >>
 +			msblk->devblksize_log2) + 2];
 +	unsigned int offset = index & ((1 << msblk->devblksize_log2) - 1);
 +	unsigned int cur_index = index >> msblk->devblksize_log2;
-+	int bytes, avail_bytes, b = 0, k;
++	int bytes, avail_bytes, b = 0, k = 0;
 +	char *c_buffer;
 +	unsigned int compressed;
 +	unsigned int c_byte = length;
@@ -282,8 +210,11 @@
 +		c_buffer = compressed ? msblk->read_data : buffer;
 +		c_byte = SQUASHFS_COMPRESSED_SIZE_BLOCK(c_byte);
 +
-+		TRACE("Block @ 0x%llx, %scompressed size %d\n", index, compressed
-+					? "" : "un", (unsigned int) c_byte);
++		TRACE("Block @ 0x%llx, %scompressed size %d, src size %d\n", index, compressed
++					? "" : "un", (unsigned int) c_byte, srclength);
++
++		if (c_byte > srclength || index < 0 || (index + c_byte) > sblk->bytes_used)
++			goto read_failure;
 +
 +		if (!(bh[0] = sb_getblk(s, cur_index)))
 +			goto block_release;
@@ -295,6 +226,9 @@
 +		}
[...2035 lines suppressed...]
--					(sblk->fragments) |
--					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+	if (!squashfs_read_data(s, (char *) msblk->fragment_index,
-+			sblk->fragment_table_start, length |
-+			SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, length)) {
- 		ERROR("unable to read fragment index table\n");
- 		return 0;
- 	}
-@@ -982,9 +1004,11 @@ static int squashfs_fill_super(struct su
- 	init_waitqueue_head(&msblk->waitq);
- 	init_waitqueue_head(&msblk->fragment_wait_queue);
- 
-+	sblk->bytes_used = sizeof(struct squashfs_super_block);
- 	if (!squashfs_read_data(s, (char *) sblk, SQUASHFS_START,
- 					sizeof(struct squashfs_super_block) |
--					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL,
-+					sizeof(struct squashfs_super_block))) {
- 		SERROR("unable to read superblock\n");
- 		goto failed_mount;
- 	}
-@@ -1012,6 +1036,15 @@ static int squashfs_fill_super(struct su
- 	if(!supported_squashfs_filesystem(msblk, silent))
- 		goto failed_mount;
- 
-+        /* Check the filesystem does not extend beyond the end of the
-+           block device */
-+        if(sblk->bytes_used < 0 || sblk->bytes_used > i_size_read(s->s_bdev->bd_inode))
-+                goto failed_mount;
-+
-+        /* Check the root inode for sanity */
-+        if (SQUASHFS_INODE_OFFSET(sblk->root_inode) > SQUASHFS_METADATA_SIZE)
-+                goto failed_mount;
-+
- 	TRACE("Found valid superblock on %s\n", bdevname(s->s_bdev, b));
- 	TRACE("Inodes are %scompressed\n",
- 					SQUASHFS_UNCOMPRESSED_INODES
-@@ -1081,7 +1114,9 @@ static int squashfs_fill_super(struct su
- 		if (!squashfs_read_data(s, (char *) &suid, sblk->uid_start,
- 					((sblk->no_uids + sblk->no_guids) *
- 					 sizeof(unsigned int)) |
--					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL,
-+					(sblk->no_uids + sblk->no_guids) *
-+					sizeof(unsigned int))) {
- 			ERROR("unable to read uid/gid table\n");
- 			goto failed_mount;
- 		}
-@@ -1092,7 +1127,9 @@ static int squashfs_fill_super(struct su
- 		if (!squashfs_read_data(s, (char *) msblk->uid, sblk->uid_start,
- 					((sblk->no_uids + sblk->no_guids) *
- 					 sizeof(unsigned int)) |
--					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL,
-+					(sblk->no_uids + sblk->no_guids) *
-+					sizeof(unsigned int))) {
- 			ERROR("unable to read uid/gid table\n");
- 			goto failed_mount;
- 		}
-@@ -1518,7 +1555,8 @@ static int squashfs_readpage(struct file
- 		down(&msblk->read_page_mutex);
- 		
- 		if (!(bytes = squashfs_read_data(inode->i_sb, msblk->read_page,
--					block, bsize, NULL))) {
-+					block, bsize, NULL,
-+					msblk->read_size))) {
- 			ERROR("Unable to read page, block %llx, size %x\n", block,
- 					bsize);
- 			up(&msblk->read_page_mutex);
-@@ -1618,15 +1656,12 @@ static int squashfs_readpage4K(struct fi
- 
- 	if (page->index >= ((i_size_read(inode) + PAGE_CACHE_SIZE - 1) >>
- 					PAGE_CACHE_SHIFT)) {
--		pageaddr = kmap_atomic(page, KM_USER0);
- 		block_list = NULL;
- 		goto skip_read;
- 	}
- 
- 	if (!(block_list = kmalloc(SIZE, GFP_KERNEL))) {
- 		ERROR("Failed to allocate block_list\n");
--		pageaddr = kmap_atomic(page, KM_USER0);
--		block_list = NULL;
- 		goto skip_read;
- 	}
- 
-@@ -1638,11 +1673,12 @@ static int squashfs_readpage4K(struct fi
- 
- 		down(&msblk->read_page_mutex);
- 		bytes = squashfs_read_data(inode->i_sb, msblk->read_page, block,
--					bsize, NULL);
--		pageaddr = kmap_atomic(page, KM_USER0);
--		if (bytes)
-+					bsize, NULL, msblk->read_size);
-+		if (bytes) {
-+			pageaddr = kmap_atomic(page, KM_USER0);
- 			memcpy(pageaddr, msblk->read_page, bytes);
--		else
-+			kunmap_atomic(pageaddr, KM_USER0);
-+		} else
- 			ERROR("Unable to read page, block %llx, size %x\n",
- 					block, bsize);
- 		up(&msblk->read_page_mutex);
-@@ -1652,11 +1688,12 @@ static int squashfs_readpage4K(struct fi
- 					SQUASHFS_I(inode)->
- 					u.s1.fragment_start_block,
- 					SQUASHFS_I(inode)-> u.s1.fragment_size);
--		pageaddr = kmap_atomic(page, KM_USER0);
- 		if (fragment) {
- 			bytes = i_size_read(inode) & (sblk->block_size - 1);
-+			pageaddr = kmap_atomic(page, KM_USER0);
- 			memcpy(pageaddr, fragment->data + SQUASHFS_I(inode)->
- 					u.s1.fragment_offset, bytes);
-+			kunmap_atomic(pageaddr, KM_USER0);
- 			release_cached_fragment(msblk, fragment);
- 		} else
- 			ERROR("Unable to read page, block %llx, size %x\n",
-@@ -1666,6 +1703,7 @@ static int squashfs_readpage4K(struct fi
- 	}
- 
- skip_read:
-+	pageaddr = kmap_atomic(page, KM_USER0);
- 	memset(pageaddr + bytes, 0, PAGE_CACHE_SIZE - bytes);
- 	kunmap_atomic(pageaddr, KM_USER0);
- 	flush_dcache_page(page);
-diff -Nurp linux/fs/squashfs/squashfs2_0.c linux-mokb/fs/squashfs/squashfs2_0.c
---- linux/fs/squashfs/squashfs2_0.c	2006-11-14 23:36:59.000000000 +0000
-+++ linux-mokb/fs/squashfs/squashfs2_0.c	2006-11-15 02:18:15.000000000 +0000
-@@ -73,12 +73,13 @@ static int read_fragment_index_table_2(s
- 	}
-    
- 	if (SQUASHFS_FRAGMENT_INDEX_BYTES_2(sblk->fragments) &&
--					!squashfs_read_data(s, (char *)
--					msblk->fragment_index_2,
--					sblk->fragment_table_start,
--					SQUASHFS_FRAGMENT_INDEX_BYTES_2
--					(sblk->fragments) |
--					SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
-+			!squashfs_read_data(s, (char *)
-+			msblk->fragment_index_2,
-+			sblk->fragment_table_start,
-+			SQUASHFS_FRAGMENT_INDEX_BYTES_2
-+			(sblk->fragments) |
-+			SQUASHFS_COMPRESSED_BIT_BLOCK, NULL,
-+			SQUASHFS_FRAGMENT_INDEX_BYTES_2(sblk->fragments))) {
- 		ERROR("unable to read fragment index table\n");
- 		return 0;
- 	}
-diff -Nurp linux/fs/squashfs/squashfs.h linux-mokb/fs/squashfs/squashfs.h
---- linux/fs/squashfs/squashfs.h	2006-11-14 23:36:59.000000000 +0000
-+++ linux-mokb/fs/squashfs/squashfs.h	2006-11-15 01:59:01.000000000 +0000
-@@ -49,7 +49,7 @@ static inline struct squashfs_inode_info
- #define SQSH_EXTERN
- extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
- 				long long index, unsigned int length,
--				long long *next_index);
-+				long long *next_index, int srclength);
- extern int squashfs_get_cached_block(struct super_block *s, char *buffer,
- 				long long block, unsigned int offset,
- 				int length, long long *next_block,
---- linux-2.6.18.noarch/fs/squashfs/inode.c~	2006-11-17 15:29:09.000000000 -0500
-+++ linux-2.6.18.noarch/fs/squashfs/inode.c	2006-11-17 15:29:51.000000000 -0500
-@@ -2148,9 +2148,7 @@ static int __init init_inodecache(void)
- 
- static void destroy_inodecache(void)
- {
--	if (kmem_cache_destroy(squashfs_inode_cachep))
--		printk(KERN_INFO "squashfs_inode_cache: not all structures "
--			"were freed\n");
-+	kmem_cache_destroy(squashfs_inode_cachep);
- }
- 
- 
---- linux-2.6.17.noarch/fs/squashfs/inode.c~	2006-07-12 13:54:31.000000000 -0400
-+++ linux-2.6.17.noarch/fs/squashfs/inode.c	2006-07-12 13:54:53.000000000 -0400
-@@ -607,7 +607,6 @@ static struct inode *squashfs_iget(struc
- 			i->i_fop = &generic_ro_fops;
- 			i->i_mode |= S_IFREG;
- 			i->i_blocks = ((i->i_size - 1) >> 9) + 1;
--			i->i_blksize = PAGE_CACHE_SIZE;
- 			SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
- 			SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
- 			SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;
-@@ -660,7 +659,6 @@ static struct inode *squashfs_iget(struc
- 			i->i_fop = &generic_ro_fops;
- 			i->i_mode |= S_IFREG;
- 			i->i_blocks = ((i->i_size - 1) >> 9) + 1;
--			i->i_blksize = PAGE_CACHE_SIZE;
- 			SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
- 			SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
- 			SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;
---- linux-2.6.17.noarch/fs/squashfs/squashfs2_0.c~	2006-07-12 13:55:43.000000000 -0400
-+++ linux-2.6.17.noarch/fs/squashfs/squashfs2_0.c	2006-07-12 13:55:46.000000000 -0400
-@@ -228,7 +228,6 @@ static struct inode *squashfs_iget_2(str
- 			i->i_atime.tv_sec = inodep->mtime;
- 			i->i_ctime.tv_sec = inodep->mtime;
- 			i->i_blocks = ((i->i_size - 1) >> 9) + 1;
--			i->i_blksize = PAGE_CACHE_SIZE;
- 			SQUASHFS_I(i)->u.s1.fragment_start_block = frag_blk;
- 			SQUASHFS_I(i)->u.s1.fragment_size = frag_size;
- 			SQUASHFS_I(i)->u.s1.fragment_offset = inodep->offset;


--- linux-2.6-squashfs-s390-dirty-memory-fix.patch DELETED ---




More information about the fedora-cvs-commits mailing list