Fix invalid memory reference in signal and sigaction
- Aug 12, 2019
- Aug 11, 2019
At this line, https://gitlab.redox-os.org/redox-os/relibc/blob/master/src/header/signal/mod.rs#L96 the map call moves the newly created sigaction struct, making the reference instantly invalid. This was causing segmentation faults when using the signal and sigaction functions.
Convert pointers to Option of reference upon reception to avoid those problems. And since the functions now work, add tests for them.
The sigaction handler called map on an option, creating a pointer to a move value. This in turned caused UB for signal handlers. Avoid using pointers directly, and instead prefer references.