Make fixes and improvements

- Document more compiler flags
- Expose new __print_maps() api
- Better overflow checking in mmap()
- Improve the shell example somewhat
- Fix minor runtime bugs regarding stacks
- Make kill() on fork()+execve()'d children work
- Support CLONE_CHILD_CLEARTID for proper joining
- Fix recent possible deadlock regression with --ftrace
This commit is contained in:
Justine Tunney 2022-05-19 16:57:49 -07:00
parent 6e52cba37a
commit ec2cb88058
68 changed files with 1211 additions and 431 deletions

View file

@ -57,8 +57,9 @@ static void sigaltstack2linux(struct sigaltstack *linux,
* struct sigaction sa;
* struct sigaltstack ss;
* ss.ss_flags = 0;
* ss.ss_size = SIGSTKSZ;
* ss.ss_sp = malloc(ss.ss_size);
* ss.ss_size = GetStackSize();
* ss.ss_sp = mmap(0, GetStackSize(), PROT_READ | PROT_WRITE,
* MAP_STACK | MAP_ANONYMOUS, -1, 0);
* sa.sa_flags = SA_ONSTACK;
* sa.sa_handler = OnStackOverflow;
* __cxa_atexit(free, ss[0].ss_sp, 0);
@ -66,6 +67,11 @@ static void sigaltstack2linux(struct sigaltstack *linux,
* sigaltstack(&ss, 0);
* sigaction(SIGSEGV, &sa, 0);
*
* It's strongly recommended that you allocate a stack with the same
* size as GetStackSize() and that it have GetStackSize() alignment.
* Otherwise some of your runtime support code (e.g. ftrace stack use
* logging, kprintf() memory safety) won't be able to work as well.
*
* @param neu if non-null will install new signal alt stack
* @param old if non-null will receive current signal alt stack
* @return 0 on success, or -1 w/ errno