diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2019-01-22 22:45:18 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-01-23 17:35:31 -0800 |
commit | 2cbd95a5c4fb855a4177c0343a880cc2091f500d (patch) | |
tree | 850b2057a8437e87cf2f4139b159c1f8a2f0100a /net/ife | |
parent | bbebce8eb9a54091b9a66121fd26b7caabd76895 (diff) | |
download | linux-2cbd95a5c4fb855a4177c0343a880cc2091f500d.tar.gz linux-2cbd95a5c4fb855a4177c0343a880cc2091f500d.tar.bz2 linux-2cbd95a5c4fb855a4177c0343a880cc2091f500d.zip |
bpf: change parameters of call/branch offset adjustment
In preparation for code removal change parameters to branch
and call adjustment functions to be more universal. The
current parameters assume we are patching a single instruction
with a longer set.
A diagram may help reading the change, this is for the patch
single case, patching instruction 1 with a replacement of 4:
____
0 |____|
1 |____| <-- pos ^
2 | | <-- end old ^ |
3 | | | delta | len
4 |____| | | (patch region)
5 | | <-- end new v v
6 |____|
end_old = pos + 1
end_new = pos + delta + 1
If we are before the patch region - curr variable and the target
are fully in old coordinates (hence comparing against end_old).
If we are after the region curr is in new coordinates (hence
the comparison to end_new) but target is in mixed coordinates,
so we just check if it falls before end_new, and if so it needs
the adjustment.
Note that we will not fix up branches which land in removed region
in case of removal, which should be okay, as we are only going to
remove dead code.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/ife')
0 files changed, 0 insertions, 0 deletions