login
Header Space

 
 

Re: [RFC, PATCH] fix SEM_UNDO with namespaces

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Serge E. Hallyn <serue@...>
Cc: Eric W. Biederman <ebiederm@...>, Pavel Emelyanov <xemul@...>, Linux Kernel Mailing List <linux-kernel@...>, Andrew Morton <akpm@...>, Sukadev Bhattiprolu <sukadev@...>
Date: Sunday, April 6, 2008 - 11:11 am

Serge E. Hallyn wrote:

The patch is bogus, sorry that I didn't notice it immediately.
The problem is ipc/sem.c, function find_undo, lookup_undo:
lookup_undo doesn't check the namespace pointer, thus a simple single 
threaded app can trigger the problem.

Attached is a test app and a kernel patch that shows the problem.
Run the test app immediately after boot (or within a new ipc namespace), 
otherwise the ipc sequence counter will prevent the app from triggering 
the problem: The undo structure that was created before unshare() [i.e. 
with 1 semaphore in it] will be used after unshare() [i.e. semaphore 100 
will be accessed].

With kernel debugging (full slub debugging) enabled, I even got an oops 
when I tried to ipcrm the left over array after running undons, probably 
because the undo structure was freed at exit_sem() within the new 
namespace, but still used in the outer namespace.

--
    Manfred
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Sun Mar 30, 4:50 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Pavel Emelyanov, (Mon Mar 31, 3:12 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Mon Mar 31, 12:14 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Pavel Emelyanov, (Tue Apr 1, 5:44 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Eric W. Biederman, (Tue Apr 1, 11:25 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Thu Apr 3, 3:44 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Fri Apr 4, 12:39 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Sun Apr 6, 11:11 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Mon Apr 14, 5:10 pm)
[PATCH] fix SEM_UNDO with namespaces, take 2, Manfred Spraul, (Sun Apr 6, 12:26 pm)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Pavel Emelyanov, (Mon Apr 7, 3:21 am)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Manfred Spraul, (Mon Apr 7, 1:03 pm)
Re: [PATCH] fix SEM_UNDO with namespaces, take 2, Pavel Emelyanov, (Tue Apr 8, 4:09 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Thu Apr 3, 3:40 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Serge E. Hallyn, (Tue Apr 1, 10:15 am)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Andrew Morton, (Thu Apr 3, 3:04 pm)
Re: [RFC, PATCH] fix SEM_UNDO with namespaces, Manfred Spraul, (Thu Apr 3, 3:31 pm)
speck-geostationary