On Fri, Mar 3, 2023 at 1:07 PM Tim Hardisty <t...@hardisty.co.uk> wrote:
> The bug I thought I had in a driver I'm developing (well, one of them!) 
> appears to be related to file closing.
>
> - I have a related example-type app I'm using to exercise and check the 
> driver. It opens 2 "files" (O-RDONLY) to read data from the device driver
> - I have enabled CONFIG_SIGKILL_ACTION to allow me to ctrl-c from the console 
> if the app is misbehaving or, I thought, just to exit it.
>
> The behaviours I see are:
>
> 1) If I ctrl-c, the open files are not closed and if I re-run the app, the 
> system crashes. It is the very first printf statement of the app that causes 
> the crash, at the point the printf routine calls lib_fflush (not looked 
> further yet).
> 2) If I ensure the test app reads console input too, and map a character 
> received character (e.g. 'x') to a clean exit, I can then re-run the app 
> without issue.
>
> I don't think I saw this behaviour with the previous driver I did, so I have 
> probably changed something via menuconfig, but I still would have 
> thought/hoped that this sort of behaviour wouldn't happen regardless?
>
> Anyone got any suggestions or hints (other than go back to school!)?


Have you tried installing signal handlers for SIGQUIT and SIGINT and
ensuring that the files are closed before the program is quit?

Nathan

Reply via email to