I met some difficulties when I collect args from hooking sys_open
and sys_execve
.
Both systemcall use filename as first argument, and the argument may be absolute path or relative path. I want to get absolute path whether it's an absolute path or relative path.
Example:
if the filename is "/root/Desktop/../Downloads"
, i need to change it to "/root/Downloads"
.
I suppose the OS source code have resolution, but I end up with reading source code of "__link_path_walk"
.
The function "__link_path_walk"
is used to deal with "../" and "./"
, but it seems that the function don't get absolute path but get final entry (noted in source code). My OS code version is linux-2.6.32-754.el6.
Any help would be appreciated.