[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250212032155.1276806-7-jeffxu@google.com>
Date: Wed, 12 Feb 2025 03:21:54 +0000
From: jeffxu@...omium.org
To: akpm@...ux-foundation.org,
keescook@...omium.org,
jannh@...gle.com,
torvalds@...ux-foundation.org,
vbabka@...e.cz,
lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com,
adhemerval.zanella@...aro.org,
oleg@...hat.com,
avagin@...il.com,
benjamin@...solutions.net
Cc: linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
linux-mm@...ck.org,
jorgelo@...omium.org,
sroettger@...gle.com,
hch@....de,
ojeda@...nel.org,
thomas.weissschuh@...utronix.de,
adobriyan@...il.com,
johannes@...solutions.net,
pedro.falcato@...il.com,
hca@...ux.ibm.com,
willy@...radead.org,
anna-maria@...utronix.de,
mark.rutland@....com,
linus.walleij@...aro.org,
Jason@...c4.com,
deller@....de,
rdunlap@...radead.org,
davem@...emloft.net,
peterx@...hat.com,
f.fainelli@...il.com,
gerg@...nel.org,
dave.hansen@...ux.intel.com,
mingo@...nel.org,
ardb@...nel.org,
mhocko@...e.com,
42.hyeyoo@...il.com,
peterz@...radead.org,
ardb@...gle.com,
enh@...gle.com,
rientjes@...gle.com,
groeck@...omium.org,
mpe@...erman.id.au,
aleksandr.mikhalitsyn@...onical.com,
mike.rapoport@...il.com,
Jeff Xu <jeffxu@...omium.org>
Subject: [RFC PATCH v5 6/7] mseal, system mappings: uprobe mapping
From: Jeff Xu <jeffxu@...omium.org>
Provide support to mseal the uprobe mapping.
Unlike other system mappings, the uprobe mapping is not
established during program startup. However, its lifetime is the same
as the process's lifetime. It could be sealed from creation.
Signed-off-by: Jeff Xu <jeffxu@...omium.org>
---
kernel/events/uprobes.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 2ca797cbe465..55e0fa21eee6 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -22,6 +22,7 @@
#include <linux/ptrace.h> /* user_enable_single_step */
#include <linux/kdebug.h> /* notifier mechanism */
#include <linux/percpu-rwsem.h>
+#include <linux/userprocess.h>
#include <linux/task_work.h>
#include <linux/shmem_fs.h>
#include <linux/khugepaged.h>
@@ -1662,6 +1663,7 @@ static const struct vm_special_mapping xol_mapping = {
static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
{
struct vm_area_struct *vma;
+ unsigned long vm_flags;
int ret;
if (mmap_write_lock_killable(mm))
@@ -1682,8 +1684,10 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area)
}
}
+ vm_flags = VM_EXEC|VM_MAYEXEC|VM_DONTCOPY|VM_IO;
+ vm_flags |= mseal_system_mappings();
vma = _install_special_mapping(mm, area->vaddr, PAGE_SIZE,
- VM_EXEC|VM_MAYEXEC|VM_DONTCOPY|VM_IO,
+ vm_flags,
&xol_mapping);
if (IS_ERR(vma)) {
ret = PTR_ERR(vma);
--
2.48.1.502.g6dc24dfdaf-goog
Powered by blists - more mailing lists