Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev.unified] all: merge master (462b78f) into dev.unified
Merge List: + 2022-07-27 462b78f misc/cgo/test: use fewer threads in TestSetgidStress in long mode + 2022-07-27 055113e math/big: check buffer lengths in GobDecode + 2022-07-27 4248146 net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more + 2022-07-26 faf4e97 net: fix WriteMsgUDPAddrPort addr handling + 2022-07-26 caa225d doc/go1.19: note that updated race syso files require GNU ld 2.26 + 2022-07-26 ceefd3a bytes: document that Reader.Reset affects the result of Size + 2022-07-26 3e97294 runtime/cgo: use frame address to set g0 stack bound + 2022-07-25 24dc27a cmd/compile: fix blank label code + 2022-07-25 9fcc8b2 runtime: fix runtime.Breakpoint() on windows/arm64 + 2022-07-25 795a88d cmd/go: add space after comma in 'go help test' + 2022-07-25 9eb3992 doc/go1.19: minor fixes + 2022-07-25 dcea1ee time: clarify documentation for allowed formats and add tests to prove them + 2022-07-25 37c8112 internal/fuzz: fix typo in function comments + 2022-07-25 850d547 doc/go1.19: expand crypto release notes + 2022-07-24 64f2829 runtime: fix typo in function comments + 2022-07-24 2ff563a cmd/compile/internal/noder: correct spelling errors for instantiation + 2022-07-22 c5da4fb cmd/compile: make jump table symbol local + 2022-07-22 774fa58 A+C: delete AUTHORS and CONTRIBUTORS + 2022-07-21 2d655fb unsafe: document when Sizeof/Offsetof/Alignof are not constant + 2022-07-21 076c3d7 net/http: remove accidental heading in Head documentation + 2022-07-21 c4a6d30 cmd/dist: enable race detector test on S390X + 2022-07-20 244c8b0 cmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30 + 2022-07-20 df38614 test: use go tool from tree, not path + 2022-07-20 bb1749b cmd/compile: improve GOAMD64=v1 violation test + 2022-07-19 176b63e crypto/internal/nistec,debug/gosym: fix typos Change-Id: I96e5d60039381691dffd841e58927f0afff8c544
- Loading branch information
Showing
36 changed files
with
389 additions
and
4,536 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2022 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. | ||
|
||
// Issue 53989: the use of jump table caused a function | ||
// from the plugin jumps in the middle of the function | ||
// to the function with the same name in the main | ||
// executable. As these two functions may be compiled | ||
// differently as plugin needs to be PIC, this causes | ||
// crash. | ||
|
||
package main | ||
|
||
import ( | ||
"plugin" | ||
|
||
"testplugin/issue53989/p" | ||
) | ||
|
||
func main() { | ||
p.Square(7) // call the function in main executable | ||
|
||
p, err := plugin.Open("issue53989.so") | ||
if err != nil { | ||
panic(err) | ||
} | ||
f, err := p.Lookup("Square") | ||
if err != nil { | ||
panic(err) | ||
} | ||
f.(func(int))(7) // call the plugin one | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2022 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. | ||
|
||
package p | ||
|
||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
var y int | ||
|
||
//go:noinline | ||
func Square(x int) { | ||
var pc0, pc1 [1]uintptr | ||
runtime.Callers(1, pc0[:]) // get PC at entry | ||
|
||
// a switch using jump table | ||
switch x { | ||
case 1: | ||
y = 1 | ||
case 2: | ||
y = 4 | ||
case 3: | ||
y = 9 | ||
case 4: | ||
y = 16 | ||
case 5: | ||
y = 25 | ||
case 6: | ||
y = 36 | ||
case 7: | ||
y = 49 | ||
case 8: | ||
y = 64 | ||
default: | ||
panic("too large") | ||
} | ||
|
||
// check PC is in the same function | ||
runtime.Callers(1, pc1[:]) | ||
if pc1[0] < pc0[0] || pc1[0] > pc0[0]+1000000 { | ||
fmt.Printf("jump across DSO boundary. pc0=%x, pc1=%x\n", pc0[0], pc1[0]) | ||
panic("FAIL") | ||
} | ||
|
||
if y != x*x { | ||
fmt.Printf("x=%d y=%d!=%d\n", x, y, x*x) | ||
panic("FAIL") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2022 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. | ||
|
||
package main | ||
|
||
import "testplugin/issue53989/p" | ||
|
||
func Square(x int) { // export Square for plugin | ||
p.Square(x) | ||
} | ||
|
||
func main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.