Bug 1219054 (CVE-2024-0564) - VUL-0: CVE-2024-0564: kernel: max page sharing of Kernel Samepage Merging (KSM) may cause memory deduplication
Summary: VUL-0: CVE-2024-0564: kernel: max page sharing of Kernel Samepage Merging (KS...
Status: NEW
Alias: CVE-2024-0564
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Vlastimil Babka
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/391868/
Whiteboard: CVSSv3.1:SUSE:CVE-2024-0564:6.5:(AV:A...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-22 09:42 UTC by SMASH SMASH
Modified: 2024-07-15 09:10 UTC (History)
5 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SMASH SMASH 2024-01-22 09:42:30 UTC
A flaw has been discovered in the Linux kernel memory deduplication mechanism.

Previous research has shown that memory deduplication can be attacked by exploiting the Copy-on-Write (COW) mechanism.

However, the max page sharing[1] of Kernel Samepage Merging (KSM), added in Linux kernel version 4.4.0-96.119, can create another side channel.

When the attacker and the victim share the same host and the default setting of KSM is "max page sharing=256", the attacker maps 256 memory of the same pages it wants to learn and waits.
He can then time the unmap to see if it merges with the victim's page.

The reason the unmapping time depends on whether it merges with the victim's page is that additional physical pages are created beyond the KSM's "max page share".

Through these operations, the attacker leaks the victim's page.

We have confirmed that the target Linux kernel versions are 4.4.0-96.119 through 5.15.0-58-generic, and we expect later versions to be possible.

The research, titled "Exploiting Memory Page Management in KSM for Remote Memory Deduplication Attack," was presented at The 24th World Conference on Information Security Applications (WISA), 2023 [2] and will be published by Springer this year [3].


- Reference -
[1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1680513
[2] https://wisa.or.kr/accepted
[3] https://link.springer.com/conference/wisa

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2024-0564
https://bugzilla.redhat.com/show_bug.cgi?id=2258514
Comment 12 Michal Hocko 2024-05-02 10:01:41 UTC
KSM is disabled by default and requires root to enable it via /sys/kernel/mm/ksm/run interface. Also up until d7597f59d1d3 ("mm: add new api to enable ksm per process") merged 6.4 based kernels applications need to explicitly mark VMAs to be mergeable. After then application could be tricked into using KSM via prctl PR_GET_MEMORY_MERGE from parent process. Even in this case the KSM functionality needs to be enabled by the root.

There are no efforts to block KSM beyond that in upstream other than to disable CONFIG_KSM which is something that would break safe usecases as well.

Therefore I do not think we are affected in default configurations and we should close this CVE as INVALID.