Pavel Emelyanov wrote: > No, switch_task_namespaces is the wrong place to do this. It is to be > done in copy_ipc_ns. If you need a task for which a new namespace is > being prepared, then pass one into it. > > copy_ipc_ns() is also the wrong place: There are calls after copy_ipc_ns() that can fail (e.g. copy_pid_ns()), and if they fail, then the whole syscall is aborted. But undoing outstanding semaphore operations cannot be undone. Or simpler: the copy_whatever() functions do not modify current. Another option would be within sys_unshare(): sys_unshare() first creates all new pointers, and then actual unsharing is performed. What do you think? I that the right place? The implementation could be moved into a seperate function, perhaps some of the NULL tests are superflous, too. -- Manfred