Skip to contentSkip to conversation

mm: do not show ?? for VM_LOCKONFAULT pages

PATCH Applied Jason A. Donenfeld 2 participants 2 messages Dec 5, 2022 – Dec 6, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: do not show ?? for VM_LOCKONFAULT pages

When VM_LOCKONFAULT was added, /proc/PID/smaps wasn't hooked up to it, so looking at /proc/PID/smaps, it shows '??' instead of something intelligable. This can be reached by userspace by simply calling mlock2(..., MLOCK_ONFAULT);.

Fix this by adding "lf" to denote VM_LOCKONFAULT.

Cc Eric B Munson <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andrew Morton <[email protected]>
Fixes de60f5f10c58 ("mm: introduce VM_LOCKONFAULT")
---
 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)
fs/proc/task_mmu.c +1 -0
index 8a74cdcc9af0..60851e96530b 100644
@@ -667,6 +667,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
 		[ilog2(VM_RAND_READ)]	= "rr",
 		[ilog2(VM_DONTCOPY)]	= "dc",
 		[ilog2(VM_DONTEXPAND)]	= "de",
+		[ilog2(VM_LOCKONFAULT)]	= "lf",
 		[ilog2(VM_ACCOUNT)]	= "ac",
 		[ilog2(VM_NORESERVE)]	= "nr",
 		[ilog2(VM_HUGETLB)]	= "ht",
Signature · 1 line
2.38.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jason A. Donenfeld

When VM_LOCKONFAULT was added, /proc/PID/smaps wasn't hooked up to it, so looking at /proc/PID/smaps, it shows '??' instead of something intelligable. This can be reached by userspace by simply calling mlock2(..., MLOCK_ONFAULT);.

Quoted 8 lines

Fix this by adding "lf" to denote VM_LOCKONFAULT.

Cc Eric B Munson <[email protected]>
Cc Kirill A. Shutemov <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Andrew Morton <[email protected]>
Fixes de60f5f10c58 ("mm: introduce VM_LOCKONFAULT")
Quoted 16 lines
---
 fs/proc/task_mmu.c | 1 +
 1 file changed, 1 insertion(+)
fs/proc/task_mmu.c +1 -0
index 8a74cdcc9af0..60851e96530b 100644
@@ -667,6 +667,7 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
 		[ilog2(VM_RAND_READ)]	= "rr",
 		[ilog2(VM_DONTCOPY)]	= "dc",
 		[ilog2(VM_DONTEXPAND)]	= "de",
+		[ilog2(VM_LOCKONFAULT)]	= "lf",
 		[ilog2(VM_ACCOUNT)]	= "ac",
 		[ilog2(VM_NORESERVE)]	= "nr",
 		[ilog2(VM_HUGETLB)]	= "ht",