Skip to content

Commit c14e522

Browse files
Aaron Tomlinmcgrof
authored andcommitted
module: Make module_flags_taint() accept a module's taints bitmap and usable outside core code
No functional change. The purpose of this patch is to modify module_flags_taint() to accept a module's taints bitmap as a parameter and modifies all users accordingly. Furthermore, it is now possible to access a given module's taint flags data outside of non-essential code yet does remain for internal use only. This is in preparation for module unload taint tracking support. Signed-off-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 80140a8 commit c14e522

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

kernel/module/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ int cmp_name(const void *name, const void *sym);
100100
long module_get_offset(struct module *mod, unsigned int *size, Elf_Shdr *sechdr,
101101
unsigned int section);
102102
char *module_flags(struct module *mod, char *buf);
103+
size_t module_flags_taint(unsigned long taints, char *buf);
103104

104105
static inline unsigned long kernel_symbol_value(const struct kernel_symbol *sym)
105106
{

kernel/module/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,13 +890,13 @@ static inline int module_unload_init(struct module *mod)
890890
}
891891
#endif /* CONFIG_MODULE_UNLOAD */
892892

893-
static size_t module_flags_taint(struct module *mod, char *buf)
893+
size_t module_flags_taint(unsigned long taints, char *buf)
894894
{
895895
size_t l = 0;
896896
int i;
897897

898898
for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
899-
if (taint_flags[i].module && test_bit(i, &mod->taints))
899+
if (taint_flags[i].module && test_bit(i, &taints))
900900
buf[l++] = taint_flags[i].c_true;
901901
}
902902

@@ -974,7 +974,7 @@ static ssize_t show_taint(struct module_attribute *mattr,
974974
{
975975
size_t l;
976976

977-
l = module_flags_taint(mk->mod, buffer);
977+
l = module_flags_taint(mk->mod->taints, buffer);
978978
buffer[l++] = '\n';
979979
return l;
980980
}
@@ -2993,7 +2993,7 @@ char *module_flags(struct module *mod, char *buf)
29932993
mod->state == MODULE_STATE_GOING ||
29942994
mod->state == MODULE_STATE_COMING) {
29952995
buf[bx++] = '(';
2996-
bx += module_flags_taint(mod, buf + bx);
2996+
bx += module_flags_taint(mod->taints, buf + bx);
29972997
/* Show a - for module-is-being-unloaded */
29982998
if (mod->state == MODULE_STATE_GOING)
29992999
buf[bx++] = '-';

0 commit comments

Comments
 (0)