incompetent
incompetent

Reputation: 1822

absolute path of executable in multipartition Linux

I am using LSM hook to intercept exec system call to print the path of the executable being executed. On Debian with default partitioning options, the path of the executable is absolute path. But on Debian with multiple partions having separate mount points for tmp, home var etc, the first parent directory is truncated. For example a file in /tmp/abc.sh is appearing as abc.sh. Same is the case with other mount points. In this scenario, how can I get the absolute path?

Upvotes: 0

Views: 119

Answers (1)

marco
marco

Reputation: 1

First, You cannot get absolute path in any LSM hook. Only necessary data (eg: structures, pointers, flags etc) are passed. Furthermore, everything sent is const, so you don't corrupt anything accidentally. Secondly, mapping of partition base paths vary with partitioning schemes. Last, It's absolutely not a good way to execute things from /tmp directory. Try to place your binaries in appropriate locations.

Upvotes: 0

Related Questions