mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
github.com/google/gvisor/pull/14531 exposed a race window with stub threads setting ThreadID and the sentry reading it. If the sentry attempted to interrupt a stub that in the process of switching a context back, it could have read an invalid thread ID along with a context state that indicated it was still being worked on. This window has existed before #14531, but was relatively benign; with that CL, the window became punishable by subprocess death. The (mostly generated) test seems to reliably test the race-window in case things get reordered in some future refactor. Fixes #14531. PiperOrigin-RevId: 974868738
27 lines
913 B
Go
27 lines
913 B
Go
// Copyright 2026 The gVisor Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//go:build arm64
|
|
// +build arm64
|
|
|
|
// Package testutil provides common test utilities for systrap.
|
|
package testutil
|
|
|
|
// UserCode is the user program: for (;;) getpid();
|
|
var UserCode = []byte{
|
|
0x88, 0x15, 0x80, 0xd2, // mov x8, #172 (SYS_getpid)
|
|
0x01, 0x00, 0x00, 0xd4, // svc #0
|
|
0xfe, 0xff, 0xff, 0x17, // b .-8
|
|
}
|