tags:

views:

258

answers:

1
+1  Q: 

Modifying elf file

Hi

I would like to add a new flag to an elf file. This flag should then be available to the kernel in the process descriptor. My first idea was to use libelf, but unfortunately there seems to be a bug with it on Ubuntu. Elfedit would have probably been a nice tool but I have not found a version for Linux, in particular Ubuntu.

So, I am wondering if anyone can suggest to me if there is any other useful tool out there to add a custom flag to an elf file?

Many thanks for your help!

+1  A: 

People who are able to modify the kernel to take advantage of the new flag probably wouldn't be asking how to add the flag to the ELF libraries.

So, how do you plan to have the kernel use this new flag? What is the purpose of the flag?

Since you are adding to the standard libelf, can't you fix the bug for Ubuntu and let them know that you've done so (make the fix available to them - though they'll probably need to relay it back up the chain).

Jonathan Leffler
Yes, you are absolutely right. If I would be a proper Kernel hacker this would probably be a simple task. Unfortunately, I am just starting with some practical work on the Kernel. Basically, I want to specify a flag in the ELF file which tells the Kernel that an Application needs some "special treatment". This special treatment should occur during context switches, and there I would like to know if the task that has been switched out had this custom flag in the ELF File. In other words,I have 2 tasks (1) add custom flag to corresponding executeable (2) make this custom flag available to Kernel