TencentOS-kernel/net/core
Menglong Dong 6bea6f6ce1 net: skb: prevent the split of kfree_skb_reason() by gcc
[upstream commit c205cc7534a97f2d6fbd2a23a94ed7c036c6e2aa]

Sometimes, gcc will optimize the function by spliting it to two or
more functions. In this case, kfree_skb_reason() is splited to
kfree_skb_reason and kfree_skb_reason.part.0. However, the
function/tracepoint trace_kfree_skb() in it needs the return address
of kfree_skb_reason().

This split makes the call chains becomes:
  kfree_skb_reason() -> kfree_skb_reason.part.0 -> trace_kfree_skb()

which makes the return address that passed to trace_kfree_skb() be
kfree_skb().

Therefore, introduce '__fix_address', which is the combination of
'__noclone' and 'noinline', and apply it to kfree_skb_reason() to
prevent to from being splited or made inline.

(Is it better to simply apply '__noclone oninline' to kfree_skb_reason?
I'm thinking maybe other functions have the same problems)

Meanwhile, wrap 'skb_unref()' with 'unlikely()', as the compiler thinks
it is likely return true and splits kfree_skb_reason().

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-30 10:53:37 +08:00
..
.gitignore net: skb: use auto-generation to convert skb drop reason to string 2022-06-17 10:08:53 +08:00
Makefile net: skb: use auto-generation to convert skb drop reason to string 2022-06-17 10:08:53 +08:00
bpf_sk_storage.c bpf: Allow local storage to be used from LSM programs 2022-06-21 10:27:15 +08:00
datagram.c udp: fix skb_copy_and_csum_datagram with odd segment sizes 2021-04-12 12:52:05 +08:00
datagram.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dev.c net: bpf: disable the usage of bpf_dispatcher for XDP 2022-08-30 10:53:21 +08:00
dev_addr_lists.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dev_ioctl.c net: fix dev_ifsioc_locked() race condition 2021-04-12 12:52:45 +08:00
devlink.c devlink: Hold rtnl lock while reading netdev attributes 2021-03-16 16:41:51 +08:00
drop_monitor.c net: skb: use auto-generation to convert skb drop reason to string 2022-06-17 10:08:53 +08:00
dst.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dst_cache.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ethtool.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
failover.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fib_notifier.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
fib_rules.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
filter.c bpf: Add redirect_peer helper 2022-08-01 10:23:57 +08:00
flow_dissector.c bpf, netns: Keep attached programs in bpf_prog_array 2022-06-21 10:27:10 +08:00
flow_offload.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
gen_estimator.c net_sched: gen_estimator: support large ewma log 2021-04-12 12:51:50 +08:00
gen_stats.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
gro_cells.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hwbm.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
link_watch.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
lwt_bpf.c lwt: Disable BH too in run_lwt_bpf() 2021-03-16 16:43:20 +08:00
lwtunnel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
neighbour.c net: neigh: use kfree_skb_reason() for __neigh_event_send() 2022-06-17 10:08:50 +08:00
net-procfs.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
net-sysfs.c net-sysfs: take the rtnl lock when accessing xps_rxqs_map and num_tc 2021-04-12 12:51:08 +08:00
net-sysfs.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
net-traces.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
net_namespace.c net: initialize net->net_cookie at netns setup 2021-12-30 14:50:11 +08:00
netclassid_cgroup.c cgroup, netclassid: remove double cond_resched 2021-03-16 16:27:30 +08:00
netevent.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
netpoll.c net: Have netpoll bring-up DSA management interface 2021-03-16 16:41:06 +08:00
netprio_cgroup.c netprio_cgroup: Fix unlimited memory leak of v2 cgroups 2021-03-16 16:27:49 +08:00
page_pool.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pktgen.c pktgen: fix misuse of BUG_ON() in pktgen_thread_worker() 2021-04-12 12:52:46 +08:00
ptp_classifier.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
request_sock.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rtnetlink.c net: fix dev_ifsioc_locked() race condition 2021-04-12 12:52:45 +08:00
scm.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
secure_seq.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
skbuff.c net: skb: prevent the split of kfree_skb_reason() by gcc 2022-08-30 10:53:37 +08:00
skmsg.c net, sk_msg: Clear sk_user_data pointer on clone if tagged 2022-06-21 10:27:06 +08:00
sock.c bpf: Don't refcount LISTEN sockets in sk_assign() 2022-06-21 10:27:10 +08:00
sock_diag.c bpf, net: Rework cookie generator as per-cpu one 2021-12-30 14:50:11 +08:00
sock_map.c bpf: Set map_btf_{name, id} for all map types 2022-06-21 10:27:13 +08:00
sock_reuseport.c net: Generate reuseport group ID on group creation 2022-06-21 10:27:07 +08:00
stream.c net: sock: introduce sk_stream_kill_queues_reason() 2022-06-17 11:28:10 +08:00
sysctl_net_core.c net:add sysctl to enable/disable forced caps 2021-12-30 14:50:01 +08:00
timestamping.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tso.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
utils.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xdp.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00