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
This commit is contained in:
Philipp Seiler 2019-10-27 17:57:20 +00:00 committed by Git OBS Bridge
parent f160d77789
commit 65f4d119ab
10 changed files with 72 additions and 227 deletions

View File

@ -1,60 +0,0 @@
From de03266983ceb62e5365aac84fcd3b2fd4d16e6f Mon Sep 17 00:00:00 2001
From: Phillip Lougher <phillip@squashfs.org.uk>
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 <phillip@squashfs.org.uk>
---
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

View File

@ -1,30 +0,0 @@
From 9c1db6d13a51a2e009f0027ef336ce03624eac0d Mon Sep 17 00:00:00 2001
From: "Guan, Xin" <guanx.bac@gmail.com>
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 <bruno@wolff.to>
Signed-off-by: Guan, Xin <guanx.bac@gmail.com>
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
---
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

View File

@ -1,86 +0,0 @@
From 5a498ad24dcfeac9f3d747e894f22901f3ac10ef Mon Sep 17 00:00:00 2001
From: probonopd <probonopd@users.noreply.github.com>
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 <offset>\t\tSkip <offset> 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"

View File

@ -1,6 +1,7 @@
--- squashfs4.3/squashfs-tools/mksquashfs.c.orig 2014-05-13 00:18:20.000000000 +0200 diff -dupr squashfs4.4/squashfs-tools/mksquashfs.c squashfs4.4_new/squashfs-tools/mksquashfs.c
+++ squashfs4.3/squashfs-tools/mksquashfs.c 2014-05-16 14:59:30.802144932 +0200 --- squashfs4.4/squashfs-tools/mksquashfs.c 2019-08-29 03:58:04.000000000 +0200
@@ -4674,9 +4674,9 @@ void write_filesystem_tables(struct squa +++ 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); SQUASHFS_INSWAP_SUPER_BLOCK(sBlk);
write_destination(fd, SQUASHFS_START, sizeof(*sBlk), sBlk); write_destination(fd, SQUASHFS_START, sizeof(*sBlk), sBlk);
@ -13,9 +14,9 @@
} }
close(fd); close(fd);
@@ -5309,7 +5309,7 @@ printOptions: @@ -5898,7 +5898,7 @@ printOptions:
ERROR("-force-uid uid\t\tset all file uids to uid\n"); ERROR("-force-uid <uid>\tset all file uids to <uid>\n");
ERROR("-force-gid gid\t\tset all file gids to gid\n"); ERROR("-force-gid <gid>\tset all file gids to <gid>\n");
ERROR("-nopad\t\t\tdo not pad filesystem to a multiple " ERROR("-nopad\t\t\tdo not pad filesystem to a multiple "
- "of 4K\n"); - "of 4K\n");
+ "of 64K\n"); + "of 64K\n");

View File

@ -1,6 +1,7 @@
--- squashfs4.3/squashfs-tools/mksquashfs.c.orig 2014-05-13 00:18:20.000000000 +0200 diff -dupr squashfs4.4_orig/squashfs-tools/mksquashfs.c squashfs4.4/squashfs-tools/mksquashfs.c
+++ squashfs4.3/squashfs-tools/mksquashfs.c 2016-06-16 17:06:56.347792650 +0200 --- squashfs4.4_orig/squashfs-tools/mksquashfs.c 2019-10-21 15:36:52.002369471 +0200
@@ -4126,6 +4126,15 @@ void initialise_threads(int readq, int f +++ 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); processors = sysconf(_SC_NPROCESSORS_ONLN);
#endif #endif
} }

View File

@ -1,3 +1,58 @@
-------------------------------------------------------------------
Mon Oct 21 13:45:56 UTC 2019 - Philipp Seiler <p.seiler@linuxmail.org>
- 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 <p.seiler@linuxmail.org> Wed Jun 5 20:21:30 UTC 2019 - Philipp <p.seiler@linuxmail.org>

View File

@ -17,7 +17,7 @@
Name: squashfs Name: squashfs
Version: 4.3 Version: 4.4
Release: 0 Release: 0
Summary: A Read-Only File System with Efficient Compression Summary: A Read-Only File System with Efficient Compression
License: GPL-2.0-or-later License: GPL-2.0-or-later
@ -25,15 +25,7 @@ Group: System/Filesystems
Url: http://squashfs.sourceforge.net/ Url: http://squashfs.sourceforge.net/
Source0: http://sourceforge.net/projects/squashfs/files/squashfs/%{name}%{version}/%{name}%{version}.tar.gz Source0: http://sourceforge.net/projects/squashfs/files/squashfs/%{name}%{version}/%{name}%{version}.tar.gz
Patch0: squashfs-64k.patch Patch0: squashfs-64k.patch
# PATCH-FIX-UPSTREAM 0001-mksquashfs-fix-rare-race-in-fragment-waiting-in-file.patch boo#953723 Patch1: squashfs-thread-limit
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 <sys/sysmacros.h> 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
%if %{?suse_version} > 1315 %if %{?suse_version} > 1315
BuildRequires: liblz4-devel BuildRequires: liblz4-devel
%endif %endif
@ -51,10 +43,6 @@ squashfs images.
%setup -q -n squashfs%{version} %setup -q -n squashfs%{version}
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build %build
%define _lto_cflags %{nil} %define _lto_cflags %{nil}
@ -70,7 +58,7 @@ install -m 755 squashfs-tools/{un,mk}squashfs %{buildroot}%{_bindir}
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc README README-%{version} PERFORMANCE.README CHANGES %doc README-%{version} ACKNOWLEDGEMENTS CHANGES COPYING USAGE
%{_bindir}/*squashfs %{_bindir}/*squashfs
%changelog %changelog

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d605512437b1eb800b4736791559295ee5f60177e102e4d4ccd0ee241a5f3f6
size 182550

3
squashfs4.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a981b3f3f2054b5a2e658851a3c06a2460ad04a9a8a645e0afe063a63fdbb07e
size 190797

View File

@ -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 <signal.h>
#include <setjmp.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/mman.h>
#include <pthread.h>
#include <regex.h>
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 <sys/sysinfo.h>
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <limits.h>