Re: [PATCH 2/3] livepatch/rcu: Warn when system consistency is broken in RCU code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 11, 2017 at 03:52:46PM +0200, Petr Mladek wrote:
> Anyway, a crazy idea is to use the livepatch consistency model instead
> of RCU to protect the function stack. The model makes sure that all
> tasks, including the idle ones, were not running any patched function
> (and their ftrace handlers) at some point. It should be safe
> but I am not sure if it is worth it.

http://i3.kym-cdn.com/photos/images/original/000/173/580/Wat.jpg

> Alternatively, it might be enough to use the probably more lightwight
> solution that is used when ftrace handlers are deregistered, I mean:
> 
> 	/*
> 	 * We need to do a hard force of sched synchronization.
> 	 * This is because we use preempt_disable() to do RCU, but
> 	 * the function tracers can be called where RCU is not watching
> 	 * (like before user_exit()). We can not rely on the RCU
> 	 * infrastructure to do the synchronization, thus we must do it
> 	 * ourselves.
> 	 */
> 	schedule_on_each_cpu(ftrace_sync);
> 
> 	/*
> 	 * When the kernel is preeptive, tasks can be preempted
> 	 * while on a ftrace trampoline. Just scheduling a task on
> 	 * a CPU is not good enough to flush them. Calling
> 	 * synchornize_rcu_tasks() will wait for those tasks to
> 	 * execute and either schedule voluntarily or enter user space.
> 	 */
> 	if (IS_ENABLED(CONFIG_PREEMPT))
> 		synchronize_rcu_tasks();

I couldn't grok the first idea, but this one sounds promising...

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux