[Openais] API address validation - code attached

Steven Dake scd at broked.org
Sat Jan 21 14:00:24 PST 2006


For some time, I've had the idea of using the /proc/self/maps file to
validate reads and writes in the library APIs from the user data.  This
is alot better then just checking for NULL (atleast during development)
and would have to be able to be shut off during deployment.

Perhaps the way we use this is provide two libraries - one with this
built enabled and one built disabled.

Anyway I leave it to the list to discuss but here is a test program to
demonstrate the concept.

You may have to modify the test cases to match your address spaces.  I
have tested on 32/64 bit,2.4/2.6, and it appears to work everywhere.  A
printf of 0 means the address is valid, -1 means invalid.

Regards
-steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: valid.c
Type: text/x-c
Size: 3853 bytes
Desc: not available
Url : http://lists.linux-foundation.org/pipermail/openais/attachments/20060121/983691b3/valid-0001.bin


More information about the Openais mailing list