Skip to contentSkip to conversation

prctl(2): PR_SET_MM: document arg4/arg5 zero behavior

PATCH In review Mike Frysinger 2 participants 6 messages Feb 15, 2017 – Apr 19, 2017 3 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 prctl(2): PR_SET_MM: document arg4/arg5 zero behavior

The kernel will immediately reject calls where arg4/arg5 are not zero. See kernel/sys.c:prctl_set_mm().

---
 man2/prctl.2 | 5 +++++
 1 file changed, 5 insertions(+)
man2/prctl.2 +5 -0
index 97cf21a4c558..c91d328e5aa1 100644
@@ -515,6 +515,11 @@ The value in
 is one of the options below, while
 .I arg3
 provides a new value for the option.
+The
+.I arg4
+and
+.I arg5
+arguments must be zero if unused.
 .RS
 .TP
 .BR PR_SET_MM_START_CODE
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170215201443.448-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 2/3 prctl(2): PR_SET_MM: document new PR_SET_MM_MAP{,_SIZE} helpers

---
 man2/prctl.2 | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
man2/prctl.2 +28 -0
index c91d328e5aa1..dba32ebee1b5 100644
@@ -633,6 +633,34 @@ in a process life time.
 Any further attempts will be rejected.
 This should help system administrators monitor unusual
 symbolic-link transitions over all processes running on a system.
+.P
+The following options are available since Linux 3.18.
+.\" commit f606b77f1a9e362451aca8f81d8f36a3a112139e
+.TP
+.BR PR_SET_MM_MAP
+Provides one-shot access to all the addresses by passing in a
+.I struct prctl_mm_map
+(as defined in \fI<linux/prctl.h>\fP).
+The
+.I arg4
+argument should provide the size of the struct.
+
+This feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
+.TP
+.BR PR_SET_MM_MAP_SIZE
+Returns the size of the
+.I struct prctl_mm_map
+the kernel expects.
+This allows user space to find a compatible struct.
+The
+.I arg4
+argument should be a pointer to an unsigned int.
+
+This feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
 .RE
 .TP
 .BR PR_MPX_ENABLE_MANAGEMENT ", " PR_MPX_DISABLE_MANAGEMENT " (since Linux 3.19) "
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170215201443.448-2-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org

#4 lore raw

Re: [PATCH 2/3] prctl(2): PR_SET_MM: document new PR_SET_MM_MAP{,_SIZE} helpers

Quoted 1 line · Mike Frysinger

Thanks, Mike. Applied.

Cheers,

Michael

Quoted 44 lines
---
 man2/prctl.2 | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
man2/prctl.2 +28 -0
index c91d328e5aa1..dba32ebee1b5 100644
@@ -633,6 +633,34 @@ in a process life time.
 Any further attempts will be rejected.
 This should help system administrators monitor unusual
 symbolic-link transitions over all processes running on a system.
+.P
+The following options are available since Linux 3.18.
+.\" commit f606b77f1a9e362451aca8f81d8f36a3a112139e
+.TP
+.BR PR_SET_MM_MAP
+Provides one-shot access to all the addresses by passing in a
+.I struct prctl_mm_map
+(as defined in \fI<linux/prctl.h>\fP).
+The
+.I arg4
+argument should provide the size of the struct.
+
+This feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
+.TP
+.BR PR_SET_MM_MAP_SIZE
+Returns the size of the
+.I struct prctl_mm_map
+the kernel expects.
+This allows user space to find a compatible struct.
+The
+.I arg4
+argument should be a pointer to an unsigned int.
+
+This feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
 .RE
 .TP
 .BR PR_MPX_ENABLE_MANAGEMENT ", " PR_MPX_DISABLE_MANAGEMENT " (since Linux 3.19) "
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 3/3 prctl(2): PR_SET_MM: refine CONFIG_CHECKPOINT_RESTORE requirement

In reply to a message not in the archive

The Linux 3.10 release dropped the c/r requirement and opened it up to all users.

---
 man2/prctl.2 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
man2/prctl.2 +9 -3
index dba32ebee1b5..42827aa2def4 100644
@@ -504,9 +504,7 @@ Usually these fields are set by the kernel and dynamic loader (see
 for more information) and a regular application should not use this feature.
 However, there are cases, such as self-modifying programs,
 where a program might find it useful to change its own memory map.
-This feature is available only if the kernel is built with the
-.BR CONFIG_CHECKPOINT_RESTORE
-option enabled.
+
 The calling process must have the
 .BR CAP_SYS_RESOURCE
 capability.
@@ -520,6 +518,14 @@ The
 and
 .I arg5
 arguments must be zero if unused.
+
+.\" commit 52b3694157e3aa6df871e283115652ec6f2d31e0
+Since Linux 3.10,
+this feature is available all the time.
+Before Linux 3.10,
+this feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
 .RS
 .TP
 .BR PR_SET_MM_START_CODE
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20170215201443.448-3-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org

#7 lore raw

Re: [PATCH 3/3] prctl(2): PR_SET_MM: refine CONFIG_CHECKPOINT_RESTORE requirement

Quoted 2 lines · Mike Frysinger

The Linux 3.10 release dropped the c/r requirement and opened it up to all users.

Thanks, Mike. Applied.

Cheers,

Michael

Quoted 36 lines
---
 man2/prctl.2 | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
man2/prctl.2 +9 -3
index dba32ebee1b5..42827aa2def4 100644
@@ -504,9 +504,7 @@ Usually these fields are set by the kernel and dynamic loader (see
 for more information) and a regular application should not use this feature.
 However, there are cases, such as self-modifying programs,
 where a program might find it useful to change its own memory map.
-This feature is available only if the kernel is built with the
-.BR CONFIG_CHECKPOINT_RESTORE
-option enabled.
+
 The calling process must have the
 .BR CAP_SYS_RESOURCE
 capability.
@@ -520,6 +518,14 @@ The
 and
 .I arg5
 arguments must be zero if unused.
+
+.\" commit 52b3694157e3aa6df871e283115652ec6f2d31e0
+Since Linux 3.10,
+this feature is available all the time.
+Before Linux 3.10,
+this feature is available only if the kernel is built with the
+.BR CONFIG_CHECKPOINT_RESTORE
+option enabled.
 .RS
 .TP
 .BR PR_SET_MM_START_CODE
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#8 lore raw
In reply to a message not in the archive
Quoted 2 lines · Mike Frysinger

The kernel will immediately reject calls where arg4/arg5 are not zero. See kernel/sys.c:prctl_set_mm().

Thanks, Mike. Applied.

Cheers,

Michael

Quoted 22 lines
---
 man2/prctl.2 | 5 +++++
 1 file changed, 5 insertions(+)
man2/prctl.2 +5 -0
index 97cf21a4c558..c91d328e5aa1 100644
@@ -515,6 +515,11 @@ The value in
 is one of the options below, while
 .I arg3
 provides a new value for the option.
+The
+.I arg4
+and
+.I arg5
+arguments must be zero if unused.
 .RS
 .TP
 .BR PR_SET_MM_START_CODE
Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html