0

I'm trying to configure and enable ftrace on my ubuntu machine but its doesn't work. I also tried the instructions from the link here. I'm sure I'm missing something minor but I can't tell what.

Configuration:

$ cat /boot/config-5.15.0-56-generic | grep CONFIG_FUNCTION_TRACER
CONFIG_FUNCTION_TRACER=y
$ cat /boot/config-5.15.0-56-generic | grep CONFIG_FUNCTION_GRAPH_TRACER
CONFIG_FUNCTION_GRAPH_TRACER=y
$ cat /boot/config-5.15.0-56-generic | grep CONFIG_STACK_TRACER
CONFIG_STACK_TRACER=y
$ cat /boot/config-5.15.0-56-generic | grep CONFIG_DYNAMIC_FTRACE
CONFIG_DYNAMIC_FTRACE=y
$ uname -a
Linux <redacted> 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Enable tracing (with root user)

$ echo function > /sys/kernel/debug/tracing/current_trace
$ echo do_sys_open > /sys/kernel/debug/tracing/set_ftrace_filter
$ echo 1 > tracing_on

debugfs is already mounted:

$ mount
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)

After enabling the tracing I was expecting to see the traces in /sys/kernel/debug/tracing/trace or /sys/kernel/debug/tracing/trace_pipe files but I didn't see any traces.

Update: Instructions to generate the traces are working as expected. I was able to generate the traces successfully for do_sys_openat2 but with do_sys_open I don't see any traces.

chandra_cst
  • 307
  • 2
  • 13
  • I wrote a sample in C using `open()` system call and based on the strace output the system call invoked seem to be `openat()`. – chandra_cst Jan 07 '23 at 06:05
  • From the man page: "Since version 2.26, the glibc wrapper function for open() employs the openat() system call, rather than the kernel's open() system call. For certain architectures, this is also true in glibc versions before 2.26. " – chandra_cst Jan 07 '23 at 06:06

0 Answers0