diff options
author | Jamie Liu <jamieliu@google.com> | 2019-04-08 16:31:06 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2019-04-08 16:32:11 -0700 |
commit | 9471c013483b0709479c51d470ac840621ae7d46 (patch) | |
tree | 651bfe7529c28e69320dbe1c9540250e103ba5db /pkg/sentry/kernel/signal.go | |
parent | 218a7b54494b263001ed791ca13857c12d37ded6 (diff) |
Export kernel.SignalInfoPriv.
Also add kernel.SignalInfoNoInfo, and use it in RLIMIT_FSIZE checks.
PiperOrigin-RevId: 242562428
Change-Id: I4887c0e1c8f5fddcabfe6d4281bf76d2f2eafe90
Diffstat (limited to 'pkg/sentry/kernel/signal.go')
-rw-r--r-- | pkg/sentry/kernel/signal.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/signal.go b/pkg/sentry/kernel/signal.go index b066df132..22a56c6fc 100644 --- a/pkg/sentry/kernel/signal.go +++ b/pkg/sentry/kernel/signal.go @@ -56,11 +56,21 @@ func (k *Kernel) sendExternalSignal(info *arch.SignalInfo, context string) { } } -// sigPriv returns a SignalInfo representing a signal sent by the sentry. (The -// name reflects its equivalence to Linux's SEND_SIG_PRIV.) -func sigPriv(sig linux.Signal) *arch.SignalInfo { +// SignalInfoPriv returns a SignalInfo equivalent to Linux's SEND_SIG_PRIV. +func SignalInfoPriv(sig linux.Signal) *arch.SignalInfo { return &arch.SignalInfo{ Signo: int32(sig), Code: arch.SignalInfoKernel, } } + +// SignalInfoNoInfo returns a SignalInfo equivalent to Linux's SEND_SIG_NOINFO. +func SignalInfoNoInfo(sig linux.Signal, sender, receiver *Task) *arch.SignalInfo { + info := &arch.SignalInfo{ + Signo: int32(sig), + Code: arch.SignalInfoUser, + } + info.SetPid(int32(receiver.tg.pidns.IDOfThreadGroup(sender.tg))) + info.SetUid(int32(sender.Credentials().RealKUID.In(receiver.UserNamespace()).OrOverflow())) + return info +} |