firmadyne / libnvram

NVRAM emulator
MIT License
75 stars 36 forks source link

A question about nvram_init() #7

Open xyzmpv opened 1 year ago

xyzmpv commented 1 year ago

The function nvram_init() uses sem_lock() and sem_unlock() before/after mount the tmpfs. But just like the annotation that Must get sempahore after NVRAM initialization, mounting will change ID, the locked sempahore and the unlocked sempahore should be different, and could lead to unpredicted side-effect.

ddcc commented 1 year ago

Yeah, I think you're right. This code is pretty old and crufty, it'd probably be better to take the IPC key on something in the filesystem that doesn't change instead.