jirka-h / haveged

Entropy daemon ![Continuous Integration](https://github.com/jirka-h/haveged/workflows/Continuous%20Integration/badge.svg)
GNU General Public License v3.0
269 stars 33 forks source link

Check for sys/auxv.h before using it. #59

Closed pseiderer closed 3 years ago

pseiderer commented 3 years ago

Fixes:

haveged.c:22:10: fatal error: sys/auxv.h: No such file or directory 22 | #include <sys/auxv.h> | ^~~~

Signed-off-by: Peter Seiderer ps.report@gmx.net

yann-morin-1998 commented 3 years ago

I think this change is not completely correct.

As far as I can see, when built on uClibc without sys/auxv.h, then when haveged is called wihtout a full path and from an initrd (/etc/initrd-release exists), then path[0] will be set to / and then on line 527 we'd call /aveged.

This could happen for example when one is trying to debug their systemd-based initrd, or when one is dumped into a recovery systemd-based initrd and manually run haveged to try and get some entropy to restore ssh keys or such...

Of course, I may have missed a bigger picture here, but nonetheless, it looks like this is introducing a latent bug...

Thoughts?