QNX Page Access Permissions

Hey all,

I’m very new to QNX programming (actually BB10 programming), so this may sound stupid.
I’m currently tackling a bug and thus looking forward some kind of a techinque that, given an address, will provide me with its access permissions (r/w/x) -
similarly to WinDBG’s !address or Windows’ VirtualQuery().

Unfortunately, ntoarm-gdb is lacking “maintenance info sections”.
Any other ideas?

Thanks in advance!
Sue.

To start with, I don’t think there is such a function, but I can’t think of a reason you would need it.

If the address is in the code segment, then you have read and execute permission.
If the address is in the data or stack segment, you have read and write permission.
If the address is in an unpopulated page, you have no permissions.

If you don’t know which of these applies, you are probably not do something legitimate.

I should add that given super user access in a QNX process you can do a little more, but in the BB10 environment, you are more constrained.

What about JIT-featured applications?
I’m sure BB10 has some, and as far as I understand they require a r/w/x memory environment.
Where would it be located, then?

Thanks for your reply.

If you are running a native QNX application, it is possible to control the r/w/x permissions of a segment. But BB10 at the application level does not give you that ability. It’s like IOS where you are running in a sandbox.

Perhaps I haven’t made myself clear, so I’ll rephrase:

I’m not looking for a way to control access permissions at an application level (e.g. VirtualProtect(), mprotect() etc.).
I’m looking for a way to tell which access permissions a given address in some process has (for example, when debugging it with ntoarm-gdb).

Examples from other platforms include WinDBG’s !address and GDB/Linux’s “maintenance info sections”.
Is there anything I could do to mimic that functionality?

Thanks again!

I don’t think that the debugger has that functionality, nor do I understand why you would need it.
If you can get a map from the linker, you will know the addresses of the code and the addresses of the data segments. The code segments are read/execute and the data segments are read-write. That leaves the stack which is read-write to the extent that it is usable. Beyond that is a page with no rights in order to allow the OS to dynamically insert real memory and grow the stack dynamically.

I don’t know why you would want to know the permissions on some random address. Do you think it will help you in debugging some how?