You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/07/12 19:53:28 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on pull request #4124: add #undef for some libc function

xiaoxiang781216 commented on pull request #4124:
URL: https://github.com/apache/incubator-nuttx/pull/4124#issuecomment-878327795


   > Could you describe your use case with a bit more depth?
   > My first impression is that this seems an ugly solution for performing code instrumentation.
   
   Here is a case: we implement a special heap manager which contain many information about the allocation:
   
   1. The malloc call stack, thread id...
   2. The free call stack, thrad id...
   3. The redzone before and after the memory to catch the overwrite
   
   so, the manager can report the useful info when the memory corruption happen, but it would be better to catch the corruption more proactive than passive by hooking the memory manipulation function as much as possible like this:
   
   1. Define strcpy to strcpy_chk
   2. Check the source and destition pointer/size is valid in strcpy_chk
   3. Show the detailed info in case of check failure
   4. Call the original strcpy if pass
   
   The above technique is used in many libc implementation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org