Hi Dave, et al,
Example output:
crash> mod
MODULE NAME TAINT SIZE OBJECT FILE
ffffffffa0008ee0 scsi_transport_iscsi (PFUT) 57491 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa0021020 libiscsi 50543 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa0055a20 qla4xxx (U) 221130 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa0060160 video 18992 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa0065000 mdio 13436 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa006c000 libiscsi_tcp (T) 24177 (not loaded)
[CONFIG_KALLSYMS]
ffffffffa007c040 libcxgbi 56493 (not loaded)
[CONFIG_KALLSYMS]
...
Any thoughts?
Regards,
Aaron
---8<---
---
kernel.c.org 2013-02-14 20:38:54.000000000 +0000
+++ kernel.c 2013-03-15 16:36:19.116726704 +0000
@@ -3424,6 +3424,54 @@
return retval;
}
+char *show_module_taint(ulong module_address, char *buf)
+{
+ int gpgsig_ok;
+ unsigned int taints;
+ int bx = 0;
+
+ if (MEMBER_EXISTS("module", "gpgsig_ok")) {
+ readmem(module_address + MEMBER_OFFSET("module", "gpgsig_ok"),
KVADDR, &gpgsig_ok,
+ sizeof(int), "module gpgsig_ok", FAULT_ON_ERROR);
+
+ if (!gpgsig_ok) {
+ buf[bx++] = '(';
+ buf[bx++] = 'U';
+ buf[bx++] = ')';
+ }
+ }
+
+ if (MEMBER_EXISTS("module", "taints")) {
+ readmem(module_address + MEMBER_OFFSET("module", "taints"), KVADDR,
&taints,
+ sizeof(ulong), "module taints", FAULT_ON_ERROR);
+
+ if (taints) {
+ buf[bx++] = '(';
+ if (taints & (1 << TAINT_PROPRIETARY_MODULE))
+ buf[bx++] = 'P';
+
+ if (taints & (1 << TAINT_OOT_MODULE))
+ buf[bx++] = 'O';
+
+ if (taints & (1 << TAINT_FORCED_MODULE))
+ buf[bx++] = 'F';
+
+ if (taints & (1 << TAINT_UNSIGNED_MODULE))
+ buf[bx++] = 'U';
+
+ if (taints & (1 << TAINT_CRAP))
+ buf[bx++] = 'C';
+
+ if (taints & (1 << TAINT_TECH_PREVIEW))
+ buf[bx++] = 'T';
+
+ buf[bx++] = ')';
+ }
+ buf[bx] = '\0';
+ }
+ return buf;
+}
+
/*
* Do the simple list work for cmd_mod().
@@ -3437,9 +3485,12 @@
struct load_module *lm, *lmp;
int maxnamelen;
int maxsizelen;
+ int maxtaintlen = 12;
+ char buf[maxtaintlen];
char buf1[BUFSIZE];
char buf2[BUFSIZE];
char buf3[BUFSIZE];
+ char buf4[BUFSIZE];
if (NO_MODULES())
return;
@@ -3461,11 +3512,12 @@
}
if (flag == LIST_MODULE_HDR) {
- fprintf(fp, "%s %s %s OBJECT FILE\n",
+ fprintf(fp, "%s %s%s %s OBJECT FILE\n",
mkstring(buf1, VADDR_PRLEN, CENTER|LJUST,
"MODULE"),
mkstring(buf2, maxnamelen, LJUST, "NAME"),
- mkstring(buf3, maxsizelen, RJUST, "SIZE"));
+ mkstring(buf3, maxtaintlen, LJUST, "TAINT"),
+ mkstring(buf4, maxsizelen, RJUST, "SIZE"));
}
for (i = 0; i < kt->mods_installed; i++) {
@@ -3474,9 +3526,12 @@
(lm->mod_base == address)) {
fprintf(fp, "%s ", mkstring(buf1, VADDR_PRLEN,
LONG_HEX|RJUST, MKSTR(lm->module_struct)));
- fprintf(fp, "%s ", mkstring(buf2, maxnamelen,
+ fprintf(fp, "%s", mkstring(buf2, maxnamelen,
LJUST, lm->mod_name));
- fprintf(fp, "%s ", mkstring(buf3, maxsizelen,
+ /* Print module taint */
+ fprintf(fp, "%s ", mkstring(buf3, maxtaintlen,
+ LJUST, show_module_taint(lm->module_struct, buf)));
+ fprintf(fp, "%s ", mkstring(buf4, maxsizelen,
RJUST|LONG_DEC, MKSTR(lm->mod_size)));
// fprintf(fp, "%6ld ", lm->mod_size);
---
defs.h.org 2013-02-14 20:38:54.000000000 +0000
+++ defs.h 2013-03-15 16:36:16.505726642 +0000
@@ -177,6 +177,17 @@
};
/*
+ * Module taint flags
+ */
+
+#define TAINT_PROPRIETARY_MODULE 0
+#define TAINT_FORCED_MODULE 1
+#define TAINT_UNSIGNED_MODULE 6
+#define TAINT_CRAP 10
+#define TAINT_OOT_MODULE 12
+#define TAINT_TECH_PREVIEW 29
+
+/*
* program_context flags
*/
#define LIVE_SYSTEM (0x1ULL)