4.6.1 25 MAR 2023 Bug fix release to fix race condition and XATTRs

code

	1. Race condition which can cause corruption of the "fragment table"
	   fixed.  This is a regression introduced in August 2022, and it has
	   been seen when tailend packing is used (-tailends option).
	2. Fix build failure when the tools are being built without extended
	   attribute (XATTRs) support.
	3. Fix XATTR error message when an unrecognised prefix is found
	   (Christian Hesse).
	4. Fix incorrect free of pointer when an unrecognised XATTR prefix is
	   found.
This commit is contained in:
scole 2023-10-03 19:26:20 +00:00
parent 2447bcee20
commit 0d4f607bf8
7 changed files with 57 additions and 153 deletions

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.8 2020/06/19 21:17:46 scole Exp $
# $NetBSD: Makefile,v 1.9 2023/10/03 19:26:20 scole Exp $
VERSION= 4.4
VERSION= 4.6.1
DISTNAME= squashfs-tools-${VERSION}
PKGNAME= squashfs-${VERSION}
@ -23,12 +23,18 @@ USE_TOOLS+= gmake
USE_LIBTOOL= yes
INSTALLATION_DIRS= bin \
man \
man/man1 \
share/doc/squashfs \
share/doc/squashfs/RELEASE-READMEs
share/doc/squashfs/examples
SQUASH_DIR= ${WRKDIR}/${DISTNAME}
WRKSRC= ${SQUASH_DIR}/squashfs-tools
SQUASH_PKG_DOC= ${DESTDIR}${PREFIX}/share/doc/squashfs
SQUASH_DOCS= ACKNOWLEDGEMENTS ACTIONS-README CHANGES COPYING INSTALL \
README-4.6.1 TECHNICAL-INFO USAGE-4.6 USAGE-MKSQUASHFS-4.6 \
USAGE-SQFSCAT-4.6 USAGE-SQFSTAR-4.6 USAGE-UNSQUASHFS-4.6
SQUASH_MAN= mksquashfs.1 sqfscat.1 sqfstar.1 unsquashfs.1
# xxx no sigtimedwait or sigwaitinfo on mac os?
BROKEN_ON_PLATFORM= Darwin-*-*
@ -38,14 +44,16 @@ do-install:
${WRKSRC}/mksquashfs ${DESTDIR}${PREFIX}/bin
${LIBTOOL} --mode=install ${INSTALL_PROGRAM} \
${WRKSRC}/unsquashfs ${DESTDIR}${PREFIX}/bin
${INSTALL_DATA} ${SQUASH_DIR}/ACKNOWLEDGEMENTS ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/CHANGES ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/COPYING ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/INSTALL ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/README ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/README-4.4 ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/USAGE ${SQUASH_PKG_DOC}
${INSTALL_DATA} ${SQUASH_DIR}/RELEASE-READMEs/* \
${SQUASH_PKG_DOC}/RELEASE-READMEs/
${LN} -f ${DESTDIR}${PREFIX}/bin/mksquashfs ${DESTDIR}${PREFIX}/bin/sqfstar
${LN} -f ${DESTDIR}${PREFIX}/bin/unsquashfs ${DESTDIR}${PREFIX}/bin/sqfscat
for f in ${SQUASH_DOCS}; do \
${INSTALL_DATA} ${SQUASH_DIR}/$$f ${SQUASH_PKG_DOC}; \
done
for f in ${SQUASH_MAN}; do \
${INSTALL_MAN} ${SQUASH_DIR}/manpages/$$f \
${DESTDIR}${PREFIX}/${PKGMANDIR}/man1; \
done
${INSTALL_DATA} ${SQUASH_DIR}/examples/pseudo-file.example \
${SQUASH_PKG_DOC}/examples
.include "../../mk/bsd.pkg.mk"

View file

@ -1,24 +1,22 @@
@comment $NetBSD: PLIST,v 1.4 2020/06/19 21:17:46 scole Exp $
@comment $NetBSD: PLIST,v 1.5 2023/10/03 19:26:20 scole Exp $
bin/mksquashfs
bin/sqfscat
bin/sqfstar
bin/unsquashfs
man/man1/mksquashfs.1
man/man1/sqfscat.1
man/man1/sqfstar.1
man/man1/unsquashfs.1
share/doc/squashfs/ACKNOWLEDGEMENTS
share/doc/squashfs/ACTIONS-README
share/doc/squashfs/CHANGES
share/doc/squashfs/COPYING
share/doc/squashfs/INSTALL
share/doc/squashfs/README
share/doc/squashfs/README-4.4
share/doc/squashfs/RELEASE-READMEs/DONATIONS
share/doc/squashfs/RELEASE-READMEs/PERFORMANCE.README
share/doc/squashfs/RELEASE-READMEs/README-2.0
share/doc/squashfs/RELEASE-READMEs/README-2.0-AMD64
share/doc/squashfs/RELEASE-READMEs/README-2.1
share/doc/squashfs/RELEASE-READMEs/README-3.0
share/doc/squashfs/RELEASE-READMEs/README-3.1
share/doc/squashfs/RELEASE-READMEs/README-3.2
share/doc/squashfs/RELEASE-READMEs/README-3.3
share/doc/squashfs/RELEASE-READMEs/README-4.0
share/doc/squashfs/RELEASE-READMEs/README-4.1
share/doc/squashfs/RELEASE-READMEs/README-4.2
share/doc/squashfs/RELEASE-READMEs/README-4.3
share/doc/squashfs/RELEASE-READMEs/pseudo-file.example
share/doc/squashfs/USAGE
share/doc/squashfs/README-4.6.1
share/doc/squashfs/TECHNICAL-INFO
share/doc/squashfs/USAGE-4.6
share/doc/squashfs/USAGE-MKSQUASHFS-4.6
share/doc/squashfs/USAGE-SQFSCAT-4.6
share/doc/squashfs/USAGE-SQFSTAR-4.6
share/doc/squashfs/USAGE-UNSQUASHFS-4.6
share/doc/squashfs/examples/pseudo-file.example

View file

@ -1,9 +1,6 @@
$NetBSD: distinfo,v 1.5 2021/10/26 10:25:30 nia Exp $
$NetBSD: distinfo,v 1.6 2023/10/03 19:26:20 scole Exp $
BLAKE2s (squashfs-tools-4.4.tar.gz) = 2a2f1f342699557b6fb2a8fa7d44acbecf645a94122699c1b2941618ac98ded4
SHA512 (squashfs-tools-4.4.tar.gz) = 133ce437fb8c929933d52cff710b61dd9181f6f8be58250b0d6a59a7bb79a2b350f68f456b06a0e17c469409a71272d586802d570248273ddcd5dad088c00308
Size (squashfs-tools-4.4.tar.gz) = 241842 bytes
SHA1 (patch-Makefile) = ee53cb3c16983cb3767df2ccdcf4636bd646fc3c
SHA1 (patch-action.c) = 35200e6cafd0846fb05fac50862ba3ceb4777935
SHA1 (patch-mksquashfs.c) = 723e9250e0ce821825de916671ac51251dce9432
SHA1 (patch-unsquashfs.c) = 167ee4ec1aea744dac6e13d837f1ae19a0f2472a
BLAKE2s (squashfs-tools-4.6.1.tar.gz) = f6cba60eaefba487281909c44a55265dc5869fc7d36026a98b72a9f083805312
SHA512 (squashfs-tools-4.6.1.tar.gz) = 10e8a4b1e2327e062aef4f85860e76ebcd7a29e4c19e152ff7edec4a38316982b5bcfde4ab69da6bcb931258d264c2b6cb40cb5f635f9e6f6eba1ed5976267cb
Size (squashfs-tools-4.6.1.tar.gz) = 286848 bytes
SHA1 (patch-Makefile) = 501a17abded8e066327f08a8c8b0773c897972f8

View file

@ -1,19 +1,19 @@
$NetBSD: patch-Makefile,v 1.3 2020/06/19 21:17:46 scole Exp $
$NetBSD: patch-Makefile,v 1.4 2023/10/03 19:26:20 scole Exp $
use options framework and libtool
--- Makefile.orig 2019-08-29 01:58:04.000000000 +0000
--- Makefile.orig 2023-03-25 20:53:37.000000000 +0000
+++ Makefile
@@ -15,7 +15,7 @@
# Obviously, you must select at least one of the available gzip, lzma, lzo
# compression types.
@@ -22,7 +22,7 @@ ifndef CONFIG
# Obviously, you must select at least one of the available gzip, xz, lzo,
# lz4, zstd or lzma (deprecated) compression types.
#
-GZIP_SUPPORT = 1
+#GZIP_SUPPORT = 1
########### Building XZ support #############
#
@@ -85,7 +85,7 @@ GZIP_SUPPORT = 1
@@ -92,7 +92,7 @@ GZIP_SUPPORT = 1
# in Mksquashfs. Obviously the compression algorithm must have been
# selected to be built
#
@ -22,7 +22,7 @@ use options framework and libtool
###############################################
@@ -97,7 +97,7 @@ COMP_DEFAULT = gzip
@@ -104,7 +104,7 @@ COMP_DEFAULT = gzip
# If your C library or build/target environment doesn't support XATTRs then
# comment out the next line to build Mksquashfs and Unsquashfs without XATTR
# support
@ -31,7 +31,7 @@ use options framework and libtool
# Select whether you wish xattrs to be stored by Mksquashfs and extracted
# by Unsquashfs by default. If selected users can disable xattr support by
@@ -105,7 +105,7 @@ XATTR_SUPPORT = 1
@@ -112,7 +112,7 @@ XATTR_SUPPORT = 1
#
# If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by
# default. Users can enable xattrs by using the -xattrs option.
@ -40,9 +40,9 @@ use options framework and libtool
###############################################
@@ -277,11 +277,15 @@ $(error "COMP_DEFAULT is set to ${COMP_D
built!")
endif
@@ -364,12 +364,15 @@ YEAR := $(firstword $(subst /, , $(DATE)
CFLAGS += -DVERSION=\"$(VERSION)\" -DDATE=\"$(DATE)\" -DYEAR=\"$(YEAR)\"
+%.lo : %.c
+ $(LIBTOOL) --mode=compile --tag=CC $(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
@ -52,21 +52,23 @@ use options framework and libtool
-mksquashfs: $(MKSQUASHFS_OBJS)
- $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(MKSQUASHFS_OBJS) $(LIBS) -o $@
- ln -sf mksquashfs sqfstar
+mksquashfs: $(MKSQUASHFS_OBJS:.o=.lo)
+ $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(MKSQUASHFS_OBJS:.o=.lo) \
+ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LIBS)
mksquashfs.o: Makefile mksquashfs.c squashfs_fs.h squashfs_swap.h mksquashfs.h \
sort.h pseudo.h compressor.h xattr.h action.h error.h progressbar.h \
@@ -331,8 +335,9 @@ lz4_wrapper.o: lz4_wrapper.c squashfs_fs
sort.h pseudo.h compressor.h xattr.h action.h mksquashfs_error.h progressbar.h \
@@ -428,9 +431,9 @@ lz4_wrapper.o: lz4_wrapper.c squashfs_fs
xz_wrapper.o: xz_wrapper.c squashfs_fs.h xz_wrapper.h compressor.h
-unsquashfs: $(UNSQUASHFS_OBJS)
- $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(UNSQUASHFS_OBJS) $(LIBS) -o $@
- ln -sf unsquashfs sqfscat
+unsquashfs: $(UNSQUASHFS_OBJS:.o=.lo)
+ $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(UNSQUASHFS_OBJS:.o=.lo) \
+ $(LDFLAGS) $(EXTRA_LDFLAGS) $(LIBS)
unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h \
squashfs_compat.h xattr.h read_fs.h compressor.h
squashfs_compat.h xattr.h read_fs.h compressor.h unsquashfs_error.h

View file

@ -1,30 +0,0 @@
$NetBSD: patch-action.c,v 1.2 2020/06/19 21:17:46 scole Exp $
Do not use alloca and strdupa which some platforms may not have
--- action.c.orig 2019-08-29 01:58:04.000000000 +0000
+++ action.c
@@ -2284,9 +2284,22 @@ static char *get_start(char *s, int n)
static int subpathname_fn(struct atom *atom, struct action_data *action_data)
{
- return fnmatch(atom->argv[0], get_start(strdupa(action_data->subpath),
+ /* XXX some platforms might not have alloca, strdupa */
+ int ret_val;
+ char *copy_str;
+
+ if ((copy_str = strdup(action_data->subpath)) == NULL) {
+ fprintf(stderr, "Out of mem\n");
+ exit(1);
+ }
+
+ ret_val = fnmatch(atom->argv[0],get_start(copy_str,
count_components(atom->argv[0])),
FNM_PATHNAME|FNM_PERIOD|FNM_EXTMATCH) == 0;
+
+ free(copy_str);
+
+ return ret_val;
}
/*

View file

@ -1,44 +0,0 @@
$NetBSD: patch-mksquashfs.c,v 1.2 2020/06/19 21:17:46 scole Exp $
#ifdef linux includes and don't use sysinfo() unless for linux
--- mksquashfs.c.orig 2019-08-29 01:58:04.000000000 +0000
+++ mksquashfs.c
@@ -35,7 +35,9 @@
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
+#if defined(__linux__)
#include <sys/sysmacros.h>
+#endif
#include <fcntl.h>
#include <errno.h>
#include <dirent.h>
@@ -50,7 +52,9 @@
#include <sys/wait.h>
#include <limits.h>
#include <ctype.h>
+#if defined(__linux__)
#include <sys/sysinfo.h>
+#endif
#ifndef linux
#define __BYTE_ORDER BYTE_ORDER
@@ -5196,6 +5200,7 @@ int get_physical_memory()
int phys_mem;
if(num_pages == -1 || page_size == -1) {
+#if defined(__linux__)
struct sysinfo sys;
int res = sysinfo(&sys);
@@ -5204,6 +5209,9 @@ int get_physical_memory()
num_pages = sys.totalram;
page_size = sys.mem_unit;
+#else
+ BAD_ERROR("Mksquashfs sysconf num_pages or page_size failed!\n");
+#endif
}
phys_mem = num_pages * page_size >> 20;

View file

@ -1,27 +0,0 @@
$NetBSD: patch-unsquashfs.c,v 1.2 2020/06/19 21:17:46 scole Exp $
Some workarounds for not using autoconf
--- unsquashfs.c.orig 2019-08-29 01:58:04.000000000 +0000
+++ unsquashfs.c
@@ -32,8 +32,18 @@
#include "stdarg.h"
#include "fnmatch_compat.h"
-#include <sys/sysinfo.h>
-#include <sys/sysmacros.h>
+/* XXX need autoconf HAVE_SYS_SYSCTL_H */
+#if ( defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__) )
+ #include <sys/sysctl.h>
+#endif
+
+/* XXX probably others... */
+#if defined(__linux__)
+ #include <sys/sysinfo.h>
+ #include <sys/sysmacros.h>
+#endif
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>