<feed xmlns='http://www.w3.org/2005/Atom'>
<title>squashfs-tools-ng.git/lib/sqfs, 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>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>Fix destruction of NULL pointer in xattr reader cleanup</title>
<updated>2020-03-19T22:06:24+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-19T22:06:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=a86266d0479316a7ab654a35828ea2abee8a9059'/>
<id>urn:sha1:a86266d0479316a7ab654a35828ea2abee8a9059</id>
<content type='text'>
This fixes a copy and paste error in the cleanup path, destroying a
previously destroyed object again instead of the one being tested for.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix pthread_join check for valid thread handles</title>
<updated>2020-03-19T01:04:28+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-19T00:58:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=df24b3a070cc50e521b21fc2877e5b3985535a73'/>
<id>urn:sha1:df24b3a070cc50e521b21fc2877e5b3985535a73</id>
<content type='text'>
On Linux, checking for &gt; 0 worked because pthread_t is internally an
integer type. On other platforms (*caugh* Mac OS X *caugh*), it is
typedefed to an opaque pointer, causing a warning if used in an
integer relational comparison.

The intended use is to allow the generic cleanup function to be used
in the error path of the block processor creation function, while
preventing pthread_join being called on threads that haven't been
created at all. Since they are calloc'ed to 0, testing for non-zero
values should suffice in both cases.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix build of lz4 compressor with older versions of liblz4</title>
<updated>2020-03-18T21:30:17+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-18T21:30:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=ddd4f22e33a7d5d9835f129a6cd0af9c175d76a4'/>
<id>urn:sha1:ddd4f22e33a7d5d9835f129a6cd0af9c175d76a4</id>
<content type='text'>
Older versions of liblz4 don't define LZ4HC_CLEVEL_MAX. This commit
adds a definition if liblz4 doesn't provide one.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Cleanup: Move xxhash32 code to libutil</title>
<updated>2020-03-18T12:33:47+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-18T12:19:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=7c29dc8db20a3e6f1fb351c44a068171bb6c1ff1'/>
<id>urn:sha1:7c29dc8db20a3e6f1fb351c44a068171bb6c1ff1</id>
<content type='text'>
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Get rid of sqfs_compressor_exists</title>
<updated>2020-03-05T21:55:09+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-05T21:55:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=dfab234dfae735103d2e5206b0f335c8449ee3d5'/>
<id>urn:sha1:dfab234dfae735103d2e5206b0f335c8449ee3d5</id>
<content type='text'>
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Change the signature of sqfs_compressor_create to return an error code</title>
<updated>2020-03-05T21:41:04+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-05T21:38:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=85e36aab1258d8d9ec7b61ce013f167ef8e03ae0'/>
<id>urn:sha1:85e36aab1258d8d9ec7b61ce013f167ef8e03ae0</id>
<content type='text'>
Make sure the function has a way of telling the caller *why* it failed.

This way, the function can convey whether it had an internal error, an
allocation failure, whether the arguments are totaly nonsensical, or
simply that the compressor *or specific configuration* is not supported.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Cleanup: Remove the E_ prefix from all libsquashfs enumerators</title>
<updated>2020-03-05T14:17:45+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-05T14:17:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=5acb22a6a7168f8b961777482f39a125158def50'/>
<id>urn:sha1:5acb22a6a7168f8b961777482f39a125158def50</id>
<content type='text'>
Avoid namespace polution. Make sure all exportet symbols are prefixed
with either sqfs_ or SQFS_.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix block writer inheritance of sqfs_object_t</title>
<updated>2020-03-04T14:00:12+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2020-03-04T14:00:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/squashfs-tools-ng.git/commit/?id=fbf41ac14978c93d054832af6331e6795fb86b0f'/>
<id>urn:sha1:fbf41ac14978c93d054832af6331e6795fb86b0f</id>
<content type='text'>
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
</feed>
