CVE-2022-50341
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
16/09/2025
Last modified:
17/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
cifs: fix oops during encryption<br />
<br />
When running xfstests against Azure the following oops occurred on an<br />
arm64 system<br />
<br />
Unable to handle kernel write to read-only memory at virtual address<br />
ffff0001221cf000<br />
Mem abort info:<br />
ESR = 0x9600004f<br />
EC = 0x25: DABT (current EL), IL = 32 bits<br />
SET = 0, FnV = 0<br />
EA = 0, S1PTW = 0<br />
FSC = 0x0f: level 3 permission fault<br />
Data abort info:<br />
ISV = 0, ISS = 0x0000004f<br />
CM = 0, WnR = 1<br />
swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000294f3000<br />
[ffff0001221cf000] pgd=18000001ffff8003, p4d=18000001ffff8003,<br />
pud=18000001ff82e003, pmd=18000001ff71d003, pte=00600001221cf787<br />
Internal error: Oops: 9600004f [#1] PREEMPT SMP<br />
...<br />
pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)<br />
pc : __memcpy+0x40/0x230<br />
lr : scatterwalk_copychunks+0xe0/0x200<br />
sp : ffff800014e92de0<br />
x29: ffff800014e92de0 x28: ffff000114f9de80 x27: 0000000000000008<br />
x26: 0000000000000008 x25: ffff800014e92e78 x24: 0000000000000008<br />
x23: 0000000000000001 x22: 0000040000000000 x21: ffff000000000000<br />
x20: 0000000000000001 x19: ffff0001037c4488 x18: 0000000000000014<br />
x17: 235e1c0d6efa9661 x16: a435f9576b6edd6c x15: 0000000000000058<br />
x14: 0000000000000001 x13: 0000000000000008 x12: ffff000114f2e590<br />
x11: ffffffffffffffff x10: 0000040000000000 x9 : ffff8000105c3580<br />
x8 : 2e9413b10000001a x7 : 534b4410fb86b005 x6 : 534b4410fb86b005<br />
x5 : ffff0001221cf008 x4 : ffff0001037c4490 x3 : 0000000000000001<br />
x2 : 0000000000000008 x1 : ffff0001037c4488 x0 : ffff0001221cf000<br />
Call trace:<br />
__memcpy+0x40/0x230<br />
scatterwalk_map_and_copy+0x98/0x100<br />
crypto_ccm_encrypt+0x150/0x180<br />
crypto_aead_encrypt+0x2c/0x40<br />
crypt_message+0x750/0x880<br />
smb3_init_transform_rq+0x298/0x340<br />
smb_send_rqst.part.11+0xd8/0x180<br />
smb_send_rqst+0x3c/0x100<br />
compound_send_recv+0x534/0xbc0<br />
smb2_query_info_compound+0x32c/0x440<br />
smb2_set_ea+0x438/0x4c0<br />
cifs_xattr_set+0x5d4/0x7c0<br />
<br />
This is because in scatterwalk_copychunks(), we attempted to write to<br />
a buffer (@sign) that was allocated in the stack (vmalloc area) by<br />
crypt_message() and thus accessing its remaining 8 (x2) bytes ended up<br />
crossing a page boundary.<br />
<br />
To simply fix it, we could just pass @sign kmalloc&#39;d from<br />
crypt_message() and then we&#39;re done. Luckily, we don&#39;t seem to pass<br />
any other vmalloc&#39;d buffers in smb_rqst::rq_iov...<br />
<br />
Instead, let&#39;s map the correct pages and offsets from vmalloc buffers<br />
as well in cifs_sg_set_buf() and then avoiding such oopses.
Impact
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/a13e51760703f71c25d5fc1f4a62dfa4b0cc80e9
- https://git.kernel.org/stable/c/bf0543b93740916ee91956f9a63da6fc0d79daaa
- https://git.kernel.org/stable/c/e8d16a54842d609fd4a3ed2d81d4333d6329aa94
- https://git.kernel.org/stable/c/e8e2861cc3258dbe407d01ea8c59bb5a53132301
- https://git.kernel.org/stable/c/f7f291e14dde32a07b1f0aa06921d28f875a7b54
- https://git.kernel.org/stable/c/fe6ea044c4f05706cb71040055b1c70c6c8275e0