I would like to calculate the CRC values for some running processes periodically.
The purpose is to ensure that the processes are not corrupted.
The calculated CRCs are compared to the pre-calculated CRCs to check the
processes integrity.
In other embedded systems I have been able to copy an executable into RAM and execute it. Because I put it in RAM I could calculate the CRC. I haven’t figured out how to do this in QNX 6.5.0
Are you looking to make a Ram Disk and copy your executable to the RAM Disk and then execute /CRC it from there? Or are you looking to get a CRC of a running process?
If it’s the former, that’s pretty straight forward. Take a look at devb-ram. This is the RAM disk driver. Simply start it and give it a size of RAM to use for the disk. The path will be /fs/ram. Then copy your executable there and you can CRC/execute it.
I ran into this requirement on a project before using QNX 4. It was part of a gambling machine. I haven’t tried this with QNX 6 but I think it should be straight forward. You need to find the address and size of the executable. I’m pretty sure that pidin does something like this so there should be a way. It might require something extreme in the security area, like RING 0 access.
I’ve seen this type of requirement in two circumstances, the gaming board in Nevada required it for a computer run gambling game, and an FDA requirement in a medical instrument.
That said, I consider this type of programming a little ill conceived. To begin with, a bit changing in the code when your hardware isn’t hosed is extremely unlikely. If that is a concern, then consider that this is just as likely and probably more dangerous if the bit changes in data. In code there is a good chance you will get a SIGSEGV. In data it is unlikely unless the data is a pointer.
If the system protects life in a way that this possibility is unacceptable, you need a different strategy, something like triple redundancy with voting.