summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorBin Lu <bin.lu@arm.com>2020-02-11 02:55:51 -0500
committerBin Lu <bin.lu@arm.com>2020-03-31 22:53:15 -0400
commit5eb41c8fbabac090251fbfb43bd9c814124aa575 (patch)
tree45bd60e0604b0d305759906e5b0b63386f6ea88a /pkg/sentry/kernel
parent0dd9ee0d1e08d4207f78ab032a5fde171343c4b4 (diff)
Arm64 signal#2: signal support in arch module
SA_RESTORER is always used on Intel platform. But this flag is optional on other platforms. The vdso is enabled, so we can use the sigreturn trampolines the vdso provides instead on Arm platform. Signed-off-by: Bin Lu <bin.lu@arm.com>
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r--pkg/sentry/kernel/task_signals.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_signals.go b/pkg/sentry/kernel/task_signals.go
index 8802db142..0e74236c9 100644
--- a/pkg/sentry/kernel/task_signals.go
+++ b/pkg/sentry/kernel/task_signals.go
@@ -263,6 +263,19 @@ func (t *Task) deliverSignalToHandler(info *arch.SignalInfo, act arch.SignalAct)
if t.haveSavedSignalMask {
mask = t.savedSignalMask
}
+
+ // Set up the restorer.
+ // x86-64 should always uses SA_RESTORER, but this flag is optional on other platforms.
+ // Please see the linux code as reference:
+ // linux/arch/x86/kernel/signal.c:__setup_rt_frame()
+ // If SA_RESTORER is not configured, we can use the sigreturn trampolines
+ // the vdso provides instead.
+ // Please see the linux code as reference:
+ // linux/arch/arm64/kernel/signal.c:setup_return()
+ if act.Flags&linux.SA_RESTORER == 0 {
+ act.Restorer = t.MemoryManager().VDSOSigReturn()
+ }
+
if err := t.Arch().SignalSetup(st, &act, info, &alt, mask); err != nil {
return err
}