rpms/kernel/FC-5 kernel-2.6.spec, 1.2255, 1.2256 linux-2.6-squashfs.patch, 1.4, 1.5 linux-2.6-inode-diet-squashfs.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Dec 13 18:50:03 UTC 2006


Author: davej

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

Modified Files:
	kernel-2.6.spec linux-2.6-squashfs.patch 
Removed Files:
	linux-2.6-inode-diet-squashfs.patch 
Log Message:
* Wed Dec 13 2006 Dave Jones <davej at redhat.com>
- squashfs robustness fixes from Phillip Lougher.
- lower max CPU count for x86-64 to 64 CPUs.



Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/FC-5/kernel-2.6.spec,v
retrieving revision 1.2255
retrieving revision 1.2256
diff -u -r1.2255 -r1.2256
--- kernel-2.6.spec	7 Dec 2006 20:50:55 -0000	1.2255
+++ kernel-2.6.spec	13 Dec 2006 18:50:01 -0000	1.2256
@@ -350,7 +350,6 @@
 Patch1422: linux-2.6-inode-diet-move-i_bdev-into-a-union.patch
 Patch1423: linux-2.6-inode-diet-move-i_cdev-into-a-union.patch
 Patch1424: linux-2.6-inode-diet-eliminate-i_blksize-and-use-a-per-superblock-default.patch
-Patch1425: linux-2.6-inode-diet-squashfs.patch
 Patch1426: linux-2.6-inode-diet-xfs.patch
 Patch1427: linux-2.6-inode-diet-fix-splice.patch
 
@@ -895,7 +894,6 @@
 %patch1422 -p1
 %patch1423 -p1
 %patch1424 -p1
-%patch1425 -p1
 %patch1426 -p1
 %patch1427 -p1
 
@@ -1647,6 +1645,10 @@
 %endif
 
 %changelog
+* Wed Dec 13 2006 Dave Jones <davej at redhat.com>
+- squashfs robustness fixes from Phillip Lougher.
+- lower max CPU count for x86-64 to 64 CPUs.
+
 * Thu Dec  7 2006 Juan Quintela <quintela at redhat.com>
 - update xen to 2.6.18.5.
 - Fix bug 211986 on xen eventchn (Glaubert).

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.4 -r 1.5 linux-2.6-squashfs.patch
Index: linux-2.6-squashfs.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/FC-5/linux-2.6-squashfs.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-squashfs.patch	16 Nov 2006 21:50:30 -0000	1.4
+++ linux-2.6-squashfs.patch	13 Dec 2006 18:50:01 -0000	1.5
@@ -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 @@
 +		}
[...1985 lines suppressed...]
- 			if (buffer)
- 				memcpy(buffer, msblk->block_cache[i].data +
- 						offset, length);
-@@ -442,6 +462,7 @@ SQSH_EXTERN struct squashfs_fragment_cac
- {
- 	int i, n;
- 	struct squashfs_sb_info *msblk = s->s_fs_info;
-+        struct squashfs_super_block *sblk = &msblk->sblk;
- 
- 	while ( 1 ) {
- 		down(&msblk->fragment_mutex);
-@@ -487,7 +508,8 @@ SQSH_EXTERN struct squashfs_fragment_cac
- 
- 			if (!(msblk->fragment[i].length = squashfs_read_data(s,
- 						msblk->fragment[i].data,
--						start_block, length, NULL))) {
-+						start_block, length, NULL,
-+						sblk->block_size))) {
- 				ERROR("Unable to read fragment cache block "
- 							"[%llx]\n", start_block);
- 				msblk->fragment[i].locked = 0;
-@@ -876,6 +898,10 @@ static int read_fragment_index_table(str
- {
- 	struct squashfs_sb_info *msblk = s->s_fs_info;
- 	struct squashfs_super_block *sblk = &msblk->sblk;
-+	unsigned int length = SQUASHFS_FRAGMENT_INDEX_BYTES(sblk->fragments);
-+
-+	if (length == 0)
-+		return 1;
- 
- 	/* Allocate fragment index table */
- 	if (!(msblk->fragment_index = kmalloc(SQUASHFS_FRAGMENT_INDEX_BYTES
-@@ -884,13 +910,9 @@ static int read_fragment_index_table(str
- 		return 0;
- 	}
-    
--	if (SQUASHFS_FRAGMENT_INDEX_BYTES(sblk->fragments) &&
--					!squashfs_read_data(s, (char *)
--					msblk->fragment_index,
--					sblk->fragment_table_start,
--					SQUASHFS_FRAGMENT_INDEX_BYTES
--					(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-inode-diet-squashfs.patch DELETED ---




More information about the fedora-cvs-commits mailing list