From 65f4d119ab6e170623fbfdb450289f8bc10dd21249983b116c3042b5e86a7e5e Mon Sep 17 00:00:00 2001
From: Philipp Seiler
Date: Sun, 27 Oct 2019 17:57:20 +0000
Subject: [PATCH 1/2] Accepting request 741504 from
home:seilerphilipp:filesystems
- Version 4.4 - 2019-08-29:
* Reproducible builds, new compressors,
CVE fixes, security hardening and new options
for Mksquashfs/Unsquashfs.
- Overall improvements:
* Mksquashfs now generates reproducible images by default.
* Mkfs time and file timestamps can also be specified.
* Support for the Zstandard (ZSTD) compression algorithm.
* CVE-2015-4645 and CVE-2015-4646 have been fixed.
- Mksquashfs improvements and major bug fixes:
* Pseudo files now support symbolic links.
* New -mkfs-time option.
* New -all-time option.
* New -root-mode option.
* New -quiet option.
* New -noId option.
* New -offset option.
* Update lz4 wrapper to use new functions introduced
in 1.7.0.
* Bug fix, don't allow "/" pseudo filenames.
* Bug fix, allow quoting of pseudo files, to
better handle filenames with spaces.
* Fix compilation with glibc 2.25+.
- Unsquashfs improvements and major bug fixes:
* CVE-2015-4645 and CVE-2015-4646 have been fixed.
* Unsquashfs has been further hardened against corrupted
filestems.
* Unsquashfs is now more strict about error handling.
* New -ignore-errors option.
* New -strict-errors option.
* New -lln[umeric] option.
* New -lc option.
* New -llc option.
* New -mkfs-time option.
* New -UTC option.
* New -offset option.
* New -quiet option.
* Update lz4 wrapper to use new functions introduced
in 1.7.0.
* Bug fix, fatal and non-fatal errors now set the exit
code to 1.
* Bug fix, fix time setting for symlinks.
* Bug fix, try to set sticky-bit when running as a
user process.
* Fix compilation with glibc 2.25+.
- build changes
* re-created patches to fit squashfs 4.4
OBS-URL: https://build.opensuse.org/request/show/741504
OBS-URL: https://build.opensuse.org/package/show/filesystems/squashfs?expand=0&rev=42
---
...are-race-in-fragment-waiting-in-file.patch | 60 -------------
...-limit-of-the-is_fragment-.-function.patch | 30 -------
...-Add-offset-function-to-skip-n-bytes.patch | 86 -------------------
squashfs-64k.patch | 13 +--
squashfs-thread-limit | 7 +-
squashfs.changes | 55 ++++++++++++
squashfs.spec | 18 +---
squashfs4.3.tar.gz | 3 -
squashfs4.4.tar.gz | 3 +
sysmacros.patch | 24 ------
10 files changed, 72 insertions(+), 227 deletions(-)
delete mode 100644 0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch
delete mode 100644 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
delete mode 100644 0003-Add-offset-function-to-skip-n-bytes.patch
delete mode 100644 squashfs4.3.tar.gz
create mode 100644 squashfs4.4.tar.gz
delete mode 100644 sysmacros.patch
diff --git a/0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch b/0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch
deleted file mode 100644
index ca47f90..0000000
--- a/0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From de03266983ceb62e5365aac84fcd3b2fd4d16e6f Mon Sep 17 00:00:00 2001
-From: Phillip Lougher
-Date: Thu, 18 Sep 2014 01:28:11 +0100
-Subject: [PATCH 1/2] mksquashfs: fix rare race in fragment waiting in
- filesystem finalisation
-
-Fix a rare race condition in fragment waiting when finalising the
-filesystem. This is a race condition that was initially fixed in 2009,
-but inadvertantly re-introduced in the latest release when the code
-was rewritten.
-
-Background:
-
-When finalising the filesystem, the main control thread needs to ensure
-all the in-flight fragments have been queued to the writer thread before
-asking the writer thread to finish, and then writing the metadata.
-
-It does this by waiting on the fragments_outstanding counter. Once this
-counter reaches 0, it synchronises with the writer thread, waiting until
-the writer thread reports no outstanding data to be written.
-
-However, the main thread can race with the fragment deflator thread(s)
-because the fragment deflator thread(s) decrement the fragments_outstanding
-counter and release the mutex before queueing the compressed fragment
-to the writer thread, i.e. the offending code is:
-
- fragments_outstanding --;
- pthread_mutex_unlock(&fragment_mutex);
- queue_put(to_writer, write_buffer);
-
-In extremely rare circumstances, the main thread may see the
-fragments_outstanding counter is zero before the fragment
-deflator sends the fragment buffer to the writer thread, and synchronise
-with the writer thread, and finalise before the fragment has been written.
-
-The fix is to ensure the fragment is queued to the writer thread
-before releasing the mutex.
-
-Signed-off-by: Phillip Lougher
----
- squashfs-tools/mksquashfs.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
-index 87b7d86..f1fcff1 100644
---- a/squashfs-tools/mksquashfs.c
-+++ b/squashfs-tools/mksquashfs.c
-@@ -2419,8 +2419,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);
---
-2.1.4
-
diff --git a/0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch b/0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
deleted file mode 100644
index 69b5205..0000000
--- a/0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 9c1db6d13a51a2e009f0027ef336ce03624eac0d Mon Sep 17 00:00:00 2001
-From: "Guan, Xin"
-Date: Sat, 13 Sep 2014 13:15:26 +0200
-Subject: [PATCH 2/2] Fix 2GB-limit of the is_fragment(...) function.
-
-Applies to squashfs-tools 4.3.
-
-Reported-by: Bruno Wolff III
-Signed-off-by: Guan, Xin
-Signed-off-by: Phillip Lougher
----
- squashfs-tools/mksquashfs.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
-index f1fcff1..d221c35 100644
---- a/squashfs-tools/mksquashfs.c
-+++ b/squashfs-tools/mksquashfs.c
-@@ -2029,7 +2029,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
-
- 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
---
-2.1.4
-
diff --git a/0003-Add-offset-function-to-skip-n-bytes.patch b/0003-Add-offset-function-to-skip-n-bytes.patch
deleted file mode 100644
index a433ccc..0000000
--- a/0003-Add-offset-function-to-skip-n-bytes.patch
+++ /dev/null
@@ -1,86 +0,0 @@
-From 5a498ad24dcfeac9f3d747e894f22901f3ac10ef Mon Sep 17 00:00:00 2001
-From: probonopd
-Date: Thu, 15 Sep 2016 21:09:52 +0200
-Subject: [PATCH] Add -offset function to skip n bytes at the beginning of the
- squashfs file
-
----
- squashfs-tools/mksquashfs.c | 25 +++++++++++++++++++------
- 1 file changed, 19 insertions(+), 6 deletions(-)
-
-diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
-index d221c358..92b6a319 100644
---- a/squashfs-tools/mksquashfs.c
-+++ b/squashfs-tools/mksquashfs.c
-@@ -98,6 +98,7 @@ int old_exclude = TRUE;
- int use_regex = FALSE;
- int nopad = FALSE;
- int exit_on_error = FALSE;
-+static off_t squashfs_start_offset = 0;
-
- long long global_uid = -1, global_gid = -1;
-
-@@ -516,9 +517,9 @@ int read_fs_bytes(int fd, long long byte, int bytes, void *buff)
-
- pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
- pthread_mutex_lock(&pos_mutex);
-- if(lseek(fd, off, SEEK_SET) == -1) {
-+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
- ERROR("read_fs_bytes: Lseek on destination failed because %s, "
-- "offset=0x%llx\n", strerror(errno), off);
-+ "offset=0x%llx\n", strerror(errno), off+squashfs_start_offset);
- res = 0;
- } else if(read_bytes(fd, buff, bytes) < bytes) {
- ERROR("Read on destination failed\n");
-@@ -557,10 +558,10 @@ void write_destination(int fd, long long byte, int bytes, void *buff)
- pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
- pthread_mutex_lock(&pos_mutex);
-
-- if(lseek(fd, off, SEEK_SET) == -1) {
-+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
- ERROR("write_destination: Lseek on destination "
- "failed because %s, offset=0x%llx\n", strerror(errno),
-- off);
-+ off+squashfs_start_offset);
- BAD_ERROR("Probably out of space on output %s\n",
- block_device ? "block device" : "filesystem");
- }
-@@ -2315,9 +2316,9 @@ void *writer(void *arg)
- pthread_cleanup_push((void *) pthread_mutex_unlock, &pos_mutex);
- pthread_mutex_lock(&pos_mutex);
-
-- if(lseek(fd, off, SEEK_SET) == -1) {
-+ if(lseek(fd, off+squashfs_start_offset, SEEK_SET) == -1) {
- ERROR("writer: Lseek on destination failed because "
-- "%s, offset=0x%llx\n", strerror(errno), off);
-+ "%s, offset=0x%llx\n", strerror(errno), off+squashfs_start_offset);
- BAD_ERROR("Probably out of space on output "
- "%s\n", block_device ? "block device" :
- "filesystem");
-@@ -5341,6 +5342,15 @@ int main(int argc, char *argv[])
- force_progress = TRUE;
- else if(strcmp(argv[i], "-no-exports") == 0)
- exportable = FALSE;
-+ else if(strcmp(argv[i], "-offset") == 0 ||
-+ strcmp(argv[i], "-o") ==0) {
-+ if(++i == argc) {
-+ ERROR("%s: %s offset missing argument\n", argv[0],
-+ argv[i - 1]);
-+ exit(1);
-+ }
-+ squashfs_start_offset = (off_t)atol(argv[i]);
-+ }
- else if(strcmp(argv[i], "-processors") == 0) {
- if((++i == argc) || !parse_num(argv[i], &processors)) {
- ERROR("%s: -processors missing or invalid "
-@@ -5641,6 +5651,9 @@ int main(int argc, char *argv[])
- ERROR("\nMiscellaneous options:\n");
- ERROR("-root-owned\t\talternative name for -all-root"
- "\n");
-+ ERROR("-o \t\tSkip bytes at the "
-+ "beginning of the file.\n\t\t\t"
-+ "Default 0 bytes\n");
- ERROR("-noInodeCompression\talternative name for -noI"
- "\n");
- ERROR("-noDataCompression\talternative name for -noD"
-
diff --git a/squashfs-64k.patch b/squashfs-64k.patch
index 7be5863..e48cd43 100644
--- a/squashfs-64k.patch
+++ b/squashfs-64k.patch
@@ -1,6 +1,7 @@
---- squashfs4.3/squashfs-tools/mksquashfs.c.orig 2014-05-13 00:18:20.000000000 +0200
-+++ squashfs4.3/squashfs-tools/mksquashfs.c 2014-05-16 14:59:30.802144932 +0200
-@@ -4674,9 +4674,9 @@ void write_filesystem_tables(struct squa
+diff -dupr squashfs4.4/squashfs-tools/mksquashfs.c squashfs4.4_new/squashfs-tools/mksquashfs.c
+--- squashfs4.4/squashfs-tools/mksquashfs.c 2019-08-29 03:58:04.000000000 +0200
++++ squashfs4.4/squashfs-tools/mksquashfs.c 2019-10-21 15:34:39.393253955 +0200
+@@ -4948,9 +4948,9 @@ void write_filesystem_tables(struct squa
SQUASHFS_INSWAP_SUPER_BLOCK(sBlk);
write_destination(fd, SQUASHFS_START, sizeof(*sBlk), sBlk);
@@ -13,9 +14,9 @@
}
close(fd);
-@@ -5309,7 +5309,7 @@ printOptions:
- ERROR("-force-uid uid\t\tset all file uids to uid\n");
- ERROR("-force-gid gid\t\tset all file gids to gid\n");
+@@ -5898,7 +5898,7 @@ printOptions:
+ ERROR("-force-uid \tset all file uids to \n");
+ ERROR("-force-gid \tset all file gids to \n");
ERROR("-nopad\t\t\tdo not pad filesystem to a multiple "
- "of 4K\n");
+ "of 64K\n");
diff --git a/squashfs-thread-limit b/squashfs-thread-limit
index 0c3a1ad..7939033 100644
--- a/squashfs-thread-limit
+++ b/squashfs-thread-limit
@@ -1,6 +1,7 @@
---- squashfs4.3/squashfs-tools/mksquashfs.c.orig 2014-05-13 00:18:20.000000000 +0200
-+++ squashfs4.3/squashfs-tools/mksquashfs.c 2016-06-16 17:06:56.347792650 +0200
-@@ -4126,6 +4126,15 @@ void initialise_threads(int readq, int f
+diff -dupr squashfs4.4_orig/squashfs-tools/mksquashfs.c squashfs4.4/squashfs-tools/mksquashfs.c
+--- squashfs4.4_orig/squashfs-tools/mksquashfs.c 2019-10-21 15:36:52.002369471 +0200
++++ squashfs4.4/squashfs-tools/mksquashfs.c 2019-10-21 15:37:13.402549491 +0200
+@@ -4384,6 +4384,15 @@ void initialise_threads(int readq, int f
processors = sysconf(_SC_NPROCESSORS_ONLN);
#endif
}
diff --git a/squashfs.changes b/squashfs.changes
index 8ba9f7f..59b78f0 100644
--- a/squashfs.changes
+++ b/squashfs.changes
@@ -1,3 +1,58 @@
+-------------------------------------------------------------------
+Mon Oct 21 13:45:56 UTC 2019 - Philipp Seiler
+
+- Version 4.4 - 2019-08-29:
+ * Reproducible builds, new compressors,
+ CVE fixes, security hardening and new options
+ for Mksquashfs/Unsquashfs.
+
+- Overall improvements:
+ * Mksquashfs now generates reproducible images by default.
+ * Mkfs time and file timestamps can also be specified.
+ * Support for the Zstandard (ZSTD) compression algorithm.
+ * CVE-2015-4645 and CVE-2015-4646 have been fixed.
+
+- Mksquashfs improvements and major bug fixes:
+ * Pseudo files now support symbolic links.
+ * New -mkfs-time option.
+ * New -all-time option.
+ * New -root-mode option.
+ * New -quiet option.
+ * New -noId option.
+ * New -offset option.
+ * Update lz4 wrapper to use new functions introduced
+ in 1.7.0.
+ * Bug fix, don't allow "/" pseudo filenames.
+ * Bug fix, allow quoting of pseudo files, to
+ better handle filenames with spaces.
+ * Fix compilation with glibc 2.25+.
+
+- Unsquashfs improvements and major bug fixes:
+ * CVE-2015-4645 and CVE-2015-4646 have been fixed.
+ * Unsquashfs has been further hardened against corrupted
+ filestems.
+ * Unsquashfs is now more strict about error handling.
+ * New -ignore-errors option.
+ * New -strict-errors option.
+ * New -lln[umeric] option.
+ * New -lc option.
+ * New -llc option.
+ * New -mkfs-time option.
+ * New -UTC option.
+ * New -offset option.
+ * New -quiet option.
+ * Update lz4 wrapper to use new functions introduced
+ in 1.7.0.
+ * Bug fix, fatal and non-fatal errors now set the exit
+ code to 1.
+ * Bug fix, fix time setting for symlinks.
+ * Bug fix, try to set sticky-bit when running as a
+ user process.
+ * Fix compilation with glibc 2.25+.
+
+- build changes
+* re-created patches to fit squashfs 4.4
+
-------------------------------------------------------------------
Wed Jun 5 20:21:30 UTC 2019 - Philipp
diff --git a/squashfs.spec b/squashfs.spec
index c65e307..0ac90c2 100644
--- a/squashfs.spec
+++ b/squashfs.spec
@@ -17,7 +17,7 @@
Name: squashfs
-Version: 4.3
+Version: 4.4
Release: 0
Summary: A Read-Only File System with Efficient Compression
License: GPL-2.0-or-later
@@ -25,15 +25,7 @@ Group: System/Filesystems
Url: http://squashfs.sourceforge.net/
Source0: http://sourceforge.net/projects/squashfs/files/squashfs/%{name}%{version}/%{name}%{version}.tar.gz
Patch0: squashfs-64k.patch
-# PATCH-FIX-UPSTREAM 0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch boo#953723
-Patch1: 0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch
-# PATCH-FIX-UPSTREAM 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch boo#953723
-Patch2: 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
-Patch3: squashfs-thread-limit
-# PATCH-FIX-UPSTREAM Include for major/minor/makedev
-Patch4: sysmacros.patch
-# PATCH-FIX_UPSTREAM add -offset function to skip n bytes
-Patch5: 0003-Add-offset-function-to-skip-n-bytes.patch
+Patch1: squashfs-thread-limit
%if %{?suse_version} > 1315
BuildRequires: liblz4-devel
%endif
@@ -51,10 +43,6 @@ squashfs images.
%setup -q -n squashfs%{version}
%patch0 -p1
%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
%build
%define _lto_cflags %{nil}
@@ -70,7 +58,7 @@ install -m 755 squashfs-tools/{un,mk}squashfs %{buildroot}%{_bindir}
%files
%defattr(-,root,root)
-%doc README README-%{version} PERFORMANCE.README CHANGES
+%doc README-%{version} ACKNOWLEDGEMENTS CHANGES COPYING USAGE
%{_bindir}/*squashfs
%changelog
diff --git a/squashfs4.3.tar.gz b/squashfs4.3.tar.gz
deleted file mode 100644
index dc1f661..0000000
--- a/squashfs4.3.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0d605512437b1eb800b4736791559295ee5f60177e102e4d4ccd0ee241a5f3f6
-size 182550
diff --git a/squashfs4.4.tar.gz b/squashfs4.4.tar.gz
new file mode 100644
index 0000000..5f5b238
--- /dev/null
+++ b/squashfs4.4.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a981b3f3f2054b5a2e658851a3c06a2460ad04a9a8a645e0afe063a63fdbb07e
+size 190797
diff --git a/sysmacros.patch b/sysmacros.patch
deleted file mode 100644
index 53c1376..0000000
--- a/sysmacros.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Index: squashfs4.3/squashfs-tools/mksquashfs.c
-===================================================================
---- squashfs4.3.orig/squashfs-tools/mksquashfs.c
-+++ squashfs4.3/squashfs-tools/mksquashfs.c
-@@ -43,6 +43,7 @@
- #include
- #include
- #include
-+#include
- #include
- #include
- #include
-Index: squashfs4.3/squashfs-tools/unsquashfs.c
-===================================================================
---- squashfs4.3.orig/squashfs-tools/unsquashfs.c
-+++ squashfs4.3/squashfs-tools/unsquashfs.c
-@@ -33,6 +33,7 @@
-
- #include
- #include
-+#include
- #include
- #include
- #include
From 35248795dcc014d2152f35cb9d15b23cca3aa379790cfb28958755c01075123f Mon Sep 17 00:00:00 2001
From: Philipp Seiler
Date: Sun, 27 Oct 2019 20:51:43 +0000
Subject: [PATCH 2/2] - added removal information of patches to the changelog
OBS-URL: https://build.opensuse.org/package/show/filesystems/squashfs?expand=0&rev=43
---
squashfs.changes | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/squashfs.changes b/squashfs.changes
index 59b78f0..7707885 100644
--- a/squashfs.changes
+++ b/squashfs.changes
@@ -50,8 +50,16 @@ Mon Oct 21 13:45:56 UTC 2019 - Philipp Seiler
user process.
* Fix compilation with glibc 2.25+.
-- build changes
+- build changes:
* re-created patches to fit squashfs 4.4
+* removed 0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch
+ (new version includes this change)
+* removed 0002-Fix-2GB-limit-of-the-is_fragment-.-function.patch
+ (new version includes this change)
+* removed 0003-Add-offset-function-to-skip-n-bytes.patch
+ (new version includes this change)
+* removed sysmacros.patch
+ (new version includes this change)
-------------------------------------------------------------------
Wed Jun 5 20:21:30 UTC 2019 - Philipp