开发者

How to protect a process from crash by modify a dynamic library it has loaded in linux?

I have a process that loads a dynamic library when it starts(dlopen/dlsym etc), and I can send some message to it while it's running to let the process un开发者_如何学Cload the previous .so(dlclose) and load a new one.

Here the question becomes, while the process is running, if I transfer a new .so using nc like:

nc -l 9999 > mylibrary.so

If I give nc the same filename which has been loaded by the process, then the process got segv immediately after the above command being executed.

Another case that will cause process crash is when I package the .so file into an rpm package and the .so file in the rpm is the same, then yum update XXX will cause the process crash too.

I've been told that there's a way to load the .so file into memory to avoid the problem, but failed to find any resource related to it.

Any thoughts will be thankful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜