linux-application-whitelisting / fapolicyd

File Access Policy Daemon
GNU General Public License v3.0
192 stars 55 forks source link

Make fd_fgets thread safe #299

Closed radosroka closed 4 months ago

radosroka commented 4 months ago

I think this can be optimized so there will be just one allocation per thread.

stevegrubb commented 4 months ago

The patch seems to get rid of the race being detected with helgrind. But, in the fd_fgets.h file, the access attribute needs its numbers corrected to 2, 3 since the first arg is a pointer to the struct. Also, I'd suggest switching around init and destroy declaration order and then add __attr_dealloc(fd_fgets_destroy, 1) at the end of the init declaration.

stevegrubb commented 4 months ago

LGTM