CVE: CVE-2022-49261
Published: 2025-02-26
Description: In the Linux kernel, the following vulnerability has been resolved:

drm/i915/gem: add missing boundary check in vm_access

A missing bounds check in vm_access() can lead to an out-of-bounds read
or write in the adjacent memory area, since the len attribute is not
validated before the memcpy later in the function, potentially hitting:

[  183.637831] BUG: unable to handle page fault for address: ffffc90000c86000
[  183.637934] #PF: supervisor read access in kernel mode
[  183.637997] #PF: error_code(0x0000) - not-present page
[  183.638059] PGD 100000067 P4D 100000067 PUD 100258067 PMD 106341067 PTE 0
[  183.638144] Oops: 0000 [#2] PREEMPT SMP NOPTI
[  183.638201] CPU: 3 PID: 1790 Comm: poc Tainted: G      D           5.17.0-rc6-ci-drm-11296+ #1
[  183.638298] Hardware name: Intel Corporation CoffeeLake Client Platform/CoffeeLake H DDR4 RVP, BIOS CNLSFWR1.R00.X208.B00[PII_REDACTED] 05/30/2019
[  183.638430] RIP: 0010:memcpy_erms+0x6/0x10
[  183.640213] RSP: 0018:ffffc90001763d48 EFLAGS: 00010246
[  183.641117] RAX: ffff888109c14000 RBX: ffff888111bece40 RCX:[PII_REDACTED]000ffc
[  183.642029] RDX: [PII_REDACTED] RSI: ffffc90000c86000 RDI: ffff888109c14004
[  183.642946] RBP:[PII_REDACTED]000ffc R08:[PII_REDACTED]00016b R09: [PII_REDACTED]
[  183.643848] R10: ffffc90000c85000 R11: [PII_REDACTED] R12: [PII_REDACTED]
[  183.644742] R13: ffff888111bed190 R14: ffff888109c14000 R15: [PII_REDACTED]
[  183.645653] FS:  00007fe5ef807540(0000) GS:ffff88845b380000(0000) knlGS:[PII_REDACTED]
[  183.646570] CS:  0010 DS: 0000 ES: 0000 CR0: [PII_REDACTED]
[  183.647481] CR2: ffffc90000c86000 CR3: 000000010ff02006 CR4:[PII_REDACTED]3706e0
[  183.648384] DR0: [PII_REDACTED] DR1: [PII_REDACTED] DR2: [PII_REDACTED]
[  183.649271] DR3: [PII_REDACTED] DR6: 00000000fffe0ff0 DR7: [PII_REDACTED]
[  183.650142] Call Trace:
[  183.650988]  <TASK>
[  183.651793]  vm_access+0x1f0/0x2a0 [i915]
[  183.652726]  __access_remote_vm+0x224/0x380
[  183.653561]  mem_rw.isra.0+0xf9/0x190
[  183.654402]  vfs_read+0x9d/0x1b0
[  183.655238]  ksys_read+0x63/0xe0
[  183.656065]  do_syscall_64+0x38/0xc0
[  183.656882]  entry_SYSCALL_64_after_hwframe+0x44/0xae
[  183.657663] RIP: 0033:0x7fe5ef725142
[  183.659351] RSP: 002b:00007ffe1e81c7e8 EFLAGS: 00000246 ORIG_RAX: [PII_REDACTED]
[  183.660227] RAX: ffffffffffffffda RBX:[PII_REDACTED]dfb780 RCX: 00007fe5ef725142
[  183.661104] RDX: [PII_REDACTED] RSI: 00007ffe1e81d880 RDI: [PII_REDACTED]
[  183.661972] RBP: 00007ffe1e81e890 R08: [PII_REDACTED] R09: [PII_REDACTED]
[  183.662832] R10:[PII_REDACTED]dfc2e0 R11: [PII_REDACTED] R12:[PII_REDACTED]dfb1c0
[  183.663691] R13: 00007ffe1e81e980 R14: [PII_REDACTED] R15: [PII_REDACTED]

Changes since v1:
     - Updated if condition with range_overflows_t [Chris Wilson]

[mauld: tidy up the commit message and add Cc: stable]
(cherry picked from commit 661412e301e2ca86799aa4f400d1cf0bd38c57c6)
CVSS Score: 7.8 (HIGH)
CWE: CWE-125, CWE-787
References: https://git.kernel.org/stable/c/312d3d4f49e12f97260bcf972c848c3562126a18; https://git.kernel.org/stable/c/3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7; https://git.kernel.org/stable/c/5f6e560e3e86ac[PII_REDACTED]24e411034f41f5c7