Sample Header Ad - 728x90

Incomplete strace output for child processes

0 votes
0 answers
26 views
So I am writing a program that automatically determines the dependencies of an application and writes a *FROM scratch* dockerfile based on them using *strace*. I was testing it on a MariaDB, but it failed because *chmod* was not found In the MariaDB GitHub page I can see that there is a [docker-entrypoint.sh](https://github.com/MariaDB/mariadb-docker/blob/master/main/docker-entrypoint.sh) which does a *find .. -exec chown mysql {} \;* but in the strace output i don't see an *execve("/bin/chown",...)* To trace the apps, I am using a *statically-linked strace* binary which I am mounting to the Docker container running the app alongside an out.log file which captures the output The full command is the following:
run --rm --entrypoint "" -v /usr/local/bin/strace:/usr/bin/strace -v ./out.log:/out.log /usr/bin/strace -s 9999 -fe execve,execveat,open,openat docker-entrypoint.sh mariadbd
Howerver, when i try running the a test version of the find locally (not in a docker container), I see clearly the execve call to chown.
$ cat test.sh
#!/bin/sh

for file in /.; do
        find $(dirname file) -type f -exec chown $USER:$USER {} \;
done
`
$ cat out.log
5147  execve("./test.sh", ["./test.sh"], 0x7fff932870b0 /* 18 vars */) = 0
5147  open("./test.sh", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
5148  execve("/usr/bin/dirname", ["dirname", "file"], 0x7f643fa58490 /* 18 vars */) = 0
5148  +++ exited with 0 +++
5147  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=5148, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
5149  execve("/usr/bin/find", ["find", ".", "-type", "f", "-exec", "chown", "root:root", "{}", ";"], 0x7f643fa58618 /* 18 vars */) = 0
5149  open(".", O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 3
5149  open("./.config", O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 4
5149  open("./.config/micro", O_RDONLY|O_LARGEFILE|O_CLOEXEC|O_DIRECTORY) = 5
5150  execve("/usr/local/sbin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = -1 ENOENT (No such file or directory)
5150  execve("/usr/local/bin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = -1 ENOENT (No such file or directory)
5150  execve("/usr/sbin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = -1 ENOENT (No such file or directory)
5150  execve("/usr/bin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = -1 ENOENT (No such file or directory)
5150  execve("/sbin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = -1 ENOENT (No such file or directory)
5150  execve("/bin/chown", ["chown", "root:root", "./.config/micro/settings.json"], 0x7ffe6cb2bbf8 /* 18 vars */) = 0
5150  open("/etc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
5150  open("/etc/group", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 3
5150  +++ exited with 0 +++
...
Do I need to add *CAP_SYS_PTRACE* to the container when running the strace probe or anything else?
Asked by ReGeLePuMa (1 rep)
May 11, 2025, 09:14 PM