Skip to contentSkip to conversation

pkey.7: add description of signal handling behavior

PATCH In review Dave Hansen 2 participants 2 messages Oct 17, 2016 – Oct 18, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkey.7: add description of signal handling behavior

From: Dave Hansen <dave.hansen-VuQAYsv1563Yd54FQh9/[email protected]>

The signal behavior of pkeys is special compared to many other processor and OS features. Add a special section to describe the behavior.

This was previously a part of the pkey_get manpage, but that page was removed from my submission when we removed the syscall itself. I've essentially moved the content from that page to the main pkey.7 page.

---

 b/man7/pkeys.7 |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
man7/pkeys.7 renamed from man7/pkeys.7~pkey-signal-behavior +16 -0
diff -puN man7/pkeys.7~pkey-signal-behavior man7/pkeys.7
@@ -135,6 +135,22 @@ appropriate for child threads at the tim
 .BR clone (2)
 is called, or ensure that each child thread can perform its
 own initialization of protection key rights.
+
+.SS Signal Handler Behavior
+Each time a signal handler is invoked (including nested signals), the
+thread is temporarily given a new, default set of protection key rights
+that override the rights from the interrupted context.
+This means that applications must re-establish their desired protection
+key rights upon entering a signal handler if the desired rights differ
+from the defaults.
+The rights of any interrupted context are restored when the signal
+handler returns.
+
+This signal behavior is unusual and is due to the fact that the x86 PKRU
+register (which stores protection key access rights) is managed with the
+same hardware mechanism (XSAVE) that manages floating-point registers.
+The signal behavior is the same as that of floating point registers.
+
 .SS Protection Keys system calls
 The Linux kernel implements the following pkey-related system calls:
 .BR pkey_mprotect (2),

_

#1 lore raw

Hi Dave,

Quoted 10 lines · Dave Hansen

From: Dave Hansen <dave.hansen-VuQAYsv1563Yd54FQh9/[email protected]>

The signal behavior of pkeys is special compared to many other processor and OS features. Add a special section to describe the behavior.

This was previously a part of the pkey_get manpage, but that page was removed from my submission when we removed the syscall itself. I've essentially moved the content from that page to the main pkey.7 page.

Thank. Patch applied.

Cheers,

Michael

Quoted 35 lines

---

 b/man7/pkeys.7 |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff -puN man7/pkeys.7~pkey-signal-behavior man7/pkeys.7

man7/pkeys.7 renamed from man7/pkeys.7~pkey-signal-behavior +16 -0
@@ -135,6 +135,22 @@ appropriate for child threads at the tim
 .BR clone (2)
 is called, or ensure that each child thread can perform its
 own initialization of protection key rights.
+
+.SS Signal Handler Behavior
+Each time a signal handler is invoked (including nested signals), the
+thread is temporarily given a new, default set of protection key rights
+that override the rights from the interrupted context.
+This means that applications must re-establish their desired protection
+key rights upon entering a signal handler if the desired rights differ
+from the defaults.
+The rights of any interrupted context are restored when the signal
+handler returns.
+
+This signal behavior is unusual and is due to the fact that the x86 PKRU
+register (which stores protection key access rights) is managed with the
+same hardware mechanism (XSAVE) that manages floating-point registers.
+The signal behavior is the same as that of floating point registers.
+
 .SS Protection Keys system calls
 The Linux kernel implements the following pkey-related system calls:
 .BR pkey_mprotect (2),

_

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html