Debian Codegraph @

po/ar/man7/pkeys.7.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5 msgid ""
6 msgstr ""
7 "Project-Id-Version: manpages-l10n 4.30.2\n"
8 "POT-Creation-Date: 2026-06-05 06:35+0200\n"
9 "PO-Revision-Date: 2026-05-12 21:00+0400\n"
10 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
11 "Language-Team: Arabic <[email protected]>\n"
12 "Language: ar\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
17 "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
18 "X-Generator: Lokalize 23.08.5\n"
19
20 #. type: TH
21 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
22 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
23 #, no-wrap
24 msgid "pkeys"
25 msgstr "pkeys"
26
27 #. type: TH
28 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
29 #: opensuse-tumbleweed
30 #, no-wrap
31 msgid "2026-02-08"
32 msgstr "8 فبراير 2026"
33
34 #. type: TH
35 #: archlinux debian-unstable
36 #, no-wrap
37 msgid "Linux man-pages 6.18"
38 msgstr "صفحات دليل لينكس 6.18"
39
40 #. type: SH
41 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
42 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
43 #, no-wrap
44 msgid "NAME"
45 msgstr "الاسم"
46
47 #. type: Plain text
48 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
49 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
50 msgid "pkeys - overview of Memory Protection Keys"
51 msgstr "pkeys - نظرة عامة على مفاتيح حماية الذاكرة"
52
53 #. type: SH
54 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
55 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
56 #, no-wrap
57 msgid "DESCRIPTION"
58 msgstr "الوصف"
59
60 #. type: Plain text
61 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
62 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
63 msgid ""
64 "Memory Protection Keys (pkeys) are an extension to existing page-based "
65 "memory permissions. Normal page permissions using page tables require "
66 "expensive system calls and TLB invalidations when changing permissions. "
67 "Memory Protection Keys provide a mechanism for changing protections without "
68 "requiring modification of the page tables on every permission change."
69 msgstr ""
70 "مفاتيح حماية الذاكرة (pkeys) هي امتداد لأذونات الذاكرة القائمة على الصفحات. "
71 "تتطلب أذونات الصفحات العادية باستخدام جداول الصفحات استدعاءات نظام مكلفة "
72 "وإبطالات TLB عند تغيير الأذونات. توفر مفاتيح حماية الذاكرة آلية لتغيير "
73 "الحماية دون الحاجة إلى تعديل جداول الصفحات في كل تغيير إذن."
74
75 #. type: Plain text
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 msgid ""
79 "To use pkeys, software must first \"tag\" a page in the page tables with a "
80 "pkey. After this tag is in place, an application only has to change the "
81 "contents of a register in order to remove write access, or all access to a "
82 "tagged page."
83 msgstr ""
84 "لاستخدام pkeys، يجب على البرنامج أولاً \"وسم\" صفحة في جداول الصفحات بمفتاح "
85 "pkey. بعد وضع هذا الوسم، يحتاج التطبيق فقط إلى تغيير محتويات سجل لإزالة إذن "
86 "الكتابة، أو كل الوصول إلى صفحة موسومة."
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 msgid ""
92 "Protection keys work in conjunction with the existing B<PROT_READ>, "
93 "B<PROT_WRITE>, and B<PROT_EXEC> permissions passed to system calls such as "
94 "B<mprotect>(2) and B<mmap>(2), but always act to further restrict these "
95 "traditional permission mechanisms."
96 msgstr ""
97 "تعمل مفاتيح الحماية بالتزامن مع أذونات B<PROT_READ> وB<PROT_WRITE> "
98 "وB<PROT_EXEC> الحالية الممررة إلى استدعاءات النظام مثل B<mprotect>(2) "
99 "وB<mmap>(2)، ولكنها تعمل دائمًا على تقييد آليات الإذن التقليدية هذه بشكل أكبر."
100
101 #. type: Plain text
102 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
103 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
104 msgid ""
105 "If a process performs an access that violates pkey restrictions, it receives "
106 "a B<SIGSEGV> signal. See B<sigaction>(2) for details of the information "
107 "available with that signal."
108 msgstr ""
109 "إذا نفذت عملية وصولًا ينتهك قيود pkey، فإنها تتلقى إشارة B<SIGSEGV>. راجع "
110 "B<sigaction>(2) للحصول على تفاصيل المعلومات المتاحة مع تلك الإشارة."
111
112 #. type: Plain text
113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
115 msgid ""
116 "To use the pkeys feature, the processor must support it, and the kernel must "
117 "contain support for the feature on a given processor. As of early 2016 only "
118 "future Intel x86 processors are supported, and this hardware supports 16 "
119 "protection keys in each process. However, pkey 0 is used as the default "
120 "key, so a maximum of 15 are available for actual application use. The "
121 "default key is assigned to any memory region for which a pkey has not been "
122 "explicitly assigned via B<pkey_mprotect>(2)."
123 msgstr ""
124 "لاستخدام ميزة pkeys، يجب أن يدعمها المعالج، ويجب أن يحتوي النواة على دعم "
125 "للميزة على معالج معين. اعتبارًا من أوائل عام 2016، يتم دعم معالجات Intel x86 "
126 "المستقبلية فقط، وتدعم هذه الأجهزة 16 مفتاح حماية في كل عملية. ومع ذلك، "
127 "يُستخدم مفتاح pkey 0 كمفتاح مبدئي، لذا يتوفر حد أقصى 15 مفتاحًا للاستخدام "
128 "الفعلي للتطبيق. يُخصص المفتاح المبدئي لأي منطقة ذاكرة لم يُخصص لها مفتاح pkey "
129 "بشكل صريح عبر B<pkey_mprotect>(2)."
130
131 #. type: Plain text
132 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
133 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
134 msgid ""
135 "Protection keys have the potential to add a layer of security and "
136 "reliability to applications. But they have not been primarily designed as a "
137 "security feature. For instance, WRPKRU is a completely unprivileged "
138 "instruction, so pkeys are useless in any case that an attacker controls the "
139 "PKRU register or can execute arbitrary instructions."
140 msgstr ""
141 "لدى مفاتيح الحماية القدرة على إضافة طبقة من الأمان والموثوقية للتطبيقات. "
142 "لكنها لم تُصمم في المقام الأول كميزة أمان. على سبيل المثال، WRPKRU هي تعليمة "
143 "غير مميزة تمامًا، لذا فإن pkeys عديمة الفائدة في أي حالة يتحكم فيها المهاجم "
144 "في سجل PKRU أو يمكنه تنفيذ تعليمات عشوائية."
145
146 #. type: Plain text
147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
149 msgid ""
150 "Applications should be very careful to ensure that they do not \"leak\" "
151 "protection keys. For instance, before calling B<pkey_free>(2), the "
152 "application should be sure that no memory has that pkey assigned. If the "
153 "application left the freed pkey assigned, a future user of that pkey might "
154 "inadvertently change the permissions of an unrelated data structure, which "
155 "could impact security or stability. The kernel currently allows in-use "
156 "pkeys to have B<pkey_free>(2) called on them because it would have "
157 "processor or memory performance implications to perform the additional "
158 "checks needed to disallow it. Implementation of the necessary checks is "
159 "left up to applications. Applications may implement these checks by "
160 "searching the I</proc/>pidI</smaps> file for memory regions with the pkey "
161 "assigned. Further details can be found in B<proc>(5)."
162 msgstr ""
163 "يجب على التطبيقات أن تكون حذرة جدًا لضمان عدم \"تسريب\" مفاتيح الحماية. على "
164 "سبيل المثال، قبل استدعاء B<pkey_free>(2)، يجب على التطبيق التأكد من عدم وجود "
165 "ذاكرة مخصص لها ذلك المفتاح pkey. إذا ترك التطبيق المفتاح المحرر مخصصًا، فقد "
166 "يغير مستخدم مستقبلي لذلك المفتاح أذونات بنية بيانات غير مرتبطة عن غير قصد، "
167 "مما قد يؤثر على الأمان أو الاستقرار. تسمح النواة حاليًا باستدعاء "
168 "B<pkey_free>(2) على مفاتيح pkey قيد الاستخدام لأنه سيكون له آثار على أداء "
169 "المعالج أو الذاكرة لإجراء الفحوصات الإضافية اللازمة لمنع ذلك. يُترك تنفيذ "
170 "الفحوصات اللازمة للتطبيقات. يمكن للتطبيقات تنفيذ هذه الفحوصات بالبحث في ملف "
171 "I</proc/>pidI</smaps> عن مناطق الذاكرة ذات المفتاح pkey المخصص. يمكن العثور "
172 "على تفاصيل إضافية في B<proc>(5)."
173
174 #. type: Plain text
175 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
176 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
177 msgid ""
178 "Any application wanting to use protection keys needs to be able to function "
179 "without them. They might be unavailable because the hardware that the "
180 "application runs on does not support them, the kernel code does not contain "
181 "support, the kernel support has been disabled, or because the keys have all "
182 "been allocated, perhaps by a library the application is using. It is "
183 "recommended that applications wanting to use protection keys should simply "
184 "call B<pkey_alloc>(2) and test whether the call succeeds, instead of "
185 "attempting to detect support for the feature in any other way."
186 msgstr ""
187 "أي تطبيق يرغب في استخدام مفاتيح الحماية يحتاج إلى أن يكون قادرًا على العمل "
188 "بدونها. قد تكون غير متاحة لأن الأجهزة التي يعمل عليها التطبيق لا تدعمها، أو "
189 "رمز النواة لا يحتوي على دعم، أو دعم النواة معطل، أو لأن جميع المفاتيح قد "
190 "خُصصت، ربما بواسطة مكتبة يستخدمها التطبيق. يُوصى بأن التطبيقات التي ترغب في "
191 "استخدام مفاتيح الحماية يجب ببساطة استدعاء B<pkey_alloc>(2) واختبار ما إذا "
192 "كان الاستدعاء ناجحًا، بدلاً من محاولة اكتشاف دعم الميزة بأي طريقة أخرى."
193
194 #. type: Plain text
195 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
196 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
197 msgid ""
198 "Although unnecessary, hardware support for protection keys may be enumerated "
199 "with the I<cpuid> instruction. Details of how to do this can be found in "
200 "the Intel Software Developers Manual. The kernel performs this enumeration "
201 "and exposes the information in I</proc/cpuinfo> under the \"flags\" field. "
202 "The string \"pku\" in this field indicates hardware support for protection "
203 "keys and the string \"ospke\" indicates that the kernel contains and has "
204 "enabled protection keys support."
205 msgstr ""
206 "على الرغم من عدم الحاجة، يمكن تعداد دعم الأجهزة لمفاتيح الحماية باستخدام "
207 "تعليمة I<cpuid>. يمكن العثور على تفاصيل كيفية القيام بذلك في دليل مطوري "
208 "برامج Intel. تقوم النواة بهذا التعداد وتكشف المعلومات في I</proc/cpuinfo> "
209 "تحت حقل \"flags\". تشير السلسلة \"pku\" في هذا الحقل إلى دعم الأجهزة لمفاتيح "
210 "الحماية وتشير السلسلة \"ospke\" إلى أن النواة تحتوي على دعم مفاتيح الحماية "
211 "وقد مكنته."
212
213 #. type: Plain text
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 msgid ""
217 "Applications using threads and protection keys should be especially "
218 "careful. Threads inherit the protection key rights of the parent at the "
219 "time of the B<clone>(2), system call. Applications should either ensure "
220 "that their own permissions are appropriate for child threads at the time "
221 "when B<clone>(2) is called, or ensure that each child thread can perform "
222 "its own initialization of protection key rights."
223 msgstr ""
224 "يجب على التطبيقات التي تستخدم الخيوط ومفاتيح الحماية أن تكون حذرة بشكل خاص. "
225 "ترث الخيوط حقوق مفاتيح الحماية من الأصل في وقت استدعاء النظام B<clone>(2). "
226 "يجب على التطبيقات إما ضمان أن أذوناتها الخاصة مناسبة للخيوط الفرعية في الوقت "
227 "الذي يُستدعى فيه B<clone>(2)، أو ضمان أن كل خيط فرعي يمكنه إجراء تهيئته "
228 "الخاصة لحقوق مفاتيح الحماية."
229
230 #. type: SS
231 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
232 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
233 #, no-wrap
234 msgid "Signal Handler Behavior"
235 msgstr "سلوك معالج الإشارة"
236
237 #. type: Plain text
238 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
239 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
240 msgid ""
241 "Each time a signal handler is invoked (including nested signals), the thread "
242 "is temporarily given a new, default set of protection key rights that "
243 "override the rights from the interrupted context. This means that "
244 "applications must re-establish their desired protection key rights upon "
245 "entering a signal handler if the desired rights differ from the defaults. "
246 "The rights of any interrupted context are restored when the signal handler "
247 "returns."
248 msgstr ""
249 "في كل مرة يُستدعى فيها معالج إشارة (بما في ذلك الإشارات المتداخلة)، يُعطى "
250 "الخيط مؤقتًا مجموعة جديدة ومبدئية من حقوق مفاتيح الحماية التي تتجاوز الحقوق "
251 "من السياق المتقطع. هذا يعني أن التطبيقات يجب أن تعيد تأسيس حقوق مفاتيح "
252 "الحماية المرغوبة عند الدخول إلى معالج إشارة إذا كانت الحقوق المرغوبة تختلف "
253 "عن المبدئية. تُستعاد حقوق أي سياق متقطع عند عودة معالج الإشارة."
254
255 #. type: Plain text
256 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
257 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
258 msgid ""
259 "This signal behavior is unusual and is due to the fact that the x86 PKRU "
260 "register (which stores protection key access rights) is managed with the "
261 "same hardware mechanism (XSAVE) that manages floating-point registers. The "
262 "signal behavior is the same as that of floating-point registers."
263 msgstr ""
264 "سلوك الإشارة هذا غير معتاد ويعود إلى حقيقة أن سجل x86 PKRU (الذي يخزن حقوق "
265 "الوصول لمفاتيح الحماية) يُدار بنفس آلية الأجهزة (XSAVE) التي تدير سجلات "
266 "الفاصلة العائمة. سلوك الإشارة هو نفسه سلوك سجلات الفاصلة العائمة."
267
268 #. type: SS
269 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
270 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
271 #, no-wrap
272 msgid "Protection Keys system calls"
273 msgstr "استدعاءات نظام مفاتيح الحماية"
274
275 #. type: Plain text
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 msgid ""
279 "The Linux kernel implements the following pkey-related system calls: "
280 "B<pkey_mprotect>(2), B<pkey_alloc>(2), and B<pkey_free>(2)."
281 msgstr ""
282 "تنفذ نواة لينكس استدعاءات النظام التالية المتعلقة بـ pkey: "
283 "B<pkey_mprotect>(2) وB<pkey_alloc>(2) وB<pkey_free>(2)."
284
285 #. type: Plain text
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 msgid ""
289 "The Linux pkey system calls are available only if the kernel was configured "
290 "and built with the B<CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS> option."
291 msgstr ""
292 "استدعاءات نظام pkey في لينكس متاحة فقط إذا تم تكوين النواة وبناؤها مع خيار "
293 "B<CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS>."
294
295 #. type: SH
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 #, no-wrap
299 msgid "EXAMPLES"
300 msgstr "أمثلة"
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid ""
306 "The program below allocates a page of memory with read and write "
307 "permissions. It then writes some data to the memory and successfully reads "
308 "it back. After that, it attempts to allocate a protection key and disallows "
309 "access to the page by using the WRPKRU instruction. It then tries to access "
310 "the page, which we now expect to cause a fatal signal to the application."
311 msgstr ""
312 "يخصص البرنامج أدناه صفحة ذاكرة بأذونات القراءة والكتابة. ثم يكتب بعض "
313 "البيانات إلى الذاكرة ويقرأها بنجاح. بعد ذلك، يحاول تخصيص مفتاح حماية ويمنع "
314 "الوصول إلى الصفحة باستخدام تعليمة WRPKRU. ثم يحاول الوصول إلى الصفحة، والتي "
315 "نتوقع الآن أن تسبب إشارة قاتلة للتطبيق."
316
317 #. type: Plain text
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid ""
322 "$B< ./a.out>\n"
323 "buffer contains: 73\n"
324 "about to read buffer again...\n"
325 "Segmentation fault (core dumped)\n"
326 msgstr ""
327 "$B< ./a.out>\n"
328 "buffer contains: 73\n"
329 "about to read buffer again...\n"
330 "Segmentation fault (core dumped)\n"
331
332 #. type: SS
333 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
334 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
335 #, no-wrap
336 msgid "Program source"
337 msgstr "مصدر البرنامج"
338
339 #. type: Plain text
340 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
341 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
342 #, no-wrap
343 msgid ""
344 "#define _GNU_SOURCE\n"
345 "#include E<lt>err.hE<gt>\n"
346 "#include E<lt>unistd.hE<gt>\n"
347 "#include E<lt>stdio.hE<gt>\n"
348 "#include E<lt>stdlib.hE<gt>\n"
349 "#include E<lt>sys/mman.hE<gt>\n"
350 "\\&\n"
351 "int\n"
352 "main(void)\n"
353 "{\n"
354 " int status;\n"
355 " int pkey;\n"
356 " int *buffer;\n"
357 "\\&\n"
358 " /*\n"
359 " * Allocate one page of memory.\n"
360 " */\n"
361 " buffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE,\n"
362 " MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);\n"
363 " if (buffer == MAP_FAILED)\n"
364 " err(EXIT_FAILURE, \"mmap\");\n"
365 "\\&\n"
366 " /*\n"
367 " * Put some random data into the page (still OK to touch).\n"
368 " */\n"
369 " *buffer = __LINE__;\n"
370 " printf(\"buffer contains: %d\\[rs]n\", *buffer);\n"
371 "\\&\n"
372 " /*\n"
373 " * Allocate a protection key:\n"
374 " */\n"
375 " pkey = pkey_alloc(0, 0);\n"
376 " if (pkey == -1)\n"
377 " err(EXIT_FAILURE, \"pkey_alloc\");\n"
378 "\\&\n"
379 " /*\n"
380 " * Disable access to any memory with \"pkey\" set,\n"
381 " * even though there is none right now.\n"
382 " */\n"
383 " status = pkey_set(pkey, PKEY_DISABLE_ACCESS);\n"
384 " if (status)\n"
385 " err(EXIT_FAILURE, \"pkey_set\");\n"
386 "\\&\n"
387 " /*\n"
388 " * Set the protection key on \"buffer\".\n"
389 " * Note that it is still read/write as far as mprotect() is\n"
390 " * concerned and the previous pkey_set() overrides it.\n"
391 " */\n"
392 " status = pkey_mprotect(buffer, getpagesize(),\n"
393 " PROT_READ | PROT_WRITE, pkey);\n"
394 " if (status == -1)\n"
395 " err(EXIT_FAILURE, \"pkey_mprotect\");\n"
396 "\\&\n"
397 " printf(\"about to read buffer again...\\[rs]n\");\n"
398 "\\&\n"
399 " /*\n"
400 " * This will crash, because we have disallowed access.\n"
401 " */\n"
402 " printf(\"buffer contains: %d\\[rs]n\", *buffer);\n"
403 "\\&\n"
404 " status = pkey_free(pkey);\n"
405 " if (status == -1)\n"
406 " err(EXIT_FAILURE, \"pkey_free\");\n"
407 "\\&\n"
408 " exit(EXIT_SUCCESS);\n"
409 "}\n"
410 msgstr ""
411 "#define _GNU_SOURCE\n"
412 "#include E<lt>err.hE<gt>\n"
413 "#include E<lt>unistd.hE<gt>\n"
414 "#include E<lt>stdio.hE<gt>\n"
415 "#include E<lt>stdlib.hE<gt>\n"
416 "#include E<lt>sys/mman.hE<gt>\n"
417 "\\&\n"
418 "int\n"
419 "main(void)\n"
420 "{\n"
421 " int status;\n"
422 " int pkey;\n"
423 " int *buffer;\n"
424 "\\&\n"
425 " /*\n"
426 " * Allocate one page of memory.\n"
427 " */\n"
428 " buffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE,\n"
429 " MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);\n"
430 " if (buffer == MAP_FAILED)\n"
431 " err(EXIT_FAILURE, \"mmap\");\n"
432 "\\&\n"
433 " /*\n"
434 " * Put some random data into the page (still OK to touch).\n"
435 " */\n"
436 " *buffer = __LINE__;\n"
437 " printf(\"buffer contains: %d\\[rs]n\", *buffer);\n"
438 "\\&\n"
439 " /*\n"
440 " * Allocate a protection key:\n"
441 " */\n"
442 " pkey = pkey_alloc(0, 0);\n"
443 " if (pkey == -1)\n"
444 " err(EXIT_FAILURE, \"pkey_alloc\");\n"
445 "\\&\n"
446 " /*\n"
447 " * Disable access to any memory with \"pkey\" set,\n"
448 " * even though there is none right now.\n"
449 " */\n"
450 " status = pkey_set(pkey, PKEY_DISABLE_ACCESS);\n"
451 " if (status)\n"
452 " err(EXIT_FAILURE, \"pkey_set\");\n"
453 "\\&\n"
454 " /*\n"
455 " * Set the protection key on \"buffer\".\n"
456 " * Note that it is still read/write as far as mprotect() is\n"
457 " * concerned and the previous pkey_set() overrides it.\n"
458 " */\n"
459 " status = pkey_mprotect(buffer, getpagesize(),\n"
460 " PROT_READ | PROT_WRITE, pkey);\n"
461 " if (status == -1)\n"
462 " err(EXIT_FAILURE, \"pkey_mprotect\");\n"
463 "\\&\n"
464 " printf(\"about to read buffer again...\\[rs]n\");\n"
465 "\\&\n"
466 " /*\n"
467 " * This will crash, because we have disallowed access.\n"
468 " */\n"
469 " printf(\"buffer contains: %d\\[rs]n\", *buffer);\n"
470 "\\&\n"
471 " status = pkey_free(pkey);\n"
472 " if (status == -1)\n"
473 " err(EXIT_FAILURE, \"pkey_free\");\n"
474 "\\&\n"
475 " exit(EXIT_SUCCESS);\n"
476 "}\n"
477
478 #. type: SH
479 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
480 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
481 #, no-wrap
482 msgid "SEE ALSO"
483 msgstr "انظر أيضًا"
484
485 #. type: Plain text
486 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
487 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
488 msgid "B<pkey_alloc>(2), B<pkey_free>(2), B<pkey_mprotect>(2), B<sigaction>(2)"
489 msgstr ""
490 "B<pkey_alloc>(2), B<pkey_free>(2), B<pkey_mprotect>(2), B<sigaction>(2)"
491
492 #. type: TH
493 #: debian-trixie fedora-44 fedora-rawhide
494 #, no-wrap
495 msgid "2024-06-15"
496 msgstr "15 يونيو 2024"
497
498 #. type: TH
499 #: debian-trixie
500 #, no-wrap
501 msgid "Linux man-pages 6.9.1"
502 msgstr "صفحات دليل لينكس 6.9.1"
503
504 #. type: TH
505 #: fedora-44 fedora-rawhide
506 #, no-wrap
507 msgid "Linux man-pages 6.13"
508 msgstr "صفحات دليل لينكس 6.13"
509
510 #. type: TH
511 #: mageia-cauldron
512 #, no-wrap
513 msgid "Linux man-pages 6.17"
514 msgstr "صفحات دليل لينكس 6.17"
515
516 #. type: TH
517 #: opensuse-leap-16-1 opensuse-tumbleweed
518 #, no-wrap
519 msgid "Linux man-pages (unreleased)"
520 msgstr "صفحات دليل لينكس (لم تصدر بعد)"