Lucas De Marchi | 23 May 2013 20:13
Picon
Gravatar

Re: modprobe: Cannot load blacklisted module by symbol

Hi David,

On Thu, May 23, 2013 at 2:38 PM, David Henningsson
<david.henningsson@...> wrote:
> Hi Lucas,
>
> I'm not sure if you're the right person to contact, if not, feel free to
> redirect me.

Yes, but make sure to CC the mailing list (done now).

>
> While debugging and testing some other code, we were trying to use the
> kernel symbol_request() call. This does not work if the module to be loaded
> is blacklisted, whereas module_request() for the same module succeeds.
> E g, when "i915" is blacklisted, loading "i915" still succeeds, but not
> "symbol:i915_gpu_busy".
>
> I think I've traced this down to this commit [1]. Is this expected
> behaviour? We certainly did not expect it.

Yes, that's because blacklist doesn't apply to the module names,
unless "-b" is given (which I would expect to be the normal behavior,
but this inherited from module-init-tools).

Since symbol:i915_gpu_busy is treated as an alias, the blacklist
applies for this one though.

Why do you want to load i915 by symbol if it's blacklisted?

(Continue reading)

Chengwei Yang | 7 May 2013 16:54
Picon
Favicon

[PATCH] Fix 'make check': undeclared __NR_finit_module

This issue introduced by a fix for syscall(-1, ...) is invalid on some
arch. The error thrown by 'make check' likes below.

testsuite/init_module.c: In function 'syscall':
testsuite/init_module.c:317:17: error: '__NR_finit_module' undeclared
(first use in this function)
testsuite/init_module.c:317:17: note: each undeclared identifier is
reported only once for each function it appears in
make[2]: *** [testsuite/init_module.lo] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1
---
 libkmod/missing.h |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/libkmod/missing.h b/libkmod/missing.h
index b31af84..52dbcc7 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
 <at>  <at>  -12,6 +12,10  <at>  <at> 
 # define MODULE_INIT_IGNORE_MODVERSIONS 1
 #endif

+#ifndef __NR_finit_module
+# define __NR_finit_module -1
+#endif
+
 #ifndef MODULE_INIT_IGNORE_VERMAGIC
 # define MODULE_INIT_IGNORE_VERMAGIC 2
 #endif
(Continue reading)

Yang Chengwei | 7 May 2013 15:54
Picon
Favicon

[RFC] Fix the kmod internal list behavior?

Hi List,

I just found that there are some minor issues in kmod iternal list
implementation implemented by libkmod-list.c.

Say
	1. list_node_append() is identical with list_node_insert_before(),
	so somehow the list_node_append() in fact does "prepend" operation.

	2. just the same as list_node_append(), kmod_list_append() which
	invokes the former just do "prepend" operation rather than "append".

I'd like to fix these internal APIs to do the operation suggested by its
name like
	1. drop list_node_append()
	2. call list_node_insert_after() to do "append" operation
	3. call list_mode_insert_before() to do "prepend" operation

Since the list here is circular linked, so I think these changes should
not break things except the test cases.

Any comments are appreciated.

--
Thanks,
Chengwei
Stefan Achatz | 5 May 2013 16:55
Picon

depmod difference between module-init-tools and kmod

Hello,

I'm writing kernel modules for usb peripheries that are in mainline kernel and
also available as external compileable package[1].

The external modules have the newest code before it gets into the next kernel,
also backported for older kernels. To distinguish between outdated kernel
included and newer external modules they have different names. The device
specific kernel internal modules are called hid-roccat-* whereas the external
ones are called just *. This way a blacklist can prohibit loading the internal
modules when the external are installed.

Nevertheless, having both, internal and external, modules installed leads to
double symbols. depmod from module-init-tools has no problem with that (some
of the last versions tested), where the variant from kmod has its problem (v5
up to v12 tested). I observed this using Fedora 18, which seems to be the first
distro that uses kmods depmod.

Some outputs of both depmods for comparison are further down this text.

My question: Should this behaviour be fixed in kmods depmod, or is there a
intended, perhaps more intelligent, way for me to do what I intend?

Thanks and have a nice day
Stefan

**** depmod from module-init-tools

$ grep roccat /lib/modules/$(uname -r)/modules.dep

(Continue reading)

Chengwei Yang | 4 May 2013 11:07
Picon
Favicon

[V2, 1/2] Several minor fixes for documentation

---
 libkmod/libkmod-module.c |   12 +++++-------
 libkmod/libkmod.c        |    6 ++++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 47d12ad..b6fcc3b 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
 <at>  <at>  -570,8 +570,7  <at>  <at>  fail:
  * Drop a reference of each kmod module in  <at> list and releases the resources
  * taken by the list itself.
  *
- * Returns: NULL if  <at> mod is NULL or if the module was released. Otherwise it
- * returns the passed  <at> mod with its refcount decremented.
+ * Returns: 0
  */
 KMOD_EXPORT int kmod_module_unref_list(struct kmod_list *list)
 {
 <at>  <at>  -629,9 +628,8  <at>  <at>  static const struct kmod_list *module_get_dependencies_noref(const struct kmod_m
  * The result is cached in  <at> mod, so subsequent calls to this function will
  * return the already searched list of modules.
  *
- * Returns: NULL on failure or if there are any dependencies. Otherwise it
- * returns a list of kmod modules that can be released by calling
- * kmod_module_unref_list().
+ * Returns: NULL on failure. Otherwise it returns a list of kmod modules
+ * that can be released by calling kmod_module_unref_list().
  */
 KMOD_EXPORT struct kmod_list *kmod_module_get_dependencies(const struct kmod_module *mod)
(Continue reading)

Jan Luebbe | 2 May 2013 16:47
Picon
Favicon

[PATCH] libkmod: Avoid calling syscall() with -1

At least in qemu 1.4.1 for vexpress/arm-cortexa9, this resulted in an
illegal instruction error. Solve that by returning an error when
__NR_finit_module is -1.
---
 libkmod/missing.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libkmod/missing.h b/libkmod/missing.h
index edb88b9..ac24a35 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
 <at>  <at>  -20,8 +20,15  <at>  <at> 
 #endif

 #ifndef HAVE_FINIT_MODULE
+#include <errno.h>
+
 static inline int finit_module(int fd, const char *uargs, int flags)
 {
-	return syscall(__NR_finit_module, fd, uargs, flags);
+	if (__NR_finit_module == -1) {
+		errno = ENOSYS;
+		return -1;
+	} else {
+		return syscall(__NR_finit_module, fd, uargs, flags);
+	}
 }
 #endif
Johannes Berg | 2 May 2013 15:23
Favicon

[PATCH] modprobe: don't check refcount with remove command

From: Johannes Berg <johannes.berg@...>

The modprobe.d (5) documentation for the "install" command
states that you could specify

install fred /sbin/modprobe barney; /sbin/modprobe --ignore-install fred

This makes some sense, but then the loading of "barney" is
hidden from the user who did only "modprobe fred". Thus,
it seems it should be possible to be able to unload the
"fred" module with "modprobe -r fred" by configuring the
"barney" module to also be removed:

remove fred /sbin/rmmod barney fred

(or similar.)

Make this possible by not checking the refcount when an
unload command was configured.

Reported-by: David Spinadel <david.spinadel@...>
---
 tools/modprobe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/modprobe.c b/tools/modprobe.c
index a053efb..6b34658 100644
--- a/tools/modprobe.c
+++ b/tools/modprobe.c
 <at>  <at>  -386,7 +386,7  <at>  <at>  static int rmmod_do_module(struct kmod_module *mod, bool do_dependencies)
(Continue reading)

Chengwei Yang | 24 Apr 2013 10:21
Picon
Favicon

[PATCH] Fix: check cache before dump it

Signed-off-by: Chengwei Yang <chengwei.yang@...>
---
 libkmod/libkmod.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 98cf15e..fd91469 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
 <at>  <at>  -882,9 +882,14  <at>  <at>  KMOD_EXPORT int kmod_dump_index(struct kmod_ctx *ctx, enum kmod_index type,
 		return -ENOENT;

 	if (ctx->indexes[type] != NULL) {
-		DBG(ctx, "use mmaped index '%s'\n", index_files[type].fn);
-		index_mm_dump(ctx->indexes[type], fd,
+		char path[PATH_MAX];
+		snprintf(path, sizeof(path), "%s/%s.bin", ctx->dirname,
+						index_files[type].fn);
+		if (!is_cache_invalid(path, ctx->indexes_stamp[type])) {
+			DBG(ctx, "use mmaped index '%s'\n", index_files[type].fn);
+			index_mm_dump(ctx->indexes[type], fd,
 						index_files[type].prefix);
+		}
 	} else {
 		char fn[PATH_MAX];
 		struct index_file *idx;
--

-- 
1.7.9.5

(Continue reading)

Chengwei Yang | 24 Apr 2013 10:19
Picon
Favicon

[PATCH 0/2] Polish document

There are two patches for kmod documentation, the first fix several minor bugs
and the second one is a relative large change. It add more document for
exported enums.

Chengwei Yang (2):
  Several minor fixes for documentation
  Add document about exported enum definitions

 libkmod/docs/libkmod-sections.txt |    6 +++
 libkmod/libkmod-module.c          |   89 ++++++++++++++++++++++++++++++-------
 libkmod/libkmod.c                 |   23 +++++++---
 libkmod/libkmod.h                 |   32 ++++++-------
 4 files changed, 113 insertions(+), 37 deletions(-)

--

-- 
1.7.9.5

Tom Gundersen | 19 Apr 2013 23:53
Picon
Gravatar

[PATCH v2] static-nodes: tmpfiles - also create parents directories of device nodes

Before:

c /dev/cpu/microcode 0600 - - - 10:184
c /dev/fuse 0600 - - - 10:229
c /dev/btrfs-control 0600 - - - 10:234
c /dev/loop-control 0600 - - - 10:237
c /dev/snd/timer 0600 - - - 116:33

After:

d /dev/cpu 0755 - - -
c /dev/cpu/microcode 0600 - - - 10:184
c /dev/fuse 0600 - - - 10:229
c /dev/btrfs-control 0600 - - - 10:234
c /dev/loop-control 0600 - - - 10:237
d /dev/snd 0755 - - -
c /dev/snd/timer 0600 - - - 116:33
---

v2: avoid using libgen.h as requested by Lucas

 tools/static-nodes.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/static-nodes.c b/tools/static-nodes.c
index 65a36fc..2f9773a 100644
--- a/tools/static-nodes.c
+++ b/tools/static-nodes.c
 <at>  <at>  -85,12 +85,20  <at>  <at>  static const struct static_nodes_format static_nodes_format_human = {
 static int write_tmpfiles(FILE *out, char modname[], char devname[], char type, unsigned int maj,
(Continue reading)

Tom Gundersen | 19 Apr 2013 23:12
Picon
Gravatar

[PATCH] static-nodes: tmpfiles - also create parents directories of device nodes

Before:

c /dev/cpu/microcode 0600 - - - 10:184
c /dev/fuse 0600 - - - 10:229
c /dev/btrfs-control 0600 - - - 10:234
c /dev/loop-control 0600 - - - 10:237
c /dev/snd/timer 0600 - - - 116:33

After:

d /dev/cpu 0755 - - -
c /dev/cpu/microcode 0600 - - - 10:184
c /dev/fuse 0600 - - - 10:229
c /dev/btrfs-control 0600 - - - 10:234
c /dev/loop-control 0600 - - - 10:237
d /dev/snd 0755 - - -
c /dev/snd/timer 0600 - - - 116:33
---
 tools/static-nodes.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/tools/static-nodes.c b/tools/static-nodes.c
index 65a36fc..b88e09c 100644
--- a/tools/static-nodes.c
+++ b/tools/static-nodes.c
 <at>  <at>  -22,6 +22,7  <at>  <at> 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
+#include <libgen.h>
(Continue reading)


Gmane