README: Update links
[man-pages.git] / man5 / proc_pid_maps.5
blob36efa5702d2a92cb9f551e1993466780029c35ff
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_pid_maps 5 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 /proc/pid/maps \- mapped memory regions
10 .SH DESCRIPTION
11 .TP
12 .IR /proc/ pid /maps
13 A file containing the currently mapped memory regions and their access
14 permissions.
15 See
16 .BR mmap (2)
17 for some further information about memory mappings.
18 .IP
19 Permission to access this file is governed by a ptrace access mode
20 .B PTRACE_MODE_READ_FSCREDS
21 check; see
22 .BR ptrace (2).
23 .IP
24 The format of the file is:
25 .IP
26 .in +4n
27 .EX
28 .I "address           perms offset  dev   inode       pathname"
29 00400000\-00452000 r\-xp 00000000 08:02 173521      /usr/bin/dbus\-daemon
30 00651000\-00652000 r\-\-p 00051000 08:02 173521      /usr/bin/dbus\-daemon
31 00652000\-00655000 rw\-p 00052000 08:02 173521      /usr/bin/dbus\-daemon
32 00e03000\-00e24000 rw\-p 00000000 00:00 0           [heap]
33 00e24000\-011f7000 rw\-p 00000000 00:00 0           [heap]
34 \&...
35 35b1800000\-35b1820000 r\-xp 00000000 08:02 135522  /usr/lib64/ld\-2.15.so
36 35b1a1f000\-35b1a20000 r\-\-p 0001f000 08:02 135522  /usr/lib64/ld\-2.15.so
37 35b1a20000\-35b1a21000 rw\-p 00020000 08:02 135522  /usr/lib64/ld\-2.15.so
38 35b1a21000\-35b1a22000 rw\-p 00000000 00:00 0
39 35b1c00000\-35b1dac000 r\-xp 00000000 08:02 135870  /usr/lib64/libc\-2.15.so
40 35b1dac000\-35b1fac000 \-\-\-p 001ac000 08:02 135870  /usr/lib64/libc\-2.15.so
41 35b1fac000\-35b1fb0000 r\-\-p 001ac000 08:02 135870  /usr/lib64/libc\-2.15.so
42 35b1fb0000\-35b1fb2000 rw\-p 001b0000 08:02 135870  /usr/lib64/libc\-2.15.so
43 \&...
44 f2c6ff8c000\-7f2c7078c000 rw\-p 00000000 00:00 0    [stack:986]
45 \&...
46 7fffb2c0d000\-7fffb2c2e000 rw\-p 00000000 00:00 0   [stack]
47 7fffb2d48000\-7fffb2d49000 r\-xp 00000000 00:00 0   [vdso]
48 .EE
49 .in
50 .IP
51 The
52 .I address
53 field is the address space in the process that the mapping occupies.
54 The
55 .I perms
56 field is a set of permissions:
57 .IP
58 .in +4n
59 .EX
60 r = read
61 w = write
62 x = execute
63 s = shared
64 p = private (copy on write)
65 .EE
66 .in
67 .IP
68 The
69 .I offset
70 field is the offset into the file/whatever;
71 .I dev
72 is the device
73 (major:minor);
74 .I inode
75 is the inode on that device.
76 0 indicates that no inode is associated with the memory region,
77 as would be the case with BSS (uninitialized data).
78 .IP
79 The
80 .I pathname
81 field will usually be the file that is backing the mapping.
82 For ELF files,
83 you can easily coordinate with the
84 .I offset
85 field by looking at the
86 Offset field in the ELF program headers
87 .RI ( "readelf\ \-l" ).
88 .IP
89 There are additional helpful pseudo-paths:
90 .RS
91 .TP
92 .I [stack]
93 The initial process's (also known as the main thread's) stack.
94 .TP
95 .IR [stack: tid ] " (from Linux 3.4 to Linux 4.4)"
96 .\" commit b76437579d1344b612cf1851ae610c636cec7db0 (added)
97 .\" commit 65376df582174ffcec9e6471bf5b0dd79ba05e4a (removed)
98 A thread's stack (where the
99 .I tid
100 is a thread ID).
101 It corresponds to the
102 .IR /proc/ pid /task/ tid /
103 path.
104 This field was removed in Linux 4.5, since providing this information
105 for a process with large numbers of threads is expensive.
107 .I [vdso]
108 The virtual dynamically linked shared object.
110 .BR vdso (7).
112 .I [heap]
113 The process's heap.
115 .IR [anon: name ] " (since Linux 5.17)"
116 .\" Commit 9a10064f5625d5572c3626c1516e0bebc6c9fe9b
117 A named private anonymous mapping.
118 Set with
119 .BR prctl (2)
120 .BR PR_SET_VMA_ANON_NAME .
122 .IR [anon_shmem: name ] " (since Linux 6.2)"
123 .\" Commit d09e8ca6cb93bb4b97517a18fbbf7eccb0e9ff43
124 A named shared anonymous mapping.
125 Set with
126 .BR prctl (2)
127 .BR PR_SET_VMA_ANON_NAME .
131 If the
132 .I pathname
133 field is blank,
134 this is an anonymous mapping as obtained via
135 .BR mmap (2).
136 There is no easy way to coordinate this back to a process's source,
137 short of running it through
138 .BR gdb (1),
139 .BR strace (1),
140 or similar.
142 .I pathname
143 is shown unescaped except for newline characters, which are replaced
144 with an octal escape sequence.
145 As a result, it is not possible to determine whether the original
146 pathname contained a newline character or the literal
147 .I \e012
148 character sequence.
150 If the mapping is file-backed and the file has been deleted, the string
151 " (deleted)" is appended to the pathname.
152 Note that this is ambiguous too.
154 Under Linux 2.0, there is no field giving pathname.
155 .SH SEE ALSO
156 .BR proc (5)