syscall_intercept icon indicating copy to clipboard operation
syscall_intercept copied to clipboard

Introduce signal intercepting example

Open GBuella opened this issue 8 years ago • 5 comments

It is a nice first attempt to demonstrate the idea, far from complete.

To give it a try, start the dummy program which installs a signal handler:

LD_LIBRARY_PATH=./examples LD_PRELOAD=libsignal_interceptor.so ./examples/signaller

Send it a USR1 signal, and see what happens.

Ref: #4


This change is Reviewable

GBuella avatar Sep 02 '17 01:09 GBuella

BTW, this can be used to handle nasty pointers pass to pmemfile via syscall interfaces, e.g.:

thread_local sigjmp_buf user_pointer_jmb_buf;
thread_local bool jump_back_to_pmemfile;

pmemfile_write(pfp, file, buf, size)
{

  ssize_t result;
  jump_back_to_pmemfile = true;

  if (sigsetjmp(user_pointer_jmb_buf, 0) == 0) {
     memcpy(buf, pmemfile_block, size);
     result = size;
  } else {
    result = -EFAULT;
  }
  jump_back_to_pmemfile = false;
  return result;
}

signal_hook(int sig, siginfo_t *info, void *arg)
{
   if (sig == SIGSEGV && jump_back_to_pmemfile) {
      /* fault due to pointer from user */
      siglongjmp(user_pointer_jmb_buf, 1);
   }
}

GBuella avatar Sep 08 '17 18:09 GBuella

So, this info could be added to the source file and/or to some README.


Reviewed 3 of 3 files at r1. Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

krzycz avatar Sep 11 '17 08:09 krzycz

This build fails. Not quite sure why.

sarahjelinek avatar Sep 11 '17 22:09 sarahjelinek

I think there is something really wrong with the docker related scripts, which wasn't manifested until #48 was merged. It might be a good a idea to copy docker build scripts from the pmemfile repo.

GBuella avatar Sep 11 '17 23:09 GBuella

Codecov Report

Merging #46 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #46   +/-   ##
=======================================
  Coverage   69.71%   69.71%           
=======================================
  Files          19       19           
  Lines        1433     1433           
  Branches      391      391           
=======================================
  Hits          999      999           
  Misses        235      235           
  Partials      199      199
Flag Coverage Δ
#pmemfile_tests 65.67% <ø> (ø) :arrow_up:
#regular_tests 56.38% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e15d384...154f91f. Read the comment docs.

codecov-io avatar Sep 13 '17 09:09 codecov-io