Skip to contentSkip to conversation

add mseal to /proc/pid/smaps

PATCH Applied [email protected] 3 participants 4 messages Jun 14, 2024 – Jun 17, 2024

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

v2 cover add mseal to /proc/pid/smaps

From: Jeff Xu <[email protected]>

Add mseal information in /proc/pid/smaps to indicate the VMA is sealed.

I appreicate Adhemerval Zanella Netto to bring this to my attention. [1]

[1] https://public-inbox.org/libc-alpha/[email protected]/#t

History:

v2:
update from Jann Horn's comments:
- change 'sp' to 'sl'
- change 'sealed page' to 'sealed'
- move VM_SEALED define after VM_ALLOW_ANY_UNCACHED

v1:
https://lore.kernel.org/lkml/[email protected]/

Jeff Xu (1):
/proc/pid/smaps: add mseal info for vma

 Documentation/filesystems/proc.rst | 1 +
 fs/proc/task_mmu.c                 | 3 +++
 include/linux/mm.h                 | 5 +++++
 mm/internal.h                      | 5 -----
 4 files changed, 9 insertions(+), 5 deletions(-)
Signature · 1 line
2.45.2.627.g7a2c4fd464-goog
#1 lore raw

PATCH v2 1/1 /proc/pid/smaps: add mseal info for vma

From: Jeff Xu <[email protected]>

Add sl in /proc/pid/smaps to indicate vma is sealed

---
 Documentation/filesystems/proc.rst | 1 +
 fs/proc/task_mmu.c                 | 3 +++
 include/linux/mm.h                 | 5 +++++
 mm/internal.h                      | 5 -----
 4 files changed, 9 insertions(+), 5 deletions(-)
Documentation/filesystems/proc.rst +1 -0
index 7c3a565ffbef..82d142de3461 100644
@@ -571,6 +571,7 @@ encoded manner. The codes are the following:
     um    userfaultfd missing tracking
     uw    userfaultfd wr-protect tracking
     ss    shadow stack page
+    sl    sealed
     ==    =======================================
 
 Note that there is no guarantee that every flag and associated mnemonic will
fs/proc/task_mmu.c +3 -0
index 6ed1f56b32b4..93fb2c61b154 100644
@@ -711,6 +711,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
 #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */
 #ifdef CONFIG_X86_USER_SHADOW_STACK
 		[ilog2(VM_SHADOW_STACK)] = "ss",
+#endif
+#ifdef CONFIG_64BIT
+		[ilog2(VM_SEALED)] = "sl",
 #endif
 	};
 	size_t i;
include/linux/mm.h +5 -0
index 587d34879865..84c4cc7354b4 100644
@@ -406,6 +406,11 @@ extern unsigned int kobjsize(const void *objp);
 #define VM_ALLOW_ANY_UNCACHED		VM_NONE
 #endif
 
+#ifdef CONFIG_64BIT
+/* VM is sealed, in vm_flags */
+#define VM_SEALED	_BITUL(63)
+#endif
+
 /* Bits set in the VMA until the stack is in its final location */
 #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ | VM_STACK_EARLY)
 
mm/internal.h +0 -5
index fd68c43664d5..72f7c110d563 100644
@@ -1509,11 +1509,6 @@ void __meminit __init_single_page(struct page *page, unsigned long pfn,
 unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct mem_cgroup *memcg,
 			  int priority);
 
-#ifdef CONFIG_64BIT
-/* VM is sealed, in vm_flags */
-#define VM_SEALED	_BITUL(63)
-#endif
-
 #ifdef CONFIG_64BIT
 static inline int can_do_mseal(unsigned long flags)
 {
Signature · 1 line
2.45.2.627.g7a2c4fd464-goog
maintainer
#2 lore raw

Re: [PATCH v2 1/1] /proc/pid/smaps: add mseal info for vma

Quoted 9 lines · On Fri, 14 Jun 2024 23:20:14 +0000 [email protected] wrote:

From: Jeff Xu <[email protected]>

Add sl in /proc/pid/smaps to indicate vma is sealed

...

Documentation/filesystems/proc.rst encoded manner. The codes are the following: · line 575

Quoted 5 lines
Documentation/filesystems/proc.rst +1 -0
@@ -571,6 +571,7 @@ encoded manner. The codes are the following:
     um    userfaultfd missing tracking
     uw    userfaultfd wr-protect tracking
     ss    shadow stack page
+    sl    sealed
     ==    =======================================

I'll queue this for 6.10-rcX as a fix for 8be7258aad44 ("mseal: add mseal syscall").