lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 22 Oct 2010 09:49:33 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Li Zefan <lizf@...fujitsu.com>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	LKML <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...e.hu>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v2][GIT PULL] tracing: Prevent unloadable modules from
 using trace_bprintk()

On Fri, 2010-10-22 at 13:30 +0800, Li Zefan wrote:

> In fact tracepoint is free from this bug, because we'll empty the ring
> buffer if the unloading module has tracepoints in it.

Hehe, and I should know, I wrote that code :-)


> 
> So for trace_bprintk, why can't we do the same thing? If a module has
> trace_bprintk calls in it, just empty the ring buffer when unloading
> module.
> 
> And that's as simple as something like this:
> 
> diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
> index 2547d88..103987f 100644
> --- a/kernel/trace/trace_printk.c
> +++ b/kernel/trace/trace_printk.c
> @@ -80,6 +80,13 @@ static int module_trace_bprintk_format_notify(struct notifier_block *self,
>  
>  		if (val == MODULE_STATE_COMING)
>  			hold_module_trace_bprintk_format(start, end);
> +		else if (val == MODULE_STATE_GOING) {
> +			/*
> +			 * It is safest to reset the ring buffer if the
> +			 * module being unloaded uses trace_bprintk.
> +			 */
> +			tracing_reset_current_online_cpus();
> +		}
>  	}
>  	return 0;
>  }

This could definitely work.

But this prevents developers using trace_printk() in their exit() code.
We should probably add a trace_mod_printk() or something that just
forces the slow version that does not require flushing the ring buffer
on removal. As long as there's not a single trace_printk() in the
module, and it only uses the alternative, then this should work.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ