All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: mtk.manpages@gmail.com
Cc: akpm@linux-foundation.org, xemul@parallels.com,
	linux-man@vger.kernel.org, linux-kernel@vger.kernel.org,
	Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [PATCH 1/2] prctl.2: Add PR_SET_MM option description
Date: Sat, 10 Mar 2012 00:47:21 +0400	[thread overview]
Message-ID: <1331326042-32558-2-git-send-email-gorcunov@openvz.org> (raw)
In-Reply-To: <1331326042-32558-1-git-send-email-gorcunov@openvz.org>

CC: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 man2/prctl.2 |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/man2/prctl.2 b/man2/prctl.2
index effad2a..7a50ac1 100644
--- a/man2/prctl.2
+++ b/man2/prctl.2
@@ -378,6 +378,110 @@ Return the current per-process machine check kill policy.
 All unused
 .BR prctl ()
 arguments must be zero.
+.TP
+.BR PR_SET_MM " (since Linux 3.3)"
+Allows a user to modify certain kernel memory map descriptor fields
+of the calling process.
+Usually these fields are set by the kernel and dynamic loader (see
+.BR ld.so (8)
+for more information) and a regular application should not use this feature.
+Still there are cases such as self-modifying programs, where a program might
+find it useful to change its own memory map.
+The kernel must be built with
+.BR CONFIG_CHECKPOINT_RESTORE
+option turned on, otherwise this feature will not be accessible
+from a user space level.
+The calling process must have
+.BR CAP_SYS_RESOURCE
+(see
+.BR capabilities (7)
+for details) capability granted.
+The value in
+.I arg2
+is one of the options below, while
+.I arg3
+provides a new value for this option.
+
+.BR PR_SET_MM_START_CODE
+to set the address above which program text can run.
+The corresponding memory area must be readable and executable,
+but not writable or shareable (see
+.BR mprotect (2)
+and
+.BR mmap (2)
+for more information).
+
+.BR PR_SET_MM_END_CODE
+to set the address below which program text can run.
+The corresponding memory area must be readable and executable,
+but not writable or shareable.
+
+.BR PR_SET_MM_START_DATA
+to set the address above which program data+bss is placed.
+The corresponding memory area must be readable and writable,
+but not executable or shareable.
+
+.B PR_SET_MM_END_DATA
+to set the address below which program data+bss is placed.
+The corresponding memory area must be readable and writable,
+but not executable or shareable.
+
+.BR PR_SET_MM_START_STACK
+to set the start address of the stack.
+The corresponding memory area must be readable and writable.
+
+.BR PR_SET_MM_START_BRK
+to set the address above which program heap can be expanded with
+.BR brk (2)
+call.
+The address must not be greater than ending address of
+the current program data segment, neither it may exceed
+resource limit for data (see
+.BR setrlimit (2)
+for more information).
+
+.BR PR_SET_MM_BRK
+to set the current
+.BR brk (2)
+value.
+The requirements for address are the same as for
+.BR PR_SET_MM_START_BRK
+option.
+
+.BR PR_SET_MM_ARG_START
+to set the address above which program command line is placed.
+
+.BR PR_SET_MM_ARG_END
+to set the address below which program command line is placed.
+
+.BR PR_SET_MM_ENV_START
+to set the address above which program environment is placed.
+
+.BR PR_SET_MM_ENV_END
+to set the address below which program environment is placed.
+
+The address passed with
+.BR PR_SET_MM_ARG_START ,
+.BR PR_SET_MM_ARG_END ,
+.BR PR_SET_MM_ENV_START ,
+.BR PR_SET_MM_ENV_END ,
+should belong to a process stack area, thus corresponding memory area
+must be readable, writable and (depending on the kernel
+configuration) has
+.BR MAP_GROWSDOWN
+attribute set (see
+.BR mmap (2)
+for details).
+
+.BR PR_SET_MM_AUXV
+to set a new auxiliary vector.
+The
+.I arg3
+argument should provide the address of the vector.
+The
+.I arg4
+is the size of the vector.
+.\"
 .SH "RETURN VALUE"
 On success,
 .BR PR_GET_DUMPABLE ,
-- 
1.7.7.6


  reply	other threads:[~2012-03-09 20:47 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09 20:47 [PATCH 0/2] prctl.2 and kcmp.2 updated Cyrill Gorcunov
2012-03-09 20:47 ` Cyrill Gorcunov
2012-03-09 20:47 ` Cyrill Gorcunov [this message]
2012-03-20 17:21   ` [PATCH 1/2] prctl.2: Add PR_SET_MM option description Michael Kerrisk (man-pages)
2012-03-20 17:21     ` Michael Kerrisk (man-pages)
2012-03-20 17:26     ` Cyrill Gorcunov
2012-03-20 17:26       ` Cyrill Gorcunov
2012-03-20 22:24     ` Cyrill Gorcunov
2012-03-20 22:24       ` Cyrill Gorcunov
2012-03-24  2:59       ` Michael Kerrisk (man-pages)
2012-03-24  6:17         ` Cyrill Gorcunov
2012-03-24  6:17           ` Cyrill Gorcunov
2012-04-15  4:10           ` Michael Kerrisk (man-pages)
2012-04-15  4:10             ` Michael Kerrisk (man-pages)
2012-04-15 21:55             ` Cyrill Gorcunov
2012-04-15 21:55               ` Cyrill Gorcunov
2012-04-15 22:30               ` Michael Kerrisk (man-pages)
2012-04-15 22:30                 ` Michael Kerrisk (man-pages)
2012-04-15 22:34                 ` Michael Kerrisk (man-pages)
2012-04-15 22:34                   ` Michael Kerrisk (man-pages)
2012-04-16  6:13                   ` Cyrill Gorcunov
2012-04-16  6:13                     ` Cyrill Gorcunov
2012-04-16  7:33                     ` Michael Kerrisk (man-pages)
2012-04-16  7:33                       ` Michael Kerrisk (man-pages)
2012-03-09 20:47 ` [PATCH 2/2] Add kcmp.2 manpage Cyrill Gorcunov
2012-03-09 20:47   ` Cyrill Gorcunov
2012-03-09 20:50   ` H. Peter Anvin
2012-03-09 20:50     ` H. Peter Anvin
2012-03-09 21:03     ` Cyrill Gorcunov
2012-03-09 21:03       ` Cyrill Gorcunov
2012-03-09 21:15       ` H. Peter Anvin
2012-03-09 21:18         ` Cyrill Gorcunov
2012-03-09 21:18           ` Cyrill Gorcunov
2012-03-09 21:25           ` Cyrill Gorcunov
2012-03-09 21:25             ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331326042-32558-2-git-send-email-gorcunov@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.