patch_active_text.5 (2010 09)
p
patch_active_text(5) patch_active_text(5)
(Tunable Kernel Parameters)
NAME
patch_active_text - dynamically enable or disable running executable text to be modified via mprotect()
VALUES
Fail Safe
0 (off)
Default
1 (on) patch_active_text
semantics is enabled
Allowed values
0 (off) or 1 (on)
DESCRIPTION
This tunable allows
mprotect() write access to text of a running process such that the active text can
be modified. When this tunable is enabled,
mprotect() can be used with a special flag, PROT_WRTXT,
to modify the text of a running executable.
By default,
mprotect() does not work on text of a process. Enabling the
patch_active_text
tun-
able allows
mprotect() to work on text segments of a process. Making text writable will create a
private copy of the text to the process using this feature.
Once
mprotect() with special flag PROT_WRTXT allows running text to be modified, further invoca-
tions of mprotect() on text of a process with other prot flags are also allowed.
For
mprotect(), PROT_WRTXT must always be used with PROT_WRITE (see mprotect (2)). mpro-
tect(), PROT_WRTXT|PROT_WRITE
must always be used on text address range.
After the first invocation of
mprotect(text_addr,len, PROT_WRITE|PROT_WRTXT)
,further
mprotect (2) calls will work on text segments of process with any other prot flags; in other words,
mpro-
tect(2) will work on text with PROT_READ, PROT_NONE, PROT_WRITE, PROT_CHECK, or any combi-
nations of the above. The only requirement is that both these flags (PROT_WRTXT|PROT_WRITE
) must
be invoked first.
Who Is Expected to Change This Tunable?
System administrators who wish to change the default
patch_active_text behavior.
Restrictions on Changing
Changes to this tunable take effect immediately.
When Should the Tunable Be Turned Off?
If an application expects
mprotect() to fail on text segments, the tunable should be turned off.
What Are the Side Effects of Turning the Tunable Off?
Applications will no longer be able to use
mprotect() on text of a process.
When Should the Tunable Be Turned On?
If an application wants its text segment to be writable and also wants
mprotect() to be able to work on
text of processes, this tunable must be turned on. Making text writable will create a private copy of the
text to the process using this feature.
What Are the Side Effects of Turning the Tunable On?
Memory consumption in the system will increase. This is because with
mprotect(PROT_WRTXT) the
process will create a private copy of the shared text on first invocation. It should also be noted that large
page benefits on text segments will be lost.
What Other Tunables Should Be Changed at the Same Time?
None.
WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its
meaning changed in future releases of HP-UX.
Installation of optional kernel software, from HP or other vendors, may cause changes to tunable parame-
ter values. After installation, some tunable parameters may no longer be at the default or recommended
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1