在 /proc/modules 中标记 (F) 的模块

Ste*_* T. 9 kernel-modules

在我的 3.10 系统上,/proc/modules 中列出的一些模块被标记为 (F)。我想找到这个(F)的原因。我确信模块没有被强制加载并且是用内核构建的。能否请您指出是什么内核代码创建了 /proc/modules?

usb_storage 56610 0 - Live 0xffffffffa005d000 (F)
Run Code Online (Sandbox Code Playgroud)

如果我卸载并重新加载这个模块,(F)就会消失。

slm*_*slm 11

输出中的列/proc/modules如下。

usb_storage 56610 0    -   Live 0xffffffffa005d000 (F)
  (1)        (2) (3)  (4)  (5)         (6)         (7)
Run Code Online (Sandbox Code Playgroud)

注意:我没有发现似乎是第 7 列的内容,但我将其标记为这样的内容,因为第 6 列的描述(见下文)不包括显示在那里的信息。

摘录 - http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-proc-topfiles.html

  • 第一列包含模块的名称。
  • 第二列指的是模块的内存大小,以字节为单位。
  • 第三列列出了当前加载的模块实例数。零值表示卸载的模块。
  • 第四列说明模块是否依赖于另一个模块才能运行,并列出那些其他模块。
  • 第五列列出了模块所处的加载状态:Live、Loading 或 Unloading 是唯一可能的值。
  • 第六列列出了加载模块的当前内核内存偏移量。此信息可用于调试目的,或用于分析工具(如 oprofile)。

我相信标有(F)(即第 7 列)的列来自此文件中的此处 - panic.c.

/**
 *  print_tainted - return a string to represent the kernel taint state.
 *
 *  'P' - Proprietary module has been loaded.
 *  'F' - Module has been forcibly loaded.
 *  'S' - SMP with CPUs not designed for SMP.
 *  'R' - User forced a module unload.
 *  'M' - System experienced a machine check exception.
 *  'B' - System has hit bad_page.
 *  'U' - Userspace-defined naughtiness.
 *  'D' - Kernel has oopsed before
 *  'A' - ACPI table overridden.
 *  'W' - Taint on warning.
 *  'C' - modules from drivers/staging are loaded.
 *  'I' - Working around severe firmware bug.
 *  'O' - Out-of-tree module has been loaded.
 *  'E' - Unsigned module has been loaded.
 *
 *  The string is overwritten by the next call to print_tainted().
 */
Run Code Online (Sandbox Code Playgroud)

这些代码也是kernel.txt参考文档中存在的位掩码的表示。

tainted:

 Non-zero if the kernel has been tainted.  Numeric values, which
 can be ORed together:

    1 - A module with a non-GPL license has been loaded, this
        includes modules with no license.
        Set by modutils >= 2.4.9 and module-init-tools.
    2 - A module was force loaded by insmod -f.
        Set by modutils >= 2.4.9 and module-init-tools.
    4 - Unsafe SMP processors: SMP with CPUs not designed for SMP.
    8 - A module was forcibly unloaded from the system by rmmod -f.
   16 - A hardware machine check error occurred on the system.
   32 - A bad page was discovered on the system.
   64 - The user has asked that the system be marked "tainted".  This
        could be because they are running software that directly modifies
        the hardware, or for other reasons.
  128 - The system has died.
  256 - The ACPI DSDT has been overridden with one supplied by the user
         instead of using the one provided by the hardware.
  512 - A kernel warning has occurred.
 1024 - A module from drivers/staging was loaded.
 2048 - The system is working around a severe firmware bug.
 4096 - An out-of-tree module has been loaded.
 8192 - An unsigned module has been loaded in a kernel supporting module
        signature.
Run Code Online (Sandbox Code Playgroud)

参考