Finding all uses of clock_gettime in a program

I need to use Rust in a security-paranoid environment, so I'm using Linux's seccomp to disable program's access to lots of things, including timers (due to spectre).

However, timers are a commonly used functionality, so avoiding them in the code, especially all the dependencies, is hard.

I've got a report that my program gets killed for calling clock_gettime somewhere, but I can't reproduce it on my machine. How can I find all potential uses of clock_gettime in my program? Ideally by static analysis.

Could cargo-call-stack help? (I have never tested it)

1 Like

You should be able to get an idea where the function is used by grepping through the output of objdump -D <path-to-debug-binary>. The output will typically consist of many million lines of assembly, and there probably is a better way, but maybe it's a start.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.