title: How to hook system calls of my android app (non rooted device)
body: <p>I am trying to intercept all system calls made by my Android app on a non rooted device.</p>
  
  <p>So every time my app writes/reads a file, I want to intercept the system call and encrypt/decrypt the stream for security purposes. The encryption part is no problem, but how do I intercept the system calls?</p>
  
  <p>Because parts of the app are modules developed by third party providers of which I can not change the source code, there is no other way to make sure that data is  stored securely.</p>
  
  <p>Since I do not have root access I cannot access the address of the system call table as described <a href="https://stackoverflow.com/questions/14114343/android-system-call-hooking">here</a> and I can not do this through an LKM module as well.</p>
  
  <p>I would appreciate any suggestions, thanks.  </p>
  
  <p>Edit:</p>
  
  <p>Ok I got the code link form Simone Margaritelli to work now! the reason why my code kept crashing is because i had to set the right memory access permisions:</p>
  
  <pre><code>uint32_t page_size = getpagesize();
  uint32_t entry_page_start = reloc&amp; (~(page_size - 1));
  mprotect((uint32_t *)entry_page_start, page_size, PROT_READ | PROT_WRITE);
  </code></pre>