helloSystem / LinuxRuntime

Debian userland contained within a compressed read-only disk image for use with compat.linux.emul_path
6 stars 1 forks source link

See which files in the Linux userland are actually used #4

Open probonopd opened 2 years ago

probonopd commented 2 years ago

I would like to see which files in the Linux userland are actually used so that I can slim down the set of shipped files accordingly.

According to https://forums.FreeBSD.org/threads/linux-compatability-monitor-files-accessed-by-linux-app.62029/post-358476 this should work but it doesn't:

FreeBSD% sudo kldload dtrace
FreeBSD% sudo dtrace -n ':linux64:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }'
dtrace: invalid probe specifier :linux64:linux_open:entry { printf("%s", copyinstr((uintptr_t)args[1]->path)); }: probe description :linux64:linux_open:entry does not match any probes

According to https://wiki.freebsd.org/DTrace/One-Liners this should

Trace file opens with process and filename:

FreeBSD% sudo dtrace -n 'syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); }'
dtrace: invalid probe specifier syscall::open*:entry { printf("%s %s", execname, copyinstr(arg0)); }: probe description syscall::open*:entry does not match any probes

What am I missing?

probonopd commented 2 years ago

Is something missing here?

FreeBSD% sudo dtrace -l
   ID   PROVIDER            MODULE                          FUNCTION NAME
    1     dtrace                                                     BEGIN
    2     dtrace                                                     END
    3     dtrace                                                     ERROR

dwatch -X open doesn't work either:

FreeBSD% sudo dwatch -X open
INFO Sourcing open profile [found in /usr/libexec/dwatch]
INFO Watching 'syscall::open:entry, syscall::openat:entry' ...
dtrace: failed to compile script /dev/stdin: line 1: probe description syscall::open:entry does not match any probes
probonopd commented 2 years ago

Solution: Use sudo kldload dtraceall instead of sudo kldload dtrace.

probonopd commented 2 years ago

Looking at which files the Linuxulator accesses still doesn't work like this:

FreeBSD% sudo dtrace -n 'linux64:*open*:entry { printf("%s %s", execname, copyinstr(arg0)); }' 
dtrace: description 'linux64:*open*:entry ' matched 5 probes
(...)
dtrace: error on enabled probe ID 1 (ID 76713: fbt:linux64:linux_openat:entry): invalid address (0xfffffe00f72adc00) in action #2 at DIF offset 12
dtrace: error on enabled probe ID 5 (ID 76477: fbt:linux64:linux_common_open:entry): invalid address (0xfffffe00f72adc00) in action #2 at DIF offset 12
dtrace: error on enabled probe ID 1 (ID 76713: fbt:linux64:linux_openat:entry): invalid address (0xfffffe00f2e7d500) in action #2 at DIF offset 12
dtrace: error on enabled probe ID 5 (ID 76477: fbt:linux64:linux_common_open:entry): invalid address (0xfffffe00f2e7d500) in action #2 at DIF offset 12

Why?