Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D86456754 for ; Wed, 1 May 2024 13:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568446; cv=none; b=iXEMjPxPuvgmjVh6goAzprWZCmXFXv9cePiQmQGK1lEnmwTUz7Iiti1LZ7yg9/J+Ao6tfkZwEcv06L7umUXvwVV666MvFI/Luyhg+fxkSFt8oo1//63bF2Lwjne7XKw4M24FizpXW6668OJz2GfFHzs3LmjD/HOEfiJZVHLKfFY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714568446; c=relaxed/simple; bh=X8gPaSAy34FOahfLT3KrnSEkrgMi6Z/sUAqjaHU8eGE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Qpm/3Dq0v/EaiF/hnJA1BNkOkJy8GwO0gvnsn51HYax060Koj0G4UTuAnilR7AiRDHVGptGU7WB+Amaj9P0QJpKEKBrjVRXoUKAtEjN2RMP0EazD97x1vNmN1IuEQClC0Y/6794gJJLPOH47GHmkyZcTVsLDi80fBleGERkWhl4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jn7cyqif; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jn7cyqif" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99160C4AF1D; Wed, 1 May 2024 13:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1714568446; bh=X8gPaSAy34FOahfLT3KrnSEkrgMi6Z/sUAqjaHU8eGE=; h=From:To:Cc:Subject:Date:Reply-to:From; b=jn7cyqifjF7VlFwHcuaCuiz3jWGwLEFW0R2nICHYBKBNtWMm9sfx6kvRrgKE2bgNz hzjS3QQ3CZWyjmx/FL7l7xcbf6DEHzfFh/EdZhi9WCeSVmkMi63paBJoTC6nLh0b9o 3uXuc0aKFKPMxqvBVFRt4v4okktlzvK3ypO74R9o= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-27061: crypto: sun8i-ce - Fix use after free in unprepare Date: Wed, 1 May 2024 15:00:34 +0200 Message-ID: <2024050130-CVE-2024-27061-fef2@gregkh> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4494; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=X8gPaSAy34FOahfLT3KrnSEkrgMi6Z/sUAqjaHU8eGE=; b=kA0DAAIRMUfUDdst+ykByyZiAGYyPO6h+frs2uzOFDQ5awt6L/uQ5RUDzlm1qPS2hdSKdqbao IhdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmYyPO4ACgkQMUfUDdst+ynhoQCeM9YL P7s+ZDLWUBl+sNvTpWprM4UAoKrEzXDSk2Fk+y5OwQpvFUECWO7D X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: crypto: sun8i-ce - Fix use after free in unprepare sun8i_ce_cipher_unprepare should be called before crypto_finalize_skcipher_request, because client callbacks may immediately free memory, that isn't needed anymore. But it will be used by unprepare after free. Before removing prepare/unprepare callbacks it was handled by crypto engine in crypto_finalize_request. Usually that results in a pointer dereference problem during a in crypto selftest. Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=000000004716d000 [0000000000000030] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 0000000096000004 [#1] SMP This problem is detected by KASAN as well. ================================================================== BUG: KASAN: slab-use-after-free in sun8i_ce_cipher_do_one+0x6e8/0xf80 [sun8i_ce] Read of size 8 at addr ffff00000dcdc040 by task 1c15000.crypto-/373 Hardware name: Pine64 PinePhone (1.2) (DT) Call trace: dump_backtrace+0x9c/0x128 show_stack+0x20/0x38 dump_stack_lvl+0x48/0x60 print_report+0xf8/0x5d8 kasan_report+0x90/0xd0 __asan_load8+0x9c/0xc0 sun8i_ce_cipher_do_one+0x6e8/0xf80 [sun8i_ce] crypto_pump_work+0x354/0x620 [crypto_engine] kthread_worker_fn+0x244/0x498 kthread+0x168/0x178 ret_from_fork+0x10/0x20 Allocated by task 379: kasan_save_stack+0x3c/0x68 kasan_set_track+0x2c/0x40 kasan_save_alloc_info+0x24/0x38 __kasan_kmalloc+0xd4/0xd8 __kmalloc+0x74/0x1d0 alg_test_skcipher+0x90/0x1f0 alg_test+0x24c/0x830 cryptomgr_test+0x38/0x60 kthread+0x168/0x178 ret_from_fork+0x10/0x20 Freed by task 379: kasan_save_stack+0x3c/0x68 kasan_set_track+0x2c/0x40 kasan_save_free_info+0x38/0x60 __kasan_slab_free+0x100/0x170 slab_free_freelist_hook+0xd4/0x1e8 __kmem_cache_free+0x15c/0x290 kfree+0x74/0x100 kfree_sensitive+0x80/0xb0 alg_test_skcipher+0x12c/0x1f0 alg_test+0x24c/0x830 cryptomgr_test+0x38/0x60 kthread+0x168/0x178 ret_from_fork+0x10/0x20 The buggy address belongs to the object at ffff00000dcdc000 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 64 bytes inside of freed 256-byte region [ffff00000dcdc000, ffff00000dcdc100) The Linux kernel CVE team has assigned CVE-2024-27061 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit 4136212ab18e and fixed in 6.6.24 with commit dc60b25540c8 Issue introduced in 6.6 with commit 4136212ab18e and fixed in 6.7.12 with commit 51a7d338c212 Issue introduced in 6.6 with commit 4136212ab18e and fixed in 6.8 with commit 183420038444 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-27061 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/dc60b25540c82fc4baa95d1458ae96ead21859e0 https://git.kernel.org/stable/c/51a7d338c212e0640b1aca52ba6590d5bea49879 https://git.kernel.org/stable/c/183420038444547c149a0fc5f58e792c2752860c