<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/module.c, branch v3.10.44</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.44</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v3.10.44'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2014-06-07T20:25:28Z</updated>
<entry>
<title>ftrace/module: Hardcode ftrace_module_init() call into load_module()</title>
<updated>2014-06-07T20:25:28Z</updated>
<author>
<name>Steven Rostedt (Red Hat)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2014-04-24T14:40:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7d54b5cd8d53f22f6f754debd27dd1453ee1b0b0'/>
<id>urn:sha1:7d54b5cd8d53f22f6f754debd27dd1453ee1b0b0</id>
<content type='text'>
commit a949ae560a511fe4e3adf48fa44fefded93e5c2b upstream.

A race exists between module loading and enabling of function tracer.

	CPU 1				CPU 2
	-----				-----
  load_module()
   module-&gt;state = MODULE_STATE_COMING

				register_ftrace_function()
				 mutex_lock(&amp;ftrace_lock);
				 ftrace_startup()
				  update_ftrace_function();
				   ftrace_arch_code_modify_prepare()
				    set_all_module_text_rw();
				   &lt;enables-ftrace&gt;
				    ftrace_arch_code_modify_post_process()
				     set_all_module_text_ro();

				[ here all module text is set to RO,
				  including the module that is
				  loading!! ]

   blocking_notifier_call_chain(MODULE_STATE_COMING);
    ftrace_init_module()

     [ tries to modify code, but it's RO, and fails!
       ftrace_bug() is called]

When this race happens, ftrace_bug() will produces a nasty warning and
all of the function tracing features will be disabled until reboot.

The simple solution is to treate module load the same way the core
kernel is treated at boot. To hardcode the ftrace function modification
of converting calls to mcount into nops. This is done in init/main.c
there's no reason it could not be done in load_module(). This gives
a better control of the changes and doesn't tie the state of the
module to its notifiers as much. Ftrace is special, it needs to be
treated as such.

The reason this would work, is that the ftrace_module_init() would be
called while the module is in MODULE_STATE_UNFORMED, which is ignored
by the set_all_module_text_ro() call.

Link: http://lkml.kernel.org/r/1395637826-3312-1-git-send-email-indou.takao@jp.fujitsu.com

Reported-by: Takao Indoh &lt;indou.takao@jp.fujitsu.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>module: do percpu allocation after uniqueness check. No, really!</title>
<updated>2013-07-13T18:42:26Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2013-07-03T00:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0b72ac9665b63dd029675ea601cb46defd2c974d'/>
<id>urn:sha1:0b72ac9665b63dd029675ea601cb46defd2c974d</id>
<content type='text'>
commit 8d8022e8aba85192e937f1f0f7450e256d66ae5c upstream.

v3.8-rc1-5-g1fb9341 was supposed to stop parallel kvm loads exhausting
percpu memory on large machines:

    Now we have a new state MODULE_STATE_UNFORMED, we can insert the
    module into the list (and thus guarantee its uniqueness) before we
    allocate the per-cpu region.

In my defence, it didn't actually say the patch did this.  Just that
we "can".

This patch actually *does* it.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Tested-by: Jim Hull &lt;jim.hull@hp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>kmemleak: No need for scanning specific module sections</title>
<updated>2013-05-17T08:53:36Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2013-05-15T19:46:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=89c837351db0b9b52fd572ec8b0445a42e59b75c'/>
<id>urn:sha1:89c837351db0b9b52fd572ec8b0445a42e59b75c</id>
<content type='text'>
As kmemleak now scans all module sections that are allocated, writable
and non executable, there's no need to scan individual sections that
might reference data.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>kmemleak: Scan all allocated, writeable and not executable module sections</title>
<updated>2013-05-17T08:53:07Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2013-05-15T19:33:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=06c9494c0e9bdfcaa14d6d2b096a0ff7abe8494f'/>
<id>urn:sha1:06c9494c0e9bdfcaa14d6d2b096a0ff7abe8494f</id>
<content type='text'>
Instead of just picking data sections by name (names that start
with .data, .bss or .ref.data), use the section flags and scan all
sections that are allocated, writable and not executable. Which should
cover all sections of a module that might reference data.

Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
[catalin.marinas@arm.com: removed unused 'name' variable]
[catalin.marinas@arm.com: collapsed 'if' blocks]
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>module: don't unlink the module until we've removed all exposure.</title>
<updated>2013-04-17T03:53:02Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2013-04-17T03:50:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=944a1fa01266aa9ace607f29551b73c41e9440e9'/>
<id>urn:sha1:944a1fa01266aa9ace607f29551b73c41e9440e9</id>
<content type='text'>
Otherwise we get a race between unload and reload of the same module:
the new module doesn't see the old one in the list, but then fails because
it can't register over the still-extant entries in sysfs:

 [  103.981925] ------------[ cut here ]------------
 [  103.986902] WARNING: at fs/sysfs/dir.c:536 sysfs_add_one+0xab/0xd0()
 [  103.993606] Hardware name: CrownBay Platform
 [  103.998075] sysfs: cannot create duplicate filename '/module/pch_gbe'
 [  104.004784] Modules linked in: pch_gbe(+) [last unloaded: pch_gbe]
 [  104.011362] Pid: 3021, comm: modprobe Tainted: G        W    3.9.0-rc5+ #5
 [  104.018662] Call Trace:
 [  104.021286]  [&lt;c103599d&gt;] warn_slowpath_common+0x6d/0xa0
 [  104.026933]  [&lt;c1168c8b&gt;] ? sysfs_add_one+0xab/0xd0
 [  104.031986]  [&lt;c1168c8b&gt;] ? sysfs_add_one+0xab/0xd0
 [  104.037000]  [&lt;c1035a4e&gt;] warn_slowpath_fmt+0x2e/0x30
 [  104.042188]  [&lt;c1168c8b&gt;] sysfs_add_one+0xab/0xd0
 [  104.046982]  [&lt;c1168dbe&gt;] create_dir+0x5e/0xa0
 [  104.051633]  [&lt;c1168e78&gt;] sysfs_create_dir+0x78/0xd0
 [  104.056774]  [&lt;c1262bc3&gt;] kobject_add_internal+0x83/0x1f0
 [  104.062351]  [&lt;c126daf6&gt;] ? kvasprintf+0x46/0x60
 [  104.067231]  [&lt;c1262ebd&gt;] kobject_add_varg+0x2d/0x50
 [  104.072450]  [&lt;c1262f07&gt;] kobject_init_and_add+0x27/0x30
 [  104.078075]  [&lt;c1089240&gt;] mod_sysfs_setup+0x80/0x540
 [  104.083207]  [&lt;c1260851&gt;] ? module_bug_finalize+0x51/0xc0
 [  104.088720]  [&lt;c108ab29&gt;] load_module+0x1429/0x18b0

We can teardown sysfs first, then to be sure, put the state in
MODULE_STATE_UNFORMED so it's ignored while we deconstruct it.

Reported-by: Veaceslav Falico &lt;vfalico@redhat.com&gt;
Tested-by: Veaceslav Falico &lt;vfalico@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
<entry>
<title>module: fix symbol versioning with symbol prefixes</title>
<updated>2013-03-20T00:57:26Z</updated>
<author>
<name>James Hogan</name>
<email>james.hogan@imgtec.com</email>
</author>
<published>2013-03-18T09:08:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a4b6a77b77ba4f526392612c2365797fab956014'/>
<id>urn:sha1:a4b6a77b77ba4f526392612c2365797fab956014</id>
<content type='text'>
Fix symbol versioning on architectures with symbol prefixes. Although
the build was free from warnings the actual modules still wouldn't load
as the ____versions table contained unprefixed symbol names, which were
being compared against the prefixed symbol names when checking the
symbol versions.

This is fixed by modifying modpost to add the symbol prefix to the
____versions table it outputs (Modules.symvers still contains unprefixed
symbol names). The check_modstruct_version() function is also fixed as
it checks the version of the unprefixed "module_layout" symbol which
would no longer work.

Signed-off-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Cc: Michal Marek &lt;mmarek@suse.cz&gt;
Cc: Sam Ravnborg &lt;sam@ravnborg.org&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Jonathan Kliegman &lt;kliegs@chromium.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt; (use VMLINUX_SYMBOL_STR)
</content>
</entry>
<entry>
<title>CONFIG_SYMBOL_PREFIX: cleanup.</title>
<updated>2013-03-15T04:39:43Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2013-03-15T04:34:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b92021b09df70c1609e3547f3d6128dd560be97f'/>
<id>urn:sha1:b92021b09df70c1609e3547f3d6128dd560be97f</id>
<content type='text'>
We have CONFIG_SYMBOL_PREFIX, which three archs define to the string
"_".  But Al Viro broke this in "consolidate cond_syscall and
SYSCALL_ALIAS declarations" (in linux-next), and he's not the first to
do so.

Using CONFIG_SYMBOL_PREFIX is awkward, since we usually just want to
prefix it so something.  So various places define helpers which are
defined to nothing if CONFIG_SYMBOL_PREFIX isn't set:

1) include/asm-generic/unistd.h defines __SYMBOL_PREFIX.
2) include/asm-generic/vmlinux.lds.h defines VMLINUX_SYMBOL(sym)
3) include/linux/export.h defines MODULE_SYMBOL_PREFIX.
4) include/linux/kernel.h defines SYMBOL_PREFIX (which differs from #7)
5) kernel/modsign_certificate.S defines ASM_SYMBOL(sym)
6) scripts/modpost.c defines MODULE_SYMBOL_PREFIX
7) scripts/Makefile.lib defines SYMBOL_PREFIX on the commandline if
   CONFIG_SYMBOL_PREFIX is set, so that we have a non-string version
   for pasting.

(arch/h8300/include/asm/linkage.h defines SYMBOL_NAME(), too).

Let's solve this properly:
1) No more generic prefix, just CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX.
2) Make linux/export.h usable from asm.
3) Define VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR().
4) Make everyone use them.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: James Hogan &lt;james.hogan@imgtec.com&gt;
Tested-by: James Hogan &lt;james.hogan@imgtec.com&gt; (metag)
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2013-02-27T04:16:07Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2013-02-27T04:16:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d895cb1af15c04c522a25c79cc429076987c089b'/>
<id>urn:sha1:d895cb1af15c04c522a25c79cc429076987c089b</id>
<content type='text'>
Pull vfs pile (part one) from Al Viro:
 "Assorted stuff - cleaning namei.c up a bit, fixing -&gt;d_name/-&gt;d_parent
  locking violations, etc.

  The most visible changes here are death of FS_REVAL_DOT (replaced with
  "has -&gt;d_weak_revalidate()") and a new helper getting from struct file
  to inode.  Some bits of preparation to xattr method interface changes.

  Misc patches by various people sent this cycle *and* ocfs2 fixes from
  several cycles ago that should've been upstream right then.

  PS: the next vfs pile will be xattr stuff."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
  saner proc_get_inode() calling conventions
  proc: avoid extra pde_put() in proc_fill_super()
  fs: change return values from -EACCES to -EPERM
  fs/exec.c: make bprm_mm_init() static
  ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
  ocfs2: fix possible use-after-free with AIO
  ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
  get_empty_filp()/alloc_file() leave both -&gt;f_pos and -&gt;f_version zero
  target: writev() on single-element vector is pointless
  export kernel_write(), convert open-coded instances
  fs: encode_fh: return FILEID_INVALID if invalid fid_type
  kill f_vfsmnt
  vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
  nfsd: handle vfs_getattr errors in acl protocol
  switch vfs_getattr() to struct path
  default SET_PERSONALITY() in linux/elf.h
  ceph: prepopulate inodes only when request is aborted
  d_hash_and_lookup(): export, switch open-coded instances
  9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
  9p: split dropping the acls from v9fs_set_create_acl()
  ...
</content>
</entry>
<entry>
<title>switch vfs_getattr() to struct path</title>
<updated>2013-02-26T07:46:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2013-01-24T07:18:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3dadecce20603aa380023c65e6f55f108fd5e952'/>
<id>urn:sha1:3dadecce20603aa380023c65e6f55f108fd5e952</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>module: clean up load_module a little more.</title>
<updated>2013-01-21T06:50:09Z</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2013-01-21T06:48:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a3535c7e4f4495fe947f7901d25447d80e04fe52'/>
<id>urn:sha1:a3535c7e4f4495fe947f7901d25447d80e04fe52</id>
<content type='text'>
1fb9341ac34825aa40354e74d9a2c69df7d2c304 made our locking in
load_module more complicated: we grab the mutex once to insert the
module in the list, then again to upgrade it once it's formed.

Since the locking is self-contained, it's neater to do this in
separate functions.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
</entry>
</feed>
