Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchdog: always close fd on watchdog stop #1

Merged
merged 1 commit into from
Mar 30, 2024

Commits on Mar 30, 2024

  1. watchdog: always close fd on watchdog stop

    The user may asks for procd watchdog handler to be stopped
    with or without disabling it, by specifying the magicclose flag.
    If the flag is set, the watchdog will be disabled and the fd closed,
    allowing the user to take control over the watchdog.
    
    There is a race in this scenario. If the system fails before
    the user re-enables the watchdog, the system might hang
    without a proper reset.
    
    To prevent this, the user should ask the procd handler to be stopped
    without disabling the watchdog, by specifying magicclose as false.
    However, in this case, the procd will only stop refreshing the watchdog,
    but will leave the fd open. At least on Raspberry Pi, this prevents
    anyone else from opening the watchdog device, resulting in EBUSY.
    
    With this patch, watchdog fd will always be closed, regardless
    of the magicclose flag, allowing for the described safe use-case.
    
    For user that previously stopped the watchdog handler
    with the magicclose flag, the functionality remains unchanged.
    
    Signed-off-by: Dragan Milenkovic <[email protected]>
    strpbrk authored and dangowrt committed Mar 30, 2024
    Configuration menu
    Copy the full SHA
    254810d View commit details
    Browse the repository at this point in the history