Home

PAGEEXECUTEREAD

PAGE_EXECUTE_READ is a memory protection constant used in the Windows API to specify the access rights of a region of virtual memory. It indicates that the pages can be both executed and read, but cannot be written. The constant is part of the PAGE_ family of protection flags defined in the Windows headers.

In practice, PAGE_EXECUTE_READ is supplied to memory management functions such as VirtualAlloc and VirtualProtect to set

Common usage patterns include dynamic code generation and Just-In-Time compilation, where generated code needs to be

Security considerations emphasize the principle of W^X (write XOR execute): keeping memory regions non-writable after code

See also PAGE_EXECUTE, PAGE_EXECUTE_READWRITE, VirtualAlloc, and VirtualProtect for related memory protection concepts.

the
protection
attributes
of
a
memory
region.
The
Windows
API
requires
one
of
the
PAGE_
constants
for
the
protection
parameter;
PAGE_EXECUTE_READ
is
not
typically
combined
with
other
access
flags.
A
region
marked
with
PAGE_EXECUTE_READ
allows
running
code
stored
in
that
region
and
reading
its
contents,
but
attempts
to
write
to
the
region
will
raise
a
protection
fault.
executable
and
readable
but
not
writable
once
finalized.
If
a
program
must
modify
the
code
region,
it
must
first
change
the
protection
to
a
writable
variant
(for
example
PAGE_EXECUTE_READWRITE
or
PAGE_READWRITE),
perform
the
modification,
and
then
restore
PAGE_EXECUTE_READ
to
maintain
security
guarantees.
is
generated
reduces
the
risk
of
exploits.
PAGE_EXECUTE_READ
is
often
used
in
conjunction
with
security
features
such
as
the
NX
bit
to
prevent
unintended
code
modification.