From 78ed8bdf4f13e7f5d8eef77c12fbb030fdbdafe0 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Wed, 1 Nov 2023 09:56:05 -0300 Subject: linux: Add PR_SET_VMA_ANON_NAME support Linux 5.17 added support to naming anonymous virtual memory areas through the prctl syscall. The __set_vma_name is a wrapper to avoid optimizing the prctl call if the kernel does not support it. If the kernel does not support PR_SET_VMA_ANON_NAME, prctl returns EINVAL. And it also returns the same error for an invalid argument. Since it is an internal-only API, it assumes well-formatted input: aligned START, with (START, START+LEN) being a valid memory range, and NAME with a limit of 80 characters without an invalid one ("\\`$[]"). Reviewed-by: DJ Delorie --- include/sys/prctl.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/sys/prctl.h b/include/sys/prctl.h index d33f3a290e..8e8e05b07c 100644 --- a/include/sys/prctl.h +++ b/include/sys/prctl.h @@ -3,6 +3,11 @@ # ifndef _ISOMAC +# ifndef PR_SET_VMA +# define PR_SET_VMA 0x53564d41 +# define PR_SET_VMA_ANON_NAME 0 +# endif + extern int __prctl (int __option, ...); libc_hidden_proto (__prctl) -- cgit 1.4.1