In the Linux kernel, the following vulnerability has been resolved:
drm/amdgpu: fix use-after-free bug
The bug can be triggered by sending a single amdgpugemuserptr_ioctl to the AMDGPU DRM driver on any ASICs with an invalid address and size. The bug was reported by Joonkyo Jung joonkyoj@yonsei.ac.kr. For example the following code:
static void Syzkaller1(int fd) { struct drmamdgpugem_userptr arg; int ret;
arg.addr = 0xffffffffffff0000;
arg.size = 0x80000000; /*2 Gb*/
arg.flags = 0x7;
ret = drmIoctl(fd, 0xc1186451/*amdgpu_gem_userptr_ioctl*/, &arg);
}
Due to the address and size are not valid there is a failure in amdgpuhmmregister->mmuintervalnotifierinsert->mmuintervalnotifierinsert-> checkshloverflow, but we even the amdgpuhmmregister failure we still call amdgpuhmmunregister into amdgpugemobject_free which causes access to a bad address. The following stack is below when the issue is reproduced when Kazan is enabled:
[ +0.000014] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020 [ +0.000009] RIP: 0010:mmuintervalnotifierremove+0x327/0x340 [ +0.000017] Code: ff ff 49 89 44 24 08 48 b8 00 01 00 00 00 00 ad de 4c 89 f7 49 89 47 40 48 83 c0 22 49 89 47 48 e8 ce d1 2d 01 e9 32 ff ff ff <0f> 0b e9 16 ff ff ff 4c 89 ef e8 fa 14 b3 ff e9 36 ff ff ff e8 80 [ +0.000014] RSP: 0018:ffffc90002657988 EFLAGS: 00010246 [ +0.000013] RAX: 0000000000000000 RBX: 1ffff920004caf35 RCX: ffffffff8160565b [ +0.000011] RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8881a9f78260 [ +0.000010] RBP: ffffc90002657a70 R08: 0000000000000001 R09: fffff520004caf25 [ +0.000010] R10: 0000000000000003 R11: ffffffff8161d1d6 R12: ffff88810e988c00 [ +0.000010] R13: ffff888126fb5a00 R14: ffff88810e988c0c R15: ffff8881a9f78260 [ +0.000011] FS: 00007ff9ec848540(0000) GS:ffff8883cc880000(0000) knlGS:0000000000000000 [ +0.000012] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ +0.000010] CR2: 000055b3f7e14328 CR3: 00000001b5770000 CR4: 0000000000350ef0 [ +0.000010] Call Trace: [ +0.000006] <TASK> [ +0.000007] ? showregs+0x6a/0x80 [ +0.000018] ? _warn+0xa5/0x1b0 [ +0.000019] ? mmuintervalnotifierremove+0x327/0x340 [ +0.000018] ? reportbug+0x24a/0x290 [ +0.000022] ? handlebug+0x46/0x90 [ +0.000015] ? excinvalidop+0x19/0x50 [ +0.000016] ? asmexcinvalidop+0x1b/0x20 [ +0.000017] ? kasansavestack+0x26/0x50 [ +0.000017] ? mmuintervalnotifierremove+0x23b/0x340 [ +0.000019] ? mmuintervalnotifierremove+0x327/0x340 [ +0.000019] ? mmuintervalnotifierremove+0x23b/0x340 [ +0.000020] ? _pfxmmuintervalnotifierremove+0x10/0x10 [ +0.000017] ? kasansaveallocinfo+0x1e/0x30 [ +0.000018] ? srsoreturnthunk+0x5/0x5f [ +0.000014] ? _kasankmalloc+0xb1/0xc0 [ +0.000018] ? srsoreturnthunk+0x5/0x5f [ +0.000013] ? _kasancheckread+0x11/0x20 [ +0.000020] amdgpuhmmunregister+0x34/0x50 [amdgpu] [ +0.004695] amdgpugemobjectfree+0x66/0xa0 [amdgpu] [ +0.004534] ? _pfxamdgpugemobjectfree+0x10/0x10 [amdgpu] [ +0.004291] ? dosyscall64+0x5f/0xe0 [ +0.000023] ? srsoreturnthunk+0x5/0x5f [ +0.000017] drmgemobjectfree+0x3b/0x50 [drm] [ +0.000489] amdgpugemuserptrioctl+0x306/0x500 [amdgpu] [ +0.004295] ? _pfxamdgpugemuserptrioctl+0x10/0x10 [amdgpu] [ +0.004270] ? srsoreturnthunk+0x5/0x5f [ +0.000014] ? _thiscpupreemptcheck+0x13/0x20 [ +0.000015] ? srsoreturnthunk+0x5/0x5f [ +0.000013] ? sysvecapictimerinterrupt+0x57/0xc0 [ +0.000020] ? srsoreturnthunk+0x5/0x5f [ +0.000014] ? asmsysvecapictimerinterrupt+0x1b/0x20 [ +0.000022] ? drmioctlkernel+0x17b/0x1f0 [drm] [ +0.000496] ? _pfxamdgpugemuserptrioctl+0x10/0x10 [amdgpu] [ +0.004272] ? drmioctlkernel+0x190/0x1f0 [drm] [ +0.000492] drmioctlkernel+0x140/0x1f0 [drm] [ +0.000497] ? _pfxamdgpugemuserptrioctl+0x10/0x10 [amdgpu] [ +0.004297] ? _pfxdrmioctl_kernel+0x10/0x10 [d ---truncated---
[
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e87e08c94c9541b4e18c4c13f2f605935f512605",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"258011284443086723629473039936151292068",
"277433083091999261671065001796487525564",
"3562836125729104199533608377686195981",
"302246841987575775634619595939075340123",
"32542194331637635467429666664486909276",
"315086475757888686396159952639561392628",
"337792115740089896804842471333147493022",
"56936419660667759401184331326681544174",
"46264671822307785800447039076759596051",
"289546726921963387088153181248057558529",
"217109042094282434058564974691353617682"
]
},
"deprecated": false,
"target": {
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-00420040"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e87e08c94c9541b4e18c4c13f2f605935f512605",
"signature_type": "Function",
"digest": {
"length": 302.0,
"function_hash": "273217188308366833859604675943876959287"
},
"deprecated": false,
"target": {
"function": "amdgpu_hmm_register",
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-31a16366"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22f665ecfd1225afa1309ace623157d12bb9bb0c",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"258011284443086723629473039936151292068",
"277433083091999261671065001796487525564",
"3562836125729104199533608377686195981",
"302246841987575775634619595939075340123",
"32542194331637635467429666664486909276",
"315086475757888686396159952639561392628",
"337792115740089896804842471333147493022",
"56936419660667759401184331326681544174",
"46264671822307785800447039076759596051",
"289546726921963387088153181248057558529",
"217109042094282434058564974691353617682"
]
},
"deprecated": false,
"target": {
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-7e90cb90"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22f665ecfd1225afa1309ace623157d12bb9bb0c",
"signature_type": "Function",
"digest": {
"length": 302.0,
"function_hash": "273217188308366833859604675943876959287"
},
"deprecated": false,
"target": {
"function": "amdgpu_hmm_register",
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-a2a49980"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e13f88e01ae7e28a7e831bf5c2409c4748e0a60",
"signature_type": "Function",
"digest": {
"length": 300.0,
"function_hash": "43761604849623038695630977148583144208"
},
"deprecated": false,
"target": {
"function": "amdgpu_mn_register",
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c"
},
"id": "CVE-2024-26656-de3a8635"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af054a5fb24a144f99895afce9519d709891894c",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"258011284443086723629473039936151292068",
"277433083091999261671065001796487525564",
"3562836125729104199533608377686195981",
"302246841987575775634619595939075340123",
"32542194331637635467429666664486909276",
"315086475757888686396159952639561392628",
"337792115740089896804842471333147493022",
"56936419660667759401184331326681544174",
"46264671822307785800447039076759596051",
"289546726921963387088153181248057558529",
"217109042094282434058564974691353617682"
]
},
"deprecated": false,
"target": {
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-e766b795"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2e13f88e01ae7e28a7e831bf5c2409c4748e0a60",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"244708611931319174108074634273863597323",
"235652070102168598076504624151065996165",
"306776413130905770364630140342319230660",
"302246841987575775634619595939075340123",
"311601702714925274918740384855328072321",
"325911758439475679147338072486498345617",
"217590426916547821431115229389465638337",
"244003663046725231823790745366879604080",
"132697456443309662338560279170762766063",
"30406480157655108677462617370919220298",
"114316219956264724498018435597991961052"
]
},
"deprecated": false,
"target": {
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c"
},
"id": "CVE-2024-26656-e8f5c768"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22207fd5c80177b860279653d017474b2812af5e",
"signature_type": "Function",
"digest": {
"length": 302.0,
"function_hash": "273217188308366833859604675943876959287"
},
"deprecated": false,
"target": {
"function": "amdgpu_hmm_register",
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-ed5423d5"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22207fd5c80177b860279653d017474b2812af5e",
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"258011284443086723629473039936151292068",
"277433083091999261671065001796487525564",
"3562836125729104199533608377686195981",
"302246841987575775634619595939075340123",
"32542194331637635467429666664486909276",
"315086475757888686396159952639561392628",
"337792115740089896804842471333147493022",
"56936419660667759401184331326681544174",
"46264671822307785800447039076759596051",
"289546726921963387088153181248057558529",
"217109042094282434058564974691353617682"
]
},
"deprecated": false,
"target": {
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-f04174af"
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@af054a5fb24a144f99895afce9519d709891894c",
"signature_type": "Function",
"digest": {
"length": 302.0,
"function_hash": "273217188308366833859604675943876959287"
},
"deprecated": false,
"target": {
"function": "amdgpu_hmm_register",
"file": "drivers/gpu/drm/amd/amdgpu/amdgpu_hmm.c"
},
"id": "CVE-2024-26656-f434407f"
}
]