<feed xmlns='http://www.w3.org/2005/Atom'>
<title>u-boot.git/fs/squashfs, branch v2023.01</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/u-boot.git/atom/fs/squashfs?h=v2023.01</id>
<link rel='self' href='http://cgit.235523.xyz/u-boot.git/atom/fs/squashfs?h=v2023.01'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/'/>
<updated>2022-07-11T18:58:57Z</updated>
<entry>
<title>Merge branch 'next'</title>
<updated>2022-07-11T18:58:57Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-07-11T14:18:13Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=36b661dc919da318c163a45f4a220d2e3d9db608'/>
<id>urn:sha1:36b661dc919da318c163a45f4a220d2e3d9db608</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fs/squashfs: Use kcalloc when relevant</title>
<updated>2022-06-28T19:51:56Z</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2022-06-27T10:20:03Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=7f7fb9937c6cb49dd35153bd6708872b390b0a44'/>
<id>urn:sha1:7f7fb9937c6cb49dd35153bd6708872b390b0a44</id>
<content type='text'>
A crafted squashfs image could embed a huge number of empty metadata
blocks in order to make the amount of malloc()'d memory overflow and be
much smaller than expected. Because of this flaw, any random code
positioned at the right location in the squashfs image could be memcpy'd
from the squashfs structures into U-Boot code location while trying to
access the rearmost blocks, before being executed.

In order to prevent this vulnerability from being exploited in eg. a
secure boot environment, let's add a check over the amount of data
that is going to be allocated. Such a check could look like:

if (!elem_size || n &gt; SIZE_MAX / elem_size)
	return NULL;

The right way to do it would be to enhance the calloc() implementation
but this is quite an impacting change for such a small fix. Another
solution would be to add the check before the malloc call in the
squashfs implementation, but this does not look right. So for now, let's
use the kcalloc() compatibility function from Linux, which has this
check.

Fixes: c5100613037 ("fs/squashfs: new filesystem")
Reported-by: Tatsuhiko Yasumatsu &lt;Tatsuhiko.Yasumatsu@sony.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Tested-by: Tatsuhiko Yasumatsu &lt;Tatsuhiko.Yasumatsu@sony.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' into next</title>
<updated>2022-06-20T18:40:59Z</updated>
<author>
<name>Tom Rini</name>
<email>trini@konsulko.com</email>
</author>
<published>2022-06-20T18:40:59Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=52af0101be55da74a32e9b169864508101f886fe'/>
<id>urn:sha1:52af0101be55da74a32e9b169864508101f886fe</id>
<content type='text'>
Merge in v2022.07-rc5.
</content>
</entry>
<entry>
<title>fs/squashfs: sqfs_read: Prevent arbitrary code execution</title>
<updated>2022-06-16T19:22:55Z</updated>
<author>
<name>Miquel Raynal</name>
<email>miquel.raynal@bootlin.com</email>
</author>
<published>2022-06-09T14:02:06Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=2ac0baab4aff1a0b45067d0b62f00c15f4e86856'/>
<id>urn:sha1:2ac0baab4aff1a0b45067d0b62f00c15f4e86856</id>
<content type='text'>
Following Jincheng's report, an out-of-band write leading to arbitrary
code execution is possible because on one side the squashfs logic
accepts directory names up to 65535 bytes (u16), while U-Boot fs logic
accepts directory names up to 255 bytes long.

Prevent such an exploit from happening by capping directory name sizes
to 255. Use a define for this purpose so that developers can link the
limitation to its source and eventually kill it some day by dynamically
allocating this array (if ever desired).

Link: https://lore.kernel.org/all/CALO=DHFB+yBoXxVr5KcsK0iFdg+e7ywko4-e+72kjbcS8JBfPw@mail.gmail.com
Reported-by: Jincheng Wang &lt;jc.w4ng@gmail.com&gt;
Signed-off-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Tested-by: Jincheng Wang &lt;jc.w4ng@gmail.com&gt;
</content>
</entry>
<entry>
<title>fs/squashfs: fix sqfs_read_sblk()</title>
<updated>2022-06-06T21:47:17Z</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2022-05-10T19:53:25Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=84378d5c86d1b8e7afd2132e2c8d79d8e7e1f7d9'/>
<id>urn:sha1:84378d5c86d1b8e7afd2132e2c8d79d8e7e1f7d9</id>
<content type='text'>
Setting sblk = NULL has no effect on the caller.
We want to set *sblk = NULL if an error occurrs to avoid usage after free.

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
</content>
</entry>
<entry>
<title>squashfs: Fix compilation on big endian systems</title>
<updated>2022-06-03T15:15:24Z</updated>
<author>
<name>Pali Rohár</name>
<email>pali@kernel.org</email>
</author>
<published>2022-04-06T21:31:53Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=9320db0926ae4c2a24015298e3b374a07023267e'/>
<id>urn:sha1:9320db0926ae4c2a24015298e3b374a07023267e</id>
<content type='text'>
Signed-off-by: Pali Rohár &lt;pali@kernel.org&gt;
Reviewed-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
</entry>
<entry>
<title>fs/squashfs: use lldiv function for math</title>
<updated>2022-05-23T13:33:10Z</updated>
<author>
<name>Sean Nyekjaer</name>
<email>sean.nyekjaer.ext@siemensgamesa.com</email>
</author>
<published>2022-05-12T18:37:14Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=92080c6ef6c753ca69c53f191a6baef53f98bd6b'/>
<id>urn:sha1:92080c6ef6c753ca69c53f191a6baef53f98bd6b</id>
<content type='text'>
When compling for x86:
ld.bfd: fs/squashfs/sqfs.o: in function `sqfs_read':
u-boot/fs/squashfs/sqfs.c:1443: undefined reference to `__udivmoddi4'
ld.bfd: u-boot/fs/squashfs/sqfs.c:1521: undefined reference to `__udivmoddi4'

Signed-off-by: Sean Nyekjaer &lt;sean.nyekjaer.ext@siemensgamesa.com&gt;
Reviewed-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
Reviewed-by: Pali Rohár &lt;pali@kernel.org&gt;
</content>
</entry>
<entry>
<title>fs/squashfs: simplify sqfs_read()</title>
<updated>2022-04-19T18:51:11Z</updated>
<author>
<name>Heinrich Schuchardt</name>
<email>heinrich.schuchardt@canonical.com</email>
</author>
<published>2022-04-11T20:54:44Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=9bd89bbd71b12030294210be7c54da4b7cc77f00'/>
<id>urn:sha1:9bd89bbd71b12030294210be7c54da4b7cc77f00</id>
<content type='text'>
* Don't check argument of free(). Free does this itself.
* Reduce scope of data_buffer. Remove duplicate free().
* Avoid superfluous NULL assignment.

Signed-off-by: Heinrich Schuchardt &lt;heinrich.schuchardt@canonical.com&gt;
Reviewed-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
</entry>
<entry>
<title>squashfs: show an error message if the inode_table can't be, allocated</title>
<updated>2022-01-29T12:46:46Z</updated>
<author>
<name>Lars Weber</name>
<email>weber@weber-software.com</email>
</author>
<published>2022-01-13T13:28:45Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=1e69db57e64249f7f7a5a282a3a2f1b053be3f6f'/>
<id>urn:sha1:1e69db57e64249f7f7a5a282a3a2f1b053be3f6f</id>
<content type='text'>
Signed-off-by: Lars Weber &lt;weber@weber-software.com&gt;
</content>
</entry>
<entry>
<title>sqfs: Suppress the message about missing filesystem</title>
<updated>2021-09-16T17:19:25Z</updated>
<author>
<name>Simon Glass</name>
<email>sjg@chromium.org</email>
</author>
<published>2021-08-19T03:40:27Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/u-boot.git/commit/?id=ad6ddc57eeecbcad62177b47b1e2b63027bcf6a9'/>
<id>urn:sha1:ad6ddc57eeecbcad62177b47b1e2b63027bcf6a9</id>
<content type='text'>
This message comes up a lot when scanning filesystems. It suggests to the
user that there is some sort of error, but in fact there is no reason to
expect that a particular partition has a sqfs filesystem. Other
filesystems don't print this error.

Turn it into a debug message.

Signed-off-by: Simon Glass &lt;sjg@chromium.org&gt;
Reviewed-by: Miquel Raynal &lt;miquel.raynal@bootlin.com&gt;
</content>
</entry>
</feed>
