View topic - QNX Page Access Permissions

Page 1 of 1

QNX Page Access Permissions

PostPosted: Mon May 12, 2014 9:32 am
by dimaggios
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.

Re: QNX Page Access Permissions

PostPosted: Mon May 12, 2014 1:41 pm
by maschoen
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.

Re: QNX Page Access Permissions

PostPosted: Mon May 12, 2014 4:10 pm
by dimaggios
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.

Re: QNX Page Access Permissions

PostPosted: Mon May 12, 2014 6:11 pm
by maschoen
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.

Re: QNX Page Access Permissions

PostPosted: Tue May 13, 2014 8:52 am
by dimaggios
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!

Re: QNX Page Access Permissions

PostPosted: Wed May 14, 2014 1:37 am
by maschoen
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?