<feed xmlns='http://www.w3.org/2005/Atom'>
<title>squashfs-tools-ng.git/lib, branch v0.9.1</title>
<subtitle>A new set of tools and libraries for working with SquashFS images</subtitle>
<id>https://git.infraroot.at/squashfs-tools-ng.git/atom?h=v0.9.1</id>
<link rel='self' href='https://git.infraroot.at/squashfs-tools-ng.git/atom?h=v0.9.1'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/'/>
<updated>2020-05-02T23:43:11+00:00</updated>
<entry>
<title>Fix: use 0644 as default permissions when creating files</title>
<updated>2020-05-02T23:43:11+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-05-02T23:43:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=4f08666b8aafe66d4786158c8f26dec1c540893b'/>
<id>urn:sha1:4f08666b8aafe66d4786158c8f26dec1c540893b</id>
<content type='text'>
Until now, when packing or unpacking a SquashFS image, files where
created with paranoid permissions (i.e. 0600). The rational behind
this was that otherwise, the tools may inadvertently expose secrets,
e.g. if a root user packs files that that aren't world readable,
such as the /etc/shadows file, but the packed SquashFS image is, we
have accidentally leaked this file to other users that can access
the newly created SquashFS image. The same line of reasoning also
applies when unpacking files.

Unfortunately, this breaks a list of other, more common standard use
cases (e.g. a build server where the an image is built by a deamon
running as user X but then has to be accessed by another deamon
running as Y).

This commit changes to a more standard approach of using permissive
file permissions by default and asking paranoid users to simply use
a paranoid umask.

For tar2sqfs &amp; gensquashfs this simply means chaning the default
permissions in the libsquashfs file implementation.

For rdsquashfs on the other hand there is still the use case where
the unpacked files get the permissions from the [secret] image, so
setting a strict umask is not applicable and changing to permissive
file mode leaks something. For this case a second code path needs to
be added that derives the permissions from the ones in the image.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Enable uint128_t path</title>
<updated>2020-04-27T10:49:25+00:00</updated>
<author>
<name>Matt Turner</name>
<email>mattst88@gmail.com</email>
</author>
<published>2020-04-26T18:42:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=6a0d2f053ba32c63bb9a3c40135f8d5bb46c9cb0'/>
<id>urn:sha1:6a0d2f053ba32c63bb9a3c40135f8d5bb46c9cb0</id>
<content type='text'>
I forgot to enable this when I copied it over from Mesa. Mesa's
meson configuration system checks that a C program using the uint128_t
type compiles, but I think this is likely unnecessary. Simply check the
macro that clang and gcc define.

This cuts the .text size of hash_table.o by 160 bytes or about 4% on my
system.

Signed-off-by: Matt Turner &lt;mattst88@gmail.com&gt;
</content>
</entry>
<entry>
<title>Add hash table code to libutil.a</title>
<updated>2020-04-27T10:08:58+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-04-27T10:08:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=5630c5fa818a38c180ee4b859539cd37a9c2b93a'/>
<id>urn:sha1:5630c5fa818a38c180ee4b859539cd37a9c2b93a</id>
<content type='text'>
Not only does this build the hashtable into libutil.a, it also makes
sure the headers end up in the distribution tarball.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Import and use Mesa's hash table</title>
<updated>2020-04-22T12:48:46+00:00</updated>
<author>
<name>Matt Turner</name>
<email>mattst88@gmail.com</email>
</author>
<published>2020-04-19T23:01:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=20756f4354f333005bc59a2d07593d5d1429d287'/>
<id>urn:sha1:20756f4354f333005bc59a2d07593d5d1429d287</id>
<content type='text'>
With `perf record`/`perf report` I saw that 30% of the time was spent in
`sqfs_frag_table_find_tail_end` with tar2sqfs for a tarball containing
the Gentoo ebuild repository (many thousands of small files).

The reason was the bucketing hash table in frag_table.c: too many
elements in too few buckets meant lots of walking over the linked lists.

This patch replaces that hash table with the hash table implementation
from Mesa. Its implementation is more complex (is is an open-addressing,
linear-reprobing) hash table, but it is much better suited for the task.

On my 4c/8t Skylake, the time to run tar2sqfs drops from 7.5s to less
than 3s. CPU usage increases from ~207% to ~356%, presumably indicating
an increase in available parallelism due to the removal of the hash
table as a bottleneck. The `perf report` profile with this patch shows
that the time spent in `sqfs_frag_table_find_tail_end` has dropped from
~30% to 0.01%.

Output from ministat:

x before
+ after
    N          Min          Max       Median          Avg        Stddev
x  20        7.476        7.685       7.5725       7.5615   0.051254268
+  20         2.79        2.901        2.846      2.84475    0.03543842
Difference at 95.0% confidence
	-4.71675 +/- 0.0282015
	-62.3785% +/- 0.241477%
	(Student's t, pooled s = 0.0440618)

I imported only the bits of the hash table implementation that were
needed for frag_table.c. Among the changes I made after importing are

    - removed usage of ralloc, Mesa's recursive memory allocator
      - Replaced ralloc -&gt; malloc
		 ralloc_free -&gt; free
                 rzalloc_array -&gt; calloc
      - Removed mem_ctx parameters
      - Added free()s to the appropriate places (valgrind confirms there
	are no leaks)
    - removed _mesa_-prefix from function names

Fixes: #40
Signed-off-by: Matt Turner &lt;mattst88@gmail.com&gt;
</content>
</entry>
<entry>
<title>Skip PAX global headers</title>
<updated>2020-04-22T12:22:44+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-04-22T12:22:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=c6b65ee8a9a57d51956ee462fa1d61fd90d61f40'/>
<id>urn:sha1:c6b65ee8a9a57d51956ee462fa1d61fd90d61f40</id>
<content type='text'>
Tar archives can contain set two kinds of PAX headers:
 - local headers that modify the attributes of the next file
 - global headers that set defaults for all files

The later is used "... not widely used", according to tar(5)
and has been deliberately not implemented.

Some programs (e.g. git-archive) *do* generate them (in the case
of git, it stores the commit hash).

This commit adds a code path that skips a PAX global header entirely
and resumes tar parsing, instead of erroneusly reporting it as an
entry.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Remove some configure time sizeof checks</title>
<updated>2020-04-17T21:52:52+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-04-17T21:52:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=16a22bebb0bb4a28aec9ca76442af93462fc200e'/>
<id>urn:sha1:16a22bebb0bb4a28aec9ca76442af93462fc200e</id>
<content type='text'>
In libtar, the sizeof time_t checked when trying to store a time value.
It is pointless using the preprocessor here, as we can simply do an
if (sizeof(time_t) &lt; ...) check and the compiler will take care
optimizing away one or the other branch.

After changing the libtar check and the corresponding unit tests, the
sizeof check can be removed from configure.ac, along with other unused
sizeof checks.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Cleanup: split read_header.c in libtar.a</title>
<updated>2020-04-17T21:31:32+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-04-17T21:20:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=1fe3f86230a970b3974f16a6bc2e819fdaf55b58'/>
<id>urn:sha1:1fe3f86230a970b3974f16a6bc2e819fdaf55b58</id>
<content type='text'>
Simply moving the pax header decoding to a separate file and splitting
out the common helper functions should be a good start.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>tar2sqfs &amp; gensquashfs: Delete the output file on failure</title>
<updated>2020-04-16T03:17:29+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-04-16T03:13:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=6b3e6d299d5298a5936dbba57f67cdfc4a406789'/>
<id>urn:sha1:6b3e6d299d5298a5936dbba57f67cdfc4a406789</id>
<content type='text'>
This commit changes the tar2sqfs &amp; gensquashfs code to pass the exit
status on to sqfs_writer_cleanup in libcommon.

The function sqfs writer code in libcommon is changed to retain the
output file name and delete it if the status passed to the cleanup
function is anything other than EXIT_SUCCESS.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix missing header without LZO</title>
<updated>2020-04-01T16:28:54+00:00</updated>
<author>
<name>Alyssa Ross</name>
<email>hi@alyssa.is</email>
</author>
<published>2020-04-01T14:30:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=b3f2636f44eea1a8b6fbf892d2daa611cff9d4af'/>
<id>urn:sha1:b3f2636f44eea1a8b6fbf892d2daa611cff9d4af</id>
<content type='text'>
lib/common/compress.c: In function 'compressor_get_default':
lib/common/compress.c:39:2: warning: implicit declaration of function 'assert' [-Wimplicit-function-declaration]
   39 |  assert(0);
      |  ^~~~~~
lib/common/compress.c:8:1: note: 'assert' is defined in header '&lt;assert.h&gt;'; did you forget to '#include &lt;assert.h&gt;'?
    7 | #include "common.h"
  +++ |+#include &lt;assert.h&gt;
    8 |
</content>
</entry>
<entry>
<title>Fix compressor availability check in libcommon</title>
<updated>2020-03-19T22:09:17+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-19T22:09:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=43d38a3c0f8f6e234a75a69df7bc5009f6f3cd85'/>
<id>urn:sha1:43d38a3c0f8f6e234a75a69df7bc5009f6f3cd85</id>
<content type='text'>
Initialize have_compressor to false before testing, to make
the check work.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
</feed>
