On Thu 2021-02-18 12:41:39, Chris Down wrote: > Petr Mladek writes: > > > - See if it's safe to pass a printk_fmt_sec to seq_file instead of a > > > module > > > > Also it might be needed to store the pointer to struct module. > > You mean, have a `struct module` entry for this? I somewhat suspect that > module.c maintainers are not likely to be happy about injecting non-generic > code into there if it's possible to be avoided, but maybe I'm > misunderstanding?
Yes, I suggest to store the pointer into struct module. It includes many external entries. It is similar to struct task_struct. I am active also in the kernel livepatch subsystem. We have added there three values: #ifdef CONFIG_LIVEPATCH bool klp; /* Is this a livepatch module? */ bool klp_alive; /* Elf information */ struct klp_modinfo *klp_info; #endif Many other subsystems have their stuff there, for example: #ifdef CONFIG_TRACING unsigned int num_trace_bprintk_fmt; const char **trace_bprintk_fmt_start; #endif #ifdef CONFIG_EVENT_TRACING struct trace_event_call **trace_events; unsigned int num_trace_events; struct trace_eval_map **trace_evals; unsigned int num_trace_evals; #endif #ifdef CONFIG_FTRACE_MCOUNT_RECORD unsigned int num_ftrace_callsites; unsigned long *ftrace_callsites; #endif #ifdef CONFIG_KPROBES void *kprobes_text_start; unsigned int kprobes_text_size; unsigned long *kprobe_blacklist; unsigned int num_kprobe_blacklist; #endif BTW: Jessica originally worked on the kernel livepatching. She became module loader code maintainer because we needed even more hacks there and the original maintainer got busy with other stuff at that time ;-) I am pretty sure that she would accept it. We need a per-module value. It is not necessary to maintain separate global list/hash table just to store these values. Best Regards, Petr