From 05f88d6490de76aaa54c85f6e23a27fe54dbb312 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Mon, 27 Mar 2023 18:02:42 -0700 Subject: [PATCH] systrap: enabled the context decoupling feature by default PiperOrigin-RevId: 519880828 --- pkg/sentry/platform/systrap/context_decoupling_disable.go | 4 ++-- pkg/sentry/platform/systrap/context_decoupling_enable.go | 4 ++-- pkg/sentry/platform/systrap/subprocess.go | 1 + pkg/sentry/platform/systrap/systrap.go | 2 -- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/sentry/platform/systrap/context_decoupling_disable.go b/pkg/sentry/platform/systrap/context_decoupling_disable.go index 51371fa8d..63433fe2c 100644 --- a/pkg/sentry/platform/systrap/context_decoupling_disable.go +++ b/pkg/sentry/platform/systrap/context_decoupling_disable.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !context_decoupling -// +build !context_decoupling +//go:build context_decoupling_disabled +// +build context_decoupling_disabled package systrap diff --git a/pkg/sentry/platform/systrap/context_decoupling_enable.go b/pkg/sentry/platform/systrap/context_decoupling_enable.go index ab4ab8ae5..f8ee2ba87 100644 --- a/pkg/sentry/platform/systrap/context_decoupling_enable.go +++ b/pkg/sentry/platform/systrap/context_decoupling_enable.go @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build context_decoupling -// +build context_decoupling +//go:build !context_decoupling_disabled +// +build !context_decoupling_disabled package systrap diff --git a/pkg/sentry/platform/systrap/subprocess.go b/pkg/sentry/platform/systrap/subprocess.go index 25ed62345..7693b868f 100644 --- a/pkg/sentry/platform/systrap/subprocess.go +++ b/pkg/sentry/platform/systrap/subprocess.go @@ -764,6 +764,7 @@ func (s *subprocess) switchToApp(c *context, ac *arch.Context64) (isSyscall bool // Copy register state locally. regs.PtraceRegs = ctx.shared.Regs retrieveArchSpecificState(ctx.shared, ac) + c.needToPullFullState = true // We have a signal. We verify however, that the signal was // either delivered from the kernel or from this process. We // don't respect other signals. diff --git a/pkg/sentry/platform/systrap/systrap.go b/pkg/sentry/platform/systrap/systrap.go index 28d8070a8..4c4a9018a 100644 --- a/pkg/sentry/platform/systrap/systrap.go +++ b/pkg/sentry/platform/systrap/systrap.go @@ -170,8 +170,6 @@ func (c *context) FullStateChanged() { // Switch runs the provided context in the given address space. func (c *context) Switch(ctx pkgcontext.Context, mm platform.MemoryManager, ac *arch.Context64, cpu int32) (*linux.SignalInfo, hostarch.AccessType, error) { - c.needToPullFullState = true - as := mm.AddressSpace() s := as.(*subprocess) if err := s.activateContext(c); err != nil {