linux-application-whitelisting / fapolicyd

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

fapolicyd-cli -u with debdb backend triggers system lockup #259

Closed stridge-cruxml closed 1 year ago

stridge-cruxml commented 1 year ago

When fapolicyd-cli -u is called, and fapolicyd is already running a system lockup is triggered.

Still investigating but my theory is trying to open the .md5sum files is blocked, causing a crash/lockup.

stevegrubb commented 1 year ago

fapolicyd approves any access request for itself. I wonder if this is a pid vs thread id issue? (Look around line 402 of notify.c) The only debugging advice I have is use printf alot. You cannot ptrace it or it locks up.

stridge-cruxml commented 1 year ago

Thanks!

This is the output of the log every time I run it. It gets to the same package every time which I find strange. I thought it would be a race condition somewhere.

Package 1323 / 1327 : python3-blinkerLoading file backend
Creating trust database
Loading trust data from debdb backend
Loading trust data from file backend
added / mount point
added /dev/shm mount point
added /run/lock mount point
added /boot/efi mount point
added /run/snapd/ns mount point
added /run/user/1000 mount point
Starting to listen for events
It looks like there was an update of the system... Syncing DB.
backend debdb registered
backend file registered
Loading debdb backend
Computing hashes for 1327 packages.
Package 6 / 1327 : cryptsetup-bin

Ill keep looking :)

stridge-cruxml commented 1 year ago

So it stalls inside dpkg library. Seems to be related to the hash table.

I have found a fix. Calling:

fsys_hash_reset();

Before asking dpkg to construct the package hash table seems to resolve the issue. I will make a PR

darrinh commented 1 year ago

Hi, thanks, works properly now for me in 22.04.

cheers Darrin.