mirror of
https://github.com/dynup/kpatch
synced 2025-04-11 03:31:20 +00:00
test: add KPATCH_PRINTK test
This commit is contained in:
parent
9b86df0eee
commit
e2f706877d
155
test/integration/macro-printk.patch
Normal file
155
test/integration/macro-printk.patch
Normal file
@ -0,0 +1,155 @@
|
||||
Index: src/net/ipv4/fib_frontend.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_frontend.c
|
||||
+++ src/net/ipv4/fib_frontend.c
|
||||
@@ -626,6 +626,7 @@ errout:
|
||||
return err;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
{
|
||||
struct net *net = sock_net(skb->sk);
|
||||
@@ -644,6 +645,7 @@ static int inet_rtm_newroute(struct sk_b
|
||||
}
|
||||
|
||||
err = fib_table_insert(tb, &cfg);
|
||||
+ KPATCH_PRINTK("[inet_rtm_newroute]: err is %d\n", err);
|
||||
errout:
|
||||
return err;
|
||||
}
|
||||
Index: src/net/ipv4/fib_semantics.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_semantics.c
|
||||
+++ src/net/ipv4/fib_semantics.c
|
||||
@@ -773,6 +773,7 @@ __be32 fib_info_update_nh_saddr(struct n
|
||||
return nh->nh_saddr;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
{
|
||||
int err;
|
||||
@@ -797,6 +798,7 @@ struct fib_info *fib_create_info(struct
|
||||
#endif
|
||||
|
||||
err = -ENOBUFS;
|
||||
+ KPATCH_PRINTK("[fib_create_info]: create error err is %d\n",err);
|
||||
if (fib_info_cnt >= fib_info_hash_size) {
|
||||
unsigned int new_size = fib_info_hash_size << 1;
|
||||
struct hlist_head *new_info_hash;
|
||||
@@ -817,6 +819,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (!fib_info_hash_size)
|
||||
goto failure;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 2 create error err is %d\n",err);
|
||||
|
||||
fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
|
||||
if (fi == NULL)
|
||||
@@ -828,6 +831,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto failure;
|
||||
} else
|
||||
fi->fib_metrics = (u32 *) dst_default_metrics;
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err);
|
||||
|
||||
fi->fib_net = hold_net(net);
|
||||
fi->fib_protocol = cfg->fc_protocol;
|
||||
@@ -844,6 +848,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (!nexthop_nh->nh_pcpu_rth_output)
|
||||
goto failure;
|
||||
} endfor_nexthops(fi)
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 4 create error err is %d\n",err);
|
||||
|
||||
if (cfg->fc_mx) {
|
||||
struct nlattr *nla;
|
||||
@@ -866,6 +871,7 @@ struct fib_info *fib_create_info(struct
|
||||
}
|
||||
}
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 5 create error err is %d\n",err);
|
||||
|
||||
if (cfg->fc_mp) {
|
||||
#ifdef CONFIG_IP_ROUTE_MULTIPATH
|
||||
@@ -898,6 +904,7 @@ struct fib_info *fib_create_info(struct
|
||||
nh->nh_weight = 1;
|
||||
#endif
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 6 create error err is %d\n",err);
|
||||
|
||||
if (fib_props[cfg->fc_type].error) {
|
||||
if (cfg->fc_gw || cfg->fc_oif || cfg->fc_mp)
|
||||
@@ -915,6 +922,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto err_inval;
|
||||
}
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 7 create error err is %d\n",err);
|
||||
|
||||
if (cfg->fc_scope > RT_SCOPE_HOST)
|
||||
goto err_inval;
|
||||
@@ -937,6 +945,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto failure;
|
||||
} endfor_nexthops(fi)
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 8 create error err is %d\n",err);
|
||||
|
||||
if (fi->fib_prefsrc) {
|
||||
if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
|
||||
@@ -948,6 +957,7 @@ struct fib_info *fib_create_info(struct
|
||||
change_nexthops(fi) {
|
||||
fib_info_update_nh_saddr(net, nexthop_nh);
|
||||
} endfor_nexthops(fi)
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 9 create error err is %d\n",err);
|
||||
|
||||
link_it:
|
||||
ofi = fib_find_info(fi);
|
||||
@@ -957,6 +967,7 @@ link_it:
|
||||
ofi->fib_treeref++;
|
||||
return ofi;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 10 create error err is %d\n",err);
|
||||
|
||||
fi->fib_treeref++;
|
||||
atomic_inc(&fi->fib_clntref);
|
||||
@@ -980,6 +991,7 @@ link_it:
|
||||
hlist_add_head(&nexthop_nh->nh_hash, head);
|
||||
} endfor_nexthops(fi)
|
||||
spin_unlock_bh(&fib_info_lock);
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 11 create error err is %d\n",err);
|
||||
return fi;
|
||||
|
||||
err_inval:
|
||||
@@ -990,6 +1002,7 @@ failure:
|
||||
fi->fib_dead = 1;
|
||||
free_fib_info(fi);
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 12 create error err is %d\n",err);
|
||||
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
Index: src/net/ipv4/fib_trie.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_trie.c
|
||||
+++ src/net/ipv4/fib_trie.c
|
||||
@@ -1161,6 +1161,7 @@ done:
|
||||
/*
|
||||
* Caller must hold RTNL.
|
||||
*/
|
||||
+#include "kpatch-macros.h"
|
||||
int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
|
||||
{
|
||||
struct trie *t = (struct trie *) tb->tb_data;
|
||||
@@ -1187,11 +1188,14 @@ int fib_table_insert(struct fib_table *t
|
||||
|
||||
key = key & mask;
|
||||
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: start\n");
|
||||
fi = fib_create_info(cfg);
|
||||
if (IS_ERR(fi)) {
|
||||
err = PTR_ERR(fi);
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: create error err is %d\n",err);
|
||||
goto err;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: cross\n");
|
||||
|
||||
l = fib_find_node(t, key);
|
||||
fa = NULL;
|
Loading…
Reference in New Issue
Block a user