Can I replace a Linux kernel function with a module?

前端 未结 4 760
执念已碎
执念已碎 2020-12-24 10:08

Im getting into kernel work for a bit of my summer research. We are looking to make modifications to the TCP, in specific RTT calculations. What I would like to do is repl

4条回答
  •  执念已碎
    2020-12-24 10:33

    I'm not sure that'll work - I believe the symbol resolution for the internal calls to the function you want to replace will have already been done by the time your module loads.

    Instead, you could change the code by renaming the existing function, then creating a global function pointer with the original name of the function. Initialise the function pointer to the address of the internal function, so the existing code will work unmodified. Export the symbol of the global function pointer, then your module can just change its value by assignment at module load and unload time.

提交回复
热议问题