mirror of
https://github.com/dynup/kpatch
synced 2025-02-25 22:40:41 +00:00
Rebased to kernel-4.18.0-304.el8. Note: since RHEL-8.4 dropped klp.arch support, we can now re-enable those tests that reference static keys defined in vmlinux. Also, adjust for adjust for ppc64le inlining: Building gcc-static-local-var-4.patch on ppc64le results in test failure, as the kpatch .ko now contains a 'free_ioctx' symbol (the test expects to NOT see one). From the build log: aio.o: changed function: free_ioctx aio.o: new function: put_aio_ring_file << now un-inlined? aio.o: changed function: aio_free_ring aio.o: changed function: ioctx_alloc aio.o: changed function: aio_prep_rw aio.o: changed function: aio_read_events aio.o: new function: kpatch_aio_foo << expected new function and a source code change to free_ioctx(): % diff -upr \ <(objdump -D -j .text.free_ioctx ~/.kpatch/tmp/orig/fs/aio.o) \ <(objdump -D -j .text.free_ioctx ~/.kpatch/tmp/patched/fs/aio.o) --- /dev/fd/63 2020-10-26 14:28:18.086236019 -0400 +++ /dev/fd/62 2020-10-26 14:28:18.086236019 -0400 @@ -1,5 +1,5 @@ -/root/.kpatch/tmp/orig/fs/aio.o: file format elf64-powerpcle +/root/.kpatch/tmp/patched/fs/aio.o: file format elf64-powerpcle Disassembly of section .text.free_ioctx: @@ -53,7 +53,7 @@ Disassembly of section .text.free_ioctx: b0: 00 00 82 3c addis r4,r2,0 b4: 00 00 84 e8 ld r4,0(r4) b8: 78 fb e6 7f mr r6,r31 - bc: e0 00 63 38 addi r3,r3,224 + bc: 38 00 63 38 addi r3,r3,56 c0: 01 00 00 48 bl c0 <free_ioctx+0xb8> c4: 00 00 00 60 nop c8: 70 ff ff 4b b 38 <free_ioctx+0x30> Marking put_aio_ring_file() as __always_inline keeps the r3 / 224 offset value, leaving free_ioctx() unchanged. Since it's no longer included in the resulting .ko, gcc-static-local-var-4.test will pass once again. Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
150 lines
4.9 KiB
Diff
150 lines
4.9 KiB
Diff
diff -Nupr src.orig/net/ipv4/fib_frontend.c src/net/ipv4/fib_frontend.c
|
|
--- src.orig/net/ipv4/fib_frontend.c 2021-04-20 11:04:27.363102215 -0400
|
|
+++ src/net/ipv4/fib_frontend.c 2021-04-20 11:05:00.587185575 -0400
|
|
@@ -790,6 +790,7 @@ errout:
|
|
return err;
|
|
}
|
|
|
|
+#include "kpatch-macros.h"
|
|
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
@@ -811,6 +812,7 @@ static int inet_rtm_newroute(struct sk_b
|
|
err = fib_table_insert(net, tb, &cfg, extack);
|
|
if (!err && cfg.fc_type == RTN_LOCAL)
|
|
net->ipv4.fib_has_custom_local_routes = true;
|
|
+ KPATCH_PRINTK("[inet_rtm_newroute]: err is %d\n", err);
|
|
errout:
|
|
return err;
|
|
}
|
|
diff -Nupr src.orig/net/ipv4/fib_semantics.c src/net/ipv4/fib_semantics.c
|
|
--- src.orig/net/ipv4/fib_semantics.c 2021-04-20 11:04:27.363102215 -0400
|
|
+++ src/net/ipv4/fib_semantics.c 2021-04-20 11:05:00.588185577 -0400
|
|
@@ -1023,6 +1023,7 @@ static bool fib_valid_prefsrc(struct fib
|
|
return true;
|
|
}
|
|
|
|
+#include "kpatch-macros.h"
|
|
struct fib_info *fib_create_info(struct fib_config *cfg,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
@@ -1056,6 +1057,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;
|
|
@@ -1076,6 +1078,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)
|
|
@@ -1089,6 +1092,8 @@ struct fib_info *fib_create_info(struct
|
|
}
|
|
|
|
fib_info_cnt++;
|
|
+ KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err);
|
|
+
|
|
fi->fib_net = net;
|
|
fi->fib_protocol = cfg->fc_protocol;
|
|
fi->fib_scope = cfg->fc_scope;
|
|
@@ -1144,9 +1149,11 @@ struct fib_info *fib_create_info(struct
|
|
"LWT encap type not specified");
|
|
goto err_inval;
|
|
}
|
|
+ KPATCH_PRINTK("[fib_create_info]: 4 create error err is %d\n",err);
|
|
err = lwtunnel_build_state(cfg->fc_encap_type,
|
|
cfg->fc_encap, AF_INET, cfg,
|
|
&lwtstate, extack);
|
|
+ KPATCH_PRINTK("[fib_create_info]: 5 create error err is %d\n",err);
|
|
if (err)
|
|
goto failure;
|
|
|
|
@@ -1164,6 +1171,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) {
|
|
@@ -1185,6 +1193,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) {
|
|
NL_SET_ERR_MSG(extack, "Invalid scope");
|
|
@@ -1223,6 +1232,7 @@ struct fib_info *fib_create_info(struct
|
|
if (linkdown == fi->fib_nhs)
|
|
fi->fib_flags |= RTNH_F_LINKDOWN;
|
|
}
|
|
+ KPATCH_PRINTK("[fib_create_info]: 8 create error err is %d\n",err);
|
|
|
|
if (fi->fib_prefsrc && !fib_valid_prefsrc(cfg, fi->fib_prefsrc)) {
|
|
NL_SET_ERR_MSG(extack, "Invalid prefsrc address");
|
|
@@ -1232,6 +1242,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);
|
|
|
|
fib_rebalance(fi);
|
|
|
|
@@ -1243,6 +1254,7 @@ link_it:
|
|
ofi->fib_treeref++;
|
|
return ofi;
|
|
}
|
|
+ KPATCH_PRINTK("[fib_create_info]: 10 create error err is %d\n",err);
|
|
|
|
fi->fib_treeref++;
|
|
refcount_set(&fi->fib_clntref, 1);
|
|
@@ -1266,6 +1278,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:
|
|
@@ -1276,6 +1289,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);
|
|
}
|
|
diff -Nupr src.orig/net/ipv4/fib_trie.c src/net/ipv4/fib_trie.c
|
|
--- src.orig/net/ipv4/fib_trie.c 2021-04-20 11:04:27.363102215 -0400
|
|
+++ src/net/ipv4/fib_trie.c 2021-04-20 11:05:00.588185577 -0400
|
|
@@ -1174,6 +1174,7 @@ static void fib_remove_alias(struct trie
|
|
struct key_vector *l, struct fib_alias *old);
|
|
|
|
/* Caller must hold RTNL. */
|
|
+#include "kpatch-macros.h"
|
|
int fib_table_insert(struct net *net, struct fib_table *tb,
|
|
struct fib_config *cfg, struct netlink_ext_ack *extack)
|
|
{
|
|
@@ -1195,11 +1196,14 @@ int fib_table_insert(struct net *net, st
|
|
|
|
pr_debug("Insert table=%u %08x/%d\n", tb->tb_id, key, plen);
|
|
|
|
+ KPATCH_PRINTK("[fib_table_insert]: start\n");
|
|
fi = fib_create_info(cfg, extack);
|
|
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, &tp, key);
|
|
fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority,
|