mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Merge pull request #9406 from avagin:systrap-pdeathsig
PiperOrigin-RevId: 567339130
This commit is contained in:
@@ -228,6 +228,20 @@ func (s *subprocess) handlePtraceSyscallRequest(req any) {
|
||||
panic(fmt.Sprintf("error waiting for new clone: expected SIGSTOP, got %v", sig))
|
||||
}
|
||||
|
||||
t.initRegs = ptraceThread.initRegs
|
||||
// Set the parent death signal to SIGKILL.
|
||||
_, err = t.syscallIgnoreInterrupt(&t.initRegs, unix.SYS_PRCTL,
|
||||
arch.SyscallArgument{Value: linux.PR_SET_PDEATHSIG},
|
||||
arch.SyscallArgument{Value: uintptr(unix.SIGKILL)},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("prctl: %v", err))
|
||||
}
|
||||
|
||||
id, ok := s.sysmsgStackPool.Get()
|
||||
if !ok {
|
||||
panic("unable to allocate a sysmsg stub thread")
|
||||
@@ -240,7 +254,6 @@ func (s *subprocess) handlePtraceSyscallRequest(req any) {
|
||||
|
||||
// Detach the thread.
|
||||
t.detach()
|
||||
t.initRegs = ptraceThread.initRegs
|
||||
|
||||
// Return the thread.
|
||||
r.thread <- t
|
||||
|
||||
@@ -39,20 +39,6 @@ func (p *sysmsgThread) setMsg(addr uintptr) {
|
||||
|
||||
func (p *sysmsgThread) init(sentryAddr, guestAddr uintptr) {
|
||||
t := p.thread
|
||||
|
||||
// Set the parent death signal to SIGKILL.
|
||||
_, err := t.syscallIgnoreInterrupt(&t.initRegs, unix.SYS_PRCTL,
|
||||
arch.SyscallArgument{Value: linux.PR_SET_PDEATHSIG},
|
||||
arch.SyscallArgument{Value: uintptr(unix.SIGKILL)},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("prctl: %v", err))
|
||||
}
|
||||
|
||||
// Set the sysmsg signal stack.
|
||||
//
|
||||
// sentryAddr is from the stub mapping which is mapped once and never
|
||||
@@ -61,7 +47,7 @@ func (p *sysmsgThread) init(sentryAddr, guestAddr uintptr) {
|
||||
*alt = linux.SignalStack{}
|
||||
alt.Addr = uint64(guestAddr)
|
||||
alt.Size = uint64(sysmsg.MsgOffsetFromSharedStack)
|
||||
_, err = t.syscallIgnoreInterrupt(&t.initRegs, unix.SYS_SIGALTSTACK,
|
||||
_, err := t.syscallIgnoreInterrupt(&t.initRegs, unix.SYS_SIGALTSTACK,
|
||||
arch.SyscallArgument{Value: guestAddr},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
arch.SyscallArgument{Value: 0},
|
||||
|
||||
Reference in New Issue
Block a user