<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/crypto/scompress.c, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-04-25T02:33:30Z</updated>
<entry>
<title>crypto: scompress - increment scomp_scratch_users when already allocated</title>
<updated>2025-04-25T02:33:30Z</updated>
<author>
<name>Sabrina Dubroca</name>
</author>
<published>2025-04-24T20:15:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a32f1923c6d6e9e727d00558a15ec0af6639de19'/>
<id>urn:sha1:a32f1923c6d6e9e727d00558a15ec0af6639de19</id>
<content type='text'>
Commit ddd0a42671c0 only increments scomp_scratch_users when it was 0,
causing a panic when using ipcomp:

    Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
    KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
    CPU: 1 UID: 0 PID: 619 Comm: ping Tainted: G                 N  6.15.0-rc3-net-00032-ga79be02bba5c #41 PREEMPT(full)
    Tainted: [N]=TEST
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.3-1-1 04/01/2014
    RIP: 0010:inflate_fast+0x5a2/0x1b90
    [...]
    Call Trace:
     &lt;IRQ&gt;
     zlib_inflate+0x2d60/0x6620
     deflate_sdecompress+0x166/0x350
     scomp_acomp_comp_decomp+0x45f/0xa10
     scomp_acomp_decompress+0x21/0x120
     acomp_do_req_chain+0x3e5/0x4e0
     ipcomp_input+0x212/0x550
     xfrm_input+0x2de2/0x72f0
    [...]
    Kernel panic - not syncing: Fatal exception in interrupt
    Kernel Offset: disabled
    ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

Instead, let's keep the old increment, and decrement back to 0 if the
scratch allocation fails.

Fixes: ddd0a42671c0 ("crypto: scompress - Fix scratch allocation failure handling")
Signed-off-by: Sabrina Dubroca &lt;sd@queasysnail.net&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Fix off-by-one bug when calculating last page</title>
<updated>2025-04-23T01:32:57Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-04-21T03:31:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=002ba346e3d76bb2b09448beed06c5ea1b0e06b8'/>
<id>urn:sha1:002ba346e3d76bb2b09448beed06c5ea1b0e06b8</id>
<content type='text'>
Fix off-by-one bug in the last page calculation for src and dst.

Reported-by: Nhat Pham &lt;nphamcs@gmail.com&gt;
Fixes: 2d3553ecb4e3 ("crypto: scomp - Remove support for some non-trivial SG lists")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Fix wild memory accesses in scomp_free_streams</title>
<updated>2025-04-12T01:33:09Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-04-11T01:26:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ae0c92fec69374c6db8dddb0df00d86b9afa5da'/>
<id>urn:sha1:9ae0c92fec69374c6db8dddb0df00d86b9afa5da</id>
<content type='text'>
In order to use scomp_free_streams to free the partially allocted
streams in the allocation error path, move the alg-&gt;stream assignment
to the beginning.  Also check for error pointers in scomp_free_streams
before freeing the ctx.

Finally set alg-&gt;stream to NULL to not break subsequent attempts
to allocate the streams.

Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Reported-by: syzkaller &lt;syzkaller@googlegroups.com&gt;
Co-developed-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Signed-off-by: Kuniyuki Iwashima &lt;kuniyu@amazon.com&gt;
Co-developed-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Fix null-pointer deref when freeing streams</title>
<updated>2025-04-09T13:28:31Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-04-08T04:20:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cfb32c656eb7bf1d7a776b8793bb6baa6f58b5a4'/>
<id>urn:sha1:cfb32c656eb7bf1d7a776b8793bb6baa6f58b5a4</id>
<content type='text'>
As the scomp streams are freed when an algorithm is unregistered,
it is possible that the algorithm has never been used at all (e.g.,
an algorithm that does not have a self-test).  So test whether the
streams exist before freeing them.

Reported-by: Sourabh Jain &lt;sourabhjain@linux.ibm.com&gt;
Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Tested-by: Sourabh Jain &lt;sourabhjain@linux.ibm.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scompress - Fix incorrect stream freeing</title>
<updated>2025-03-21T09:39:06Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-16T09:50:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a06ef1f8da226b2de587e22c17f88b72cede3be'/>
<id>urn:sha1:5a06ef1f8da226b2de587e22c17f88b72cede3be</id>
<content type='text'>
Fix stream freeing crash by passing the correct pointer.

Fixes: 3d72ad46a23a ("crypto: acomp - Move stream management into scomp layer")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scompress - Fix scratch allocation failure handling</title>
<updated>2025-03-21T09:39:05Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-15T12:37:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ddd0a42671c0d9742fda97d26068ffbb51dd7c01'/>
<id>urn:sha1:ddd0a42671c0d9742fda97d26068ffbb51dd7c01</id>
<content type='text'>
If the scratch allocation fails, all subsequent allocations will
silently succeed without actually allocating anything.  Fix this
by only incrementing users when the allocation succeeds.

Fixes: 6a8487a1f29f ("crypto: scompress - defer allocation of scratch buffer to first use")
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Acked-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: acomp - Add support for folios</title>
<updated>2025-03-21T09:35:26Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-15T10:30:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8a6771cda3f48a4d954647d69ff0094346db6191'/>
<id>urn:sha1:8a6771cda3f48a4d954647d69ff0094346db6191</id>
<content type='text'>
For many users, it's easier to supply a folio rather than an SG
list since they already have them.  Add support for folios to the
acomp interface.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Add chaining and virtual address support</title>
<updated>2025-03-21T09:33:39Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-15T10:30:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2c1808e5fe5afda22cd49f31b24219d147c785fc'/>
<id>urn:sha1:2c1808e5fe5afda22cd49f31b24219d147c785fc</id>
<content type='text'>
Add chaining and virtual address support to all scomp algorithms.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Remove support for some non-trivial SG lists</title>
<updated>2025-03-21T09:33:39Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-15T10:30:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2d3553ecb4e316a74571da253191c37fb90cb815'/>
<id>urn:sha1:2d3553ecb4e316a74571da253191c37fb90cb815</id>
<content type='text'>
As the only user of acomp/scomp uses a trivial single-page SG
list, remove support for everything else in preprataion for the
addition of virtual address support.

However, keep support for non-trivial source SG lists as that
user is currently jumping through hoops in order to linearise
the source data.

Limit the source SG linearisation buffer to a single page as
that user never goes over that.  The only other potential user
is also unlikely to exceed that (IPComp) and it can easily do
its own linearisation if necessary.

Also keep the destination SG linearisation for IPComp.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>crypto: scomp - Disable BH when taking per-cpu spin lock</title>
<updated>2025-03-15T08:21:23Z</updated>
<author>
<name>Herbert Xu</name>
</author>
<published>2025-03-09T02:43:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cff12830e2cb2044067167f95a537074240347b7'/>
<id>urn:sha1:cff12830e2cb2044067167f95a537074240347b7</id>
<content type='text'>
Disable BH when taking per-cpu spin locks.  This isn't an issue
right now because the only user zswap calls scomp from process
context.  However, if scomp is called from softirq context the
spin lock may dead-lock.

Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
</feed>
