Debian Codegraph @

templates/man2/mprotect.2.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:31+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "mprotect"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-11"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "mprotect, pkey_mprotect - set protection on a region of memory"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Standard C library (I<libc>,\\ I<-lc>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid "B<#include E<lt>sys/mman.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
81 #: opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<int mprotect(>size_t size;\n"
85 "B< void >I<addr>B<[>I<size>B<], size_t >I<size>B<, int >I<prot>B<);>\n"
86 msgstr ""
87
88 #. type: Plain text
89 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
90 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
91 #, no-wrap
92 msgid ""
93 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
94 "B<#include E<lt>sys/mman.hE<gt>>\n"
95 msgstr ""
96
97 #. type: Plain text
98 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
99 #: opensuse-tumbleweed
100 #, no-wrap
101 msgid ""
102 "B<int pkey_mprotect(>size_t size;\n"
103 "B< void >I<addr>B<[>I<size>B<], size_t >I<size>B<, int >I<prot>B<, int >I<pkey>B<);>\n"
104 msgstr ""
105
106 #. type: SH
107 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
108 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
109 #, no-wrap
110 msgid "DESCRIPTION"
111 msgstr ""
112
113 #. type: Plain text
114 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
115 #: opensuse-tumbleweed
116 msgid ""
117 "B<mprotect>() changes the access protections for the calling process's "
118 "memory pages containing any part of the address range in the interval "
119 "[I<addr>, I<addr>+I<size>-1]. I<addr> must be aligned to a page boundary."
120 msgstr ""
121
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 msgid ""
126 "If the calling process tries to access memory in a manner that violates the "
127 "protections, then the kernel generates a B<SIGSEGV> signal for the process."
128 msgstr ""
129
130 #. type: Plain text
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 msgid ""
134 "I<prot> is a combination of the following access flags: B<PROT_NONE> or a "
135 "bitwise OR of the other values in the following list:"
136 msgstr ""
137
138 #. type: TP
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 #, no-wrap
142 msgid "B<PROT_NONE>"
143 msgstr ""
144
145 #. type: Plain text
146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
148 msgid "The memory cannot be accessed at all."
149 msgstr ""
150
151 #. type: TP
152 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
153 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
154 #, no-wrap
155 msgid "B<PROT_READ>"
156 msgstr ""
157
158 #. type: Plain text
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 msgid "The memory can be read."
162 msgstr ""
163
164 #. type: TP
165 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
166 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
167 #, no-wrap
168 msgid "B<PROT_WRITE>"
169 msgstr ""
170
171 #. type: Plain text
172 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
173 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
174 msgid "The memory can be modified."
175 msgstr ""
176
177 #. type: TP
178 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
179 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
180 #, no-wrap
181 msgid "B<PROT_EXEC>"
182 msgstr ""
183
184 #. type: Plain text
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 msgid "The memory can be executed."
188 msgstr ""
189
190 #. type: TP
191 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
192 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
193 #, no-wrap
194 msgid "B<PROT_SEM> (since Linux 2.5.7)"
195 msgstr ""
196
197 #. type: Plain text
198 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
199 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
200 msgid ""
201 "The memory can be used for atomic operations. This flag was introduced as "
202 "part of the B<futex>(2) implementation (in order to guarantee the ability "
203 "to perform atomic operations required by commands such as B<FUTEX_WAIT>), "
204 "but is not currently used in on any architecture."
205 msgstr ""
206
207 #. type: TP
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 #, no-wrap
211 msgid "B<PROT_SAO> (since Linux 2.6.26)"
212 msgstr ""
213
214 #. commit aba46c5027cb59d98052231b36efcbbde9c77a1d
215 #. commit ef3d3246a0d06be622867d21af25f997aeeb105f
216 #. type: Plain text
217 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
218 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
219 msgid ""
220 "The memory should have strong access ordering. This feature is specific to "
221 "the PowerPC architecture (version 2.06 of the architecture specification "
222 "adds the SAO CPU feature, and it is available on POWER 7 or PowerPC A2, for "
223 "example)."
224 msgstr ""
225
226 #. type: Plain text
227 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
228 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
229 msgid ""
230 "Additionally (since Linux 2.6.0), I<prot> can have one of the following "
231 "flags set:"
232 msgstr ""
233
234 #. mm/mmap.c:
235 #. vm_flags |= calc_vm_prot_bits(prot, pkey) | calc_vm_flag_bits(flags) |
236 #. mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
237 #. And calc_vm_flag_bits converts only GROWSDOWN/DENYWRITE/LOCKED.
238 #. type: TP
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 #, no-wrap
242 msgid "B<PROT_GROWSUP>"
243 msgstr ""
244
245 #. #-#-#-#-# archlinux: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
246 #. The VMA is one that was marked with VM_GROWSUP by the kernel
247 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
248 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
249 #. creating a VMA that is marked VM_GROWSUP.
250 #. type: Plain text
251 #. #-#-#-#-# debian-trixie: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
252 #. The VMA is one that was marked with VM_GROWSUP by the kernel
253 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
254 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
255 #. creating a VMA that is marked VM_GROWSUP.
256 #. type: Plain text
257 #. #-#-#-#-# debian-unstable: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
258 #. The VMA is one that was marked with VM_GROWSUP by the kernel
259 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
260 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
261 #. creating a VMA that is marked VM_GROWSUP.
262 #. type: Plain text
263 #. #-#-#-#-# fedora-44: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
264 #. The VMA is one that was marked with VM_GROWSUP by the kernel
265 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
266 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
267 #. creating a VMA that is marked VM_GROWSUP.
268 #. type: Plain text
269 #. #-#-#-#-# fedora-rawhide: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
270 #. The VMA is one that was marked with VM_GROWSUP by the kernel
271 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
272 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
273 #. creating a VMA that is marked VM_GROWSUP.
274 #. type: Plain text
275 #. #-#-#-#-# mageia-cauldron: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
276 #. The VMA is one that was marked with VM_GROWSUP by the kernel
277 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
278 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
279 #. creating a VMA that is marked VM_GROWSUP.
280 #. type: Plain text
281 #. #-#-#-#-# opensuse-leap-16-1: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
282 #. The VMA is one that was marked with VM_GROWSUP by the kernel
283 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
284 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
285 #. creating a VMA that is marked VM_GROWSUP.
286 #. type: Plain text
287 #. #-#-#-#-# opensuse-tumbleweed: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
288 #. The VMA is one that was marked with VM_GROWSUP by the kernel
289 #. when the stack was created. Note that (unlike VM_GROWSDOWN),
290 #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for
291 #. creating a VMA that is marked VM_GROWSUP.
292 #. type: Plain text
293 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
294 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
295 msgid ""
296 "Apply the protection mode up to the end of a mapping that grows upwards. "
297 "(Such mappings are created for the stack area on architectures\\[em]for "
298 "example, HP-PARISC\\[em]that have an upwardly growing stack.)"
299 msgstr ""
300
301 #. type: TP
302 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
303 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
304 #, no-wrap
305 msgid "B<PROT_GROWSDOWN>"
306 msgstr ""
307
308 #. type: Plain text
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 msgid ""
312 "Apply the protection mode down to the beginning of a mapping that grows "
313 "downward (which should be a stack segment or a segment mapped with the "
314 "B<MAP_GROWSDOWN> flag set)."
315 msgstr ""
316
317 #. type: Plain text
318 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
319 #: opensuse-leap-16-1 opensuse-tumbleweed
320 msgid ""
321 "Like B<mprotect>(), B<pkey_mprotect>() changes the protection on the pages "
322 "specified by I<addr> and I<size>. The I<pkey> argument specifies the "
323 "protection key (see B<pkeys>(7)) to assign to the memory. The protection "
324 "key must be allocated with B<pkey_alloc>(2) before it is passed to "
325 "B<pkey_mprotect>(). For an example of the use of this system call, see "
326 "B<pkeys>(7)."
327 msgstr ""
328
329 #. type: SH
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 #, no-wrap
333 msgid "RETURN VALUE"
334 msgstr ""
335
336 #. type: Plain text
337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
339 msgid ""
340 "On success, B<mprotect>() and B<pkey_mprotect>() return zero. On error, "
341 "these system calls return -1, and I<errno> is set to indicate the error."
342 msgstr ""
343
344 #. type: SH
345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
347 #, no-wrap
348 msgid "ERRORS"
349 msgstr ""
350
351 #. type: TP
352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
354 #, no-wrap
355 msgid "B<EACCES>"
356 msgstr ""
357
358 #. type: Plain text
359 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
360 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
361 msgid ""
362 "The memory cannot be given the specified access. This can happen, for "
363 "example, if you B<mmap>(2) a file to which you have read-only access, then "
364 "ask B<mprotect>() to mark it B<PROT_WRITE>."
365 msgstr ""
366
367 #. type: TP
368 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
369 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
370 #, no-wrap
371 msgid "B<EINVAL>"
372 msgstr ""
373
374 #. type: Plain text
375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
377 msgid ""
378 "I<addr> is not a valid pointer, or not a multiple of the system page size."
379 msgstr ""
380
381 #. type: Plain text
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 msgid ""
385 "(B<pkey_mprotect>()) I<pkey> has not been allocated with B<pkey_alloc>(2)"
386 msgstr ""
387
388 #. type: Plain text
389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
391 msgid "Both B<PROT_GROWSUP> and B<PROT_GROWSDOWN> were specified in I<prot>."
392 msgstr ""
393
394 #. type: Plain text
395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
397 msgid "Invalid flags specified in I<prot>."
398 msgstr ""
399
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "(PowerPC architecture) B<PROT_SAO> was specified in I<prot>, but SAO "
405 "hardware feature is not available."
406 msgstr ""
407
408 #. type: TP
409 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
410 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
411 #, no-wrap
412 msgid "B<ENOMEM>"
413 msgstr ""
414
415 #. type: Plain text
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 msgid "Internal kernel structures could not be allocated."
419 msgstr ""
420
421 #. type: Plain text
422 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
423 #: opensuse-leap-16-1 opensuse-tumbleweed
424 msgid ""
425 "Addresses in the range [I<addr>, I<addr>+I<size>-1] are invalid for the "
426 "address space of the process, or specify one or more pages that are not "
427 "mapped. (Before Linux 2.4.19, the error B<EFAULT> was incorrectly produced "
428 "for these cases.)"
429 msgstr ""
430
431 #. I.e., the number of VMAs would exceed the 64 kB maximum
432 #. type: Plain text
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 msgid ""
436 "Changing the protection of a memory region would result in the total number "
437 "of mappings with distinct attributes (e.g., read versus read/write "
438 "protection) exceeding the allowed maximum. (For example, making the "
439 "protection of a range B<PROT_READ> in the middle of a region currently "
440 "protected as B<PROT_READ|PROT_WRITE> would result in three mappings: two "
441 "read/write mappings at each end and a read-only mapping in the middle.)"
442 msgstr ""
443
444 #. type: SH
445 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
446 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
447 #, no-wrap
448 msgid "VERSIONS"
449 msgstr ""
450
451 #. #-#-#-#-# archlinux: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
452 #. SVr4 defines an additional error
453 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
454 #. type: Plain text
455 #. #-#-#-#-# debian-trixie: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
456 #. SVr4 defines an additional error
457 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
458 #. type: Plain text
459 #. #-#-#-#-# debian-unstable: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
460 #. SVr4 defines an additional error
461 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
462 #. type: Plain text
463 #. #-#-#-#-# fedora-44: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
464 #. SVr4 defines an additional error
465 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
466 #. type: Plain text
467 #. #-#-#-#-# fedora-rawhide: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
468 #. SVr4 defines an additional error
469 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
470 #. type: Plain text
471 #. #-#-#-#-# mageia-cauldron: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
472 #. SVr4 defines an additional error
473 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
474 #. type: Plain text
475 #. #-#-#-#-# opensuse-leap-16-1: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
476 #. SVr4 defines an additional error
477 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
478 #. type: Plain text
479 #. #-#-#-#-# opensuse-tumbleweed: mprotect.2.pot (PACKAGE VERSION) #-#-#-#-#
480 #. SVr4 defines an additional error
481 #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's.
482 #. type: Plain text
483 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
484 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
485 msgid ""
486 "POSIX says that the behavior of B<mprotect>() is unspecified if it is "
487 "applied to a region of memory that was not obtained via B<mmap>(2)."
488 msgstr ""
489
490 #. type: Plain text
491 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
492 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
493 msgid ""
494 "On Linux, it is always permissible to call B<mprotect>() on any address in "
495 "a process's address space (except for the kernel vsyscall area). In "
496 "particular, it can be used to change existing code mappings to be writable."
497 msgstr ""
498
499 #. type: Plain text
500 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
501 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
502 msgid ""
503 "Whether B<PROT_EXEC> has any effect different from B<PROT_READ> depends on "
504 "processor architecture, kernel version, and process state. If "
505 "B<READ_IMPLIES_EXEC> is set in the process's personality flags (see "
506 "B<personality>(2)), specifying B<PROT_READ> will implicitly add B<PROT_EXEC>."
507 msgstr ""
508
509 #. type: Plain text
510 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
511 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
512 msgid ""
513 "On some hardware architectures (e.g., i386), B<PROT_WRITE> implies "
514 "B<PROT_READ>."
515 msgstr ""
516
517 #. type: Plain text
518 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
519 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
520 msgid ""
521 "POSIX.1 says that an implementation may permit access other than that "
522 "specified in I<prot>, but at a minimum can allow write access only if "
523 "B<PROT_WRITE> has been set, and must not allow any access if B<PROT_NONE> "
524 "has been set."
525 msgstr ""
526
527 #. type: Plain text
528 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
529 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
530 msgid ""
531 "Applications should be careful when mixing use of B<mprotect>() and "
532 "B<pkey_mprotect>(). On x86, when B<mprotect>() is used with I<prot> set to "
533 "B<PROT_EXEC> a pkey may be allocated and set on the memory implicitly by the "
534 "kernel, but only when the pkey was 0 previously."
535 msgstr ""
536
537 #. type: Plain text
538 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
539 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
540 msgid ""
541 "On systems that do not support protection keys in hardware, "
542 "B<pkey_mprotect>() may still be used, but I<pkey> must be set to -1. When "
543 "called this way, the operation of B<pkey_mprotect>() is equivalent to "
544 "B<mprotect>()."
545 msgstr ""
546
547 #. type: SH
548 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
549 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
550 #, no-wrap
551 msgid "STANDARDS"
552 msgstr ""
553
554 #. type: TP
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 #, no-wrap
558 msgid "B<mprotect>()"
559 msgstr ""
560
561 #. type: Plain text
562 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
563 #: opensuse-tumbleweed
564 msgid "POSIX.1-2024."
565 msgstr ""
566
567 #. type: TP
568 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
569 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
570 #, no-wrap
571 msgid "B<pkey_mprotect>()"
572 msgstr ""
573
574 #. type: Plain text
575 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
576 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
577 msgid "Linux."
578 msgstr ""
579
580 #. type: SH
581 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
582 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
583 #, no-wrap
584 msgid "HISTORY"
585 msgstr ""
586
587 #. type: Plain text
588 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
589 #: opensuse-tumbleweed
590 msgid "SVr4, SUSv1, POSIX.1-1996."
591 msgstr ""
592
593 #. type: Plain text
594 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
595 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
596 msgid "Linux 4.9, glibc 2.27."
597 msgstr ""
598
599 #. type: SH
600 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
601 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
602 #, no-wrap
603 msgid "NOTES"
604 msgstr ""
605
606 #. type: SH
607 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
608 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
609 #, no-wrap
610 msgid "EXAMPLES"
611 msgstr ""
612
613 #. sigaction.2 refers to this example
614 #. type: Plain text
615 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
616 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
617 msgid ""
618 "The program below demonstrates the use of B<mprotect>(). The program "
619 "allocates four pages of memory, makes the third of these pages read-only, "
620 "and then executes a loop that walks upward through the allocated region "
621 "modifying bytes."
622 msgstr ""
623
624 #. type: Plain text
625 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
626 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
627 msgid ""
628 "An example of what we might see when running the program is the following:"
629 msgstr ""
630
631 #. type: Plain text
632 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
633 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
634 #, no-wrap
635 msgid ""
636 "$B< ./a.out>\n"
637 "Start of region: 0x804c000\n"
638 "Got SIGSEGV at address: 0x804e000\n"
639 msgstr ""
640
641 #. type: SS
642 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
643 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
644 #, no-wrap
645 msgid "Program source"
646 msgstr ""
647
648 #. type: Plain text
649 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
650 #: opensuse-tumbleweed
651 #, no-wrap
652 msgid ""
653 "#include E<lt>err.hE<gt>\n"
654 "#include E<lt>malloc.hE<gt>\n"
655 "#include E<lt>signal.hE<gt>\n"
656 "#include E<lt>stdio.hE<gt>\n"
657 "#include E<lt>stdlib.hE<gt>\n"
658 "#include E<lt>sys/mman.hE<gt>\n"
659 "#include E<lt>unistd.hE<gt>\n"
660 "\\&\n"
661 "static char *buffer;\n"
662 "\\&\n"
663 "static void\n"
664 "handler(int sig, siginfo_t *si, void *unused)\n"
665 "{\n"
666 " /* Note: calling printf() from a signal handler is not safe\n"
667 " (and should not be done in production programs), since\n"
668 " printf() is not async-signal-safe; see signal-safety(7).\n"
669 " Nevertheless, we use printf() here as a simple way of\n"
670 " showing that the handler was called. */\n"
671 "\\&\n"
672 " printf(\"Got SIGSEGV at address: %p\\[rs]n\", si-E<gt>si_addr);\n"
673 " exit(EXIT_FAILURE);\n"
674 "}\n"
675 "\\&\n"
676 "int\n"
677 "main(void)\n"
678 "{\n"
679 " int pagesize;\n"
680 " struct sigaction sa;\n"
681 "\\&\n"
682 " sa.sa_flags = SA_SIGINFO;\n"
683 " sigemptyset(&sa.sa_mask);\n"
684 " sa.sa_sigaction = handler;\n"
685 " if (sigaction(SIGSEGV, &sa, NULL) == -1)\n"
686 " err(EXIT_FAILURE, \"sigaction\");\n"
687 "\\&\n"
688 " pagesize = sysconf(_SC_PAGE_SIZE);\n"
689 " if (pagesize == -1)\n"
690 " err(EXIT_FAILURE, \"sysconf\");\n"
691 "\\&\n"
692 " /* Allocate a buffer aligned on a page boundary;\n"
693 " initial protection is PROT_READ | PROT_WRITE. */\n"
694 "\\&\n"
695 " buffer = memalign(pagesize, 4 * pagesize);\n"
696 " if (buffer == NULL)\n"
697 " err(EXIT_FAILURE, \"memalign\");\n"
698 "\\&\n"
699 " printf(\"Start of region: %p\\[rs]n\", buffer);\n"
700 "\\&\n"
701 " if (mprotect(buffer + pagesize * 2, pagesize,\n"
702 " PROT_READ) == -1)\n"
703 " err(EXIT_FAILURE, \"mprotect\");\n"
704 "\\&\n"
705 " for (char *p = buffer ; ; )\n"
706 " *(p++) = \\[aq]a\\[aq];\n"
707 "\\&\n"
708 " printf(\"Loop completed\\[rs]n\"); /* Should never happen */\n"
709 " exit(EXIT_SUCCESS);\n"
710 "}\n"
711 msgstr ""
712
713 #. SRC END
714 #. type: SH
715 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
716 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
717 #, no-wrap
718 msgid "SEE ALSO"
719 msgstr ""
720
721 #. type: Plain text
722 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
723 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
724 msgid "B<mmap>(2), B<sysconf>(3), B<pkeys>(7)"
725 msgstr ""
726
727 #. type: TH
728 #: debian-trixie
729 #, no-wrap
730 msgid "2024-06-15"
731 msgstr ""
732
733 #. type: TH
734 #: debian-trixie
735 #, no-wrap
736 msgid "Linux man-pages 6.9.1"
737 msgstr ""
738
739 #. type: Plain text
740 #: debian-trixie
741 msgid "Standard C library (I<libc>, I<-lc>)"
742 msgstr ""
743
744 #. type: Plain text
745 #: debian-trixie
746 #, no-wrap
747 msgid "B<int mprotect(void >I<addr>B<[.>I<len>B<], size_t >I<len>B<, int >I<prot>B<);>\n"
748 msgstr ""
749
750 #. type: Plain text
751 #: debian-trixie
752 #, no-wrap
753 msgid "B<int pkey_mprotect(void >I<addr>B<[.>I<len>B<], size_t >I<len>B<, int >I<prot>B<, int >I<pkey>B<);>\n"
754 msgstr ""
755
756 #. type: Plain text
757 #: debian-trixie
758 msgid ""
759 "B<mprotect>() changes the access protections for the calling process's "
760 "memory pages containing any part of the address range in the interval "
761 "[I<addr>,\\ I<addr>+I<len>-1]. I<addr> must be aligned to a page boundary."
762 msgstr ""
763
764 #. type: Plain text
765 #: debian-trixie
766 msgid ""
767 "Like B<mprotect>(), B<pkey_mprotect>() changes the protection on the pages "
768 "specified by I<addr> and I<len>. The I<pkey> argument specifies the "
769 "protection key (see B<pkeys>(7)) to assign to the memory. The protection "
770 "key must be allocated with B<pkey_alloc>(2) before it is passed to "
771 "B<pkey_mprotect>(). For an example of the use of this system call, see "
772 "B<pkeys>(7)."
773 msgstr ""
774
775 #. type: Plain text
776 #: debian-trixie
777 msgid ""
778 "Addresses in the range [I<addr>, I<addr>+I<len>-1] are invalid for the "
779 "address space of the process, or specify one or more pages that are not "
780 "mapped. (Before Linux 2.4.19, the error B<EFAULT> was incorrectly produced "
781 "for these cases.)"
782 msgstr ""
783
784 #. type: Plain text
785 #: debian-trixie fedora-44 fedora-rawhide
786 msgid "POSIX.1-2008."
787 msgstr ""
788
789 #. type: Plain text
790 #: debian-trixie fedora-44 fedora-rawhide
791 msgid "POSIX.1-2001, SVr4."
792 msgstr ""
793
794 #. type: Plain text
795 #: debian-trixie fedora-44 fedora-rawhide
796 #, no-wrap
797 msgid ""
798 "#include E<lt>malloc.hE<gt>\n"
799 "#include E<lt>signal.hE<gt>\n"
800 "#include E<lt>stdio.hE<gt>\n"
801 "#include E<lt>stdlib.hE<gt>\n"
802 "#include E<lt>sys/mman.hE<gt>\n"
803 "#include E<lt>unistd.hE<gt>\n"
804 "\\&\n"
805 "#define handle_error(msg) \\[rs]\n"
806 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
807 "\\&\n"
808 "static char *buffer;\n"
809 "\\&\n"
810 "static void\n"
811 "handler(int sig, siginfo_t *si, void *unused)\n"
812 "{\n"
813 " /* Note: calling printf() from a signal handler is not safe\n"
814 " (and should not be done in production programs), since\n"
815 " printf() is not async-signal-safe; see signal-safety(7).\n"
816 " Nevertheless, we use printf() here as a simple way of\n"
817 " showing that the handler was called. */\n"
818 "\\&\n"
819 " printf(\"Got SIGSEGV at address: %p\\[rs]n\", si-E<gt>si_addr);\n"
820 " exit(EXIT_FAILURE);\n"
821 "}\n"
822 "\\&\n"
823 "int\n"
824 "main(void)\n"
825 "{\n"
826 " int pagesize;\n"
827 " struct sigaction sa;\n"
828 "\\&\n"
829 " sa.sa_flags = SA_SIGINFO;\n"
830 " sigemptyset(&sa.sa_mask);\n"
831 " sa.sa_sigaction = handler;\n"
832 " if (sigaction(SIGSEGV, &sa, NULL) == -1)\n"
833 " handle_error(\"sigaction\");\n"
834 "\\&\n"
835 " pagesize = sysconf(_SC_PAGE_SIZE);\n"
836 " if (pagesize == -1)\n"
837 " handle_error(\"sysconf\");\n"
838 "\\&\n"
839 " /* Allocate a buffer aligned on a page boundary;\n"
840 " initial protection is PROT_READ | PROT_WRITE. */\n"
841 "\\&\n"
842 " buffer = memalign(pagesize, 4 * pagesize);\n"
843 " if (buffer == NULL)\n"
844 " handle_error(\"memalign\");\n"
845 "\\&\n"
846 " printf(\"Start of region: %p\\[rs]n\", buffer);\n"
847 "\\&\n"
848 " if (mprotect(buffer + pagesize * 2, pagesize,\n"
849 " PROT_READ) == -1)\n"
850 " handle_error(\"mprotect\");\n"
851 "\\&\n"
852 " for (char *p = buffer ; ; )\n"
853 " *(p++) = \\[aq]a\\[aq];\n"
854 "\\&\n"
855 " printf(\"Loop completed\\[rs]n\"); /* Should never happen */\n"
856 " exit(EXIT_SUCCESS);\n"
857 "}\n"
858 msgstr ""
859
860 #. type: TH
861 #: fedora-44 fedora-rawhide
862 #, no-wrap
863 msgid "2024-11-17"
864 msgstr ""
865
866 #. type: TH
867 #: fedora-44 fedora-rawhide
868 #, no-wrap
869 msgid "Linux man-pages 6.13"
870 msgstr ""
871
872 #. type: Plain text
873 #: fedora-44 fedora-rawhide
874 #, no-wrap
875 msgid "B<int mprotect(void >I<addr>B<[.>I<size>B<], size_t >I<size>B<, int >I<prot>B<);>\n"
876 msgstr ""
877
878 #. type: Plain text
879 #: fedora-44 fedora-rawhide
880 #, no-wrap
881 msgid "B<int pkey_mprotect(void >I<addr>B<[.>I<size>B<], size_t >I<size>B<, int >I<prot>B<, int >I<pkey>B<);>\n"
882 msgstr ""
883
884 #. type: Plain text
885 #: fedora-44 fedora-rawhide
886 msgid ""
887 "B<mprotect>() changes the access protections for the calling process's "
888 "memory pages containing any part of the address range in the interval "
889 "[I<addr>,\\ I<addr>+I<size>-1]. I<addr> must be aligned to a page boundary."
890 msgstr ""
891
892 #. type: TH
893 #: mageia-cauldron
894 #, no-wrap
895 msgid "Linux man-pages 6.17"
896 msgstr ""
897
898 #. type: TH
899 #: opensuse-leap-16-1 opensuse-tumbleweed
900 #, no-wrap
901 msgid "Linux man-pages (unreleased)"
902 msgstr ""