linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] uprobes: Use percpu_rw_semaphore to fix register/unregister vs dup_mmap() race
@ 2012-11-14 18:49 Oleg Nesterov
  2012-11-14 18:49 ` [PATCH v2 1/1] " Oleg Nesterov
  0 siblings, 1 reply; 3+ messages in thread
From: Oleg Nesterov @ 2012-11-14 18:49 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Srikar Dronamraju
  Cc: Ananth N Mavinakayanahalli, Andrew Morton, Anton Arapov,
	Tejun Heo, linux-kernel

Hello.

The same patch I sent before, the only difference is that it uses
percpu_rw_semaphore instead of brw_mutex.

Srikar, I'll hope you can ack v2 too, and unless someone objects
I'll ask Ingo to pull this fix.

Tejun, recently we briefly discussed signal->group_rwsem, please
see the note about cgroups below.

Note:

	- The current implementation of percpu_rw_semaphore is not
	  optimal, register/unregister will block fork() completely
	  while it sleeps in msleep() and synchronize_sched().

	  So this patch assumes that

	  	percpu_rw_semaphore-reimplement-to-not-block-the-readers-unnecessarily.patch
	  	http://marc.info/?l=linux-mm-commits&m=135240650828875

	  will be applied eventually (and the new implementation can be
	  improved).

	- This patch adds percpu_down_read/up_read around dup_mmap()
	  for uprobes.

	  Given that it is very cheap (and assuming the optimizations
	  above), _perhaps_ we can turn this dup_mmap_sem into fork_sem
	  and use it instead of threadgroup_change_begin/end, so that
	  uprobes and cgroups can use it.

	- Compared to v1, percpu_rw_semaphore doesn't support multi-
	  writers. I hope we can tolerate this, register/unregister
	  are system-wide and rare events anyway. And _perhaps_ we
	  can add percpu_down_write_nonexclusive() later.

	- Given that currently percpu_down_write() is exclusive, this
	  patch almost dismisses the purpose of uprobes_mutex[] array.

	  Yes, but we need to rework this locking anyway for filtering.

Oleg.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-15  6:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-14 18:49 [PATCH v2 0/1] uprobes: Use percpu_rw_semaphore to fix register/unregister vs dup_mmap() race Oleg Nesterov
2012-11-14 18:49 ` [PATCH v2 1/1] " Oleg Nesterov
2012-11-15  6:57   ` Srikar Dronamraju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).