net/sched: Load modules via alias
Subsystems (8)
v3 cover net/sched: Load modules via alias
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.)
For example (before the change):
$ tc filter add dev lo parent 1: protocol ip prio 1 handle 10 tcindex ... # cls_tcindex module is loaded despite a `blacklist cls_tcindex` entry # in /etc/modprobe.d/*.conf
After the change:
$ tc filter add dev lo parent 1: protocol ip prio 1 handle 10 tcindex ... Unknown filter "tcindex", hence option "..." is unparsable # explicit/acknowledged (privileged) action is needed $ modprobe cls_tcindex # blacklist entry won't apply to this direct modprobe, module is # loaded with awareness
A considered alternative was invoking modprobe -b always from request_module(), however, dismissed as too intrusive and slightly confusing in favor of the precedented aliases (the commit 7f78e0351394 ("fs: Limit sys_mount to only request filesystem modules.").
User experience suffers in both alternatives. It's improvement is orthogonal to blacklist honoring.
Changes from v1 (https://lore.kernel.org/r/[email protected])
- Treat sch_ and act_ modules analogously to cls_
Changes from v2 (https://lore.kernel.org/r/[email protected])
- reorganized commits (one generated commit + manual pre-/post- work)
- used alias names more fitting the existing net- aliases
- more info in commit messages and cover letter
- rebased on current master
Michal Koutný (4):
net/sched: Add helper macros with module names net/sched: Add module aliases for cls_,sch_,act_ modules net/sched: Load modules via their alias net/sched: Remove aliases of act_xt and sch_clsact
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 | 3 ++- 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 | 3 ++- 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(+), 5 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/4 net/sched: Add helper macros with module names
The macros are preparation for adding module aliases en mass in a separate commit.
Although it would be tempting to create aliases like cls-foo for name cls_foo, this could not be used because modprobe utilities treat '-' and '_' interchangeably.
In the end, the naming follows pattern of proto modules in linux/net.h.
--- include/net/act_api.h | 1 + include/net/pkt_cls.h | 1 + include/net/pkt_sched.h | 1 + 3 files changed, 3 insertions(+)
include/net/act_api.h +1 -0
@@ -200,6 +200,7 @@ int tcf_idr_release(struct tc_action *a, bool bind);int tcf_register_action (struct tc_action_ops *a,struct pernet_operations *ops);int tcf_unregister_action (struct tc_action_ops *a,struct pernet_operations *ops); +#define MODULE_ALIAS_NET_ACT (kind) MODULE_ALIAS("net-act-" __stringify(kind))int tcf_action_destroy (struct tc_action *actions[],int bind);int tcf_action_exec (struct sk_buff *skb,struct tc_action **actions,int nr_actions,struct tcf_result *res);
include/net/pkt_cls.h +1 -0
@@ -24,6 +24,7 @@ struct tcf_walker {int register_tcf_proto_ops (struct tcf_proto_ops *ops);void unregister_tcf_proto_ops (struct tcf_proto_ops *ops); +#define MODULE_ALIAS_NET_CLS (kind) MODULE_ALIAS("net-cls-" __stringify(kind))struct tcf_block_ext_info {enum flow_block_binder_type binder_type;
include/net/pkt_sched.h +1 -0
@@ -100,6 +100,7 @@ struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,int register_qdisc (struct Qdisc_ops *qops);void unregister_qdisc (struct Qdisc_ops *qops); +#define MODULE_ALIAS_NET_SCH (id) MODULE_ALIAS("net-sch-" __stringify(id))void qdisc_get_default (char *id,size_t len);int qdisc_set_default (const char *id);
Signature · 1 line
2.43.0
Re: [PATCH v3 1/4] net/sched: Add helper macros with module names
Quoted 31 lines · Michal Koutný
The macros are preparation for adding module aliases en mass in a separate commit.
Although it would be tempting to create aliases like cls-foo for namecls_foo, this could not be used because modprobe utilities treat '-' and '_' interchangeably.
In the end, the naming follows pattern of proto modules inlinux/net.h.Signed-off-by Michal Koutný <[email protected]>--- include/net/act_api.h | 1 + include/net/pkt_cls.h | 1 + include/net/pkt_sched.h | 1 + 3 files changed, 3 insertions(+)include/net/act_api.h +1
-0@@ -200,6 +200,7 @@ int tcf_idr_release(struct tc_action *a, bool bind);int tcf_register_action (struct tc_action_ops *a,struct pernet_operations *ops);int tcf_unregister_action (struct tc_action_ops *a,struct pernet_operations *ops); +#define MODULE_ALIAS_NET_ACT (kind) MODULE_ALIAS("net-act-" __stringify(kind))int tcf_action_destroy (struct tc_action *actions[],int bind);int tcf_action_exec (struct sk_buff *skb,struct tc_action **actions,int nr_actions,struct tcf_result *res);include/net/pkt_cls.h +0
-0
include/net/pkt_cls.h struct tcf_walker { · line 26
Quoted 3 lines
include/net/pkt_cls.h +0
-0@@ -24,6 +24,7 @@ struct tcf_walker {int register_tcf_proto_ops (struct tcf_proto_ops *ops); void unregister_tcf_proto_ops(struct tcf_proto_ops *ops); > +#define MODULE_ALIAS_NET_CLS(kind) MODULE_ALIAS("net-cls-"
__stringify(kind))
I believe something like (untested):
#define TC_CLS_ALIAS_PREFIX "tc-cls-"
#define MODULE_ALIAS_TC_CLS(kind) MODULE_ALIAS(TC_CLS_ALIAS_PREFIX __stringify(kind))
And then reuse the macro:
request_module(TC_CLS_ALIAS_PREFIX "%s", cls_name);
Would look better. In any case, net-next is currently closed. You will need to repost once it reopens.
It seems you are also missing a rebase. We recently removed act_ipt :).
Quoted 15 lines
include/net/pkt_cls.h +0
-0struct tcf_block_ext_info {enum flow_block_binder_type binder_type;include/net/pkt_sched.h +1
-0@@ -100,6 +100,7 @@ struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,int register_qdisc (struct Qdisc_ops *qops);void unregister_qdisc (struct Qdisc_ops *qops); +#define MODULE_ALIAS_NET_SCH (id) MODULE_ALIAS("net-sch-" __stringify(id))void qdisc_get_default (char *id,size_t len);int qdisc_set_default (const char *id);
Re: [PATCH v3 1/4] net/sched: Add helper macros with module names
Quoted 1 line · Pedro Tammela
request_module(TC_CLS_ALIAS_PREFIX "%s", cls_name);
Yeah, that would be more systemic without proliferating literal strings.
Quoted 4 lines
Would look better. In any case, net-next is currently closed. You will need to repost once it reopens.
It seems you are also missing a rebase. We recently removed
act_ipt:).
I see, I rebased only on torvalds/master then (commit de927f6c0b07 ("Merge tag 's390-6.8-1' ofgit://git.kernel.org/pub/scm/linux/kernel/git/s390/linux")).
I'm not familiar with netdev tree, I will post after Jan 22 as suggested.
Thanks,
Michal
PATCH v3 2/4 net/sched: Add module aliases for cls_,sch_,act_ modules
In reply to Michal KoutnýNo functional change intended, aliases will be used in followup commits. Note for backporters: you may need to add aliases also for modules that are already removed in mainline kernel but still in your version.
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_NET_CLS("\1");/'And analogously for:
static struct tc_action_ops ops = {
.kind = K,
static struct Qdisc_ops ops = {
.id = K,(Someone familiar would be able to fit those into one .cocci file without sed post processing.)
--- 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_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_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 + 56 files changed, 58 insertions(+)
net/sched/act_bpf.c +1 -0
@@ -401,6 +401,7 @@ static struct tc_action_ops act_bpf_ops __read_mostly = { .init = tcf_bpf_init, .size = sizeof(struct tcf_bpf), }; +MODULE_ALIAS_NET_ACT ("bpf" );static __net_init int bpf_init_net (struct net *net) {
net/sched/act_connmark.c +1 -0
@@ -242,6 +242,7 @@ static struct tc_action_ops act_connmark_ops = { .cleanup = tcf_connmark_cleanup, .size = sizeof(struct tcf_connmark_info), }; +MODULE_ALIAS_NET_ACT ("connmark" );static __net_init int connmark_init_net (struct net *net) {
net/sched/act_csum.c +1 -0
@@ -709,6 +709,7 @@ static struct tc_action_ops act_csum_ops = { .offload_act_setup = tcf_csum_offload_act_setup, .size = sizeof(struct tcf_csum), }; +MODULE_ALIAS_NET_ACT ("csum" );static __net_init int csum_init_net (struct net *net) {
net/sched/act_ct.c +1 -0
@@ -1600,6 +1600,7 @@ static struct tc_action_ops act_ct_ops = { .offload_act_setup = tcf_ct_offload_act_setup, .size = sizeof(struct tcf_ct), }; +MODULE_ALIAS_NET_ACT ("ct" );static __net_init int ct_init_net (struct net *net) {
net/sched/act_ctinfo.c +1 -0
@@ -363,6 +363,7 @@ static struct tc_action_ops act_ctinfo_ops = { .cleanup= tcf_ctinfo_cleanup, .size = sizeof(struct tcf_ctinfo), }; +MODULE_ALIAS_NET_ACT ("ctinfo" );static __net_init int ctinfo_init_net (struct net *net) {
net/sched/act_gact.c +1 -0
@@ -296,6 +296,7 @@ static struct tc_action_ops act_gact_ops = { .offload_act_setup = tcf_gact_offload_act_setup, .size = sizeof(struct tcf_gact), }; +MODULE_ALIAS_NET_ACT ("gact" );static __net_init int gact_init_net (struct net *net) {
net/sched/act_gate.c +1 -0
@@ -645,6 +645,7 @@ static struct tc_action_ops act_gate_ops = { .offload_act_setup = tcf_gate_offload_act_setup, .size = sizeof(struct tcf_gate), }; +MODULE_ALIAS_NET_ACT ("gate" );static __net_init int gate_init_net (struct net *net) {
net/sched/act_ife.c +1 -0
@@ -889,6 +889,7 @@ static struct tc_action_ops act_ife_ops = { .init = tcf_ife_init, .size = sizeof(struct tcf_ife_info), }; +MODULE_ALIAS_NET_ACT ("ife" );static __net_init int ife_init_net (struct net *net) {
net/sched/act_ipt.c +2 -0
@@ -381,6 +381,7 @@ static struct tc_action_ops act_ipt_ops = { .init = tcf_ipt_init, .size = sizeof(struct tcf_ipt), }; +MODULE_ALIAS_NET_ACT ("ipt" );static __net_init int ipt_init_net (struct net *net) {
@@ -411,6 +412,7 @@ static struct tc_action_ops act_xt_ops = { .init = tcf_xt_init, .size = sizeof(struct tcf_ipt), }; +MODULE_ALIAS_NET_ACT ("xt" );static __net_init int xt_init_net (struct net *net) {
net/sched/act_mirred.c +1 -0
@@ -505,6 +505,7 @@ static struct tc_action_ops act_mirred_ops = { .size = sizeof(struct tcf_mirred), .get_dev = tcf_mirred_get_dev, }; +MODULE_ALIAS_NET_ACT ("mirred" );static __net_init int mirred_init_net (struct net *net) {
net/sched/act_mpls.c +1 -0
@@ -452,6 +452,7 @@ static struct tc_action_ops act_mpls_ops = { .offload_act_setup = tcf_mpls_offload_act_setup, .size = sizeof(struct tcf_mpls), }; +MODULE_ALIAS_NET_ACT ("mpls" );static __net_init int mpls_init_net (struct net *net) {
net/sched/act_nat.c +1 -0
@@ -324,6 +324,7 @@ static struct tc_action_ops act_nat_ops = { .cleanup = tcf_nat_cleanup, .size = sizeof(struct tcf_nat), }; +MODULE_ALIAS_NET_ACT ("nat" );static __net_init int nat_init_net (struct net *net) {
net/sched/act_pedit.c +1 -0
@@ -620,6 +620,7 @@ static struct tc_action_ops act_pedit_ops = { .offload_act_setup = tcf_pedit_offload_act_setup, .size = sizeof(struct tcf_pedit), }; +MODULE_ALIAS_NET_ACT ("pedit" );static __net_init int pedit_init_net (struct net *net) {
net/sched/act_police.c +1 -0
@@ -502,6 +502,7 @@ static struct tc_action_ops act_police_ops = { .offload_act_setup = tcf_police_offload_act_setup, .size = sizeof(struct tcf_police), }; +MODULE_ALIAS_NET_ACT ("police" );static __net_init int police_init_net (struct net *net) {
net/sched/act_sample.c +1 -0
@@ -316,6 +316,7 @@ static struct tc_action_ops act_sample_ops = { .offload_act_setup = tcf_sample_offload_act_setup, .size = sizeof(struct tcf_sample), }; +MODULE_ALIAS_NET_ACT ("sample" );static __net_init int sample_init_net (struct net *net) {
net/sched/act_simple.c +1 -0
@@ -209,6 +209,7 @@ static struct tc_action_ops act_simp_ops = { .init = tcf_simp_init, .size = sizeof(struct tcf_defact), }; +MODULE_ALIAS_NET_ACT ("simple" );static __net_init int simp_init_net (struct net *net) {
net/sched/act_skbedit.c +1 -0
@@ -426,6 +426,7 @@ static struct tc_action_ops act_skbedit_ops = { .offload_act_setup = tcf_skbedit_offload_act_setup, .size = sizeof(struct tcf_skbedit), }; +MODULE_ALIAS_NET_ACT ("skbedit" );static __net_init int skbedit_init_net (struct net *net) {
net/sched/act_skbmod.c +1 -0
@@ -287,6 +287,7 @@ static struct tc_action_ops act_skbmod_ops = { .cleanup = tcf_skbmod_cleanup, .size = sizeof(struct tcf_skbmod), }; +MODULE_ALIAS_NET_ACT ("skbmod" );static __net_init int skbmod_init_net (struct net *net) {
net/sched/act_tunnel_key.c +1 -0
@@ -842,6 +842,7 @@ static struct tc_action_ops act_tunnel_key_ops = { .offload_act_setup = tcf_tunnel_key_offload_act_setup, .size = sizeof(struct tcf_tunnel_key), }; +MODULE_ALIAS_NET_ACT ("tunnel_key" );static __net_init int tunnel_key_init_net (struct net *net) {
net/sched/act_vlan.c +1 -0
@@ -427,6 +427,7 @@ static struct tc_action_ops act_vlan_ops = { .offload_act_setup = tcf_vlan_offload_act_setup, .size = sizeof(struct tcf_vlan), }; +MODULE_ALIAS_NET_ACT ("vlan" );static __net_init int vlan_init_net (struct net *net) {
net/sched/cls_basic.c +1 -0
@@ -328,6 +328,7 @@ static struct tcf_proto_ops cls_basic_ops __read_mostly = { .bind_class = basic_bind_class, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("basic" );static int __init init_basic (void ) {
net/sched/cls_bpf.c +1 -0
@@ -693,6 +693,7 @@ static struct tcf_proto_ops cls_bpf_ops __read_mostly = { .dump = cls_bpf_dump, .bind_class = cls_bpf_bind_class, }; +MODULE_ALIAS_NET_SCH ("bpf" );static int __init cls_bpf_init_mod (void ) {
net/sched/cls_cgroup.c +1 -0
@@ -209,6 +209,7 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = { .dump = cls_cgroup_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("cgroup" );static int __init init_cgroup_cls (void ) {
net/sched/cls_flow.c +1 -0
@@ -702,6 +702,7 @@ static struct tcf_proto_ops cls_flow_ops __read_mostly = { .walk = flow_walk, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("flow" );static int __init cls_flow_init (void ) {
net/sched/cls_flower.c +1 -0
@@ -3633,6 +3633,7 @@ static struct tcf_proto_ops cls_fl_ops __read_mostly = { .owner = THIS_MODULE, .flags = TCF_PROTO_OPS_DOIT_UNLOCKED, }; +MODULE_ALIAS_NET_SCH ("flower" );static int __init cls_fl_init (void ) {
net/sched/cls_fw.c +1 -0
@@ -433,6 +433,7 @@ static struct tcf_proto_ops cls_fw_ops __read_mostly = { .bind_class = fw_bind_class, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("fw" );static int __init init_fw (void ) {
net/sched/cls_matchall.c +1 -0
@@ -398,6 +398,7 @@ static struct tcf_proto_ops cls_mall_ops __read_mostly = { .bind_class = mall_bind_class, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("matchall" );static int __init cls_mall_init (void ) {
net/sched/cls_route.c +1 -0
@@ -671,6 +671,7 @@ static struct tcf_proto_ops cls_route4_ops __read_mostly = { .bind_class = route4_bind_class, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("route" );static int __init init_route4 (void ) {
net/sched/cls_u32.c +1 -0
@@ -1453,6 +1453,7 @@ static struct tcf_proto_ops cls_u32_ops __read_mostly = { .bind_class = u32_bind_class, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("u32" );static int __init init_u32 (void ) {
net/sched/sch_cake.c +1 -0
@@ -3103,6 +3103,7 @@ static struct Qdisc_ops cake_qdisc_ops __read_mostly = { .dump_stats = cake_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("cake" );static int __init cake_module_init (void ) {
net/sched/sch_cbs.c +1 -0
@@ -546,6 +546,7 @@ static struct Qdisc_ops cbs_qdisc_ops __read_mostly = { .dump = cbs_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("cbs" );static struct notifier_block cbs_device_notifier = { .notifier_call = cbs_dev_notifier,
net/sched/sch_choke.c +1 -0
@@ -498,6 +498,7 @@ static struct Qdisc_ops choke_qdisc_ops __read_mostly = { .dump_stats = choke_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("choke" );static int __init choke_module_init (void ) {
net/sched/sch_codel.c +1 -0
@@ -287,6 +287,7 @@ static struct Qdisc_ops codel_qdisc_ops __read_mostly = { .dump_stats = codel_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("codel" );static int __init codel_module_init (void ) {
net/sched/sch_drr.c +1 -0
@@ -481,6 +481,7 @@ static struct Qdisc_ops drr_qdisc_ops __read_mostly = { .destroy = drr_destroy_qdisc, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("drr" );static int __init drr_init (void ) {
net/sched/sch_etf.c +1 -0
@@ -500,6 +500,7 @@ static struct Qdisc_ops etf_qdisc_ops __read_mostly = { .dump = etf_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("etf" );static int __init etf_module_init (void ) {
net/sched/sch_ets.c +1 -0
@@ -812,6 +812,7 @@ static struct Qdisc_ops ets_qdisc_ops __read_mostly = { .dump = ets_qdisc_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("ets" );static int __init ets_init (void ) {
net/sched/sch_fq.c +1 -0
@@ -1264,6 +1264,7 @@ static struct Qdisc_ops fq_qdisc_ops __read_mostly = { .dump_stats = fq_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("fq" );static int __init fq_module_init (void ) {
net/sched/sch_fq_codel.c +1 -0
@@ -717,6 +717,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { .dump_stats = fq_codel_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("fq_codel" );static int __init fq_codel_module_init (void ) {
net/sched/sch_gred.c +1 -0
@@ -930,6 +930,7 @@ static struct Qdisc_ops gred_qdisc_ops __read_mostly = { .dump = gred_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("gred" );static int __init gred_module_init (void ) {
net/sched/sch_hfsc.c +1 -0
@@ -1679,6 +1679,7 @@ static struct Qdisc_ops hfsc_qdisc_ops __read_mostly = { .priv_size = sizeof(struct hfsc_sched), .owner = THIS_MODULE }; +MODULE_ALIAS_NET_SCH ("hfsc" );static int __init hfsc_init (void )
net/sched/sch_hhf.c +1 -0
@@ -702,6 +702,7 @@ static struct Qdisc_ops hhf_qdisc_ops __read_mostly = { .dump_stats = hhf_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("hhf" );static int __init hhf_module_init (void ) {
net/sched/sch_htb.c +1 -0
@@ -2166,6 +2166,7 @@ static struct Qdisc_ops htb_qdisc_ops __read_mostly = { .dump = htb_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("htb" );static int __init htb_module_init (void ) {
net/sched/sch_ingress.c +2 -0
@@ -168,6 +168,7 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = { .ingress_block_get = ingress_ingress_block_get, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("ingress" );struct clsact_sched_data {struct tcf_block *ingress_block;
@@ -344,6 +345,7 @@ static struct Qdisc_ops clsact_qdisc_ops __read_mostly = { .egress_block_get = clsact_egress_block_get, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("clsact" );static int __init ingress_module_init (void ) {
net/sched/sch_mqprio.c +1 -0
@@ -774,6 +774,7 @@ static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = { .dump = mqprio_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("mqprio" );static int __init mqprio_module_init (void ) {
net/sched/sch_multiq.c +1 -0
@@ -395,6 +395,7 @@ static struct Qdisc_ops multiq_qdisc_ops __read_mostly = { .dump = multiq_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("multiq" );static int __init multiq_module_init (void ) {
net/sched/sch_netem.c +1 -0
@@ -1293,6 +1293,7 @@ static struct Qdisc_ops netem_qdisc_ops __read_mostly = { .dump = netem_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("netem" );static int __init netem_module_init (void )
net/sched/sch_pie.c +1 -0
@@ -556,6 +556,7 @@ static struct Qdisc_ops pie_qdisc_ops __read_mostly = { .dump_stats = pie_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("pie" );static int __init pie_module_init (void ) {
net/sched/sch_plug.c +1 -0
@@ -213,6 +213,7 @@ static struct Qdisc_ops plug_qdisc_ops __read_mostly = { .reset = qdisc_reset_queue, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("plug" );static int __init plug_module_init (void ) {
net/sched/sch_prio.c +1 -0
@@ -418,6 +418,7 @@ static struct Qdisc_ops prio_qdisc_ops __read_mostly = { .dump = prio_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("prio" );static int __init prio_module_init (void ) {
net/sched/sch_qfq.c +1 -0
@@ -1521,6 +1521,7 @@ static struct Qdisc_ops qfq_qdisc_ops __read_mostly = { .destroy = qfq_destroy_qdisc, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("qfq" );static int __init qfq_init (void ) {
net/sched/sch_red.c +1 -0
@@ -548,6 +548,7 @@ static struct Qdisc_ops red_qdisc_ops __read_mostly = { .dump_stats = red_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("red" );static int __init red_module_init (void ) {
net/sched/sch_sfb.c +1 -0
@@ -709,6 +709,7 @@ static struct Qdisc_ops sfb_qdisc_ops __read_mostly = { .dump_stats = sfb_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("sfb" );static int __init sfb_module_init (void ) {
net/sched/sch_sfq.c +1 -0
@@ -925,6 +925,7 @@ static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { .dump = sfq_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("sfq" );static int __init sfq_module_init (void ) {
net/sched/sch_skbprio.c +1 -0
@@ -292,6 +292,7 @@ static struct Qdisc_ops skbprio_qdisc_ops __read_mostly = { .destroy = skbprio_destroy, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("skbprio" );static int __init skbprio_module_init (void ) {
net/sched/sch_taprio.c +1 -0
@@ -2548,6 +2548,7 @@ static struct Qdisc_ops taprio_qdisc_ops __read_mostly = { .dump_stats = taprio_dump_stats, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("taprio" );static struct notifier_block taprio_device_notifier = { .notifier_call = taprio_dev_notifier,
net/sched/sch_tbf.c +1 -0
@@ -608,6 +608,7 @@ static struct Qdisc_ops tbf_qdisc_ops __read_mostly = { .dump = tbf_dump, .owner = THIS_MODULE, }; +MODULE_ALIAS_NET_SCH ("tbf" );static int __init tbf_module_init (void ) {
Signature · 1 line
2.43.0
PATCH v3 3/4 net/sched: Load modules via their alias
In reply to Michal KoutnýThe cls_,sch_,act_ modules may be loaded lazily during network configuration but without user's awareness and control.
Switch the lazy loading from canonical module names to a module alias. This allows finer control over lazy loading, the precedent from commit 7f78e0351394 ("fs: Limit sys_mount to only request filesystem modules.") explains it already:
Using aliases means user space can control the policy of which filesystem^W net/sched modules are auto-loaded by editing /etc/modprobe.d/*.conf with blacklist and alias directives. Allowing simple, safe, well understood work-arounds to known problematic software.
By default, nothing changes. However, if a specific module is blacklisted (its canonical name), it won't be modprobe'd when requested under its alias (i.e. kernel auto-loading). It would appear as if the given module was unknown.
The module can still be loaded under its canonical name, which is an explicit (privileged) user action.
--- net/sched/act_api.c | 2 +- net/sched/cls_api.c | 2 +- net/sched/sch_api.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/sched/act_api.c +1 -1
@@ -1331,7 +1331,7 @@ struct tc_action_ops *tc_action_load_ops(struct nlattr *nla, bool police,#ifdef CONFIG_MODULES if (rtnl_held)rtnl_unlock (); -request_module ("act_%s" , act_name); +request_module ("net-act-%s" , act_name);if (rtnl_held)rtnl_lock ();
net/sched/cls_api.c +1 -1
@@ -257,7 +257,7 @@ tcf_proto_lookup_ops(const char *kind, bool rtnl_held,#ifdef CONFIG_MODULES if (rtnl_held)rtnl_unlock (); -request_module ("cls_%s" , kind); +request_module ("net-cls-%s" , kind);if (rtnl_held)rtnl_lock (); ops =__tcf_proto_lookup_ops (kind);
net/sched/sch_api.c +1 -1
@@ -1246,7 +1246,7 @@ static struct Qdisc *qdisc_create(struct net_device *dev,* go away in the mean time. */ rtnl_unlock (); -request_module ("sch_%s" , name); +request_module ("net-sch-%s" , name);rtnl_lock (); ops =qdisc_lookup_ops (kind);if (ops !=NULL ) {
Signature · 1 line
2.43.0
PATCH v3 4/4 net/sched: Remove aliases of act_xt and sch_clsact
In reply to Michal KoutnýThe modules act_ipt and sch_ingress standout among net/sched modules because they provide multiple act/sch functionalities in a single .ko. They have aliases to make autoloading work for any of the provided functionalities.
Since the autoloading was changed to uniformly request any functionality under its alias, the non-systemic aliases can be removed now (i.e. assuming the alias were only used to ensure autoloading).
--- net/sched/act_ipt.c | 1 - net/sched/sch_ingress.c | 1 - 2 files changed, 2 deletions(-)
net/sched/act_ipt.c +0 -1
@@ -436,7 +436,6 @@ static struct pernet_operations xt_net_ops = {MODULE_AUTHOR ("Jamal Hadi Salim(2002-13)" );MODULE_DESCRIPTION ("Iptables target actions" );MODULE_LICENSE ("GPL" ); -MODULE_ALIAS ("act_xt" );static int __init ipt_init_module (void ) {
net/sched/sch_ingress.c +0 -1
@@ -370,6 +370,5 @@ static void __exit ingress_module_exit(void)module_init (ingress_module_init);module_exit (ingress_module_exit); -MODULE_ALIAS ("sch_clsact" );MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Ingress and clsact based ingress and egress qdiscs" );
Signature · 1 line
2.43.0
Jakub Kicinski
maintainerQuoted 5 lines · On Fri, 12 Jan 2024 19:06:42 +0100 Michal Koutný wrote:
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.)
## Form letter - net-next-closed
The merge window for v6.8 has begun and we have already posted our pull request. Therefore net-next is closed for new drivers, features, code refactoring and optimizations. We are currently accepting bug fixes only.
Please repost when net-next reopens after January 22nd.
RFC patches sent for review only are obviously welcome at any time.
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
Signature · 1 line
pw-bot: defer