# SOME DESCRIPTIVE TITLE # Copyright (C) YEAR Free Software Foundation, Inc. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "POT-Creation-Date: 2024-06-01 06:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "mprotect" msgstr "" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.8" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "mprotect, pkey_mprotect - set protection on a region of memory" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Standard C library (I, I<-lc>)" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B<#include Esys/mman.hE>\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BIB<[.>IB<], size_t >IB<, int >IB<);>\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#include Esys/mman.hE>\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BIB<[.>IB<], size_t >IB<, int >IB<, int >IB<);>\n" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "B() changes the access protections for the calling process's " "memory pages containing any part of the address range in the interval " "[I,\\ I+I-1]. I must be aligned to a page boundary." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If the calling process tries to access memory in a manner that violates the " "protections, then the kernel generates a B signal for the process." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed msgid "" "I is a combination of the following access flags: B or a " "bitwise OR of the other values in the following list:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The memory cannot be accessed at all." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The memory can be read." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The memory can be modified." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The memory can be executed." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 2.5.7)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The memory can be used for atomic operations. This flag was introduced as " "part of the B(2) implementation (in order to guarantee the ability " "to perform atomic operations required by commands such as B), " "but is not currently used in on any architecture." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 2.6.26)" msgstr "" #. commit aba46c5027cb59d98052231b36efcbbde9c77a1d #. commit ef3d3246a0d06be622867d21af25f997aeeb105f #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The memory should have strong access ordering. This feature is specific to " "the PowerPC architecture (version 2.06 of the architecture specification " "adds the SAO CPU feature, and it is available on POWER 7 or PowerPC A2, for " "example)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Additionally (since Linux 2.6.0), I can have one of the following " "flags set:" msgstr "" #. mm/mmap.c: #. vm_flags |= calc_vm_prot_bits(prot, pkey) | calc_vm_flag_bits(flags) | #. mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC; #. And calc_vm_flag_bits converts only GROWSDOWN/DENYWRITE/LOCKED. #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. The VMA is one that was marked with VM_GROWSUP by the kernel #. when the stack was created. Note that (unlike VM_GROWSDOWN), #. there is no mmap() flag (analogous to MAP_GROWSDOWN) for #. creating a VMA that is marked VM_GROWSUP. #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Apply the protection mode up to the end of a mapping that grows upwards. " "(Such mappings are created for the stack area on architectures\\[em]for " "example, HP-PARISC\\[em]that have an upwardly growing stack.)" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Apply the protection mode down to the beginning of a mapping that grows " "downward (which should be a stack segment or a segment mapped with the " "B flag set)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Like B(), B() changes the protection on the pages " "specified by I and I. The I argument specifies the " "protection key (see B(7)) to assign to the memory. The protection " "key must be allocated with B(2) before it is passed to " "B(). For an example of the use of this system call, see " "B(7)." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "On success, B() and B() return zero. On error, " "these system calls return -1, and I is set to indicate the error." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The memory cannot be given the specified access. This can happen, for " "example, if you B(2) a file to which you have read-only access, then " "ask B() to mark it B." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I is not a valid pointer, or not a multiple of the system page size." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "(B()) I has not been allocated with B(2)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Both B and B were specified in I." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Invalid flags specified in I." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "(PowerPC architecture) B was specified in I, but SAO " "hardware feature is not available." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Internal kernel structures could not be allocated." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Addresses in the range [I, I+I-1] are invalid for the " "address space of the process, or specify one or more pages that are not " "mapped. (Before Linux 2.4.19, the error B was incorrectly produced " "for these cases.)" msgstr "" #. I.e., the number of VMAs would exceed the 64 kB maximum #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Changing the protection of a memory region would result in the total number " "of mappings with distinct attributes (e.g., read versus read/write " "protection) exceeding the allowed maximum. (For example, making the " "protection of a range B in the middle of a region currently " "protected as B would result in three mappings: two " "read/write mappings at each end and a read-only mapping in the middle.)" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "VERSIONS" msgstr "" #. SVr4 defines an additional error #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's. #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "" "POSIX says that the behavior of B() is unspecified if it is " "applied to a region of memory that was not obtained via B(2)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "On Linux, it is always permissible to call B() on any address in " "a process's address space (except for the kernel vsyscall area). In " "particular, it can be used to change existing code mappings to be writable." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Whether B has any effect different from B depends on " "processor architecture, kernel version, and process state. If " "B is set in the process's personality flags (see " "B(2)), specifying B will implicitly add B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "On some hardware architectures (e.g., i386), B implies " "B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "POSIX.1 says that an implementation may permit access other than that " "specified in I, but at a minimum can allow write access only if " "B has been set, and must not allow any access if B " "has been set." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Applications should be careful when mixing use of B() and " "B(). On x86, when B() is used with I set to " "B a pkey may be allocated and set on the memory implicitly by the " "kernel, but only when the pkey was 0 previously." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "On systems that do not support protection keys in hardware, " "B() may still be used, but I must be set to -1. When " "called this way, the operation of B() is equivalent to " "B()." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "" #. type: TP #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B()" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX.1-2008." msgstr "" #. type: TP #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B()" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux." msgstr "" #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "POSIX.1-2001, SVr4." msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 4.9, glibc 2.27." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "" #. sigaction.2 refers to this example #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The program below demonstrates the use of B(). The program " "allocates four pages of memory, makes the third of these pages read-only, " "and then executes a loop that walks upward through the allocated region " "modifying bytes." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "An example of what we might see when running the program is the following:" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out>\n" "Start of region: 0x804c000\n" "Got SIGSEGV at address: 0x804e000\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "#include Emalloc.hE\n" "#include Esignal.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "static char *buffer;\n" "\\&\n" "static void\n" "handler(int sig, siginfo_t *si, void *unused)\n" "{\n" " /* Note: calling printf() from a signal handler is not safe\n" " (and should not be done in production programs), since\n" " printf() is not async-signal-safe; see signal-safety(7).\n" " Nevertheless, we use printf() here as a simple way of\n" " showing that the handler was called. */\n" "\\&\n" " printf(\"Got SIGSEGV at address: %p\\en\", si-Esi_addr);\n" " exit(EXIT_FAILURE);\n" "}\n" "\\&\n" "int\n" "main(void)\n" "{\n" " int pagesize;\n" " struct sigaction sa;\n" "\\&\n" " sa.sa_flags = SA_SIGINFO;\n" " sigemptyset(&sa.sa_mask);\n" " sa.sa_sigaction = handler;\n" " if (sigaction(SIGSEGV, &sa, NULL) == -1)\n" " handle_error(\"sigaction\");\n" "\\&\n" " pagesize = sysconf(_SC_PAGE_SIZE);\n" " if (pagesize == -1)\n" " handle_error(\"sysconf\");\n" "\\&\n" " /* Allocate a buffer aligned on a page boundary;\n" " initial protection is PROT_READ | PROT_WRITE. */\n" "\\&\n" " buffer = memalign(pagesize, 4 * pagesize);\n" " if (buffer == NULL)\n" " handle_error(\"memalign\");\n" "\\&\n" " printf(\"Start of region: %p\\en\", buffer);\n" "\\&\n" " if (mprotect(buffer + pagesize * 2, pagesize,\n" " PROT_READ) == -1)\n" " handle_error(\"mprotect\");\n" "\\&\n" " for (char *p = buffer ; ; )\n" " *(p++) = \\[aq]a\\[aq];\n" "\\&\n" " printf(\"Loop completed\\en\"); /* Should never happen */\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "B(2), B(3), B(7)" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-05" msgstr "" #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "I is a combination of the following access flags: B or a " "bitwise-or of the other values in the following list:" msgstr "" #. type: Plain text #: debian-bookworm msgid "" "B() first appeared in Linux 4.9; library support was added " "in glibc 2.27." msgstr "" #. SVr4 defines an additional error #. code EAGAIN. The SVr4 error conditions don't map neatly onto Linux's. #. type: Plain text #: debian-bookworm msgid "" "B(): POSIX.1-2001, POSIX.1-2008, SVr4. POSIX says that the " "behavior of B() is unspecified if it is applied to a region of " "memory that was not obtained via B(2)." msgstr "" #. type: Plain text #: debian-bookworm msgid "B() is a nonportable Linux extension." msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#include Emalloc.hE\n" "#include Esignal.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Esys/mman.hE\n" "#include Eunistd.hE\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "#define handle_error(msg) \\e\n" " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "static char *buffer;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "static void\n" "handler(int sig, siginfo_t *si, void *unused)\n" "{\n" " /* Note: calling printf() from a signal handler is not safe\n" " (and should not be done in production programs), since\n" " printf() is not async-signal-safe; see signal-safety(7).\n" " Nevertheless, we use printf() here as a simple way of\n" " showing that the handler was called. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"Got SIGSEGV at address: %p\\en\", si-Esi_addr);\n" " exit(EXIT_FAILURE);\n" "}\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "int\n" "main(void)\n" "{\n" " int pagesize;\n" " struct sigaction sa;\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " sa.sa_flags = SA_SIGINFO;\n" " sigemptyset(&sa.sa_mask);\n" " sa.sa_sigaction = handler;\n" " if (sigaction(SIGSEGV, &sa, NULL) == -1)\n" " handle_error(\"sigaction\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " pagesize = sysconf(_SC_PAGE_SIZE);\n" " if (pagesize == -1)\n" " handle_error(\"sysconf\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Allocate a buffer aligned on a page boundary;\n" " initial protection is PROT_READ | PROT_WRITE. */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " buffer = memalign(pagesize, 4 * pagesize);\n" " if (buffer == NULL)\n" " handle_error(\"memalign\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " printf(\"Start of region: %p\\en\", buffer);\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (mprotect(buffer + pagesize * 2, pagesize,\n" " PROT_READ) == -1)\n" " handle_error(\"mprotect\");\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " for (char *p = buffer ; ; )\n" " *(p++) = \\[aq]a\\[aq];\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"Loop completed\\en\"); /* Should never happen */\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2023-10-31" msgstr "" #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "" #. type: TH #: opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr ""