-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dtrace: fix fbt regression for aarch64 #855
Conversation
CC @markjdb |
Thanks, I think your analysis is correct. I'd prefer to fix it by getting rid of Would you make these changes and re-push? If not I am happy to, just let me know. |
fbt computes incorrect instruction position upon AArch64 kernel module load. A reproduction example: $ kldload pf $ dtrace -n 'fbt:pf:hook_pf:entry' $ pfctl -e # it's expected to hit the probe once As a result dtrace is stuck in a loop, e.g. its output after SIGINT: ... 4 59199 hook_pf:entry 4 59199 hook_pf:entry 4 59199 hook_pf:entry dtrace: 8893079 drops on CPU 4 The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Pull-request: freebsd#855 Signed-off-by: Igor Ostapenko <pm@igoro.pro>
c223cbf
to
cf72f1d
Compare
Sure. Please, consider another commit pushed. Let me know if a bit different style or way was expected. |
Two more nits: first, the With those fixed, I'll push the patch. Thanks again. |
fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Pull-request: freebsd#855 Signed-off-by: Igor Ostapenko <pm@igoro.pro>
cf72f1d
to
4c06a3d
Compare
Agree, good point. |
fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko <pm@igoro.pro> Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: #855 MFC after: 1 week
Merged, thank you. |
MFC after: 3 days
fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko <pm@igoro.pro> Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: #855 MFC after: 1 week (cherry picked from commit b4db386)
fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko <pm@igoro.pro> Approved by: re (gjb) Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: #855 MFC after: 1 week (cherry picked from commit b4db386) (cherry picked from commit 2ba605f)
fbt computes incorrect instruction position for AArch64 kernel module symbol. The issue is with the for loop, it does an extra increment of instr pointer after the required instruction is found. Hence, a wrong instruction is targeted for patching. Signed-off-by: Igor Ostapenko <pm@igoro.pro> Fixes: 980746e ("fbt: simplify arm64 function-prologue parsing") Reviewed by: markj Pull Request: freebsd/freebsd-src#855 MFC after: 1 week
I was working with pf and faced the issue with dtrace on main@aarch64. The steps:
$ kldload pf
$ dtrace -n 'fbt:pf:hook_pf:entry'
$ pfctl -e # it's expected to hit the probe once
As a result, dtrace was in a loop. Its output tail after interruption was like:
I did some first comparisons:
I git bisect'ed it down to 980746e as the root cause.
The instr gets an extra increment -- a wrong instruction is targeted for patching.
This is the proposed variant of the fix.
I guess it would be good to fix it for 14.0 as well.