Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
49
.gitignore
vendored
49
.gitignore
vendored
@ -1 +1,48 @@
|
||||
SOURCES/squashfs4.3.tar.gz
|
||||
squashfs-4.1.tar.bz2
|
||||
/squashfs-4.1.tar.bz2
|
||||
/squashfs4.1.tar.gz
|
||||
/squashfs-4.2-2010-12-23.bz2
|
||||
/squashfs-4.2-20101223.bz2
|
||||
/squashfs-4.2-20101231.bz2
|
||||
/squashfs4.2.tar.gz
|
||||
/squashfs4.3.tar.gz
|
||||
/unsquashfs.1
|
||||
/mksquashfs.1
|
||||
/squashfs-tools-c570c6188811088b12ffdd9665487a2960c997a0.tar.gz
|
||||
/4.4-git.1.tar.gz
|
||||
/squashfs-tools-4.5.tar.gz
|
||||
/4.5.tar.gz
|
||||
/squashfs-tools-e0485802ec72996c20026da320650d8362f555bd.tar.gz
|
||||
/squashfs-tools-5ae7238a0ae6fc420f55227d052ce9b1c66a9d0f.tar.gz
|
||||
/squashfs-tools-d5a583e4edce3df9f0c3bca84bff4f1d5ad3d09c.tar.gz
|
||||
/squashfs-tools-11c9591260599b7874841db6f69ae570708a4077.tar.gz
|
||||
/squashfs-tools-8a9d02e0027c69e6f47d8c2ed995d8c755c9581b.tar.gz
|
||||
/squashfs-tools-d61eb68d75b32977b6c5a8b2d2fe57cbef0d6b4a.tar.gz
|
||||
/squashfs-tools-7f9203e31bae003d12c0fc81a4b32097d17b5618.tar.gz
|
||||
/squashfs-tools-bd186a77fe670d635e65b021b3d05fc6e67f8d07.tar.gz
|
||||
/squashfs-tools-9e46a75985f0b236797976e387e8bce717e7a2d5.tar.gz
|
||||
/squashfs-tools-0425d3d2d87a7775864bc6d04a4c8c45b93fa9b2.tar.gz
|
||||
/squashfs-tools-e7e96fe6ecd5c01aada20908188d9d0096ad0bd8.tar.gz
|
||||
/squashfs-tools-a8f61e2a38992d4cd967303a61277123fcd66681.tar.gz
|
||||
/squashfs-tools-de944c3e6fc8861d8a8844186983d1295415fdaf.tar.gz
|
||||
/squashfs-tools-f491ad858bcacf32dab2b37b3b0b325aa0ea6668.tar.gz
|
||||
/squashfs-tools-75951fb96de64e8062306359c87d987b527a42d0.tar.gz
|
||||
/squashfs-tools-f3783bbec5b0f105c6571699d3fd38803a345b12.tar.gz
|
||||
/squashfs-tools-bc0c097be93154997fe0576181e5c12d746a1420.tar.gz
|
||||
/squashfs-tools-2dfbcdac38bc42af4b200a1a1e86d3154e079e04.tar.gz
|
||||
/squashfs-tools-c883f3212cf5004c49121e0803f12d26d0db6a97.tar.gz
|
||||
/squashfs-tools-263a14e4d1ec93fbd192289bc3aae0cac2485221.tar.gz
|
||||
/squashfs-tools-2baf12e55af5a519e1285437343d3a606962a4b6.tar.gz
|
||||
/squashfs-tools-580b4e122471c11dffb7dcf1e392a72c8dcb6512.tar.gz
|
||||
/squashfs-tools-8b6ee895c763f0b8e2f394d83e93fc5a3e51942f.tar.gz
|
||||
/squashfs-tools-2ac40ca6d23cad73fb5b5da0c915382eaa31378d.tar.gz
|
||||
/squashfs-tools-de61d00ffd2689d122696d4fc39f584c72fb24cf.tar.gz
|
||||
/squashfs-tools-76624e1e6be8e16ca08273eaadb82d7b38f3d5a5.tar.gz
|
||||
/squashfs-tools-4.5.1.tar.gz
|
||||
/squashfs-tools-7cf6cee6acfa61a423d63168ad198a3bfafacda8.tar.gz
|
||||
/squashfs-tools-746a81c8ea15e0573cc6abca9dc52e265d43a049.tar.gz
|
||||
/squashfs-tools-1eaad6d730604131f0da0c675e547cfe544ddcfa.tar.gz
|
||||
/squashfs-tools-aaf011a868c786b06e74cbdaf860d45793939f35.tar.gz
|
||||
/squashfs-tools-36abab0ad661247498834c2e7f5e1ec476f2081d.tar.gz
|
||||
/squashfs-tools-squashfs-tools-4.6.tar.gz
|
||||
/squashfs-tools-4.6.1.tar.gz
|
||||
|
33
0001-xattrs-fix-out-of-bounds-access-again.patch
Normal file
33
0001-xattrs-fix-out-of-bounds-access-again.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 5b2b9acd762e859822c99c5262d0bcbccff619de Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Wed, 15 Mar 2023 12:35:38 -0700
|
||||
Subject: [PATCH] xattrs: fix out of bounds access (again)
|
||||
|
||||
This restores the fix from c5db34e , which was somehow lost in
|
||||
83b2f3a . `j` is not available after the loop is done, we need
|
||||
to use i. We use `i - 1` because, of course, list indexes start
|
||||
at 0.
|
||||
|
||||
Fixes https://github.com/plougher/squashfs-tools/issues/230
|
||||
|
||||
Signed-off-by: Adam Williamson <awilliam@redhat.com>
|
||||
---
|
||||
squashfs-tools/xattr.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/squashfs-tools/xattr.c b/squashfs-tools/xattr.c
|
||||
index d48d950..32343f5 100644
|
||||
--- a/squashfs-tools/xattr.c
|
||||
+++ b/squashfs-tools/xattr.c
|
||||
@@ -838,7 +838,7 @@ int read_xattrs(void *d, int type)
|
||||
for(j = 1; j < i; j++)
|
||||
xattr_list[j - 1].vnext = &xattr_list[j];
|
||||
|
||||
- xattr_list[j].vnext = NULL;
|
||||
+ xattr_list[i - 1].vnext = NULL;
|
||||
head = xattr_list;
|
||||
|
||||
sort_xattr_list(&head, i);
|
||||
--
|
||||
2.39.2
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- squashfs-tools/mksquashfs.c.orig 2014-09-13 11:08:27.352318167 -0500
|
||||
+++ squashfs-tools/mksquashfs.c 2014-09-13 11:09:36.701132044 -0500
|
||||
@@ -2055,7 +2055,7 @@
|
||||
|
||||
inline int is_fragment(struct inode_info *inode)
|
||||
{
|
||||
- int file_size = inode->buf.st_size;
|
||||
+ off_t file_size = inode->buf.st_size;
|
||||
|
||||
/*
|
||||
* If this block is to be compressed differently to the
|
@ -1,477 +0,0 @@
|
||||
diff -Nupr a/squashfs-tools/Makefile b/squashfs-tools/Makefile
|
||||
--- a/squashfs-tools/Makefile 2023-06-26 23:57:01.519732066 -0500
|
||||
+++ b/squashfs-tools/Makefile 2023-06-26 23:57:52.192705923 -0500
|
||||
@@ -117,7 +117,8 @@ MKSQUASHFS_OBJS = mksquashfs.o read_fs.o
|
||||
caches-queues-lists.o
|
||||
|
||||
UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o \
|
||||
- unsquash-4.o unsquash-1234.o swap.o compressor.o unsquashfs_info.o
|
||||
+ unsquash-4.o unsquash-1234.o unsquash-12.o swap.o compressor.o \
|
||||
+ unsquashfs_info.o
|
||||
|
||||
CFLAGS ?= -O2
|
||||
CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
|
||||
@@ -294,6 +295,8 @@ unsquash-4.o: unsquashfs.h unsquash-4.c
|
||||
|
||||
unsquash-1234.o: unsquash-1234.c
|
||||
|
||||
+unsquash-12.o: unsquash-12.c unsquashfs.h
|
||||
+
|
||||
unsquashfs_xattr.o: unsquashfs_xattr.c unsquashfs.h squashfs_fs.h xattr.h
|
||||
|
||||
unsquashfs_info.o: unsquashfs.h squashfs_fs.h
|
||||
diff -Nupr a/squashfs-tools/unsquash-1234.c b/squashfs-tools/unsquash-1234.c
|
||||
--- a/squashfs-tools/unsquash-1234.c 2023-06-26 23:57:01.519732066 -0500
|
||||
+++ b/squashfs-tools/unsquash-1234.c 2023-06-26 23:57:52.192705923 -0500
|
||||
@@ -25,6 +25,8 @@
|
||||
* unsquash-4.
|
||||
*/
|
||||
|
||||
+#include "unsquashfs.h"
|
||||
+
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/*
|
||||
@@ -56,3 +58,23 @@ int check_name(char *name, int size)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Check directory for duplicate names. As the directory should be sorted,
|
||||
+ * duplicates will be consecutive. Obviously we also need to check if the
|
||||
+ * directory has been deliberately unsorted, to evade this check.
|
||||
+ */
|
||||
+int check_directory(struct dir *dir)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct dir_ent *ent;
|
||||
+
|
||||
+ if (dir->dir_count < 2)
|
||||
+ return TRUE;
|
||||
+
|
||||
+ for (ent = dir->dirs, i = 0; i < dir->dir_count - 1; ent = ent->next, i++)
|
||||
+ if (strcmp(ent->name, ent->next->name) >= 0)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
diff -Nupr a/squashfs-tools/unsquash-12.c b/squashfs-tools/unsquash-12.c
|
||||
--- a/squashfs-tools/unsquash-12.c 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ b/squashfs-tools/unsquash-12.c 2023-06-26 23:57:52.192705923 -0500
|
||||
@@ -0,0 +1,103 @@
|
||||
+/*
|
||||
+ * Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
+ * filesystem.
|
||||
+ *
|
||||
+ * Copyright (c) 2021
|
||||
+ * Phillip Lougher <phillip@squashfs.org.uk>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2,
|
||||
+ * or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+ *
|
||||
+ * unsquash-12.c
|
||||
+ *
|
||||
+ * Helper functions used by unsquash-1 and unsquash-2.
|
||||
+ */
|
||||
+
|
||||
+#include "unsquashfs.h"
|
||||
+
|
||||
+/*
|
||||
+ * Bottom up linked list merge sort.
|
||||
+ *
|
||||
+ */
|
||||
+void sort_directory(struct dir *dir)
|
||||
+{
|
||||
+ struct dir_ent *cur, *l1, *l2, *next;
|
||||
+ int len1, len2, stride = 1;
|
||||
+
|
||||
+ if (dir->dir_count < 2)
|
||||
+ return;
|
||||
+
|
||||
+ /*
|
||||
+ * We can consider our linked-list to be made up of stride length
|
||||
+ * sublists. Each iteration around this loop merges adjacent
|
||||
+ * stride length sublists into larger 2*stride sublists. We stop
|
||||
+ * when stride becomes equal to the entire list.
|
||||
+ *
|
||||
+ * Initially stride = 1 (by definition a sublist of 1 is sorted), and
|
||||
+ * these 1 element sublists are merged into 2 element sublists, which
|
||||
+ * are then merged into 4 element sublists and so on.
|
||||
+ */
|
||||
+ do {
|
||||
+ l2 = dir->dirs; /* head of current linked list */
|
||||
+ cur = NULL; /* empty output list */
|
||||
+
|
||||
+ /*
|
||||
+ * Iterate through the linked list, merging adjacent sublists.
|
||||
+ * On each interation l2 points to the next sublist pair to be
|
||||
+ * merged (if there's only one sublist left this is simply added
|
||||
+ * to the output list)
|
||||
+ */
|
||||
+ while (l2) {
|
||||
+ l1 = l2;
|
||||
+ for (len1 = 0; l2 && len1 < stride; len1 ++, l2 = l2->next);
|
||||
+ len2 = stride;
|
||||
+
|
||||
+ /*
|
||||
+ * l1 points to first sublist.
|
||||
+ * l2 points to second sublist.
|
||||
+ * Merge them onto the output list
|
||||
+ */
|
||||
+ while (len1 && l2 && len2) {
|
||||
+ if(strcmp(l1->name, l2->name) <= 0) {
|
||||
+ next = l1;
|
||||
+ l1 = l1->next;
|
||||
+ len1 --;
|
||||
+ } else {
|
||||
+ next = l2;
|
||||
+ l2 = l2->next;
|
||||
+ len2 --;
|
||||
+ }
|
||||
+
|
||||
+ if (cur) {
|
||||
+ cur->next = next;
|
||||
+ cur = next;
|
||||
+ } else
|
||||
+ dir->dirs = cur = next;
|
||||
+ }
|
||||
+ /*
|
||||
+ * One sublist is now empty, copy the other one onto the
|
||||
+ * output list
|
||||
+ */
|
||||
+ for (; len1; len1 --, l1 = l1->next) {
|
||||
+ if(cur) {
|
||||
+ cur->next = l1;
|
||||
+ cur = l1;
|
||||
+ } else
|
||||
+ dir->dirs = cur = l1;
|
||||
+ }
|
||||
+ }
|
||||
+ cur->next = NULL;
|
||||
+ stride = stride << 1;
|
||||
+ } while(stride < dir->dir_count);
|
||||
+}
|
||||
diff -Nupr a/squashfs-tools/unsquash-1.c b/squashfs-tools/unsquash-1.c
|
||||
--- a/squashfs-tools/unsquash-1.c 2023-06-26 23:57:01.519732066 -0500
|
||||
+++ b/squashfs-tools/unsquash-1.c 2023-06-26 23:57:52.192705923 -0500
|
||||
@@ -211,7 +211,7 @@ struct dir *squashfs_opendir_1(unsigned
|
||||
long long start;
|
||||
int bytes;
|
||||
int dir_count, size;
|
||||
- struct dir_ent *new_dir;
|
||||
+ struct dir_ent *ent, *cur_ent = NULL;
|
||||
struct dir *dir;
|
||||
|
||||
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
|
||||
@@ -224,7 +224,7 @@ struct dir *squashfs_opendir_1(unsigned
|
||||
EXIT_UNSQUASH("squashfs_opendir: malloc failed!\n");
|
||||
|
||||
dir->dir_count = 0;
|
||||
- dir->cur_entry = 0;
|
||||
+ dir->cur_entry = NULL;
|
||||
dir->mode = (*i)->mode;
|
||||
dir->uid = (*i)->uid;
|
||||
dir->guid = (*i)->gid;
|
||||
@@ -295,29 +295,37 @@ struct dir *squashfs_opendir_1(unsigned
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
- if((dir->dir_count % DIR_ENT_SIZE) == 0) {
|
||||
- new_dir = realloc(dir->dirs, (dir->dir_count +
|
||||
- DIR_ENT_SIZE) * sizeof(struct dir_ent));
|
||||
- if(new_dir == NULL)
|
||||
- EXIT_UNSQUASH("squashfs_opendir: "
|
||||
- "realloc failed!\n");
|
||||
- dir->dirs = new_dir;
|
||||
- }
|
||||
- strcpy(dir->dirs[dir->dir_count].name, dire->name);
|
||||
- dir->dirs[dir->dir_count].start_block =
|
||||
- dirh.start_block;
|
||||
- dir->dirs[dir->dir_count].offset = dire->offset;
|
||||
- dir->dirs[dir->dir_count].type = dire->type;
|
||||
+
|
||||
+ ent = malloc(sizeof(struct dir_ent));
|
||||
+ if (ent == NULL)
|
||||
+ MEM_ERROR();
|
||||
+
|
||||
+ ent->name = strdup(dire->name);
|
||||
+ ent->start_block = dirh.start_block;
|
||||
+ ent->offset = dire->offset;
|
||||
+ ent->type = dire->type;
|
||||
+ ent->next = NULL;
|
||||
+ if (cur_ent == NULL)
|
||||
+ dir->dirs = ent;
|
||||
+ else
|
||||
+ cur_ent->next = ent;
|
||||
+ cur_ent = ent;
|
||||
dir->dir_count ++;
|
||||
bytes += dire->size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+ /* check directory for duplicate names. Need to sort directory first */
|
||||
+ sort_directory(dir);
|
||||
+ if (check_directory(dir) == FALSE) {
|
||||
+ ERROR("File system corrupted: directory has duplicate names\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
return dir;
|
||||
|
||||
corrupted:
|
||||
- free(dir->dirs);
|
||||
- free(dir);
|
||||
+ squashfs_closedir(dir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff -Nupr a/squashfs-tools/unsquash-3.c b/squashfs-tools/unsquash-3.c
|
||||
--- a/squashfs-tools/unsquash-3.c 2023-06-26 23:57:01.519732066 -0500
|
||||
+++ b/squashfs-tools/unsquash-3.c 2023-06-26 23:57:52.192705923 -0500
|
||||
@@ -288,7 +288,7 @@ struct dir *squashfs_opendir_3(unsigned
|
||||
long long start;
|
||||
int bytes;
|
||||
int dir_count, size;
|
||||
- struct dir_ent *new_dir;
|
||||
+ struct dir_ent *ent, *cur_ent = NULL;
|
||||
struct dir *dir;
|
||||
|
||||
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
|
||||
@@ -301,7 +301,7 @@ struct dir *squashfs_opendir_3(unsigned
|
||||
EXIT_UNSQUASH("squashfs_opendir: malloc failed!\n");
|
||||
|
||||
dir->dir_count = 0;
|
||||
- dir->cur_entry = 0;
|
||||
+ dir->cur_entry = NULL;
|
||||
dir->mode = (*i)->mode;
|
||||
dir->uid = (*i)->uid;
|
||||
dir->guid = (*i)->gid;
|
||||
@@ -373,28 +373,35 @@ struct dir *squashfs_opendir_3(unsigned
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
- if((dir->dir_count % DIR_ENT_SIZE) == 0) {
|
||||
- new_dir = realloc(dir->dirs, (dir->dir_count +
|
||||
- DIR_ENT_SIZE) * sizeof(struct dir_ent));
|
||||
- if(new_dir == NULL)
|
||||
- EXIT_UNSQUASH("squashfs_opendir: "
|
||||
- "realloc failed!\n");
|
||||
- dir->dirs = new_dir;
|
||||
- }
|
||||
- strcpy(dir->dirs[dir->dir_count].name, dire->name);
|
||||
- dir->dirs[dir->dir_count].start_block =
|
||||
- dirh.start_block;
|
||||
- dir->dirs[dir->dir_count].offset = dire->offset;
|
||||
- dir->dirs[dir->dir_count].type = dire->type;
|
||||
+
|
||||
+ ent = malloc(sizeof(struct dir_ent));
|
||||
+ if (ent == NULL)
|
||||
+ MEM_ERROR();
|
||||
+
|
||||
+ ent->name = strdup(dire->name);
|
||||
+ ent->start_block = dirh.start_block;
|
||||
+ ent->offset = dire->offset;
|
||||
+ ent->type = dire->type;
|
||||
+ ent->next = NULL;
|
||||
+ if (cur_ent == NULL)
|
||||
+ dir->dirs = ent;
|
||||
+ else
|
||||
+ cur_ent->next = ent;
|
||||
+ cur_ent = ent;
|
||||
dir->dir_count ++;
|
||||
bytes += dire->size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+ /* check directory for duplicate names and sorting */
|
||||
+ if (check_directory(dir) == FALSE) {
|
||||
+ ERROR("File system corrupted: directory has duplicate names or is unsorted\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
return dir;
|
||||
|
||||
corrupted:
|
||||
- free(dir->dirs);
|
||||
- free(dir);
|
||||
+ squashfs_closedir(dir);
|
||||
return NULL;
|
||||
}
|
||||
diff -Nupr a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
|
||||
--- a/squashfs-tools/unsquash-4.c 2023-06-26 23:57:01.519732066 -0500
|
||||
+++ b/squashfs-tools/unsquash-4.c 2023-06-26 23:57:52.193705923 -0500
|
||||
@@ -268,7 +268,7 @@ struct dir *squashfs_opendir_4(unsigned
|
||||
long long start;
|
||||
int bytes;
|
||||
int dir_count, size;
|
||||
- struct dir_ent *new_dir;
|
||||
+ struct dir_ent *ent, *cur_ent = NULL;
|
||||
struct dir *dir;
|
||||
|
||||
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
|
||||
@@ -281,7 +281,7 @@ struct dir *squashfs_opendir_4(unsigned
|
||||
EXIT_UNSQUASH("squashfs_opendir: malloc failed!\n");
|
||||
|
||||
dir->dir_count = 0;
|
||||
- dir->cur_entry = 0;
|
||||
+ dir->cur_entry = NULL;
|
||||
dir->mode = (*i)->mode;
|
||||
dir->uid = (*i)->uid;
|
||||
dir->guid = (*i)->gid;
|
||||
@@ -342,29 +342,36 @@ struct dir *squashfs_opendir_4(unsigned
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
- if((dir->dir_count % DIR_ENT_SIZE) == 0) {
|
||||
- new_dir = realloc(dir->dirs, (dir->dir_count +
|
||||
- DIR_ENT_SIZE) * sizeof(struct dir_ent));
|
||||
- if(new_dir == NULL)
|
||||
- EXIT_UNSQUASH("squashfs_opendir: "
|
||||
- "realloc failed!\n");
|
||||
- dir->dirs = new_dir;
|
||||
- }
|
||||
- strcpy(dir->dirs[dir->dir_count].name, dire->name);
|
||||
- dir->dirs[dir->dir_count].start_block =
|
||||
- dirh.start_block;
|
||||
- dir->dirs[dir->dir_count].offset = dire->offset;
|
||||
- dir->dirs[dir->dir_count].type = dire->type;
|
||||
+
|
||||
+ ent = malloc(sizeof(struct dir_ent));
|
||||
+ if (ent == NULL)
|
||||
+ MEM_ERROR();
|
||||
+
|
||||
+ ent->name = strdup(dire->name);
|
||||
+ ent->start_block = dirh.start_block;
|
||||
+ ent->offset = dire->offset;
|
||||
+ ent->type = dire->type;
|
||||
+ ent->next = NULL;
|
||||
+ if (cur_ent == NULL)
|
||||
+ dir->dirs = ent;
|
||||
+ else
|
||||
+ cur_ent->next = ent;
|
||||
+ cur_ent = ent;
|
||||
dir->dir_count ++;
|
||||
bytes += dire->size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+ /* check directory for duplicate names and sorting */
|
||||
+ if (check_directory(dir) == FALSE) {
|
||||
+ ERROR("File system corrupted: directory has duplicate names or is unsorted\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
return dir;
|
||||
|
||||
corrupted:
|
||||
- free(dir->dirs);
|
||||
- free(dir);
|
||||
+ squashfs_closedir(dir);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
diff -Nupr a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
|
||||
--- a/squashfs-tools/unsquashfs.c 2023-06-26 23:57:01.520732065 -0500
|
||||
+++ b/squashfs-tools/unsquashfs.c 2023-06-26 23:57:52.193705923 -0500
|
||||
@@ -1231,14 +1231,18 @@ failed:
|
||||
int squashfs_readdir(struct dir *dir, char **name, unsigned int *start_block,
|
||||
unsigned int *offset, unsigned int *type)
|
||||
{
|
||||
- if(dir->cur_entry == dir->dir_count)
|
||||
+ if (dir->cur_entry == NULL)
|
||||
+ dir->cur_entry = dir->dirs;
|
||||
+ else
|
||||
+ dir->cur_entry = dir->cur_entry->next;
|
||||
+
|
||||
+ if (dir->cur_entry == NULL)
|
||||
return FALSE;
|
||||
|
||||
- *name = dir->dirs[dir->cur_entry].name;
|
||||
- *start_block = dir->dirs[dir->cur_entry].start_block;
|
||||
- *offset = dir->dirs[dir->cur_entry].offset;
|
||||
- *type = dir->dirs[dir->cur_entry].type;
|
||||
- dir->cur_entry ++;
|
||||
+ *name = dir->cur_entry->name;
|
||||
+ *start_block = dir->cur_entry->start_block;
|
||||
+ *offset = dir->cur_entry->offset;
|
||||
+ *type = dir->cur_entry->type;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1246,7 +1250,16 @@ unsigned int *offset, unsigned int *type
|
||||
|
||||
void squashfs_closedir(struct dir *dir)
|
||||
{
|
||||
- free(dir->dirs);
|
||||
+ struct dir_ent *ent = dir->dirs;
|
||||
+
|
||||
+ while (ent) {
|
||||
+ struct dir_ent *tmp = ent;
|
||||
+
|
||||
+ ent = ent->next;
|
||||
+ free(tmp->name);
|
||||
+ free(tmp);
|
||||
+ }
|
||||
+
|
||||
free(dir);
|
||||
}
|
||||
|
||||
@@ -1895,6 +1908,7 @@ int read_super(char *source)
|
||||
* 1.x, 2.x and 3.x filesystems use gzip compression.
|
||||
*/
|
||||
comp = lookup_compressor("gzip");
|
||||
+
|
||||
return TRUE;
|
||||
|
||||
failed_mount:
|
||||
diff -Nupr a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h
|
||||
--- a/squashfs-tools/unsquashfs.h 2023-06-26 23:57:01.520732065 -0500
|
||||
+++ b/squashfs-tools/unsquashfs.h 2023-06-26 23:57:52.193705923 -0500
|
||||
@@ -168,21 +168,22 @@ struct queue {
|
||||
#define DIR_ENT_SIZE 16
|
||||
|
||||
struct dir_ent {
|
||||
- char name[SQUASHFS_NAME_LEN + 1];
|
||||
+ char *name;
|
||||
unsigned int start_block;
|
||||
unsigned int offset;
|
||||
unsigned int type;
|
||||
+ struct dir_ent *next;
|
||||
};
|
||||
|
||||
struct dir {
|
||||
int dir_count;
|
||||
- int cur_entry;
|
||||
unsigned int mode;
|
||||
uid_t uid;
|
||||
gid_t guid;
|
||||
unsigned int mtime;
|
||||
unsigned int xattr;
|
||||
struct dir_ent *dirs;
|
||||
+ struct dir_ent *cur_entry;
|
||||
};
|
||||
|
||||
struct file_entry {
|
||||
@@ -278,4 +279,10 @@ extern int read_uids_guids_4();
|
||||
|
||||
/* unsquash-1234.c */
|
||||
extern int check_name(char *, int);
|
||||
+
|
||||
+extern void squashfs_closedir(struct dir *);
|
||||
+extern int check_directory(struct dir *);
|
||||
+
|
||||
+/* unsquash-12.c */
|
||||
+extern void sort_directory(struct dir *);
|
||||
#endif
|
@ -1,159 +0,0 @@
|
||||
From 55f7ba830d40d438f0b0663a505e0c227fc68b6b Mon Sep 17 00:00:00 2001
|
||||
From: Phillip Lougher <phillip@squashfs.org.uk>
|
||||
Date: Tue, 10 Jun 2014 21:51:52 +0100
|
||||
Subject: mksquashfs: fix phys mem calculation for 32-bit processes on
|
||||
PAE/64-bit kernels
|
||||
|
||||
When adding the code to base default memory usage on physical memory
|
||||
(by default use 25% of physical memory), I made an oversight. I assumed
|
||||
the process would be able to address 25% of physical memory.
|
||||
|
||||
However, for 32-bit processes running on a PAE kernel or 64-bit kernel,
|
||||
25% of physical memory can easily exceed the addressible memory for a
|
||||
32-bit process, e.g. if a machine has 24 GB of physical memory, the
|
||||
code would asume the process could easily use 6 GB.
|
||||
|
||||
A 32-bit process by definition can only address 4 GB (32-bit pointers).
|
||||
But, due to the typical kernel/user-space split (1GB/3GB, or 2GB/2GB)
|
||||
on PAE kernels, a 32-bit process may only be able to address 2 GB.
|
||||
|
||||
So, if Mksquashfs is a 32-bit application running on a PAE/64-bit kernel,
|
||||
the code assumes it can address much more memory than it really can, which
|
||||
means it runs out of memory.
|
||||
|
||||
The fix is to impose a maximum default limit on 32-bit kernels, or
|
||||
otherwise to never use a value more than 25% of the address space. If
|
||||
we assume the maximum address space is 2 GB, then the maximum becomes
|
||||
512 MB. But, given most kernels used the 1GB/3GB split, that may be
|
||||
unduely conservative, and 25% of 3 GB (756 MB) may be better. This
|
||||
patch compromises on 640 MB, which is mid-way between the 512 MB and 756 MB
|
||||
values. It is also the fixed default value previously used by Mksquashfs.
|
||||
|
||||
This patch also alters the code which imposes a maximum size. Previously
|
||||
it was believed limiting to the physical memory size was adequate. But
|
||||
obviously this needs to be updated to take into account a 32-bit process
|
||||
may only be able to address 2 GB. In the process I've also taken the
|
||||
opportunity to limit all requests to no more than 75% of physical memory.
|
||||
|
||||
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
|
||||
|
||||
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
|
||||
index 86f82bb..5370ecf 100644
|
||||
--- a/squashfs-tools/mksquashfs.c
|
||||
+++ b/squashfs-tools/mksquashfs.c
|
||||
@@ -304,7 +304,7 @@ void restorefs();
|
||||
struct dir_info *scan1_opendir(char *pathname, char *subpath, int depth);
|
||||
void write_filesystem_tables(struct squashfs_super_block *sBlk, int nopad);
|
||||
unsigned short get_checksum_mem(char *buff, int bytes);
|
||||
-int get_physical_memory();
|
||||
+void check_usable_phys_mem(int total_mem);
|
||||
|
||||
|
||||
void prep_exit()
|
||||
@@ -4053,11 +4053,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq,
|
||||
BAD_ERROR("Queue sizes rediculously too large\n");
|
||||
total_mem += fwriteq;
|
||||
|
||||
- if(total_mem > get_physical_memory()) {
|
||||
- ERROR("Total queue sizes larger than physical memory.\n");
|
||||
- ERROR("Mksquashfs will exhaust physical memory and thrash.\n");
|
||||
- BAD_ERROR("Queues too large\n");
|
||||
- }
|
||||
+ check_usable_phys_mem(total_mem);
|
||||
|
||||
/*
|
||||
* convert from queue size in Mbytes to queue size in
|
||||
@@ -4879,6 +4875,72 @@ int get_physical_memory()
|
||||
}
|
||||
|
||||
|
||||
+void check_usable_phys_mem(int total_mem)
|
||||
+{
|
||||
+ /*
|
||||
+ * We want to allow users to use as much of their physical
|
||||
+ * memory as they wish. However, for practical reasons there are
|
||||
+ * limits which need to be imposed, to protect users from themselves
|
||||
+ * and to prevent people from using Mksquashfs as a DOS attack by using
|
||||
+ * all physical memory. Mksquashfs uses memory to cache data from disk
|
||||
+ * to optimise performance. It is pointless to ask it to use more
|
||||
+ * than 75% of physical memory, as this causes thrashing and it is thus
|
||||
+ * self-defeating.
|
||||
+ */
|
||||
+ int mem = get_physical_memory();
|
||||
+
|
||||
+ mem = (mem >> 1) + (mem >> 2); /* 75% */
|
||||
+
|
||||
+ if(total_mem > mem) {
|
||||
+ ERROR("Total memory requested is more than 75%% of physical "
|
||||
+ "memory.\n");
|
||||
+ ERROR("Mksquashfs uses memory to cache data from disk to "
|
||||
+ "optimise performance.\n");
|
||||
+ ERROR("It is pointless to ask it to use more than this amount "
|
||||
+ "of memory, as this\n");
|
||||
+ ERROR("causes thrashing and it is thus self-defeating.\n");
|
||||
+ BAD_ERROR("Requested memory size too large\n");
|
||||
+ }
|
||||
+
|
||||
+ if(sizeof(void *) == 4 && total_mem > 2048) {
|
||||
+ /*
|
||||
+ * If we're running on a kernel with PAE or on a 64-bit kernel,
|
||||
+ * then the 75% physical memory limit can still easily exceed
|
||||
+ * the addressable memory by this process.
|
||||
+ *
|
||||
+ * Due to the typical kernel/user-space split (1GB/3GB, or
|
||||
+ * 2GB/2GB), we have to conservatively assume the 32-bit
|
||||
+ * processes can only address 2-3GB. So refuse if the user
|
||||
+ * tries to allocate more than 2GB.
|
||||
+ */
|
||||
+ ERROR("Total memory requested may exceed maximum "
|
||||
+ "addressable memory by this process\n");
|
||||
+ BAD_ERROR("Requested memory size too large\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+int get_default_phys_mem()
|
||||
+{
|
||||
+ int mem = get_physical_memory() / SQUASHFS_TAKE;
|
||||
+
|
||||
+ if(sizeof(void *) == 4 && mem > 640) {
|
||||
+ /*
|
||||
+ * If we're running on a kernel with PAE or on a 64-bit kernel,
|
||||
+ * the default memory usage can exceed the addressable
|
||||
+ * memory by this process.
|
||||
+ * Due to the typical kernel/user-space split (1GB/3GB, or
|
||||
+ * 2GB/2GB), we have to conservatively assume the 32-bit
|
||||
+ * processes can only address 2-3GB. So limit the default
|
||||
+ * usage to 640M, which gives room for other data.
|
||||
+ */
|
||||
+ mem = 640;
|
||||
+ }
|
||||
+
|
||||
+ return mem;
|
||||
+}
|
||||
+
|
||||
+
|
||||
void calculate_queue_sizes(int mem, int *readq, int *fragq, int *bwriteq,
|
||||
int *fwriteq)
|
||||
{
|
||||
@@ -4890,7 +4952,7 @@ void calculate_queue_sizes(int mem, int *readq, int *fragq, int *bwriteq,
|
||||
|
||||
|
||||
#define VERSION() \
|
||||
- printf("mksquashfs version 4.3 (2014/05/12)\n");\
|
||||
+ printf("mksquashfs version 4.3-git (2014/06/09)\n");\
|
||||
printf("copyright (C) 2014 Phillip Lougher "\
|
||||
"<phillip@squashfs.org.uk>\n\n"); \
|
||||
printf("This program is free software; you can redistribute it and/or"\
|
||||
@@ -4918,7 +4980,7 @@ int main(int argc, char *argv[])
|
||||
int fragq;
|
||||
int bwriteq;
|
||||
int fwriteq;
|
||||
- int total_mem = get_physical_memory() / SQUASHFS_TAKE;
|
||||
+ int total_mem = get_default_phys_mem();
|
||||
int progress = TRUE;
|
||||
int force_progress = FALSE;
|
||||
struct file_buffer **fragment = NULL;
|
||||
--
|
||||
cgit v0.10.1
|
||||
|
@ -1,95 +0,0 @@
|
||||
diff -Nupr a/squashfs-tools/action.c b/squashfs-tools/action.c
|
||||
--- a/squashfs-tools/action.c 2014-05-09 23:54:13.000000000 -0500
|
||||
+++ b/squashfs-tools/action.c 2019-04-18 10:59:53.140496887 -0500
|
||||
@@ -1094,8 +1094,14 @@ static int parse_sym_mode_args(struct ac
|
||||
for (i = 0; i < args; i++) {
|
||||
struct mode_data *entry = parse_sym_mode_arg(argv[i]);
|
||||
|
||||
- if (entry == NULL)
|
||||
+ if (entry == NULL) {
|
||||
+ while (head) {
|
||||
+ cur = head;
|
||||
+ head = head->next;
|
||||
+ free(cur);
|
||||
+ }
|
||||
return 0;
|
||||
+ }
|
||||
|
||||
if (cur) {
|
||||
cur->next = entry;
|
||||
diff -Nupr a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
|
||||
--- a/squashfs-tools/mksquashfs.c 2019-04-18 10:51:05.975460126 -0500
|
||||
+++ b/squashfs-tools/mksquashfs.c 2019-04-18 11:04:16.860682497 -0500
|
||||
@@ -3537,11 +3537,11 @@ void dir_scan2(struct dir_info *dir, str
|
||||
char *subpath = strdup(subpathname(dir_ent));
|
||||
struct dir_info *sub_dir = scan1_opendir("", subpath,
|
||||
dir->depth + 1);
|
||||
+ free(subpath);
|
||||
if(sub_dir == NULL) {
|
||||
ERROR_START("Could not create pseudo directory "
|
||||
"\"%s\"", pseudo_ent->pathname);
|
||||
ERROR_EXIT(", skipping...\n");
|
||||
- free(subpath);
|
||||
pseudo_ino --;
|
||||
continue;
|
||||
}
|
||||
diff -Nupr a/squashfs-tools/read_fs.c b/squashfs-tools/read_fs.c
|
||||
--- a/squashfs-tools/read_fs.c 2014-05-09 23:54:13.000000000 -0500
|
||||
+++ b/squashfs-tools/read_fs.c 2019-04-18 11:06:32.499233451 -0500
|
||||
@@ -974,7 +974,8 @@ long long read_filesystem(char *root_nam
|
||||
|
||||
error:
|
||||
free(id_table);
|
||||
- free(inode_table);
|
||||
+ if (inode_table)
|
||||
+ free(inode_table);
|
||||
free(directory_table);
|
||||
return 0;
|
||||
}
|
||||
diff -Nupr a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
|
||||
--- a/squashfs-tools/unsquash-4.c 2019-04-18 10:51:05.972460124 -0500
|
||||
+++ b/squashfs-tools/unsquash-4.c 2019-04-18 11:32:54.600160166 -0500
|
||||
@@ -50,9 +50,11 @@ int read_fragment_table_4(long long *dir
|
||||
"fragment table index\n");
|
||||
|
||||
fragment_table = malloc(bytes);
|
||||
- if(fragment_table == NULL)
|
||||
+ if(fragment_table == NULL) {
|
||||
+ free(fragment_table_index);
|
||||
EXIT_UNSQUASH("read_fragment_table: failed to allocate "
|
||||
"fragment table\n");
|
||||
+ }
|
||||
|
||||
res = read_fs_bytes(fd, sBlk.s.fragment_table_start,
|
||||
SQUASHFS_FRAGMENT_INDEX_BYTES(sBlk.s.fragments),
|
||||
@@ -60,7 +62,7 @@ int read_fragment_table_4(long long *dir
|
||||
if(res == FALSE) {
|
||||
ERROR("read_fragment_table: failed to read fragment table "
|
||||
"index\n");
|
||||
- return FALSE;
|
||||
+ goto out;
|
||||
}
|
||||
SQUASHFS_INSWAP_FRAGMENT_INDEXES(fragment_table_index, indexes);
|
||||
|
||||
@@ -75,7 +77,8 @@ int read_fragment_table_4(long long *dir
|
||||
if(length == FALSE) {
|
||||
ERROR("read_fragment_table: failed to read fragment "
|
||||
"table index\n");
|
||||
- return FALSE;
|
||||
+ res = FALSE;
|
||||
+ goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +86,10 @@ int read_fragment_table_4(long long *dir
|
||||
SQUASHFS_INSWAP_FRAGMENT_ENTRY(&fragment_table[i]);
|
||||
|
||||
*directory_table_end = fragment_table_index[0];
|
||||
- return TRUE;
|
||||
+ res = TRUE;
|
||||
+out:
|
||||
+ free(fragment_table_index);
|
||||
+ return res;
|
||||
}
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- a/squashfs-tools/Makefile 2019-07-24 13:52:09.552920269 -0400
|
||||
+++ b/squashfs-tools/Makefile 2019-07-24 23:52:47.839665687 -0400
|
||||
@@ -107,6 +107,8 @@ XATTR_DEFAULT = 1
|
||||
# End of BUILD options section #
|
||||
###############################################
|
||||
|
||||
+EXTRA_LDFLAGS += -z now -pie
|
||||
+
|
||||
INCLUDEDIR = -I.
|
||||
INSTALL_DIR = /usr/local/bin
|
||||
|
@ -1,21 +0,0 @@
|
||||
--- a/squashfs-tools/mksquashfs.c 2019-08-06 11:03:34.071402614 -0400
|
||||
+++ b/squashfs-tools/mksquashfs.c 2019-08-06 11:09:54.063340318 -0400
|
||||
@@ -267,6 +267,7 @@ pthread_mutex_t pos_mutex = PTHREAD_MUTE
|
||||
pthread_mutex_t dup_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/* user options that control parallelisation */
|
||||
+#define MAX_CPUS 256
|
||||
int processors = -1;
|
||||
int bwriter_size;
|
||||
|
||||
@@ -4124,6 +4125,10 @@ void initialise_threads(int readq, int f
|
||||
#endif
|
||||
}
|
||||
|
||||
+ /* Limit the number of processors we're going to use */
|
||||
+ if(processors > MAX_CPUS)
|
||||
+ processors = MAX_CPUS;
|
||||
+
|
||||
if(multiply_overflow(processors, 3) ||
|
||||
multiply_overflow(processors * 3, sizeof(pthread_t)))
|
||||
BAD_ERROR("Processors too large\n");
|
@ -1,13 +0,0 @@
|
||||
--- a/squashfs-tools/mksquashfs.c
|
||||
+++ b/squashfs-tools/mksquashfs.c
|
||||
@@ -2447,8 +2447,8 @@ void *frag_deflator(void *arg)
|
||||
write_buffer->block = bytes;
|
||||
bytes += compressed_size;
|
||||
fragments_outstanding --;
|
||||
- pthread_mutex_unlock(&fragment_mutex);
|
||||
queue_put(to_writer, write_buffer);
|
||||
+ pthread_mutex_unlock(&fragment_mutex);
|
||||
TRACE("Writing fragment %lld, uncompressed size %d, "
|
||||
"compressed size %d\n", file_buffer->block,
|
||||
file_buffer->size, compressed_size);
|
||||
|
@ -1,20 +0,0 @@
|
||||
--- a/squashfs-tools/unsquashfs.c 2021-01-14 14:34:49.658184361 -0600
|
||||
+++ b/squashfs-tools/unsquashfs.c 2021-01-14 14:50:19.604100949 -0600
|
||||
@@ -822,8 +822,6 @@ int set_attributes(char *pathname, int m
|
||||
{
|
||||
struct utimbuf times = { time, time };
|
||||
|
||||
- write_xattr(pathname, xattr);
|
||||
-
|
||||
if(utime(pathname, ×) == -1) {
|
||||
ERROR("set_attributes: failed to set time on %s, because %s\n",
|
||||
pathname, strerror(errno));
|
||||
@@ -846,6 +844,8 @@ int set_attributes(char *pathname, int m
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+ write_xattr(pathname, xattr);
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1,204 +0,0 @@
|
||||
diff -Nupr a/squashfs-tools/Makefile b/squashfs-tools/Makefile
|
||||
--- a/squashfs-tools/Makefile 2021-10-08 12:02:28.881477426 -0500
|
||||
+++ b/squashfs-tools/Makefile 2021-10-08 11:47:05.503307841 -0500
|
||||
@@ -117,7 +117,7 @@ MKSQUASHFS_OBJS = mksquashfs.o read_fs.o
|
||||
caches-queues-lists.o
|
||||
|
||||
UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2.o unsquash-3.o \
|
||||
- unsquash-4.o swap.o compressor.o unsquashfs_info.o
|
||||
+ unsquash-4.o unsquash-1234.o swap.o compressor.o unsquashfs_info.o
|
||||
|
||||
CFLAGS ?= -O2
|
||||
CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
|
||||
@@ -292,6 +292,8 @@ unsquash-3.o: unsquashfs.h unsquash-3.c
|
||||
unsquash-4.o: unsquashfs.h unsquash-4.c squashfs_fs.h squashfs_swap.h \
|
||||
read_fs.h
|
||||
|
||||
+unsquash-1234.o: unsquash-1234.c
|
||||
+
|
||||
unsquashfs_xattr.o: unsquashfs_xattr.c unsquashfs.h squashfs_fs.h xattr.h
|
||||
|
||||
unsquashfs_info.o: unsquashfs.h squashfs_fs.h
|
||||
diff -Nupr a/squashfs-tools/unsquash-1234.c b/squashfs-tools/unsquash-1234.c
|
||||
--- a/squashfs-tools/unsquash-1234.c 1969-12-31 18:00:00.000000000 -0600
|
||||
+++ b/squashfs-tools/unsquash-1234.c 2021-10-08 11:49:06.032243697 -0500
|
||||
@@ -0,0 +1,58 @@
|
||||
+/*
|
||||
+ * Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
+ * filesystem.
|
||||
+ *
|
||||
+ * Copyright (c) 2021
|
||||
+ * Phillip Lougher <phillip@squashfs.org.uk>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2,
|
||||
+ * or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+ *
|
||||
+ * unsquash-1234.c
|
||||
+ *
|
||||
+ * Helper functions used by unsquash-1, unsquash-2, unsquash-3 and
|
||||
+ * unsquash-4.
|
||||
+ */
|
||||
+
|
||||
+#define TRUE 1
|
||||
+#define FALSE 0
|
||||
+/*
|
||||
+ * Check name for validity, name should not
|
||||
+ * - be ".", "./", or
|
||||
+ * - be "..", "../" or
|
||||
+ * - have a "/" anywhere in the name, or
|
||||
+ * - be shorter than the expected size
|
||||
+ */
|
||||
+int check_name(char *name, int size)
|
||||
+{
|
||||
+ char *start = name;
|
||||
+
|
||||
+ if(name[0] == '.') {
|
||||
+ if(name[1] == '.')
|
||||
+ name++;
|
||||
+ if(name[1] == '/' || name[1] == '\0')
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ while(name[0] != '/' && name[0] != '\0')
|
||||
+ name ++;
|
||||
+
|
||||
+ if(name[0] == '/')
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if((name - start) != size)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
diff -Nupr a/squashfs-tools/unsquash-1.c b/squashfs-tools/unsquash-1.c
|
||||
--- a/squashfs-tools/unsquash-1.c 2014-03-08 23:31:59.000000000 -0600
|
||||
+++ b/squashfs-tools/unsquash-1.c 2021-10-08 11:51:18.827274779 -0500
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
* filesystem.
|
||||
*
|
||||
- * Copyright (c) 2009, 2010, 2011, 2012
|
||||
+ * Copyright (c) 2009, 2010, 2011, 2012, 2021
|
||||
* Phillip Lougher <phillip@squashfs.org.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -285,6 +285,13 @@ struct dir *squashfs_opendir_1(unsigned
|
||||
memcpy(dire->name, directory_table + bytes,
|
||||
dire->size + 1);
|
||||
dire->name[dire->size + 1] = '\0';
|
||||
+
|
||||
+ /* check name for invalid characters (i.e /, ., ..) */
|
||||
+ if(check_name(dire->name, dire->size + 1) == FALSE) {
|
||||
+ ERROR("File system corrupted: invalid characters in name\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
diff -Nupr a/squashfs-tools/unsquash-3.c b/squashfs-tools/unsquash-3.c
|
||||
--- a/squashfs-tools/unsquash-3.c 2014-03-08 23:31:59.000000000 -0600
|
||||
+++ b/squashfs-tools/unsquash-3.c 2021-10-08 11:56:30.881697731 -0500
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
* filesystem.
|
||||
*
|
||||
- * Copyright (c) 2009, 2010, 2011, 2012, 2013
|
||||
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2021
|
||||
* Phillip Lougher <phillip@squashfs.org.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -363,6 +363,13 @@ struct dir *squashfs_opendir_3(unsigned
|
||||
memcpy(dire->name, directory_table + bytes,
|
||||
dire->size + 1);
|
||||
dire->name[dire->size + 1] = '\0';
|
||||
+
|
||||
+ /* check name for invalid characters (i.e /, ., ..) */
|
||||
+ if(check_name(dire->name, dire->size + 1) == FALSE) {
|
||||
+ ERROR("File system corrupted: invalid characters in name\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
diff -Nupr a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
|
||||
--- a/squashfs-tools/unsquash-4.c 2021-10-08 12:02:28.879477411 -0500
|
||||
+++ b/squashfs-tools/unsquash-4.c 2021-10-08 11:57:20.357081890 -0500
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
* filesystem.
|
||||
*
|
||||
- * Copyright (c) 2009, 2010, 2011, 2012, 2013
|
||||
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2021
|
||||
* Phillip Lougher <phillip@squashfs.org.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -332,6 +332,13 @@ struct dir *squashfs_opendir_4(unsigned
|
||||
memcpy(dire->name, directory_table + bytes,
|
||||
dire->size + 1);
|
||||
dire->name[dire->size + 1] = '\0';
|
||||
+
|
||||
+ /* check name for invalid characters (i.e /, ., ..) */
|
||||
+ if(check_name(dire->name, dire->size + 1) == FALSE) {
|
||||
+ ERROR("File system corrupted: invalid characters in name\n");
|
||||
+ goto corrupted;
|
||||
+ }
|
||||
+
|
||||
TRACE("squashfs_opendir: directory entry %s, inode "
|
||||
"%d:%d, type %d\n", dire->name,
|
||||
dirh.start_block, dire->offset, dire->type);
|
||||
diff -Nupr a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
|
||||
--- a/squashfs-tools/unsquashfs.c 2021-10-08 12:02:28.888477481 -0500
|
||||
+++ b/squashfs-tools/unsquashfs.c 2021-10-08 11:59:29.508084687 -0500
|
||||
@@ -3,7 +3,7 @@
|
||||
* filesystem.
|
||||
*
|
||||
* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
- * 2012, 2013, 2014
|
||||
+ * 2012, 2013, 2014, 2021
|
||||
* Phillip Lougher <phillip@squashfs.org.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -2478,8 +2478,8 @@ int parse_number(char *arg, int *res)
|
||||
|
||||
|
||||
#define VERSION() \
|
||||
- printf("unsquashfs version 4.3 (2014/05/12)\n");\
|
||||
- printf("copyright (C) 2014 Phillip Lougher "\
|
||||
+ printf("unsquashfs version 4.3 (2021/10/8)\n");\
|
||||
+ printf("copyright (C) 2021 Phillip Lougher "\
|
||||
"<phillip@squashfs.org.uk>\n\n");\
|
||||
printf("This program is free software; you can redistribute it and/or"\
|
||||
"\n");\
|
||||
diff -Nupr a/squashfs-tools/unsquashfs.h b/squashfs-tools/unsquashfs.h
|
||||
--- a/squashfs-tools/unsquashfs.h 2014-05-09 23:54:13.000000000 -0500
|
||||
+++ b/squashfs-tools/unsquashfs.h 2021-10-08 12:01:00.424790607 -0500
|
||||
@@ -4,7 +4,7 @@
|
||||
* Unsquash a squashfs filesystem. This is a highly compressed read only
|
||||
* filesystem.
|
||||
*
|
||||
- * Copyright (c) 2009, 2010, 2013, 2014
|
||||
+ * Copyright (c) 2009, 2010, 2013, 2014, 2021
|
||||
* Phillip Lougher <phillip@squashfs.org.uk>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -275,4 +275,7 @@ extern struct inode *read_inode_4(unsign
|
||||
extern struct dir *squashfs_opendir_4(unsigned int, unsigned int,
|
||||
struct inode **);
|
||||
extern int read_uids_guids_4();
|
||||
+
|
||||
+/* unsquash-1234.c */
|
||||
+extern int check_name(char *, int);
|
||||
#endif
|
@ -1,29 +0,0 @@
|
||||
diff --git a/squashfs-tools/unsquash-4.c b/squashfs-tools/unsquash-4.c
|
||||
index ecdaac796f09..2c0cf63daf67 100644
|
||||
--- a/squashfs-tools/unsquash-4.c
|
||||
+++ b/squashfs-tools/unsquash-4.c
|
||||
@@ -31,9 +31,9 @@ static unsigned int *id_table;
|
||||
int read_fragment_table_4(long long *directory_table_end)
|
||||
{
|
||||
int res, i;
|
||||
- int bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments);
|
||||
- int indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
|
||||
- long long fragment_table_index[indexes];
|
||||
+ size_t bytes = SQUASHFS_FRAGMENT_BYTES(sBlk.s.fragments);
|
||||
+ size_t indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
|
||||
+ long long *fragment_table_index;
|
||||
|
||||
TRACE("read_fragment_table: %d fragments, reading %d fragment indexes "
|
||||
"from 0x%llx\n", sBlk.s.fragments, indexes,
|
||||
@@ -44,6 +44,11 @@ int read_fragment_table_4(long long *directory_table_end)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+ fragment_table_index = malloc(indexes*sizeof(long long));
|
||||
+ if(fragment_table_index == NULL)
|
||||
+ EXIT_UNSQUASH("read_fragment_table: failed to allocate "
|
||||
+ "fragment table index\n");
|
||||
+
|
||||
fragment_table = malloc(bytes);
|
||||
if(fragment_table == NULL)
|
||||
EXIT_UNSQUASH("read_fragment_table: failed to allocate "
|
@ -1,11 +0,0 @@
|
||||
--- squashfs-tools/unsquash-4.c.orig 2015-06-24 14:23:22.270710744 -0500
|
||||
+++ squashfs-tools/unsquash-4.c 2015-06-24 14:24:13.671243487 -0500
|
||||
@@ -35,7 +35,7 @@
|
||||
size_t indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
|
||||
long long *fragment_table_index;
|
||||
|
||||
- TRACE("read_fragment_table: %d fragments, reading %d fragment indexes "
|
||||
+ TRACE("read_fragment_table: %u fragments, reading %zu fragment indexes "
|
||||
"from 0x%llx\n", sBlk.s.fragments, indexes,
|
||||
sBlk.s.fragment_table_start);
|
||||
|
@ -1,33 +0,0 @@
|
||||
From 604b607d8ac91eb8afc0b6e3d917d5c073096103 Mon Sep 17 00:00:00 2001
|
||||
From: Phillip Lougher <phillip@squashfs.org.uk>
|
||||
Date: Wed, 11 Jun 2014 04:51:37 +0100
|
||||
Subject: mksquashfs: ensure value does not overflow a signed int in -mem
|
||||
option
|
||||
|
||||
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
|
||||
|
||||
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
|
||||
index 5370ecf..9676dc8 100644
|
||||
--- a/squashfs-tools/mksquashfs.c
|
||||
+++ b/squashfs-tools/mksquashfs.c
|
||||
@@ -5193,7 +5193,16 @@ print_compressor_options:
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
- /* convert from bytes to Mbytes */
|
||||
+
|
||||
+ /*
|
||||
+ * convert from bytes to Mbytes, ensuring the value
|
||||
+ * does not overflow a signed int
|
||||
+ */
|
||||
+ if(number >= (1LL << 51)) {
|
||||
+ ERROR("%s: -mem invalid mem size\n", argv[0]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
total_mem = number / 1048576;
|
||||
if(total_mem < (SQUASHFS_LOWMEM / SQUASHFS_TAKE)) {
|
||||
ERROR("%s: -mem should be %d Mbytes or "
|
||||
--
|
||||
cgit v0.10.1
|
||||
|
@ -1,22 +0,0 @@
|
||||
diff -Nupr squashfs4.3.orig/squashfs-tools/mksquashfs.c squashfs4.3/squashfs-tools/mksquashfs.c
|
||||
--- squashfs4.3.orig/squashfs-tools/mksquashfs.c 2018-08-20 10:47:49.286289155 -0400
|
||||
+++ squashfs4.3/squashfs-tools/mksquashfs.c 2018-08-20 10:49:28.348541210 -0400
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
diff -Nupr squashfs4.3.orig/squashfs-tools/unsquashfs.c squashfs4.3/squashfs-tools/unsquashfs.c
|
||||
--- squashfs4.3.orig/squashfs-tools/unsquashfs.c 2018-08-20 10:47:49.283289208 -0400
|
||||
+++ squashfs4.3/squashfs-tools/unsquashfs.c 2018-08-20 10:58:44.238732579 -0400
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
+#include <sys/sysmacros.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
@ -1,146 +0,0 @@
|
||||
.TH MKSQUASHFS 1 "2014\-05\-13" "4.3" "create and append squashfs filesystems"
|
||||
|
||||
.SH NAME
|
||||
mksquashfs \- tool to create and append to squashfs filesystems
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBmksquashfs\fR \fISOURCE\fR [\fISOURCE2\fR \fI...\fR] \fIDESTINATION\fR [\fIOPTIONS\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
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 minimize data overhead. Block sizes greater than 4K are supported up to a maximum of 64K.
|
||||
.PP
|
||||
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 constrained block device/memory systems (e.g. embedded systems) where low overhead is needed.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.SS Filesystem build options
|
||||
.IP "\-comp \fICOMPRESSION\fR" 4
|
||||
select \fICOMPRESSION\fR compression. Compressors available: gzip (default), lzma (no kernel support), lzo, lz4 and xz.
|
||||
.IP "\-b \fIBLOCK_SIZE\fR"
|
||||
set data block to \fIBLOCK_SIZE\fR. Default 131072 bytes. Optionally K or M can be used as a suffix to specify kilobytes or megabytes, respectively.
|
||||
.IP "\-no\-exports" 4
|
||||
don't make the filesystem exportable via NFS.
|
||||
.IP "\-no\-sparse" 4
|
||||
don't detect sparse files.
|
||||
.IP "\-no\-xattrs" 4
|
||||
don't store extended attributes.
|
||||
.IP "\-xattrs" 4
|
||||
store extended attributes (default).
|
||||
.IP "\-noI" 4
|
||||
do not compress inode table.
|
||||
.IP "\-noD" 4
|
||||
do not compress data blocks.
|
||||
.IP "\-noF" 4
|
||||
do not compress fragment blocks.
|
||||
.IP "\-noX" 4
|
||||
do not compress extended attributes.
|
||||
.IP "\-no\-fragments" 4
|
||||
do not use fragments.
|
||||
.IP "\-always\-use\-fragments" 4
|
||||
use fragment blocks for files larger than block size.
|
||||
.IP "\-no\-duplicates" 4
|
||||
do not perform duplicate checking.
|
||||
.IP "\-all\-root" 4
|
||||
make all files owned by root.
|
||||
.IP "\-force\-uid uid" 4
|
||||
set all file uids to uid.
|
||||
.IP "\-force\-gid gid" 4
|
||||
set all file gids to gid.
|
||||
.IP "\-nopad" 4
|
||||
do not pad filesystem to a multiple of 4K.
|
||||
.IP "\-keep\-as\-directory" 4
|
||||
if one source directory is specified, create a root directory containing that directory, rather than the contents of the directory.
|
||||
|
||||
.SS Filesystem filter options
|
||||
.IP "\-p \fIPSEUDO_DEFINITION\fR" 4
|
||||
Add pseudo file definition.
|
||||
.IP "\-pf \fIPSEUDO_FILE\fR" 4
|
||||
Add list of pseudo file definitions.
|
||||
.IP "\-sort \fISORT_FILE\fR" 4
|
||||
sort files according to priorities in \fISORT_FILE\fR. One file or dir with priority per line. Priority \-32768 to 32767, default priority 0.
|
||||
.IP "\-ef \fIEXCLUDE_FILE\fR" 4
|
||||
list of exclude dirs/files. One per line.
|
||||
.IP "\-wildcards" 4
|
||||
Allow extended shell wildcards (globbing) to be used in exclude dirs/files
|
||||
.IP "\-regex" 4
|
||||
Allow POSIX regular expressions to be used in exclude dirs/files.
|
||||
|
||||
.SS Filesystem append options
|
||||
.IP "\-noappend" 4
|
||||
do not append to existing filesystem.
|
||||
.IP "\-root\-becomes \fINAME\fR" 4
|
||||
when appending source files/directories, make the original root become a subdirectory in the new root called \fINAME\fR, rather than adding the new source items to the original root.
|
||||
|
||||
.SS Mksquashfs runtime options:
|
||||
.IP "\-version" 4
|
||||
print version, licence and copyright message.
|
||||
.IP "\-exit\-on\-error" 4
|
||||
treat normally ignored errors as fatal.
|
||||
.IP "\-recover \fINAME\fR" 4
|
||||
recover filesystem data using recovery file \fINAME\fR.
|
||||
.IP "\-no\-recovery" 4
|
||||
don't generate a recovery file.
|
||||
.IP "\-info" 4
|
||||
print files written to filesystem.
|
||||
.IP "\-no\-progress" 4
|
||||
don't display the progress bar.
|
||||
.IP "\-progress" 4
|
||||
display progress bar when using the \-info option.
|
||||
.IP "\-processors \fINUMBER\fR" 4
|
||||
Use \fINUMBER\fR processors. By default will use number of processors available.
|
||||
.IP "\-mem \fISIZE\fR" 4
|
||||
Use \fISIZE\fR physical memory. Optionally K or M can be used as a suffix for kilobytes or megabytes, respectively. Default 25% of memory.
|
||||
.IP "\-read\-queue \fISIZE\fR" 4
|
||||
Deprecated. Use \-mem instead.
|
||||
.IP "\-write\-queue \fISIZE\fR" 4
|
||||
Deprecated. Use \-mem instead.
|
||||
.IP "\-fragment\-queue \fISIZE\fR" 4
|
||||
Deprecated. Use \-mem instead.
|
||||
|
||||
.SS Miscellaneous options
|
||||
.IP "\-root\-owned" 4
|
||||
alternative name for \-all\-root.
|
||||
.IP "\-noInodeCompression" 4
|
||||
alternative name for \-noI.
|
||||
.IP "\-noDataCompression" 4
|
||||
alternative name for \-noD.
|
||||
.IP "\-noFragmentCompression" 4
|
||||
alternative name for \-noF.
|
||||
.IP "\-noXattrCompression" 4
|
||||
alternative name for \-noX.
|
||||
.IP "\-Xhelp" 4
|
||||
print compressor options for selected compressor
|
||||
|
||||
.SS Compressors available and compressor specific options
|
||||
.IP "gzip (default)"
|
||||
.IP "\-Xcompression-level \fIcompression\-level\fR" 4
|
||||
\fIcompression\-level\fR should be 1 .. 9 (default 9)
|
||||
.IP "\-Xwindow\-size \fIwindow\-size\fR" 4
|
||||
\fIwindow\-size\fR should be 8 .. 15 (default 15)
|
||||
.IP "\-Xstrategy strategy1,strategy2,...,strategyN" 4
|
||||
Compress using strategy1,strategy2,...,strategyN in turn and choose the best compression. Available strategies: default, filtered, huffman_only, run_length_encoded and fixed
|
||||
.IP "lzmz (no options) (no kernel support)" 4
|
||||
.IP "lzo" 4
|
||||
.IP "\-Xalgorithm \fIalgorithm\fR" 4
|
||||
Where \fIalgorithm\fR is one of: lzo1x_1, lzo1x_1_11, lzo1x_1_12, lzo1x_1_15 or lzo1x_999. (default lzo1x_999)
|
||||
.IP "\-Xcompression\-level \fIcompression\-level\fR" 4
|
||||
\fIcompression\-level\fR should be 1 .. 9 (default 8)
|
||||
.IP "lz4" 4
|
||||
.IP "\-Xhc"
|
||||
Compress using LZ4 High Compression
|
||||
.IP "xz" 4
|
||||
.IP "\-Xbcj filter1,filter2,...,filterN" 4
|
||||
Compress using filter1,filter2,...,filterN in turn (in addition to no filter), and choose the best compression. Available filters: x86, arm, armthumb, powerpc, sparc, ia64.
|
||||
.IP "\-Xdict\-size \fIDICT_SIZE\fR" 4
|
||||
Use \fIDICT_SIZE\fR as the XZ dictionary size. The dictionary size can be specified as a percentage of the block size, or as an absolute value. The dictionary size must be less than or equal to the block size and 8192 bytes or larger. It must also be storable in the xz header as either 2^n or as 2^n+2^(n+1). Example dict\-sizes are 75%, 50%, 37.5%, 25%, or 32K, 16K, 8K etc.
|
||||
|
||||
.SH SEE ALSO
|
||||
unsquashfs(1)
|
||||
|
||||
.SH HOMEPAGE
|
||||
More information about mksquashfs and the squashfs filesystem can be found at <\fIhttp://squashfs.sourceforge.net/\fR>.
|
||||
|
||||
.SH AUTHOR
|
||||
squashfs was written by Phillip Lougher <\fIplougher@users.sourceforge.net\fR>.
|
||||
.PP
|
||||
This manual page was written by Daniel Baumann <\fIdaniel.baumann@progress\-technologies.net\fR>. With some updates for 4.3 for use with Fedora.
|
@ -1,66 +0,0 @@
|
||||
.TH UNSQUASHFS 1 "2014\-05\-13" "4.3" "uncompress squashfs filesystems"
|
||||
|
||||
.SH NAME
|
||||
mksquashfs \- tool to uncompress squashfs filesystems
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBunsquashfs\fR [\fIOPTIONS\fR] \fIFILESYSTEM\fR [\fIdirectories or files to extract\fR]
|
||||
|
||||
.SH DESCRIPTION
|
||||
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 minimize data overhead. Block sizes greater than 4K are supported up to a maximum of 64K.
|
||||
.PP
|
||||
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 constrained block device/memory systems (e.g. embedded systems) where low overhead is needed.
|
||||
|
||||
.SH OPTIONS
|
||||
.IP "\-v, \-version" 4
|
||||
print version, licence and copyright information.
|
||||
.IP "\-d \fIPATHNAME\fR, \-dest \fIPATHNAME\fR" 4
|
||||
unsquash to \fIPATHNAME\fR, default "squashfs\-root".
|
||||
.IP "\-n, \-no\-progress" 4
|
||||
don't display the progress bar.
|
||||
.IP "\-no, \-no\-xattrs" 4
|
||||
don't extract xattrs in file system.
|
||||
.IP "\-x, \-xattrs" 4
|
||||
extract xattrs in file system (default).
|
||||
.IP "\-u, \-user\-xattrs" 4
|
||||
only extract user xattrs in file system. Enables extracting xattrs.
|
||||
.IP "\-p \fINUMBER\fR, \-processors \fINUMBER\fR" 4
|
||||
use \fINUMBER\fR processors. By default will use number of processors available.
|
||||
.IP "\-i, \-info" 4
|
||||
print files as they are unsquashed.
|
||||
.IP "\-li, \-linfo" 4
|
||||
print files as they are unsquashed with file attributes (like ls \-l output).
|
||||
.IP "\-l, \-ls" 4
|
||||
list filesystem, but don't unsquash.
|
||||
.IP "\-ll, \-lls" 4
|
||||
list filesystem with file attributes (like ls \-l output), but don't unsquash.
|
||||
.IP "\-f, \-force" 4
|
||||
if file already exists then overwrite.
|
||||
.IP "\-s, \-stat" 4
|
||||
display filesystem superblock information.
|
||||
.IP "\-e \fIEXTRACT_FILE\fR, \-ef \fIEXTRACT_FILE\fR" 4
|
||||
list of directories or files to extract. One per line.
|
||||
.IP "\-da \fISIZE\fR, \-data\-queue \fISIZE\fR" 4
|
||||
Set data queue to \fISIZE\fR Mbytes. Default 256 Mbytes.
|
||||
.IP "\-fr \fISIZE\fR, \-frag\-queue \fISIZE\fR" 4
|
||||
Set fragment queue to \fISIZE\fR Mbytes. Default 256 Mbytes.
|
||||
.IP "\-r, \-regex" 4
|
||||
treat extract names as POSIX regular expressions rather than use the default shell wildcard expansion (globbing).
|
||||
|
||||
.SS Decompressors available
|
||||
.IP "gzip" 4
|
||||
.IP "lzma" 4
|
||||
.IP "lzo" 4
|
||||
.IP "lz4" 4
|
||||
.IP "xz" 4
|
||||
|
||||
.SH SEE ALSO
|
||||
mksquashfs(1)
|
||||
|
||||
.SH HOMEPAGE
|
||||
More information about unsquashfs and the squashfs filesystem can be found at <\fIhttp://squashfs.sourceforge.net/\fR>.
|
||||
|
||||
.SH AUTHOR
|
||||
squashfs was written by Phillip Lougher <\fIplougher@users.sourceforge.net\fR>.
|
||||
.PP
|
||||
This manual page was written by Daniel Baumann <\fIdaniel.baumann@progress\-technologies.net\fR>. With some updates for 4.3 for use with Fedora.
|
7
gating.yaml
Normal file
7
gating.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- fedora-*
|
||||
decision_context: bodhi_update_push_testing
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: dist.depcheck}
|
||||
- !PassingTestCaseRule {test_case_name: working}
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (squashfs-tools-4.6.1.tar.gz) = 10e8a4b1e2327e062aef4f85860e76ebcd7a29e4c19e152ff7edec4a38316982b5bcfde4ab69da6bcb931258d264c2b6cb40cb5f635f9e6f6eba1ed5976267cb
|
@ -1,122 +1,274 @@
|
||||
Summary: Utility for the creation of squashfs filesystems
|
||||
Name: squashfs-tools
|
||||
Version: 4.3
|
||||
Release: 21%{?dist}
|
||||
License: GPLv2+
|
||||
Group: System Environment/Base
|
||||
URL: http://squashfs.sourceforge.net/
|
||||
Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz
|
||||
# manpages from http://ftp.debian.org/debian/pool/main/s/squashfs-tools/squashfs-tools_4.2+20121212-1.debian.tar.xz
|
||||
# The man pages have been modified for 4.3 for Fedora.
|
||||
Source1: mksquashfs.1
|
||||
Source2: unsquashfs.1
|
||||
# From master branch (55f7ba830d40d438f0b0663a505e0c227fc68b6b).
|
||||
# 32 bit process can use too much memory when using PAE or 64 bit kernels
|
||||
Patch0: PAE.patch
|
||||
# From master branch (604b607d8ac91eb8afc0b6e3d917d5c073096103).
|
||||
# Prevent overflows when using the -mem option.
|
||||
Patch1: mem-overflow.patch
|
||||
# From squashfs-devel@lists.sourceforge.net by Guan Xin <guanx.bac@gmail.com>
|
||||
# For https://bugzilla.redhat.com/show_bug.cgi?id=1141206
|
||||
Patch2: 2gb.patch
|
||||
# From https://github.com/gcanalesb/sasquatch/commit/6777e08cc38bc780d27c69c1d8c272867b74524f
|
||||
# Which is forked from Phillip's squashfs-tools, though it looks like
|
||||
# the issue applies to us.
|
||||
Patch3: cve-2015-4645.patch
|
||||
# Update formats to match changes in cve-2015-4645.patch
|
||||
Patch4: local-cve-fix.patch
|
||||
# rhbz 1611746
|
||||
Patch5: mksquashfs-sysmacros-fix.patch
|
||||
# rhbz 1602698
|
||||
Patch6: bz1602698.patch
|
||||
# rhbz 1624173
|
||||
Patch7: bz1624173.patch
|
||||
# rhbz 1716278
|
||||
Patch8: bz1716278.patch
|
||||
# rhbz 1754815
|
||||
Patch9: bz1754815.patch
|
||||
# rhbz 1895017
|
||||
Patch10: bz1895017.patch
|
||||
# rhbz 2000637 - CVE-2021-40153
|
||||
Patch11: bz2000637.patch
|
||||
# rhbz 2007303 - CVE-2021-41072
|
||||
Patch12: CVE-2021-41072-c8s-combined.patch
|
||||
Version: 4.6.1
|
||||
Summary: Utility for the creation of squashfs filesystems
|
||||
%global forgeurl https://github.com/plougher/%{name}
|
||||
%global tag %{version}
|
||||
%forgemeta
|
||||
URL: %{forgeurl}
|
||||
Source: %{forgesource}
|
||||
# https://github.com/plougher/squashfs-tools/pull/231
|
||||
# https://github.com/plougher/squashfs-tools/issues/230
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2178510
|
||||
# Fix a crash caused by an out-of-bounds access that was inadvertently
|
||||
# re-introduced in a memory leak fix
|
||||
Release: 6%{dist}
|
||||
License: GPL-2.0-or-later
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: xz-devel
|
||||
BuildRequires: lzo-devel
|
||||
BuildRequires: libattr-devel
|
||||
BuildRequires: lz4-devel
|
||||
BuildRequires: libzstd-devel
|
||||
BuildRequires: help2man
|
||||
|
||||
%description
|
||||
Squashfs is a highly compressed read-only filesystem for Linux. This package
|
||||
contains the utilities for manipulating squashfs filesystems.
|
||||
|
||||
%prep
|
||||
%setup -q -n squashfs%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p0
|
||||
%patch3 -p1
|
||||
%patch4 -p0
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%forgesetup
|
||||
|
||||
%build
|
||||
%set_build_flags
|
||||
pushd squashfs-tools
|
||||
CFLAGS="%{optflags}" XZ_SUPPORT=1 LZO_SUPPORT=1 LZMA_XZ_SUPPORT=1 LZ4_SUPPORT=1 make %{?_smp_mflags}
|
||||
CFLAGS="%optflags" XZ_SUPPORT=1 LZO_SUPPORT=1 LZMA_XZ_SUPPORT=1 LZ4_SUPPORT=1 ZSTD_SUPPORT=1 make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_mandir}/man1
|
||||
install -m 755 squashfs-tools/mksquashfs %{buildroot}%{_sbindir}/mksquashfs
|
||||
install -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs
|
||||
install -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/mksquashfs.1
|
||||
install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
pushd squashfs-tools
|
||||
make INSTALL_PREFIX=%{buildroot}/usr INSTALL_DIR=%{buildroot}%{_sbindir} INSTALL_MANPAGES_DIR=%{buildroot}%{_mandir}/man1 install
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README ACKNOWLEDGEMENTS DONATIONS PERFORMANCE.README README-4.3 CHANGES pseudo-file.example COPYING
|
||||
%doc ACKNOWLEDGEMENTS README* CHANGES COPYING USAGE* ACTIONS-README
|
||||
|
||||
%doc README
|
||||
%{_mandir}/man1/*
|
||||
%{_mandir}/man1/mksquashfs.1.gz
|
||||
%{_mandir}/man1/unsquashfs.1.gz
|
||||
%{_mandir}/man1/sqfstar.1.gz
|
||||
%{_mandir}/man1/sqfscat.1.gz
|
||||
|
||||
%{_sbindir}/mksquashfs
|
||||
%{_sbindir}/unsquashfs
|
||||
%{_sbindir}/sqfstar
|
||||
%{_sbindir}/sqfscat
|
||||
|
||||
%changelog
|
||||
* Mon Sep 18 2023 Abhi Das <adas@redhat.com> - 4.3-21
|
||||
- CVE-2021-41072 squashfs-tools: additional write outside destination directory exploit fix
|
||||
CVE-2021-40153 squashfs-tools: unvalidated filepaths allow writing outside of destination
|
||||
Resolves: rhbz#2007303 rhbz#2000637
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 4.6.1-6
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Thu Feb 25 2021 Abhi Das <adas@redhat.com> - 4.3-20
|
||||
- rhbz#1895017 - unsquashfs does not preserve file capabilities
|
||||
rhbz#1754815 - Kdump: Building kdump initramfs img may fail with 'dracut: Failed making squash image' occasionally
|
||||
Resolves: rhbz#1895017, rhbz#1754815
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 4.6.1-5
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Tue Aug 06 2019 Abhi Das <adas@redhat.com> - 4.3-19
|
||||
- rhbz#1602698 - Fix coverity issues
|
||||
rhbz#1624173 - Fix annocheck failures
|
||||
rhbz#1716278 - limit max cpus in mksquashfs
|
||||
Resolves: rhbz#1602698, rhbz#1624173, rhbz#1716278
|
||||
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.6.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Tue Aug 06 2019 Abhi Das <adas@redhat.com> - 4.3-18
|
||||
- Add manual gating test
|
||||
Resolves: rhbz#1682413
|
||||
* Mon Oct 16 2023 Pavel Reichl <preichl@redhat.com> - 4.6.1-3
|
||||
- Convert License tag to SPDX format
|
||||
|
||||
* Mon Aug 20 2018 Josh Boyer <jwboyer@redhat.com> - 4.3-17
|
||||
- Fix build against glibc 2.28
|
||||
Resolves: rhbz#1611746
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.6.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Wed Mar 29 2023 Bruno Wolff III <bruno@wolff.to> - 4.6.1-1
|
||||
- Phillip is now doing two tags per release and we can
|
||||
- use the one that works better with forgemeta
|
||||
- There are a few fixes after the 4.6 release. I think only
|
||||
- one applies to Fedora because of the build options we use.
|
||||
- It was not something that affects image builds.
|
||||
|
||||
* Fri Mar 17 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-2
|
||||
- Remove the dist prefix from the release
|
||||
|
||||
* Fri Mar 17 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-1
|
||||
- 4.6 release
|
||||
- PR #231 was merged
|
||||
- See https://github.com/plougher/squashfs-tools/blob/master/CHANGES
|
||||
|
||||
* Wed Mar 15 2023 Adam Williamson <awilliam@redhat.com> - 4.6-0.7.20230314git36abab0
|
||||
- Backport PR #231 to fix a crash (#2178510)
|
||||
|
||||
* Tue Mar 14 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.6^20230314git36abab0
|
||||
- A few minor memory leaks were fixed
|
||||
|
||||
* Sun Mar 12 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.5^20230312gitaaf011a
|
||||
- Doc updates
|
||||
- Probably the last version before the official release (tentatively tomorrow)
|
||||
|
||||
* Mon Mar 06 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.4^20230306git1eaad6d
|
||||
- Doc updates and unanchored search improvemebts
|
||||
|
||||
* Tue Feb 28 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.3^20230228git746a81c
|
||||
- Doc updates and minor bug fix
|
||||
|
||||
* Thu Feb 23 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.2^20230323git7cf6cee
|
||||
- Remove the -i and -v forgemeta flags to get rid of the extra noise
|
||||
|
||||
* Thu Feb 23 2023 Bruno Wolff III <bruno@wolff.to> - 4.6-0.1^20230323git7cf6cee
|
||||
- Prerelease snapshot of 4.6
|
||||
|
||||
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Sat Mar 19 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-1
|
||||
- 4.5.1 release
|
||||
- Up to date man pages
|
||||
- Lots of little fixes
|
||||
|
||||
* Fri Mar 11 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-27.20220311git76624e1
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Minor fixes
|
||||
|
||||
* Thu Mar 10 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-26.20220310gitde61d0a
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Minor fixes
|
||||
- Doc updates
|
||||
|
||||
* Tue Mar 08 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-25.20220308git2ac40ca
|
||||
- Upstream fix for unsquashfs breakage from recent commit
|
||||
|
||||
* Tue Mar 08 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-24.20220308git8b6ee89
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Minor fixes
|
||||
- Man page tweaks
|
||||
- Tentative 4.5.1 change log
|
||||
|
||||
* Mon Mar 07 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-23.20220307git580b4e1
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Minor fixes
|
||||
|
||||
* Fri Mar 04 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-22.20220304git2baf12e
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Minor fixes
|
||||
|
||||
* Mon Feb 28 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-21.20220228git263a14e
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Man page improvement
|
||||
|
||||
* Fri Feb 25 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-20.20220225gitc883f32
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Man page improvement
|
||||
|
||||
* Wed Feb 23 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-19.20220223git2dfbcda
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Man page improvement
|
||||
|
||||
* Mon Feb 21 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-18.20220221gitbc0c097
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some minor fixes.
|
||||
|
||||
* Fri Feb 18 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-17.20220218gitf3783bb
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some minor fixes.
|
||||
|
||||
* Thu Feb 17 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-16.20220217git75951fb
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some minor fixes.
|
||||
|
||||
* Tue Feb 15 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-15.20220215gitf491ad8
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some minor fixes.
|
||||
|
||||
* Mon Feb 14 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-14.20220214gitde944c3
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some minor fixes.
|
||||
|
||||
* Thu Feb 10 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-13.20220210gita8f61e2
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Some code cleanups for stuff noted by gcc.
|
||||
|
||||
* Thu Feb 10 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-12.20220210gite7e96fe
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Add man page for sqfscat.
|
||||
|
||||
* Wed Feb 09 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-11.20220209git0425d3d
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Add man page for sqfstar.
|
||||
|
||||
* Tue Feb 08 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-10.20220208git9e46a75
|
||||
- Continue testing upstream patches prior to 4.5.1 release.
|
||||
- Upstream man page for unsquashfs replaces out of date one froom Debian.
|
||||
|
||||
* Mon Feb 07 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-9.20220207gitbd186a7
|
||||
- Continue testing upstream patches
|
||||
- The deprecated lzma support options are improved in the man page
|
||||
|
||||
* Mon Feb 07 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-8.20220207git7f9203e
|
||||
- Continue testing upstream patches
|
||||
- Man pages are now built during the build process
|
||||
|
||||
* Fri Feb 04 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-7.20220204git8a9d02e
|
||||
- Continue testing upstream patches
|
||||
- A makefile for mksquashfs is now included
|
||||
|
||||
* Wed Feb 02 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-6.20220202git11c9591
|
||||
- Continue testing upstream patches
|
||||
- This includes help text changes
|
||||
|
||||
* Fri Jan 28 2022 Bruno Wolff III <bruno@wolff.to> - 4.5-5.20220128gitd5a583e
|
||||
- Test a few changes before upstream tags a new point release
|
||||
|
||||
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Mon Dec 27 2021 Bruno Wolff III <bruno@wolff.to> - 4.5-4.20211227git5ae7238
|
||||
- Get fixes for a few minor bugs
|
||||
|
||||
* Mon Sep 13 2021 Bruno Wolff III <bruno@wolff.to> - 4.5-3.20210913gite048580
|
||||
- Fix bug 2003701 (additional write outside destination directory exploit)
|
||||
|
||||
* Mon Jul 26 2021 Bruno Wolff III <bruno@wolff.to> - 4.5-2
|
||||
- Fix for sparse fragment bug 1985561
|
||||
|
||||
* Fri Jul 23 2021 Bruno Wolff III <bruno@wolff.to> - 4.5-1
|
||||
- First crack at 4.5 release
|
||||
- Man pages still need significant work
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.4-5.git1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Sat Nov 14 2020 Bruno Wolff III <bruno@wolff.to> - 4.4-4.git1
|
||||
- Gating tests failed and unable to rerun them
|
||||
|
||||
* Wed Nov 11 2020 Bruno Wolff III <bruno@wolff.to> - 4.4-3.git1
|
||||
- New upstream release with a minor fix
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.4-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue May 12 2020 Bruno Wolff III <bruno@wolff.to> - 4.4-1.20200513gitc570c61
|
||||
- Go to 4.4 release + plus a few upstream post release patches
|
||||
|
||||
* Sat Feb 08 2020 Bruno Wolff III <bruno@wolff.to> - 4.3-25
|
||||
- Fix duplicate definition flagged by gcc10
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-24
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Jan 17 2020 Jeff Law <law@redhat.com> - 4.3-23
|
||||
- Fix undefined symbol when building with LTO due to incorrect
|
||||
use of inline function
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-22
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Mon Jun 24 2019 Bruno Wolff III <bruno@wolff.to> - 4.3-21
|
||||
- Add zstd compression support (Sean Purcell via github.com/plougher/squashfs-tools)
|
||||
|
||||
* Tue May 21 2019 Bruno Wolff III <bruno@wolff.to> - 4.3-20
|
||||
- Fix issue with LDFLAGS not being set
|
||||
|
||||
* Tue May 21 2019 Bruno Wolff III <bruno@wolff.to> - 4.3-19
|
||||
- Fix issue with glibc changes
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-18
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-17
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.3-16
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
122
tests/Squashfs-compression-test.sh
Executable file
122
tests/Squashfs-compression-test.sh
Executable file
@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
# We need rpmdev-vercmp
|
||||
rpm -q rpmdevtools > /dev/null 2>&1 || (echo 'rpmdev-vercmp from rpmdevtools is needed to run this script, aborting (failed).'; exit 1)
|
||||
|
||||
# Define block sizes
|
||||
blocks=(4K 1M)
|
||||
|
||||
# Define fill files
|
||||
fill=(/dev/zero /dev/urandom)
|
||||
|
||||
# Define number of iterations
|
||||
iter=5
|
||||
|
||||
# Define fragment sizes
|
||||
frags=(0 1 2047 4095)
|
||||
|
||||
# Define test directory
|
||||
testdir=/tmp/test-squashfs
|
||||
|
||||
# Define mount point
|
||||
mp=${testdir}/mnt
|
||||
|
||||
# Define data directory
|
||||
datadir=${testdir}/data
|
||||
|
||||
# Check for squashfs-tools version and set compression types to test
|
||||
sqfsver=`rpm -q --qf '%{EVR}' squashfs-tools`
|
||||
if rpmdev-vercmp 4.1 ${sqfsver} > /dev/null; [ $? == '11' ]; then
|
||||
ucomp=('gzip')
|
||||
elif rpmdev-vercmp 4.2 ${sqfsver} > /dev/null; [ $? == '11' ]; then
|
||||
ucomp=(gzip lzo lzma)
|
||||
elif rpmdev-vercmp 4.3-1 ${sqfsver} > /dev/null; [ $? == '11' ]; then
|
||||
ucomp=(gzip lzo lzma xz)
|
||||
elif rpmdev-vercmp 4.3-21 ${sqfsver} > /dev/null; [ $? == '11' ]; then
|
||||
ucomp=(gzip lzo lzma xz lz4)
|
||||
else
|
||||
ucomp=(gzip lzo lzma xz lz4 zstd)
|
||||
fi
|
||||
|
||||
# Check for kernel verion and set mount test compression types
|
||||
kernel=`uname -r`
|
||||
if rpmdev-vercmp 2.6.36 ${kernel} > /dev/null; [ $? == '11' ]; then
|
||||
mcomp=('gzip')
|
||||
elif rpmdev-vercmp 2.6.38 ${kernel} > /dev/null; [ $? == '11' ]; then
|
||||
mcomp=(gzip lzo)
|
||||
elif rpmdev-vercmp 3.19 ${kernel} > /dev/null; [ $? == '11' ]; then
|
||||
mcomp=(gzip lzo xz)
|
||||
elif rpmdev-vercmp 4.14 ${kernel} > /dev/null; [ $? == '11' ]; then
|
||||
mcomp=(gzip lzo xz lz4)
|
||||
else
|
||||
mcomp=(gzip lzo xz lz4 zstd)
|
||||
fi
|
||||
|
||||
# Check for uid 0 and print a warning if not
|
||||
[ ${UID} -ne 0 ] && echo 'Mount tests will not be performed when not running as root'
|
||||
|
||||
# Check if test directory exists and make if not
|
||||
[ -d ${testdir} ] || mkdir ${testdir}
|
||||
[ -d ${testdir} ] || (echo "Unable to make '${testdir}', aborting (failed)."; exit 1)
|
||||
|
||||
# Check if mount point directory exists and make if not
|
||||
[ -d ${mp} ] || mkdir ${mp}
|
||||
[ -d ${mp} ] || (echo "Unable to make '${mp}', aborting (failed)."; exit 1)
|
||||
|
||||
# Check if data directory exists and make if not
|
||||
if [ -d ${datadir} ]; then
|
||||
echo "Using existing data directory."
|
||||
else
|
||||
echo "Building data directory."
|
||||
mkdir ${datadir}
|
||||
[ -d ${datadir} ] || (echo "Unable to make '${datadir}', aborting (failed)."; exit 1)
|
||||
for size in ${frags[*]}; do
|
||||
for file in ${fill[*]}; do
|
||||
dd if=${file} of=${datadir}/frag-`basename ${file}`-${size} bs=1 count=${size} > /dev/null 2>&1
|
||||
done
|
||||
done
|
||||
for size in ${blocks[*]}; do
|
||||
for ((count=1;${count}<=${iter};count++)); do
|
||||
for file in ${fill[*]}; do
|
||||
dd if=${file} of=${datadir}/file-`basename ${file}`-${size}-${count} bs=${size} count=${count} > /dev/null 2>&1
|
||||
done
|
||||
done
|
||||
done
|
||||
for size1 in ${frags[*]}; do
|
||||
for file1 in ${fill[*]}; do
|
||||
for size2 in ${blocks[*]}; do
|
||||
for ((count=1;${count}<=${iter};count++)); do
|
||||
for file2 in ${fill[*]}; do
|
||||
cat ${datadir}/file-`basename ${file2}`-${size2}-${count} ${datadir}/frag-`basename ${file1}`-${size1} > ${datadir}/combined-`basename ${file2}`-${size2}-${count}-`basename ${file1}`-${size1}
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
# Run unmounted tests
|
||||
for comp in ${ucomp[*]}; do
|
||||
echo "Building squashfs image using ${comp} compression."
|
||||
if [ "${comp}" == gzip ]; then
|
||||
mksquashfs ${datadir} ${testdir}/sq.img || (echo "mksquashfs failed for ${comp} compression."; continue)
|
||||
else
|
||||
mksquashfs ${datadir} ${testdir}/sq.img -comp ${comp} || (echo "mksquashfs failed for ${comp} compression."; continue)
|
||||
fi
|
||||
echo "Testing unmounted extract using ${comp} compression."
|
||||
unsquashfs -d ${testdir}/sq ${testdir}/sq.img || echo "unsquashfs failed for ${comp} compression."
|
||||
diff -r -q ${testdir}/sq ${datadir} || (echo "Extract test failed for ${comp} compression."; exit)
|
||||
rm -rf ${testdir}/sq
|
||||
if [ ${UID} == 0 ]; then
|
||||
for kern in ${mcomp[*]}; do
|
||||
if [ ${kern} == ${comp} ]; then
|
||||
echo "Testing mounted image using ${comp} compression."
|
||||
mount -r -o loop -t squashfs ${testdir}/sq.img ${mp} || echo "Mount failed.";
|
||||
diff -r -q ${mp} ${datadir} || echo "Mounted test failed for ${comp} compression."
|
||||
umount ${mp}
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
rm -f ${testdir}/sq ${testdir}/sq.img
|
||||
done
|
30
tests/test_working.yml
Normal file
30
tests/test_working.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
vars:
|
||||
- artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}"
|
||||
tags:
|
||||
- classic
|
||||
remote_user: root
|
||||
tasks:
|
||||
- name: Add extra required packages
|
||||
dnf:
|
||||
name: rpmdevtools, kernel-modules-{{ ansible_kernel }}
|
||||
- name: Install the test files
|
||||
copy: src={{ item.file }} dest=/usr/local/bin/{{ item.dest }} mode=0755
|
||||
with_items:
|
||||
- {file: Squashfs-compression-test.sh, dest: Squashfs-compression-test.sh }
|
||||
- name: Test block
|
||||
block:
|
||||
- name: Execute the tests
|
||||
shell: |
|
||||
(/usr/local/bin/Squashfs-compression-test.sh &> /tmp/test.log); grep -iq failed /tmp/test.log && result=fail || result=pass
|
||||
echo -e "results:\n- {result: $result, test: working}" > /tmp/results.yml
|
||||
always:
|
||||
- name: Pull out the logs
|
||||
fetch:
|
||||
dest: "{{ artifacts }}/"
|
||||
src: "{{ item }}"
|
||||
flat: yes
|
||||
with_items:
|
||||
- /tmp/test.log
|
||||
- /tmp/results.yml
|
1
tests/tests.yml
Normal file
1
tests/tests.yml
Normal file
@ -0,0 +1 @@
|
||||
- import_playbook: test_working.yml
|
Loading…
Reference in New Issue
Block a user