login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
October
»
21
Re: [PATCH 1/2] tracing: Prevent unloadable modules from using trace_bprintk()
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Frederic Weisbecker
Subject:
Re: [PATCH 1/2] tracing: Prevent unloadable modules from using trace_bprintk()
Date: Wednesday, October 20, 2010 - 8:42 pm
On Wed, Oct 20, 2010 at 10:42:34PM -0400, Steven Rostedt wrote:
quoted text
> From: Steven Rostedt <srostedt@redhat.com> > > While debugging a module, I found that unloading the module and > then reading the ring buffer can cause strange side effects, including > a kernel crash. > > This is due to the trace_bprintk(). The trace_bprintk() is a faster > version of trace_printk(). The difference is that trace_bprintk() > only copies the arguments and a pointer to the format string into > the ring buffer. > > If a module uses this function and is unloaded, the pointer back to > the format string in the module is still around. If the trace file > is read, then the pointer is referenced and this can cause a kernel > oops. > > The simple solution is to not let modules use trace_bprintk() and > instead it will use the slower version of this. > > When talking with Frederic Weisbecker about it, he suggested not to > punish modules that can not be unloaded since they do not have > this side effect. Modules that can not be unloaded can still use > trace_bprintk(). We added a check for MODVERSIONS to be set to make > sure that the module and kernel have the same options. If you > run without MODVERSIONS set, and you load a module that was compiled > differently, then that's just your tough luck. > > Cc: Frederic Weisbecker <fweisbec@gmail.com> > Cc: Thomas Gleixner <tglx@linutronix.de> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org> > --- > include/linux/kernel.h | 21 +++++++++++++++++++-- > kernel/trace/trace_printk.c | 2 ++ > 2 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/include/linux/kernel.h b/include/linux/kernel.h > index 2b0a35e..1003476 100644 > --- a/include/linux/kernel.h > +++ b/include/linux/kernel.h > @@ -538,6 +538,23 @@ do { \ > ____trace_printk_check_format(fmt, ##args); \ > } while (0) > > +/* > + * Module code must not use trace_bprintk, because if it is unloaded > + * then we leave a pointer back to the module code inside > + * the ring buffer, and then reading the ring buffer may cause a bug. > + * > + * We do allow for modules to use it if the kernel does not allow > + * unloading of modules, and MODVERSIONS is set (to make sure kernel > + * and module are the same). If you load modules without MODVERSIONS > + * set, then you deserve what you get. > + */ > +#if defined(MODULE) && \
Did you mean CONFIG_MODULE may be? Thanks. --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 1/2] tracing: Prevent unloadable modules from using ...
, Steven Rostedt
, (Wed Oct 20, 7:42 pm)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Frederic Weisbecker
, (Wed Oct 20, 8:42 pm)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Steven Rostedt
, (Wed Oct 20, 8:47 pm)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Frederic Weisbecker
, (Wed Oct 20, 8:54 pm)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Ingo Molnar
, (Thu Oct 21, 1:16 am)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Steven Rostedt
, (Thu Oct 21, 3:57 am)
Re: [PATCH 1/2] tracing: Prevent unloadable modules from u ...
, Ingo Molnar
, (Thu Oct 21, 4:05 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Kay Sievers
Re: char/tpm: tpm_infineon no longer loaded for HP 2510p laptop
Eric W. Biederman
[PATCH 8/8] sysfs: user namespaces: fix bug with clone(CLONE_NEWUSER) with fairsched
S K
Re: cpufreq doesn't seem to work in Intel Q9300
Bart Van Assche
Re: Is gcc thread-unsafe?
Greg Kroah-Hartman
[PATCH 20/36] Driver core: Call device_pm_add() after bus_add_device() in device_a...
git
:
Junio C Hamano
Re: git-svnimport
Junio C Hamano
Re: [PATCH] git-mv: Keep moved index entries inact
Johannes Schindelin
Re: [PATCH] Fix approxidate("never") to always return 0
A Large Angry SCM
Re: [RFC] origin link for cherry-pick and revert
Gabriel
[PATCH] When a remote is added but not fetched, tell the user.
linux-netdev
:
Daniel Lezcano
getsockopt(TCP_DEFER_ACCEPT) value change
David Miller
Re: 2.6.27.18: bnx2/tg3: BUG: "scheduling while atomic" trying to ifenslave a seco...
Ingo Molnar
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
Eric W. Biederman
[PATCH 14/20] net: Simplify pppol2tp pernet operations.
Jeff Kirsher
[net-2.6 PATCH 2/5] e1000e: increase swflag acquisition timeout for ICHx/PCH
git-commits-head
:
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Linux Kernel Mailing List
sm501: add power control callback
Linux Kernel Mailing List
MIPS: Cavium: Remove unused watchdog code.
Linux Kernel Mailing List
V4L/DVB (8976): af9015: Add USB ID for AVerMedia A309
Linux Kernel Mailing List
ARM: 5670/1: bcmring: add default configuration for bcmring arch
openbsd-misc
:
daniele.pilenga
snmpd hangs on 4.1 looking up hrSWRunTable
Jason Dixon
Re: any web management gui for pf ?
Christophe Rioux
Implementation example of snmp
Nick Holland
Re: booting openbsd on eee without cd-rom
Bryan Irvine
Re: OpenBSD 4.7 Released, May 19 2010
Colocation donated by:
Syndicate