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:	Tue, 04 Nov 2008 20:27:51 -0500
From:	Masami Hiramatsu <mhiramat@...hat.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>, ananth@...ibm.com,
	David Miller <davem@...emloft.net>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] kprobes: disable preempt for module_text_address()

Hi Lai,

Lai Jiangshan wrote:
> __register_kprobe() may be preempted after module_text_address()
> but before try_module_get(), and in this interval the module may be
> unloaded and try_module_get(probed_mod) will access to invalid address.
> this patch uses preempt_disable() to protect it.

Thank you for your work.

I think this is the problem of module_text_address() because it can
return incorrect address of struct module if a preemption happens.
So, I think the module_text_address() would better to call try_module_get()
before returning its address, or at least they should comment that caller
needs disabling preemption.

struct module *module_text_address(unsigned long addr)
{
	struct module *mod;

	preempt_disable(); /*
			    * I also think this preemption disabling is not so useful
			    * without try_module_get(), because caller have to
			    * disable preemption...
			    */
	mod = __module_text_address(addr);
	/* here, try_module_get() is needed.
	 * (or commenting "caller must disable preemption!") */
	preempt_enable();

	/*
	 * !!Here!! if the preemption happened, it could return invalid "mod".
         * In that case, even if module_text_address() returns non-NULL,
	 * the addr is no longer in any module.
	 */
	return mod;
}

Thank you,

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@...hat.com

--
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