遇到一个问题现象随记录。(具体问题不说,说一下处理问题中遇到的一个现象)
同时环境变量LD_LIBRARY_PATH第一个环境变量是/opt/data/debugrootfs/newroot/lib64/, 切其路径下有ld-linux-x84-64.so.2 但是为什么就是不连接/opt目录下的这个呢??
使用strace跟踪:
发现都没有open ld 这个动作 这又是为啥? 可以肯定的是 cryptsetup 命令肯定会使用 ld-xx.so
原因是: control is passed to the dynamic linker during process creation by the kernel.; the dynamic linker is not invoked from userspace via a system call
An executable file that participates in dynamic linking shall have one PT_INTERP program header element.
During the function exec, the system retrieves a path name from the PT_INTERP segment and creates the
initial process image from the interpreter file’s segments. That is, instead of using the original
executable file’s segment images, the system composes a memory image for the interpreter.
It then is the interpreter’s responsibility to receive control from the system and provide
an environment for the application program.
As ‘‘Process Initialization’’ in Chapter 3 of the processor supplement mentions, the interpreter
receives control in one of two ways. First, it may receive a file descriptor to read the executable file,
positioned at the beginning. It can use this file descriptor to read and/or map the executable file’s segments into
memory. Second, depending on the executable file format, the system may load the executable file
into memory instead of giving the interpreter an open file descriptor.
With the possible exception of the file descriptor, the interpreter’s initial process state matches
what the executable file would have received. The interpreter itself
may not require a second interpreter. An interpreter may be either a shared object or an executable file.
It is significant that INTERP
is a program header, as program headers are used by the kernel when mapping the binary into memory to create a running process. It can be inferred that the presence of the pathname of the dynamic linker in a program header has implications for process creation by the kernel.
参考:how-does-execve-call-dynamic-linker-loader-ld-linux-so-2
http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!!
但行好事 莫问前程
--身高体重180的胖子