| Age | Commit message (Collapse) | Author |
|
|
|
Change-Id: Ibff8e7a08090d67d9a0625dee068c8d2eefbd190
GitHub-Last-Rev: b90b986121314615cf5d259d76a7be59303de1b0
GitHub-Pull-Request: golang/go#78630
Reviewed-on: https://go-review.googlesource.com/c/go/+/765480
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
On AIX, libInit passes a function descriptor instead of the function
pointer to pthread_create. This is a regression from CL 706417.
Change-Id: I660175eb992a41ef61b1927c51392887a724cd76
Reviewed-on: https://go-review.googlesource.com/c/go/+/761780
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
We can use SP instead of FP for the single thing this was used for
(finding the gopanic frame).
Change-Id: Iad2b406705abc3cdb0dbcdd069f7f9a330509164
Reviewed-on: https://go-review.googlesource.com/c/go/+/738042
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Currently, all Op implementations on loong64 do not modify the FCSR
(floating point control status register), but users can modify the
FCSR for special floating point computing needs.
FCSR is also saved and restored in the fpu context of the Linux kernel [1].
[1]: https://github.com/torvalds/linux/blob/master/arch/loongarch/kernel/fpu.S#L565C1-L566C1
Change-Id: I776e72dfcc1f027bfe8d22aa2eae453100a6ee1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/761720
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
The nsec field of timespec is a C long even when using
64bits time on 32bits systems.
This is because by timespec API if nsec never holds more than a
second worth of nanoseconds.
If it would theses would increment the sec field while the nsec
field would get the amount of nanoseconds modulus a second.
Fixes #77934
Change-Id: I9803998ba70123eb3b226379bd72b11cae972c38
Reviewed-on: https://go-review.googlesource.com/c/go/+/751341
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
This is inspired by CL 724560 by Bobby Powers, particularly their great
commit message.
When using address sanitizer with leak detection, sysReserve registers
memory regions with LSAN via lsanregisterrootregion. However, several
code paths release this memory using sysFreeOS without first
unregistering from LSAN. This leaves LSAN with stale root region entries
pointing to memory that has been unmapped and may be reallocated for
other purposes.
This bug was latent until glibc 2.42, which changed pthread stack guard
pages from mprotect(PROT_NONE) to madvise(MADV_GUARD_INSTALL). The
difference matters because LSAN filters root region scanning by
intersecting registered regions with readable mappings from
/proc/self/maps:
- mprotect(PROT_NONE) splits the VMA, creating a separate entry with
---p permissions. LSAN's IsReadable() check excludes it from scanning.
- MADV_GUARD_INSTALL operates at the page table level without modifying
the VMA. The region still appears as rw-p in /proc/self/maps, so LSAN
includes it in the scan and crashes with SIGSEGV when accessing the
guard pages.
Address this by adding sysUnreserve to undo sysReserve. sysUnreserve
unregisters the region from LSAN and frees the mapping.
With the addition of sysUnreserve, we have complete coverage of LSAN
unregister in the mem.go abstract: sysFree unregisters Ready memory.
sysUnreserve unregisters Reserved memory. And there is no way to free
Prepared memory at all (it must transition to Ready or Reserved first).
The implementation of lsanunregisterrootregion [1] finds the region by
exact match of start and end address. It therefore does not support
splitting a region, and we must extend this requirement to sysUnreserve
and sysFree. I am not completely confident that we always pass the full
region to sysFree, but LSAN aborts if it can't find the region, so we
must not be blatantly violating this.
sysReserveAligned does need to unreserve a subset of a region, so it
cannot use sysUnreserve directly. Rather than breaking the mem.go
abstract, move sysReserveAligned into mem.go, adding it to the
abstraction.
We should not have any calls to sysFreeOS outside of the mem.go
abstraction. That is now true with this CL.
Fixes #74476.
[1] https://github.com/llvm/llvm-project/blob/3e3e362648fa062038b90ccc21f46a09d6902288/compiler-rt/lib/lsan/lsan_common.cpp#L1157
Change-Id: I8c46a62154b2f23456ffd5086a7b91156a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/762381
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
sysFree decrements mappedReady since CL 393402, meaning it can only be
used on Ready memory, not any memory as stated.
The example uses are not relevant as those cases would not necessarily
be Ready memory. The no-op note is meant to be relevant to
sysReserveAligned, but that doesn't use sysFree anyway.
Change-Id: I3aeb0e703b0a57202a01317e0904cd966a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/762380
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
|
For Go symbols accessed from other package via linkname or
assembly, we have an export linkname from the definition side. We
currently don't always have the linkname directive for assembly
functions, for which external accesses are allowed. We may want
to tighten up the restriction. So add export linknames for the ones
that are needed.
Change-Id: If664634c81580edd49086d916024f23f86871092
Reviewed-on: https://go-review.googlesource.com/c/go/+/749981
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
libInit runs before rt0_go, which is where TLS setup occurs. Thus the
contents of the TLS may not be defined, so the g lookup in asmcgocall is
not safe.
Concretely, android-386 c-shared builds crash without this change
because asmcgocall reads an invalid non-zero g from the TLS.
Move libInit to a file limited to GOARCH that support c-archive or
c-shared so that only those require asmcgocall_no_g. In addition,
loong64 and s390x need asmcgocall_no_g implementations.
Fixes #78480.
Cq-Include-Trybots: luci.golang.try:gotip-linux-loong64,gotip-linux-s390x
Change-Id: I175e6d020339af89c9b576535d79c1e76a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/761541
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Change-Id: Icc89533e4cfc737bfee8b0c7a72006bdc79746c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/762280
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Often we want to run _mkmalloc using a different toolchain. The
previous module path runtime/_mkmalloc would produce an ambiguous import
path error because the directory runtime/_mkmalloc exists in a Go 1.26+
toolchain. Rename the module to avoid the conflict.
Change-Id: Id73a3ca102081d8b51da58879aee851b6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/761880
Reviewed-by: Michael Matloob <matloob@google.com>
Auto-Submit: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
In runtime/secret's TestCore, it copies some files from the
runtime/secret package to a test main package, including assembly
files. The assembly function references a stub function in Go,
which is also copied. Make it reference the copied one, not the
original one, to avoid cross-package assembly references.
We may want to rewrite the test to avoid copy, e.g. including the
test functions in the test binary itself and having the test
run itself in a subprocess. Leave that for later.
Change-Id: I5187edcc41d1d0469fc6b1b5f2acc60df37e5c1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/761520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
In the standard library, there are a number of linknames, for
sharing symbols within the standard library. They are not supposed
to be accessed externally. But currently there is no good
mechanism to prevent that. In the linker we have a blocklist of
linknames, which forbids linkname references other than explicitly
allowed packages. The blocklist is manually maintained, requiring
periodic manual update.
To move away from that manually maintained blocklist, this CL
introduces a new directive, linknamestd, that marks a linkname
for use within the standard library only. The linker will allow
references within the standard library and forbid others.
For a proof of concept, runtime.coroswitch is removed from the
blocklist, and replaced with linknamestd. An external reference to
it is still disallowed by the linker, as tested with
cmd/link.TestCheckLinkname with testdata/linkname/coro.go.
Change-Id: I0d0f8746b8835d8cdcfc3ff835d22a551da5f038
Reviewed-on: https://go-review.googlesource.com/c/go/+/749942
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
|
|
The misc/ios exec wrapper doesn't support lldb since https://go.dev/cl/573175.
This means that the SIGSEGV emulation code in the cgo signal handling on
iOS is no longer needed, and can be removed.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64_26
Change-Id: I39827cb20756e4730352d87cb3514bb6a3f1cee8
Reviewed-on: https://go-review.googlesource.com/c/go/+/756800
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
A curious bug was reported to kubernetes[1] and runc[2] recently:
sometimes runc init reports exit status of 2.
Turns out, Go runtime assumes that on any UNIX system signals such as
SIGTERM (or any other that has _sigKill flag set in sigtable) with no
signal handler set up, will result in kernel terminating the program.
This is true, except for PID 1 which gets a custom treatment from the
kernel.
As a result, when a Go program that runs as PID 1 (which is easy to
achieve in Linux by using a new PID namespace) receives such a signal,
Go runtime calls dieFromSignal which falls through all the way to
exit(2), which is very confusing to a user.
This issue can be worked around by the program by adding custom handlers
for SIGTERM/SIGINT/SIGHUP, but that requires a goroutine to handle those
signals, which, in case of runc, unnecessarily raises its NPROC/pid.max
requirement (see discussion at [2]).
Since practically exit(2) in dieFromSignal can only happen when the
process is running as PID 1, replace it with exit(128+sig) to mimic
the shell convention when a child is terminated by a signal.
Add a test case which demonstrates the issue and validates the fix
(albeit only on Linux).
[An earlier version of this patch used to do nothing in dieFromSignal
for PID 1 case, but such behavior might be a breaking change for a Go
program running in a Linux container as PID 1.]
Fixes #78442
[1]: https://github.com/kubernetes/kubernetes/issues/135713
[2]: https://github.com/opencontainers/runc/pull/5189
Change-Id: I196e09e4b5ce84ce2c747a0c2d1fc6e9cf3a6131
Reviewed-on: https://go-review.googlesource.com/c/go/+/759040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
We were depending on runtime.etypes immediately following the itabs.
However, on AIX, runtime.etypes, as a zero-sized symbol, can float
when using external linking. It won't necessarily stay right at the
end of the itabs. Rather than worry about this, just record the size
of the itab data.
In practice it almost always works on AIX, but it fails the runtime
test TestSchedPauseMetrics/runtime/debug.WriteHeapDump,
which fails when iterating over all the itabs.
Tested on AIX. This should fix AIX on the build dashboard.
Change-Id: Id3a113b75b93fa8440c047e92f764ab81423df48
Reviewed-on: https://go-review.googlesource.com/c/go/+/760203
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
|
|
We have only seen the wrappersym case reported in the opposite order in
practice, but since these are intentionally racy, they could
theoretically all occur in the opposite order.
It would be nice to have a bit more structure to these tests so the test
itself could easily flip the order. However, since they are just regular
expressions, for now I've simply listed both orders.
Fixes #78394.
Change-Id: I92e04127f275c2394a12d63d2f2a3ce56a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/761161
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
The function is no longer defined since CL 40331. Remove its prototype
from libcgo_unix.h as well.
Change-Id: I155ca632cd61bddcd798def691856c04b03040d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/760163
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
|
|
The memProfCycle struct holds allocation counts and bytes allocated, and
frees and bytes freed. But the memory profile records are already
aggregated by allocation size, which is stored in the "size" field of
the bucket struct. We can derive the bytes allocated/freed using the
counts and the size we already store. Thus we can delete the bytes
fields from memProfCycle, saving 64 bytes per memRecord.
We can do something similar for the profilerecord.MemProfileRecord type.
We just need to know the object size and we can derive the allocated and
freed bytes accordingly.
Change-Id: I103885c2f29471b25283e330674fc16d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/760140
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
For #78394.
Change-Id: I4ef1a299f37e2b6532e2008378aca3aa6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/760308
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
|
|
Change reflect to call a new function to get the compiled type descriptors,
returning the type pointers directly rather than the type offsets.
We have to keep the existing reflect.typelinks for third party
packages that break the rules and call it directly using linkname.
Change-Id: I476efb6bd7836a7a5f396c97bbe4b2c1a2428990
Reviewed-on: https://go-review.googlesource.com/c/go/+/729502
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Antonio Camacho <antoniocho444@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
|
|
traceStringTable.put inserted the full user-supplied string into the
trace map, then only truncated it to MaxEventTrailerDataSize (1024
bytes) when writing to the trace buffer. If the string exceeded the
traceRegionAlloc block size (~64KB), this caused a fatal
"traceRegion: alloc too large" crash.
Move the truncation to the top of put, before the map insertion, so
that the map key, map entry, and written output are all consistent
and bounded.
The existing truncation in writeString is retained: the emit method
also calls writeString without going through the map, so writeString
still needs its own guard.
TestStartRegionLongString reproduces the crash before the fix.
Observed in production at CockroachDB: Stopper.RunTask passes
singleflight keys (up to ~450KB) as trace region names via
trace.StartRegion. See:
https://github.com/cockroachdb/cockroach/pull/166669 for context
on the trigger.
Change-Id: I95d0b2f0bd2e806840b83a0b675ce6d2f0e2c2c5
GitHub-Last-Rev: 3c53061685d5237f9f2fc4522fce6d774776fede
GitHub-Pull-Request: golang/go#78348
Reviewed-on: https://go-review.googlesource.com/c/go/+/759140
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Instead of keeping a separate list of pointers to itabs,
just walk through the itabs themselves.
For #6853
Change-Id: If030bd64fbd01d73b0bf8495f6c9826ed2e61568
Reviewed-on: https://go-review.googlesource.com/c/go/+/729201
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
Updates #60641
Change-Id: I0340a561690a2b45e27a82dc15479b846a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/754400
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
The previous fallback-on-ENOSYS logic causes issues on forks of Linux.
Android: #77621 (CL 750040 added a workaround with a TODO,
this fixes that TODO)
Causes the OS to terminate the program when running on Android
versions <=10 since the seccomp jail does not know about the 64-bit
time syscall and is configured to terminate the program on any
unknown syscall.
Synology's Linux: #77930
On old versions of Synology's Linux they added custom vendor syscalls
without adding a gap in the syscall numbers, that means when we call
the newer Linux syscall which was added later, Synology's Linux
interprets it as a completely different vendor syscall.
Originally by Jorropo in CL 751340.
Fixes #77930
Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
Change-Id: I90e15495d9249fd7f6e112f9e3ae8ad1322f56e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/758902
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
asmstdcall now returns the 32-bit Windows error code in the return
register. cgocall captures this as a signed int32. On 64-bit systems,
casting this directly to uintptr results in sign extension for error
codes with the high bit set (e.g., 0x80092004 becomes
0xffffffff80092004), breaking equality checks against zero-extended
constants.
This CL ensures the error code is zero-extended by casting to uint32
before converting to uintptr.
Fixes #78324
Change-Id: Ia75fe32965ccc7fb836f7caff8bbb8575af11e2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/758800
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
|
Map groups are currently:
type group struct {
ctrl uint64
slots [8]slot
}
type slot struct {
key K
elem E
}
If the element type is struct{}, the slot will be padded so that the
address of the elem is unique rather than pointing outside the alloc.
This has the effect of map[K]struct{} wasting space due to the extra
byte and padding, making it no better than map[K]bool.
This CL changes the group layout to instead place keys and elems
together, as they used to be before swiss maps:
type group struct {
ctrl uint64
keys [8]K
elems [8]V
}
This is an alternative to CL 701976, which I suspect will have better
performance. Keys placed together should lead to better cache behavior,
at the cost of more expensive elem lookups, since the elems are not a
fixed offset from their keys.
This change is locked behind GOEXPERIMENT=mapsplitgroup.
Updates #70835
Updates #71368
Change-Id: Ide8d1406ae4ab636f86edc40e0640cc80653197c
Reviewed-on: https://go-review.googlesource.com/c/go/+/711560
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
|
The minimum Windows version has been 10 for a few releases, but the PE
headers weren't updated. Windows sometimes can use these in determining
what kind of subsystem compatibility hacks to apply, which of course we
don't want now, since Go targets Windows 10. This also causes older OSes
to refuse to run the executables, rather than having them crash in some
undefined way.
This isn't trivial to do, because subsystem ≥ 10.0 means that the
Windows loader expects to see either _load_config_used.SecurityCookie
set to the initial magic value, or for IMAGE_GUARD_SECURITY_COOKIE_UNUSED
to be set. Go obviously isn't making use of these features, and neither
does clang/gcc for that matter; libssp doesn't even use SecurityCookie.
Rather, it's exclusively for MSVC's /GS protection. So it seems like the
proper thing to do is signal to the OS that it doesn't need to
initialize SecurityCookie. This check lives in ntdll!LdrInitSecurityCookie.
So, add the _load_config_used structure to the right PE section and give
it the right flag. This lets the Windows 10-marked binaries actually
run.
Change-Id: I91887073c7ad01aeb0237906aafa4ea5574ac8fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/756680
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Getting errno from assembly code is cheap. There is no need to
overcomplicate syscall_rawsyscalln to get errno from the cached errno
address pointer stored in the M struct.
This also better aligns syscallN_trampoline with the cgocall convention
of returning the error code as a return value.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_15,gotip-darwin-arm64_26
Change-Id: I05d5177e7c1471942e8ecafb4fb05594b4b18e2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/753540
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
Upstream TSAN had bug that could result in use of uninitialized memory
on Go threads that don't have any TSAN events. For example, if the
thread only ever runs the GC.
This bug was fixed upstream in
https://github.com/llvm/llvm-project/commit/cdfdb06c9155080ec97d6e4f4dd90b6e7cefb0ca.
In https://go.dev/issue/78059 we have reports of actual Go crashes due
to this bug.
Update the prebuilt race sysos to incorporate this fix. The fix is
applied as a single patch on top of the existing LLVM revisions to
minimize risk of this CL, making it safe to backport. A later CL can
update to a newer version of LLVM.
Note that all of the patch files are identical. CL 756620 makes
racebuild add a unique patch file for each architecture in the event
that some arches need distinct patches.
linux-loong64 failed race.bash when building the new syso, though they
were just timeouts, perhaps from a slow builder.
linux-riscv64 is not updated because its builder is too slow
(https://go.dev/issue/78258).
linux-ppc64le is not updated because its builder is missing curl
(https://go.dev/issue/78210).
openbsd-amd64 is not updated because its builder is missing unzip
(https://go.dev/issue/78212).
netbsd-amd64 is not updated because it does not have a LUCI builder
(https://go.dev/issue/61121).
Fixes #78059.
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-race,gotip-darwin-arm64-race,gotip-darwin-amd64-race,gotip-freebsd-amd64-race,gotip-windows-amd64-race,gotip-linux-s390x-race,gotip-linux-arm64-race,gotip-linux-loong64
Change-Id: I5404cb88af9d86b56b385801f8a9ed106a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/757521
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Pratt <mpratt@google.com>
|
|
clears"
This reverts CL 750480.
Reason: Adding preemptible memclrNoHeapPointers exposes existing unsafe
use of notInHeapSlice, causing crashes. Revert the memclr stack until
the underlying issue is fixed.
We keep the test added in CL 755942, which is useful regardless.
For #78254.
Change-Id: I8be3f9a20292b7f294e98e74e5a86c6a204406ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/757343
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
|
|
This reverts CL 756122.
Reason: Adding preemptible memclrNoHeapPointers exposes existing unsafe
use of notInHeapSlice, causing crashes. Revert the memclr stack until
the underlying issue is fixed.
For #78254.
Change-Id: I8a234d1a6dddf70d9aa5ecda1ac8bb25deb08248
Reviewed-on: https://go-review.googlesource.com/c/go/+/757342
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
|
|
SyscallN already supports more than 42 arguments on 386 and arm64.
Lift that limit on amd64 as well.
Change-Id: I3f5c6ebb959aa9b0d367903cac119fc27cb93064
Reviewed-on: https://go-review.googlesource.com/c/go/+/751862
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
|
This shaves off 8 bytes from the syscall_syscalln stack frame, which is
significant as that call path is almost over the nosplit limit.
Also, it follows the cgocall convention of returning the error code as
a return value, making it easier to reason about.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64,gotip-windows-386
Change-Id: I62acdb7c0d4cf9cb928bf3974d3300dd752f6c29
Reviewed-on: https://go-review.googlesource.com/c/go/+/751861
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Windows doesn't require any special handling for cgo threads. They
can be created in the same way as in non-cgo code.
In fact, the code to create threads in runtime and in runtime/cgo is
basically the same, except that the latter does some retries on failure.
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race,gotip-windows-arm64
Change-Id: I49d4de93d4d3b07a4c89e2bfb6b7302c6dfb9877
Reviewed-on: https://go-review.googlesource.com/c/go/+/746300
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
All architectures supporting c-shared and c-archive share the same
initialization code in assembly, and most of it can be implemented in
pure Go.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-linux-ppc64le_power10,gotip-linux-riscv64,gotip-linux-loong64,gotip-linux-s390x
Change-Id: Iaa9fb7d6f9ca8785f1098461646d607ef6b00d47
Reviewed-on: https://go-review.googlesource.com/c/go/+/706417
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
|
Being able to call asmcgocall without a G is useful for code shared
between different stages of the runtime initialization and thread
creation.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64_15,gotip-linux-mips64le,gotip-linux-ppc64le_power10,gotip-linux-riscv64,gotip-openbsd-ppc64,gotip-openbsd-amd64
Change-Id: Ic427764de197e648e8b9987c98c3b7521512cc5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/750541
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
|
|
memclrNoHeapPointersChunked was originally written for
clearing fresh allocations. It converts to uintptr early and thus
doesn't handle the case where the pointer points to the stack.
At the preemption point, the buffer being pointed to might be
on the stack and copied to a new location. Then we'd end up
zeroing random heap memory when we return from preemption.
Fix it to keep the pointer to the allocation in an unsafe.Pointer,
so it gets updated correctly on a stack copy.
Update #78081
(Fixes?)
Change-Id: Id25c7faf45f201929cb8c8bbcc7c8bd4f67c31ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/756122
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Add a comment to the void* example in the Handle documentation
highlighting that if the C code keeps the pointer after the call
returns, runtime.Pinner should be used to pin it.
The existing documentation already mentions this requirement in prose
(lines 69-73), but adding a comment directly in the example makes it
more visible and less likely to be missed when copying the example.
Fixes #68044
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change-Id: I20a5b1ad10de1b441980dc7ed3185720e77912bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/741443
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Solaris
The -lsocket and -lxnet flags are needed for accept4 syscall on Solaris.
The runtime/cgo package doens't use them, so it doesn't make sense for
it to explicitly link against those libraries.
Instead, use the //go:cgo_ldflag in the syscall package.
Cq-Include-Trybots: luci.golang.try:gotip-solaris-amd64
Change-Id: I10db524ebf1c720a460515d8c1f362b0070bd771
Reviewed-on: https://go-review.googlesource.com/c/go/+/751760
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
|
|
https://go.dev/cl/742580 updated the goroutine label format in
tracebacks to only quote the values under some circumstances, and use a
more broadly acceptable format. Flip the GODEBUG=tracebacklabels default
for go 1.27+ modules.
Notably, tracebacklabels is marked as Opaque to avoid some diciness in
maintaining a usage metric in signal handlers, etc. (where mutex
acquisition may be problematic)
Also, update the go 1.27 release notes to call out the new feature.
Updates #76349
Change-Id: Iedd3f6b17d83e99da20365b952a565022d20ff13
Reviewed-on: https://go-review.googlesource.com/c/go/+/751580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
|
|
While looking up the stack for a defer to run, if we come across
a panic frame we can skip ahead (up) to where the previous panic
was looking for a defer to run.
Switch from keeping LR (the caller's pc) to PC (the frame's PC).
Seems easier to reason about.
Fixes #77062
Change-Id: Idb39411ebad8c072c8f65c62a518da848bddbd61
Reviewed-on: https://go-review.googlesource.com/c/go/+/738041
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
|
|
The meta tag can include a content attribute that contains URLs, which
we currently don't escape if they are inserted via a template action.
This can plausibly lead to XSS vulnerabilities if untrusted data is
inserted there, the http-equiv attribute is set to "refresh", and the
content attribute contains an action like `url={{.}}`.
Track whether we are inside of a meta element, if we are inside of a
content attribute, _and_ if the content attribute contains "url=". If
all of those are true, then we will apply the same URL escaping that we
use elsewhere.
Also add a new GODEBUG, htmlmetacontenturlescape, to allow disabling this
escaping for cases where this behavior is considered safe. The behavior
can be disabled by setting htmlmetacontenturlescape=0.
Fixes CVE-2026-27142
Fixes #77954
Change-Id: I9bbca263be9894688e6ef1e9a8f8d2f4304f5873
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3360
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/752181
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
Large memory clearing operations (via clear() or large slice allocation)
currently use non-preemptible assembly loops. This blocks the Garbage
Collector from performing a Stop The World (STW) event, leading to
significant tail latency or even indefinite hangs in tight loops.
This change introduces memclrNoHeapPointersPreemptible, which chunks
clears into 256KB blocks with preemption checks. The compiler's walk
phase is updated to emit this call for large pointer-free clears.
To prevent regressions, SSA rewrite rules are added to ensure that
constant-size clears (which are common and small) continue to be
inlined into OpZero assembly.
Benchmarks on darwin/arm64:
- STW with 50MB clear: Improved from 'Hung' to ~500µs max pause.
- Small clears (5-64B): No measurable regression.
- Large clears (1M-64M): No measurable regression.
Fixes #69327
Change-Id: Ide14d6bcdca1f60d6ac95443acb57da9a8822538
Reviewed-on: https://go-review.googlesource.com/c/go/+/750480
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
|
|
Fixes #77730
Change-Id: I8b68b2d4353344e70f970d48a2d50c1a3bd7f273
Reviewed-on: https://go-review.googlesource.com/c/go/+/747664
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Rongrong <rongrong-for-oss@oss.cipunited.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
The buffers added in CL 716002 for printfloat64 and printcomplex128 are
too small to fit the longest formatted values. For values that are too
long, AppendFloat allocates, which may cause a crash for prints in
places in the runtime where allocation is not allowed.
Fixes #77854.
Change-Id: I6a6a636cc2fc5cae9fda25f10b28fd641aa1ff28
Reviewed-on: https://go-review.googlesource.com/c/go/+/749947
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
|
In Android versions 8.0-10 (API levels 26-29), futex_time64 and
timer_settime64 are not in the allowlist of the seccomp filter and will
lead to a runtime crash.
Fixes #77621
Change-Id: I99607d7128c395edf93738440c2928b6819d8a21
Reviewed-on: https://go-review.googlesource.com/c/go/+/750040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
|
|
This will ensure we remain portable. We use gnu90 rather than c90
because c90 doesn't permit C++ style line comments, and that is just
too painful.
Change-Id: Ia0e52c4aa75493ceb3e8ce383cdd2ec85afa0bd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/653138
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|
|
In ASAN mode, extra memory allocations alter the object size and impact the scansize computation. Skip this test when ASAN is enabled.
Fixes #77857.
Fixes #77858.
Fixes #77859.
Change-Id: I21027ff20c411a0fda7a50446b2202871baa2262
Reviewed-on: https://go-review.googlesource.com/c/go/+/750140
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
|