Modules changes for v6.1-rc1

There's only two pathes queued up for v6.1 for modules, these have
 been grinding on linux-next for at least 4 weeks now:
 
   * David Disseldorp's minor enhancement for sysfs compression string
   * Aaron Tomlin's debugfs interface to view unloaded tainted modules
 
 But there are other changes queued up for testing for the next merge
 window already. One change being still discussed, and *not* yet even close
 to testing on linux-next, but worth mentioning to put on your radar is
 the generalization of the bpf prog_pack thing. The idea with that is to
 generalize the iTLB gains seen with using huge pages on eBPF to other text
 uses on the kernel (modules, ftrace, kprobes). Song Liu is doing a good job
 following up on that difficult task as the semantics for the special
 permissions are crap, and it really hasn't been easy to put all this
 together. The latest effort can be read on his vmalloc_exec() patch
 series [0].
 
 Aaron will have a fix posted soon for the debugfs interface for unloaded
 modules, when that comes I'll just bounce that to you as it should be
 merged.
 
 [0] https://lkml.kernel.org/r/20220818224218.2399791-1-song@kernel.org
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCgAwFiEENnNq2KuOejlQLZofziMdCjCSiKcFAmM/beASHG1jZ3JvZkBr
 ZXJuZWwub3JnAAoJEM4jHQowkoinKRoQAKNZRWte0LC2kRn9NA5skKWxg5eVWW2i
 /gtG/FlubUpV+Oq+ZT38tVoZ7etTXZILCpOXmEKT0ZcComMA+Es8R3jd0b7TqNUb
 OvQW8ZfNnF5EJsI3i//M40Tj7H05MhQdIWkbIVmQrYMgzP847nRz4mzEYyYqpVPO
 1SRa4YsmDMUpdqe0rYe2p/o9aBl2ejjm15h5oO7yc3xC0xvRL+DpcBG441Ovru+z
 M3V9xu07TywVemLdbnET16yxk6D4rweHt37KBwsuKUHr/LIv8eWFXhadNJmUhHAQ
 /APh93rjRN4MsDTRhdWaUZK2gEl4HM3skahObxbobHX1Oyth6yqcGXQ04sIEfjzn
 1d3Mz/jg3br+Cr9P5DFWeCaaq1XVumJELej46FrS7Gb8Ga5DFA9EaoQ8tfT6+Yae
 dDkum+1xbg16Jm2Ajat2H8cd64dqkNo/EmkqgWyjoVl+wx6WVgJprt8tcLcp8SH6
 x19b8FzPoJf5wDGYEza75/f19A6Ep13PyGv78DVKi5D7dnYcul366tes4lFYGg6G
 ZeH7x2owl4h9eEA92gRj0YeJ27piPcGpRU4DQA2Wzy/VM5FQ4JNNyp5yIfd1OXp6
 NZzWrflvxn4dAFYMI8+ax6kxwF9QOWQcRLoPaV0mT8zAggsefWk8Bu8Vhc+OpAwl
 yvNzOCCZdh4z
 =g/mg
 -----END PGP SIGNATURE-----

Merge tag 'modules-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux

Pull module updates from Luis Chamberlain:

 - minor enhancement for sysfs compression string (David Disseldorp)

 - debugfs interface to view unloaded tainted modules (Aaron Tomlin)

* tag 'modules-6.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux:
  module/decompress: generate sysfs string at compile time
  module: Add debugfs interface to view unloaded tainted modules
This commit is contained in:
Linus Torvalds 2022-10-10 12:13:36 -07:00
commit 385f4a1019
2 changed files with 69 additions and 1 deletions

View File

@ -256,7 +256,7 @@ void module_decompress_cleanup(struct load_info *info)
static ssize_t compression_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%s\n", __stringify(MODULE_COMPRESSION));
return sysfs_emit(buf, __stringify(MODULE_COMPRESSION) "\n");
}
static struct kobj_attribute module_compression_attr = __ATTR_RO(compression);

View File

@ -10,6 +10,7 @@
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/debugfs.h>
#include <linux/rculist.h>
#include "internal.h"
@ -59,3 +60,70 @@ void print_unloaded_tainted_modules(void)
}
}
}
#ifdef CONFIG_DEBUG_FS
static void *unloaded_tainted_modules_seq_start(struct seq_file *m, loff_t *pos)
__acquires(rcu)
{
rcu_read_lock();
return seq_list_start_rcu(&unloaded_tainted_modules, *pos);
}
static void *unloaded_tainted_modules_seq_next(struct seq_file *m, void *p, loff_t *pos)
{
return seq_list_next_rcu(p, &unloaded_tainted_modules, pos);
}
static void unloaded_tainted_modules_seq_stop(struct seq_file *m, void *p)
__releases(rcu)
{
rcu_read_unlock();
}
static int unloaded_tainted_modules_seq_show(struct seq_file *m, void *p)
{
struct mod_unload_taint *mod_taint;
char buf[MODULE_FLAGS_BUF_SIZE];
size_t l;
mod_taint = list_entry(p, struct mod_unload_taint, list);
l = module_flags_taint(mod_taint->taints, buf);
buf[l++] = '\0';
seq_printf(m, "%s (%s) %llu", mod_taint->name, buf, mod_taint->count);
seq_puts(m, "\n");
return 0;
}
static const struct seq_operations unloaded_tainted_modules_seq_ops = {
.start = unloaded_tainted_modules_seq_start,
.next = unloaded_tainted_modules_seq_next,
.stop = unloaded_tainted_modules_seq_stop,
.show = unloaded_tainted_modules_seq_show,
};
static int unloaded_tainted_modules_open(struct inode *inode, struct file *file)
{
return seq_open(file, &unloaded_tainted_modules_seq_ops);
}
static const struct file_operations unloaded_tainted_modules_fops = {
.open = unloaded_tainted_modules_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init unloaded_tainted_modules_init(void)
{
struct dentry *dir;
dir = debugfs_create_dir("modules", NULL);
debugfs_create_file("unloaded_tainted", 0444, dir, NULL,
&unloaded_tainted_modules_fops);
return 0;
}
module_init(unloaded_tainted_modules_init);
#endif /* CONFIG_DEBUG_FS */