Skip to content

Commit c4a85f8

Browse files
authored
Merge pull request #253 from parca-dev/upstream-merge
Merge 8 upstream commits (up to lock file maintenance open-telemetry#1251)
2 parents b5e3d6e + f45d3c9 commit c4a85f8

19 files changed

Lines changed: 1488 additions & 57 deletions

File tree

.github/workflows/unit-test-on-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183
go install github.com/florianl/bluebox@v0.0.1
184184
sudo mv ~/go/bin/bluebox /usr/local/bin/.
185185
- name: Fetch integration test binaries
186-
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
186+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
187187
with: { name: "integration-test-binaries-${{ matrix.target_arch }}" }
188188
- name: Fetch precompiled kernel
189189
run: |

Cargo.lock

Lines changed: 175 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/factory_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//go:build linux
4+
//go:build linux && (amd64 || arm64)
55

66
package collector // import "go.opentelemetry.io/ebpf-profiler/collector"
77

collector/factory_others.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright The OpenTelemetry Authors
22
// SPDX-License-Identifier: Apache-2.0
33

4-
//go:build !linux
4+
//go:build !(linux && (amd64 || arm64))
55

66
package collector // import "go.opentelemetry.io/ebpf-profiler/collector"
77

@@ -21,7 +21,7 @@ func BuildProfilesReceiver(options ...Option) xreceiver.CreateProfilesFunc {
2121
_ component.Config,
2222
_ xconsumer.Profiles,
2323
) (xreceiver.Profiles, error) {
24-
return nil, errors.New("profiling receiver is only supported on Linux")
24+
return nil, errors.New("profiling receiver is only supported on Linux and arm64 or amd64")
2525

2626
}
2727
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require (
4646
go.uber.org/zap/exp v0.3.0
4747
golang.org/x/arch v0.25.0
4848
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
49-
golang.org/x/mod v0.33.0
49+
golang.org/x/mod v0.34.0
5050
golang.org/x/sync v0.20.0
5151
golang.org/x/sys v0.42.0
5252
google.golang.org/grpc v1.79.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
312312
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
313313
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
314314
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
315-
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
316-
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
315+
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
316+
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
317317
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
318318
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
319319
golang.org/x/net v0.0.0-20191007182048-72f939374954/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=

interpreter/hotspot/data.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,18 @@ type hotspotVMData struct {
166166
ConstMethod uint `name:"_constMethod"`
167167
} `name:"Method,methodOopDesc"`
168168
Nmethod struct { // .Sizeof >256
169-
Sizeof uint
170-
CompileID uint `name:"_compile_id"`
171-
MetadataOffset uint `name:"_metadata_offset,_oops_offset"`
172-
ScopesPcsOffset uint `name:"_scopes_pcs_offset"`
173-
DependenciesOffset uint `name:"_dependencies_offset"` // JDK -22 only
174-
ImmutableData uint `name:"_immutable_data"` // JDK 23+ only
175-
ImmutableDataSize uint `name:"_immutable_data_size"` // JDK 23+ only
176-
OrigPcOffset uint `name:"_orig_pc_offset"`
177-
DeoptimizeOffset uint `name:"_deoptimize_offset,_deopt_handler_offset,_deopt_handler_begin"`
178-
Method uint `name:"_method"`
179-
ScopesDataOffset uint `name:"_scopes_data_offset,_scopes_data_begin"`
169+
Sizeof uint
170+
CompileID uint `name:"_compile_id"`
171+
MetadataOffset uint `name:"_metadata_offset,_oops_offset"`
172+
ScopesPcsOffset uint `name:"_scopes_pcs_offset"`
173+
DependenciesOffset uint `name:"_dependencies_offset"` // JDK -22 only
174+
ImmutableData uint `name:"_immutable_data"` // JDK 23+ only
175+
ImmutableDataSize uint `name:"_immutable_data_size"` // JDK 23+ only
176+
ImmutableDataRefCountOff uint `name:"_immutable_data_ref_count_offset"` // JDK 26+ only
177+
OrigPcOffset uint `name:"_orig_pc_offset"`
178+
DeoptimizeOffset uint `name:"_deoptimize_offset,_deopt_handler_offset,_deopt_handler_begin,_deopt_handler_entry_offset"`
179+
Method uint `name:"_method"`
180+
ScopesDataOffset uint `name:"_scopes_data_offset,_scopes_data_begin"`
180181
} `name:"nmethod,CompiledMethod"`
181182
OopDesc struct {
182183
Sizeof uint
@@ -601,6 +602,11 @@ func (d *hotspotData) newVMData(rm remotememory.RemoteMemory, bias libpf.Address
601602
vms.CodeBlob.RelocationSize = 0
602603
}
603604

605+
// JDK26+: immutable data has a ref count trailer; not present prior to JDK26
606+
if vms.Nmethod.ImmutableDataRefCountOff == ^uint(0) {
607+
vms.Nmethod.ImmutableDataRefCountOff = 0
608+
}
609+
604610
// Check that all symbols got loaded from JVM introspection data
605611
err := forEachItem("", reflect.ValueOf(&vmd.vmStructs).Elem(),
606612
func(item reflect.Value, name string) error {

interpreter/hotspot/hotspot.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ package hotspot // import "go.opentelemetry.io/ebpf-profiler/interpreter/hotspot
7878
// JDK24 - Tested ok
7979
// - nmethod metadata moved to codeblob mutable data area
8080
// JDK25 - Tested ok
81+
// JDK26 - Tested ok
82+
// - nmethod._deopt_handler_offset renamed to _deopt_handler_entry_offset
83+
// - immutable_data now has ref count trailer (_immutable_data_ref_count_offset)
8184
//
8285
// NOTE: Ahead-Of-Time compilation (AOT) is NOT SUPPORTED. The main complication is that, the AOT
8386
// ELF files are mapped directly to the program virtual space, and contain the code to execute.

interpreter/hotspot/instance.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,8 @@ func (d *hotspotInstance) getJITInfo(addr libpf.Address, addrCheck uint32) (
511511
// [scopes_data] @ _immutable_data + nmethod._scopes_data_begin \ arrays we need
512512
// [scopes_pcs] @ _immutable_data + nmethod._scopes_pcs_offset / for inlining info
513513
// [speculations] @ _immutable_data + nmethod._speculations_offset
514-
// [end] @ _immutable_Data + nmethod._immutable_data_size
514+
// [end] @ _immutable_data + nmethod._immutable_data_size
515+
// [end] @ _immutable_data + min(_immutable_data_size, _immutable_data_ref_count_offset) (JDK 26+)
515516
// ...
516517
// speculations presence depends on JDK build, and is not used. Instead the scopes
517518
// end is determined from immutable data size.
@@ -535,6 +536,15 @@ func (d *hotspotInstance) getJITInfo(addr libpf.Address, addrCheck uint32) (
535536
scopesDataOff := npsr.PtrDiff32(nmethod, vms.Nmethod.ScopesDataOffset)
536537
immutableDataPtr := npsr.Ptr(nmethod, vms.Nmethod.ImmutableData)
537538
immutableDataSize := npsr.Uint32(nmethod, vms.Nmethod.ImmutableDataSize)
539+
540+
// JDK26+: immutable data ends at ref_count offset, not at immutable_data_size
541+
if vms.Nmethod.ImmutableDataRefCountOff != 0 {
542+
immutableDataRefCountOff := npsr.Uint32(nmethod, vms.Nmethod.ImmutableDataRefCountOff)
543+
if immutableDataRefCountOff < immutableDataSize {
544+
immutableDataSize = immutableDataRefCountOff
545+
}
546+
}
547+
538548
if immutableDataSize >= maxMetadataSize {
539549
return nil, fmt.Errorf("unreasonably large immutable data region: %d bytes",
540550
immutableDataSize)

0 commit comments

Comments
 (0)