What will happen if I kill a process which is waiting for the retuan ioctl() syscall?

Miles Fidelman mfidelman at meetinghouse.net
Wed Mar 14 10:15:16 EDT 2018


Another reference: 
https://www.slideshare.net/JeremyBrown37/a-bug-hunters-perspective-on-unix-drivers



On 3/13/18 11:27 PM, Larry Chen wrote:
> Hello Douglas,
>
> On 03/13/2018 07:56 PM, Douglas Su wrote:
>> If I have these:
>>
>> 1. I have implemented a simple ioctl() system call which just delay a 
>> period and return.
>> 2. Call this ioctl() from a userspace process, of course, this 
>> process will be blocked until ioctl() return.
>> 3. Before ioctl() return, use `kill -9 <pid>` command terminates the 
>> process.
>>
>> Question:
>>
>> 1. Can we instantly kill this process?
> Of course, you can. But whether your behavior will affect your process 
> depends on your implementation.
>> 2. If we can instantly kill this process, does ioctl() still keep 
>> delay after killing?
> It depends on your implementation of your ioctl.
> If your ioctl has some kind of mechanism to check whether there is a 
> signal received, you can let your ioctl return.
>> 3. If ioctl() still running even after we terminate this process, 
>> where does the return value ioctl() will return to?
> That sounds insane.
>> 4. How to keep the device's state consistent when we kill a process 
>> when it is invoking a system call?
> Sorry, I did not get your point.
>
> Thanks,
> Larry
>>
>> Best regards.
>>
>>
>>
>>
>> Douglas
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-- 
In theory, there is no difference between theory and practice.
In practice, there is.  .... Yogi Berra




More information about the Kernelnewbies mailing list