[PATCH 0/3] net/sched: Load modules via alias

From: Michal Koutný
Date: Wed Dec 06 2023 - 14:28:08 EST


These modules may be loaded lazily without user's awareness and
control. Add respective aliases to modules and request them under these
aliases so that modprobe's blacklisting mechanism (through aliases)
works for them. (The same pattern exists e.g. for filesystem
modules.)

Original module names remain unchanged.

Patches were generated with the help of Coccinelle scripts like:

cat >scripts/coccinelle/misc/tcf_alias.cocci <<EOD
virtual patch
virtual report

@ haskernel @
@@

@ tcf_has_kind depends on report && haskernel @
identifier ops;
constant K;
@@

static struct tcf_proto_ops ops = {
.kind = K,
...
};
+char module_alias = K;
EOD

/usr/bin/spatch -D report --cocci-file scripts/coccinelle/misc/tcf_alias.cocci \
--dir . \
-I ./arch/x86/include -I ./arch/x86/include/generated -I ./include \
-I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi \
-I ./include/uapi -I ./include/generated/uapi \
--include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h \
--jobs 8 --chunksize 1 2>/dev/null | \
sed 's/char module_alias = "\([^"]*\)";/MODULE_ALIAS_TCF("\1");/'

Changes from v1 (https://lore.kernel.org/r/20231121175640.9981-1-mkoutny@xxxxxxxx)
- Treat sch_ and act_ modules analogously to cls_

Michal Koutný (3):
net/sched: cls: Load net classifier modules via alias
net/sched: sch: Load qdisc modules via alias
net/sched: act: Load TC action modules via alias

include/net/act_api.h | 1 +
include/net/pkt_cls.h | 1 +
include/net/pkt_sched.h | 1 +
net/sched/act_api.c | 2 +-
net/sched/act_bpf.c | 1 +
net/sched/act_connmark.c | 1 +
net/sched/act_csum.c | 1 +
net/sched/act_ct.c | 1 +
net/sched/act_ctinfo.c | 1 +
net/sched/act_gact.c | 1 +
net/sched/act_gate.c | 1 +
net/sched/act_ife.c | 1 +
net/sched/act_ipt.c | 2 ++
net/sched/act_mirred.c | 1 +
net/sched/act_mpls.c | 1 +
net/sched/act_nat.c | 1 +
net/sched/act_pedit.c | 1 +
net/sched/act_police.c | 1 +
net/sched/act_sample.c | 1 +
net/sched/act_simple.c | 1 +
net/sched/act_skbedit.c | 1 +
net/sched/act_skbmod.c | 1 +
net/sched/act_tunnel_key.c | 1 +
net/sched/act_vlan.c | 1 +
net/sched/cls_api.c | 2 +-
net/sched/cls_basic.c | 1 +
net/sched/cls_bpf.c | 1 +
net/sched/cls_cgroup.c | 1 +
net/sched/cls_flow.c | 1 +
net/sched/cls_flower.c | 1 +
net/sched/cls_fw.c | 1 +
net/sched/cls_matchall.c | 1 +
net/sched/cls_route.c | 1 +
net/sched/cls_u32.c | 1 +
net/sched/sch_api.c | 2 +-
net/sched/sch_cake.c | 1 +
net/sched/sch_cbs.c | 1 +
net/sched/sch_choke.c | 1 +
net/sched/sch_codel.c | 1 +
net/sched/sch_drr.c | 1 +
net/sched/sch_etf.c | 1 +
net/sched/sch_ets.c | 1 +
net/sched/sch_fq.c | 1 +
net/sched/sch_fq_codel.c | 1 +
net/sched/sch_gred.c | 1 +
net/sched/sch_hfsc.c | 1 +
net/sched/sch_hhf.c | 1 +
net/sched/sch_htb.c | 1 +
net/sched/sch_ingress.c | 2 ++
net/sched/sch_mqprio.c | 1 +
net/sched/sch_multiq.c | 1 +
net/sched/sch_netem.c | 1 +
net/sched/sch_pie.c | 1 +
net/sched/sch_plug.c | 1 +
net/sched/sch_prio.c | 1 +
net/sched/sch_qfq.c | 1 +
net/sched/sch_red.c | 1 +
net/sched/sch_sfb.c | 1 +
net/sched/sch_sfq.c | 1 +
net/sched/sch_skbprio.c | 1 +
net/sched/sch_taprio.c | 1 +
net/sched/sch_tbf.c | 1 +
62 files changed, 64 insertions(+), 3 deletions(-)

--
2.42.1