Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758430Ab2EaU01 (ORCPT ); Thu, 31 May 2012 16:26:27 -0400 Received: from casper.infradead.org ([85.118.1.10]:41069 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758306Ab2EaU00 convert rfc822-to-8bit (ORCPT ); Thu, 31 May 2012 16:26:26 -0400 Message-ID: <1338495969.28384.119.camel@twins> Subject: Re: [PATCH 1/5] ftrace: Synchronize variable setting with breakpoints From: Peter Zijlstra To: Steven Rostedt Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Frederic Weisbecker , Masami Hiramatsu , "H. Peter Anvin" , Dave Jones , Andi Kleen , acme Date: Thu, 31 May 2012 22:26:09 +0200 In-Reply-To: <1338495006.13348.418.camel@gandalf.stny.rr.com> References: <20120531012829.160060586@goodmis.org> <20120531020440.476352979@goodmis.org> <1338462398.28384.52.camel@twins> <1338473302.13348.336.camel@gandalf.stny.rr.com> <1338486029.28384.93.camel@twins> <1338486820.13348.366.camel@gandalf.stny.rr.com> <1338487413.28384.103.camel@twins> <1338490218.13348.379.camel@gandalf.stny.rr.com> <1338491176.28384.114.camel@twins> <20120531195529.GA22976@Krystal> <1338495006.13348.418.camel@gandalf.stny.rr.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2132 Lines: 45 On Thu, 2012-05-31 at 16:10 -0400, Steven Rostedt wrote: > On Thu, 2012-05-31 at 15:55 -0400, Mathieu Desnoyers wrote: > > > > Also, why did Mathieu insist on keeping that kmap()? > > > > Not sure about the entire context here, but the goal of using kmap() is > > to allow modification of text in configurations where the kernel text > > is read-only: the kmap does a temporary shadow RW mapping that allows > > modification of the text. Presumably that Ftrace's 30k changes are done > > before the kernel text mapping is set to read-only ? If this is the > > case, then it is similar to text_poke_early, which don't use the kmap > > since it happens before kernel text gets write-protected. But text_poke > > has to deal with RO pages. > > No this is also when ftrace is enabled at runtime. The trick that ftrace > does is to temporarially convert the kernel text from ro to rw, and > then back to ro when done. You can argue that this degrades the security > of the system, but tracing every function in the kernel does too ;-) > That's why it's a root only utility. Right, but when you loose stop-machine you could simply do 30k kmap_atomic/kunmap_atomic's consecutively since you're not holding anybody up. > Hmm, this brings up another question. By default, perf does not allow > users to profile trace_events correct? IOW, perf does not let > unprivileged users call text_poke()? I just tried it and got the: > > $ ~/bin/perf record -e sched:sched_switch sleep 1 > Permission error - are you root? > Consider tweaking /proc/sys/kernel/perf_event_paranoid: > -1 - Not paranoid at all > 0 - Disallow raw tracepoint access for unpriv > 1 - Disallow cpu events for unpriv > 2 - Disallow kernel profiling for unpriv It would, except tools/perf does stupid, its unconditionally adding PERF_SAMPLE_RAW (even for non-sampling events), which is the bit that requires privs. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/