Wolfgang Mauerer : RTDM: Fix potential NULL pointer dereference
Quoted 8 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200
Quoted 7 lines
RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Signature · 1 line
Gilles.
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
Quoted 8 lines
Quoted 5 lines
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Gilles Chanteperdrix
Quoted 15 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Quoted 7 lines
Quoted 2 lines
I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Ok. I am fine with any variation as long as:
- close returns immediately even if the request is not taken into account immediately;
- the file descriptor index is available again as soon as close returns;
- the kernel objects attached to the file descriptor are destroyed when the last reference to it is closed.
In shoft: POSIX conformance.
Signature · 1 line
Gilles.
Quoted 25 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Quoted 6 lines
Ok. I am fine with any variation as long as:
- close returns immediately even if the request is not taken into account immediately;
- the file descriptor index is available again as soon as close returns;
- the kernel objects attached to the file descriptor are destroyed when the last reference to it is closed.
That's precisely what I implemented. Additionally, I had to take care of RTDM drivers deferring the close via EAGAIN and some other minor aspects.
Quoted 2 lines
In shoft: POSIX conformance.
At least blocking has nothing to do with POSIX (some drivers will continue to block in their close handlers). And - AFAIU - the order of releasing the fd internally and blocking on something during close is not specified.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 18 lines · Jan Kiszka
Quoted 17 lines · Gilles Chanteperdrix
Quoted 15 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Quoted 7 lines
Quoted 2 lines
I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
You mean that your current implementation, does poll, right? Because mine does not, that was the point of it, also to solve races in cross-context management IIRC. That patch dates back to the 2.5 -rc cycle, when I needed it to have a decent behavior while working on the RTIPC stuff. It should not be that difficult to forward port it to -head, I guess. Let me know if I can help.
Quoted 3 lines
Jan
Signature · 1 line
Philippe.
Quoted 32 lines · Jan Kiszka
Quoted 22 lines · Gilles Chanteperdrix
Quoted 21 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
Quoted 7 lines
Quoted 5 lines
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
Quoted 8 lines
Quoted 2 lines
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Ok. I am fine with any variation as long as:
- close returns immediately even if the request is not taken into account immediately;
- the file descriptor index is available again as soon as close returns;
- the kernel objects attached to the file descriptor are destroyed when the last reference to it is closed.
Quoted 2 lines
That's precisely what I implemented. Additionally, I had to take care of RTDM drivers deferring the close via EAGAIN and some other minor aspects.
I am afraid EAGAIN gets translated automatically into ENOMERGE ;-)
Quoted 7 lines
Quoted 2 lines
In shoft: POSIX conformance.
At least blocking has nothing to do with POSIX (some drivers will continue to block in their close handlers). And - AFAIU - the order of releasing the fd internally and blocking on something during close is not specified.
The point is that the close handler should not be called when close is called, but when the last reference to the file descriptor is closed, asynchronously if need be. So, it may block. But the close service should return immediately.
Maybe it is not POSIX, but it is the way it should be, and the way people expect a sane driver API to answer. Crappy drivers which do not answer to SIGINT are simply not acceptable and only a waste developer time (and POSIX mandates EINTR in that case).
Signature · 1 line
Gilles.
Quoted 32 lines · Gilles Chanteperdrix
Quoted 31 lines · Jan Kiszka
Quoted 30 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Ok. I am fine with any variation as long as:
- close returns immediately even if the request is not taken into account immediately;
- the file descriptor index is available again as soon as close returns;
- the kernel objects attached to the file descriptor are destroyed when the last reference to it is closed.
Quoted 4 lines
Quoted 2 lines
That's precisely what I implemented. Additionally, I had to take care of RTDM drivers deferring the close via EAGAIN and some other minor aspects.
I am afraid EAGAIN gets translated automatically into ENOMERGE ;-)
Sorry, I'm also concerned about legacy compatibility. So this is a must-have.
But don't worry, this is an internal detail between driver and RTDM. Neither the user nor drivers that makes no use of it will notice.
Quoted 12 lines
Quoted 6 lines
Quoted 2 lines
In shoft: POSIX conformance.
At least blocking has nothing to do with POSIX (some drivers will continue to block in their close handlers). And - AFAIU - the order of releasing the fd internally and blocking on something during close is not specified.
The point is that the close handler should not be called when close is called, but when the last reference to the file descriptor is closed, asynchronously if need be. So, it may block. But the close service should return immediately.
Quoted 4 lines
Maybe it is not POSIX, but it is the way it should be, and the way people expect a sane driver API to answer. Crappy drivers which do not answer to SIGINT are simply not acceptable and only a waste developer time (and POSIX mandates EINTR in that case).
We can't change these bits. The close handler will continue to be called when the request is issued and possibly once again (or more if it asks for this via EAGAIN) when the final release happens.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 53 lines · Jan Kiszka
Quoted 32 lines · Gilles Chanteperdrix
Quoted 31 lines · Jan Kiszka
Quoted 30 lines · Gilles Chanteperdrix
Quoted 15 lines · Jan Kiszka
Quoted 14 lines · Gilles Chanteperdrix
Quoted 13 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Ok. I am fine with any variation as long as:
- close returns immediately even if the request is not taken into account immediately;
- the file descriptor index is available again as soon as close returns;
- the kernel objects attached to the file descriptor are destroyed when the last reference to it is closed.Quoted 3 lines
Quoted 2 lines
That's precisely what I implemented. Additionally, I had to take care of RTDM drivers deferring the close via EAGAIN and some other minor aspects.
I am afraid EAGAIN gets translated automatically into ENOMERGE ;-)
Sorry, I'm also concerned about legacy compatibility. So this is a must-have.
But don't worry, this is an internal detail between driver and RTDM. Neither the user nor drivers that makes no use of it will notice.
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
In shoft: POSIX conformance.
At least blocking has nothing to do with POSIX (some drivers will continue to block in their close handlers). And - AFAIU - the order of releasing the fd internally and blocking on something during close is not specified.
The point is that the close handler should not be called when close is called, but when the last reference to the file descriptor is closed, asynchronously if need be. So, it may block. But the close service should return immediately.
Quoted 8 lines
Quoted 4 lines
Maybe it is not POSIX, but it is the way it should be, and the way people expect a sane driver API to answer. Crappy drivers which do not answer to SIGINT are simply not acceptable and only a waste developer time (and POSIX mandates EINTR in that case).
We can't change these bits. The close handler will continue to be called when the request is issued and possibly once again (or more if it asks for this via EAGAIN) when the final release happens.
As fare as I remember Philippe's patch fixed these bits. I have no problem if the polling happens in a kernel thread (or workqueue, as far as I remember Philippe's patch), and the close service has already returned and freed the file descriptor.
Signature · 1 line
Gilles.
Quoted 20 lines · Philippe Gerum
Quoted 19 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 8 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200Quoted 7 lines
RTDM: Fix potential NULL pointer dereference
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Quoted 8 lines
Quoted 4 lines
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
You mean that your current implementation, does poll, right? Because mine does not, that was the point of it, also to solve races in cross-context management IIRC.
Polling is part of the RTDM API: If a driver requests it via EAGAIN, we have to provide it. We may deprecate this feature long-term, but for now there are no drop-in replacements available and we have drivers in the field that make use of it.
Quoted 4 lines
That patch dates back to the 2.5 -rc
cycle, when I needed it to have a decent behavior while working on the RTIPC stuff. It should not be that difficult to forward port it to -head, I guess. Let me know if I can help.
Thanks. The patch is done, it just waits for the final tests as I wrote. I would be happy if you could test it as well if you have something that nicely stresses e.g. RTIPC in this domain.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 26 lines · Jan Kiszka
Quoted 25 lines · Philippe Gerum
Quoted 23 lines · Jan Kiszka
Quoted 11 lines · Gilles Chanteperdrix
Quoted 10 lines · GIT version control
Module: xenomai-jki Branch: for-upstream Commit: 55ebde80258b5b6c3d29d37b5f30a3199faf0881 URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55ebde80258b5b6c3d29d37b5f30a3199faf0881Author: Wolfgang Mauerer <[email protected]> Date: Tue Mar 30 11:13:33 2010 +0200RTDM: Fix potential NULL pointer dereference
Quoted 7 lines
Quoted 5 lines
The rework in
95278926edc559d4misses the case that context can be NULL, which can (and has) triggered a kernel oops. Take care of this case.Signed-off-by Wolfgang Mauerer <[email protected]>Signed-off-by Jan Kiszka <[email protected]>I still think that fix is a useles waste of time. Let us merge Philippe's patches instead.
Please accept that Philippe's patch is orthogonal to this bug.
And it didn't work as-is. I'll post a rework which has the same benefit (avoiding to poll on pending context references) - once it is tested.
Quoted 8 lines
Quoted 3 lines
You mean that your current implementation, does poll, right? Because mine does not, that was the point of it, also to solve races in cross-context management IIRC.
Polling is part of the RTDM API: If a driver requests it via EAGAIN, we have to provide it. We may deprecate this feature long-term, but for now there are no drop-in replacements available and we have drivers in the field that make use of it.
Well, you likely know my feeling about this. Being bug-compatible induces more issues than it solves in the long run. As a frequent RTDM user myself, I must admit that the close issue has been a real PITA over time, and I guess a lot more people are suffering in silence. So anything to solve it properly, I mean following the POLA, would be warmly welcomed. POSIX is sometimes silly, but follows POLA for sure.
Quoted 10 lines
Quoted 5 lines
That patch dates back to the 2.5 -rc
cycle, when I needed it to have a decent behavior while working on the RTIPC stuff. It should not be that difficult to forward port it to -head, I guess. Let me know if I can help.Thanks. The patch is done, it just waits for the final tests as I wrote. I would be happy if you could test it as well if you have something that nicely stresses e.g. RTIPC in this domain.
Ok, I can do that. Let me know when I can try things.
Quoted 2 lines
Jan
Signature · 1 line
Philippe.