Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't trace Go code on Linux #24

Open
ndmitchell opened this issue Apr 10, 2019 · 2 comments
Open

Can't trace Go code on Linux #24

ndmitchell opened this issue Apr 10, 2019 · 2 comments

Comments

@ndmitchell
Copy link
Contributor

As an example, given the go code:

package main

import (
    "fmt"
    "io/ioutil"
    "os"
)

func main() {
    b, err := ioutil.ReadFile(os.Args[1])
    if err != nil {
        fmt.Print(err)
    }
    fmt.Print(string(b))
}

Save that as main.go and compile it with go build -o main main.go. fsatrace does not detect the read. I believe the cause will be that go does not use dynamic libraries but jumps straight to syscalls.

@jacereda
Copy link
Owner

That's right, and this is a dead end in this case. The code injection depends on injecting libc with a preload. At some point I started a FUSE filesystem that was almost ready, but since fsatrace worked fine for my use case I stopped development. Here is the repo:

https://github.com/jacereda/traced-fs

@droundy
Copy link

droundy commented Apr 11, 2019

You could alternatively use libbigbro to track changes on linux. Bigbro uses ptrace internally, so it can handle go just fine, since it's tracking the system calls. ptrace does have its own limitations, since it is sometimes disabled in container systems like docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants