Skip to content

Commit

Permalink
Exploration Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenMatan committed Feb 23, 2025
1 parent 82a2c11 commit 08a01e0
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 1,034 deletions.
12 changes: 9 additions & 3 deletions pkg/dynamicinstrumentation/diconfig/binary_inspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,23 @@ import (
// inspectGoBinaries goes through each service and populates information about the binary
// and the relevant parameters, and their types
// configEvent maps service names to info about the service and their configurations
func inspectGoBinaries(configEvent ditypes.DIProcs) bool {
func inspectGoBinaries(configEvent ditypes.DIProcs) error {
var err error
var inspectedAtLeastOneBinary bool
for i := range configEvent {
err := AnalyzeBinary(configEvent[i])
err = AnalyzeBinary(configEvent[i])
if err != nil {
log.Info("inspection of PID %d (path=%s) failed: %w", configEvent[i].PID, configEvent[i].BinaryPath, err)
} else {
inspectedAtLeastOneBinary = true
}
}
return inspectedAtLeastOneBinary

if !inspectedAtLeastOneBinary {
return fmt.Errorf("failed to inspect all tracked go binaries")
}

return nil
}

// AnalyzeBinary reads the binary associated with the specified process and parses
Expand Down
6 changes: 3 additions & 3 deletions pkg/dynamicinstrumentation/diconfig/mem_config_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func (cm *ReaderConfigManager) update() error {
}

if !reflect.DeepEqual(cm.state, updatedState) {
atLeastOneBinaryAnalyzed := inspectGoBinaries(updatedState)
if !atLeastOneBinaryAnalyzed {
return fmt.Errorf("failed to inspect all tracked go binaries.")
err := inspectGoBinaries(updatedState)
if err != nil {
return err
}

for pid, procInfo := range cm.state {
Expand Down
2 changes: 1 addition & 1 deletion pkg/dynamicinstrumentation/proctracker/proctracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (pt *ProcessTracker) Stop() {
}
}

func (pt *ProcessTracker) Test_HandleProcessStart(pid uint32) {
func (pt *ProcessTracker) HandleProcessStartSync(pid uint32) {
exePath := filepath.Join(pt.procRoot, strconv.FormatUint(uint64(pid), 10), "exe")

pt.inspectBinary(exePath, pid)
Expand Down
Loading

0 comments on commit 08a01e0

Please sign in to comment.