diff options
| author | Vladimir Kukharenko <vladimir@genproof.com> | 2026-10-14 20:34:21 +0000 |
|---|---|---|
| committer | Eric Biggers <ebiggers@kernel.org> | 2026-10-15 23:17:16 -0700 |
| commit | f92159895b96078fbe54f059cd8e93fe3deb34f0 (patch) | |
| tree | 09f26690ca283a6ebbf8d87954ba292847f95d4e /tools/perf/scripts/python/stackcollapse.py | |
| parent | e42003dba6dd11380b8c2a39f3bc1bf11a6d0b0f (diff) | |
| download | linux-f92159895b96078fbe54f059cd8e93fe3deb34f0.tar.gz linux-f92159895b96078fbe54f059cd8e93fe3deb34f0.zip | |
lib/crypto: arm/chacha: Handle lengths of 2 GiB or more in scalar code
chacha_doarm() compares the remaining length with signed conditions
(blt, movle/movgt, bgt), and DIV_ROUND_UP(bytes, CHACHA_BLOCK_SIZE) in
chacha_crypt_arch() wraps above 0xffffffc0, so lengths of 2 GiB or
more are mishandled. size_t is 32 bits on arm, so declaring the length
as size_t does not avoid this. On a Cortex-A7, an in-place
chacha20_crypt() of 2 GiB + 4101 bytes changed only one byte.
Use unsigned conditions (blo, movls/movhi, bhi) and
DIV_ROUND_UP_POW2().
This affects the scalar code, which is used when NEON isn't usable and
always on Cortex-A5 and Cortex-A7. No in-tree caller passes such
lengths. Tested in QEMU on a Cortex-A7 with CONFIG_VMSPLIT_1G. An LLM
review of this code found the bug.
Assisted-by: LLM
Signed-off-by: Vladimir Kukharenko <vladimir@genproof.com>
Link: https://patch.msgid.link/20261014-libcrypto-chacha-32bit-2gib-v1-1-e0719ca0be89@genproof.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
