s390/probes: Various fixes
Heiko Carstens
maintainercover s390/probes: Various fixes
Fix various bugs in uprobes/kprobes instruction fixup handling:
- For cgrb a wrong (non existing) opcode is used for comparison
- Handling for bctgr and bic instructions is missing
- Wrong comment for clgib
Thanks,
Heiko
Heiko Carstens (3):
s390/probes: Fix wrong opcode for cgrb fixup s390/probes: Add missing fixup for bctgr and bic s390/probes: Fix wrong mnemonic comment for clgib
arch/s390/lib/probes.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
2.53.0
Heiko Carstens
maintainerPATCH 1/3 s390/probes: Fix wrong opcode for cgrb fixup
The last byte of the cgrb instruction is 0xe4, however the probes code compares against 0xe6. Fix it.
--- arch/s390/lib/probes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/lib/probes.c +1 -1
@@ -99,8 +99,8 @@ int probe_get_fixup_type(u16 *insn)break ;case 0xec :switch (insn[2 ] &0xff ) { +case 0xe4 :/* cgrb */ case 0xe5 :/* clgrb */ -case 0xe6 :/* cgrb */ case 0xf6 :/* crb */ case 0xf7 :/* clrb */ case 0xfc :/* cgib */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
The last byte of the cgrb instruction is
0xe4, however the probes code compares against0xe6. Fix it.Fixes 6b169ac9b434 ("s390/kprobes: add support for compare and branch instructions")Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Heiko Carstens
maintainerPATCH 2/3 s390/probes: Add missing fixup for bctgr and bic
In reply to Heiko CarstensFor the bctgr and bic instructions the probes fixup is missing. For both instructions the instruction address must only be fixed up if the branch is not taken. If the branch is taken the instruction address is already correct.
Return FIXUP_BRANCH_NOT_TAKEN instead of the default FIXUP_PSW_NORMAL to reflect that.
--- arch/s390/lib/probes.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
arch/s390/lib/probes.c +12 -4
@@ -77,6 +77,10 @@ int probe_get_fixup_type(u16 *insn)if ((insn[0 ] &0xff ) ==0xb2 ) fixup =FIXUP_NOT_REQUIRED ;break ; +case 0xb9 :/* bctgr */ +if ((insn[0 ] &0xff ) ==0x46 ) + fixup =FIXUP_BRANCH_NOT_TAKEN ; +break ;case 0xa7 :/* bras */ if ((insn[0 ] &0x0f ) ==0x05 ) fixup |=FIXUP_RETURN_REGISTER ;
@@ -85,6 +89,14 @@ int probe_get_fixup_type(u16 *insn)if ((insn[0 ] &0x0f ) ==0x05 )/* brasl */ fixup |=FIXUP_RETURN_REGISTER ;break ; +case 0xe3 : +switch (insn[2 ] &0xff ) { +case 0x46 :/* bctg */ +case 0x47 :/* bic */ + fixup =FIXUP_BRANCH_NOT_TAKEN ; +break ; + } +break ;case 0xeb :switch (insn[2 ] &0xff ) {case 0x44 :/* bxhg */
@@ -93,10 +105,6 @@ int probe_get_fixup_type(u16 *insn)break ; }break ; -case 0xe3 :/* bctg */ -if ((insn[2 ] &0xff ) ==0x46 ) - fixup =FIXUP_BRANCH_NOT_TAKEN ; -break ;case 0xec :switch (insn[2 ] &0xff ) {case 0xe4 :/* cgrb */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines
For the bctgr and bic instructions the probes fixup is missing. For both instructions the instruction address must only be fixed up if the branch is not taken. If the branch is taken the instruction address is already correct.
Return
FIXUP_BRANCH_NOT_TAKENinstead of the defaultFIXUP_PSW_NORMALto reflect that.Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Heiko Carstens
maintainerPATCH 3/3 s390/probes: Fix wrong mnemonic comment for clgib
In reply to Heiko CarstensThere is no cglib instruction; the correct mnemonic is clgib. Fix the comment.
--- arch/s390/lib/probes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/lib/probes.c +1 -1
@@ -112,7 +112,7 @@ int probe_get_fixup_type(u16 *insn)case 0xf6 :/* crb */ case 0xf7 :/* clrb */ case 0xfc :/* cgib */ -case 0xfd :/* cglib */ +case 0xfd :/* clgib */ case 0xfe :/* cib */ case 0xff :/* clib */ fixup =FIXUP_BRANCH_NOT_TAKEN ;
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
There is no cglib instruction; the correct mnemonic is clgib. Fix the comment.
Fixes 6b169ac9b434 ("s390/kprobes: add support for compare and branch instructions")Signed-off-by Heiko Carstens <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3