[CRIU] [PATCH] restore: Serialize access to last_pid

Cyrill Gorcunov gorcunov at gmail.com
Sat Nov 16 21:17:32 MSK 2019


On Sat, Nov 16, 2019 at 10:10:14AM -0800, Andrey Vagin wrote:
> 
> context_lock has to return whether a mutex has been locked or not:
> 
> locked = context_lock();
> ....
> context_unlock(locked)l

No, it should not. Similar to spin_locks, this is void helpers
the only difference is that we keep the lock instacce hidden
in context and available for all processes.

> otherwise you can call mutex_unlock for the unlocked mutex or unlock a
> mutex which has been locked by someone else.

We don't have lockdep at all, which means two mutex_unlock
have the same effect. I see what you mean but lvalue doesn't
help anyhow.

> Actually, all this looks like overdesign...
> 
> I think we don't need context and another shared vma.
> 
> static struct *last_pid_mutex;
> 
> void clone_noasan_init(struct *last_pid_mu) {
> 	last_pid_mutex = last_pid_mu;
> }
> 
> and then call clone_noasan_init before forking the root task. Hmm?

You know, I would prefer to have it as a separate subsystem instead.
And actually would love to not use last_pid mutex at all but instead
call context_lock from pie code.

Still I won't insist, if you prefer last_pid_mutex with clone_noasan_init
I will make it so.


More information about the CRIU mailing list