In the Linux kernel, the following vulnerability has been resolved:
block/ioctl: prefer different overflow check
Running syzkaller with the newly reintroduced signed integer overflow sanitizer shows this report:
[ 62.982337] ------------[ cut here ]------------ [ 62.985692] cgroup: Invalid name [ 62.986211] UBSAN: signed-integer-overflow in ../block/ioctl.c:36:46 [ 62.989370] 9pnetfd: p9fdcreatetcp (7343): problem connecting socket to 127.0.0.1 [ 62.992992] 9223372036854775807 + 4095 cannot be represented in type 'long long' [ 62.997827] 9pnetfd: p9fdcreatetcp (7345): problem connecting socket to 127.0.0.1 [ 62.999369] random: crng reseeded on system resumption [ 63.000634] GUP no longer grows the stack in syz-executor.2 (7353): 20002000-20003000 (20001000) [ 63.000668] CPU: 0 PID: 7353 Comm: syz-executor.2 Not tainted 6.8.0-rc2-00035-gb3ef86b5a957 #1 [ 63.000677] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 63.000682] Call Trace: [ 63.000686] <TASK> [ 63.000731] dumpstacklvl+0x93/0xd0 [ 63.000919] _getuserpages+0x903/0xd30 [ 63.001030] _guplongtermlocked+0x153e/0x1ba0 [ 63.001041] ? rawreadunlockirqrestore+0x17/0x50 [ 63.001072] ? trygetfolio+0x29c/0x2d0 [ 63.001083] internalgetuserpagesfast+0x1119/0x1530 [ 63.001109] ioviterextractpages+0x23b/0x580 [ 63.001206] bioiovitergetpages+0x4de/0x1220 [ 63.001235] iomapdiobioiter+0x9b6/0x1410 [ 63.001297] _iomapdiorw+0xab4/0x1810 [ 63.001316] iomapdiorw+0x45/0xa0 [ 63.001328] ext4filewriteiter+0xdde/0x1390 [ 63.001372] vfswrite+0x599/0xbd0 [ 63.001394] ksyswrite+0xc8/0x190 [ 63.001403] dosyscall64+0xd4/0x1b0 [ 63.001421] ? archexittousermodeprepare+0x3a/0x60 [ 63.001479] entrySYSCALL64afterhwframe+0x6f/0x77 [ 63.001535] RIP: 0033:0x7f7fd3ebf539 [ 63.001551] Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 [ 63.001562] RSP: 002b:00007f7fd32570c8 EFLAGS: 00000246 ORIGRAX: 0000000000000001 [ 63.001584] RAX: ffffffffffffffda RBX: 00007f7fd3ff3f80 RCX: 00007f7fd3ebf539 [ 63.001590] RDX: 4db6d1e4f7e43360 RSI: 0000000020000000 RDI: 0000000000000004 [ 63.001595] RBP: 00007f7fd3f1e496 R08: 0000000000000000 R09: 0000000000000000 [ 63.001599] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 63.001604] R13: 0000000000000006 R14: 00007f7fd3ff3f80 R15: 00007ffd415ad2b8 ... [ 63.018142] ---[ end trace ]---
Historically, the signed integer overflow sanitizer did not work in the
kernel due to its interaction with -fwrapv
but this has since been
changed [1] in the newest version of Clang; It was re-enabled in the
kernel with Commit 557f8c582a9ba8ab ("ubsan: Reintroduce signed overflow
sanitizer").
Let's rework this overflow checking logic to not actually perform an overflow during the check itself, thus avoiding the UBSAN splat.
{ "vanir_signatures": [ { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@58706e482bf45c4db48b0c53aba2468c97adda24", "signature_type": "Function", "digest": { "function_hash": "31085793236132963947797500266759812171", "length": 1005.0 }, "id": "CVE-2024-41000-0dd160bd", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@54160fb1db2de367485f21e30196c42f7ee0be4e", "signature_type": "Function", "digest": { "function_hash": "165120761888742616506315264171580137519", "length": 1004.0 }, "id": "CVE-2024-41000-0e5dcaeb", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3220c90f4dbdc6d20d0608b164d964434a810d66", "signature_type": "Function", "digest": { "function_hash": "215967642456028174960995146264369736963", "length": 862.0 }, "id": "CVE-2024-41000-1c060480", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@54160fb1db2de367485f21e30196c42f7ee0be4e", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "275859329671843655259931083220931231540", "139841856696485385276471396354216633281", "326759039789426073016187142448621354396", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-30e539f1", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fd841ee01fb4a79cb7f5cc424b5c96c3a73b2d1e", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "275859329671843655259931083220931231540", "139841856696485385276471396354216633281", "326759039789426073016187142448621354396", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-5e0ebdc3", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ccb326b5f9e623eb7f130fbbf2505ec0e2dcaff9", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "275859329671843655259931083220931231540", "139841856696485385276471396354216633281", "326759039789426073016187142448621354396", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-66c62739", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fd841ee01fb4a79cb7f5cc424b5c96c3a73b2d1e", "signature_type": "Function", "digest": { "function_hash": "215967642456028174960995146264369736963", "length": 862.0 }, "id": "CVE-2024-41000-747eb3cc", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@61ec76ec930709b7bcd69029ef1fe90491f20cf9", "signature_type": "Function", "digest": { "function_hash": "215967642456028174960995146264369736963", "length": 862.0 }, "id": "CVE-2024-41000-aafb5d72", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3220c90f4dbdc6d20d0608b164d964434a810d66", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "275859329671843655259931083220931231540", "139841856696485385276471396354216633281", "326759039789426073016187142448621354396", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-acf42d02", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@58706e482bf45c4db48b0c53aba2468c97adda24", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "276049155765311743428357438324946496951", "249205225457432499742440349424885276415", "33894889719450430958923290637477989081", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-c4f24420", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@61ec76ec930709b7bcd69029ef1fe90491f20cf9", "signature_type": "Line", "digest": { "threshold": 0.9, "line_hashes": [ "275859329671843655259931083220931231540", "139841856696485385276471396354216633281", "326759039789426073016187142448621354396", "290301682810641670090120143827116595445" ] }, "id": "CVE-2024-41000-e51b0286", "target": { "file": "block/ioctl.c" }, "deprecated": false, "signature_version": "v1" }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ccb326b5f9e623eb7f130fbbf2505ec0e2dcaff9", "signature_type": "Function", "digest": { "function_hash": "165120761888742616506315264171580137519", "length": 1004.0 }, "id": "CVE-2024-41000-e87dd25d", "target": { "file": "block/ioctl.c", "function": "blkpg_do_ioctl" }, "deprecated": false, "signature_version": "v1" } ] }