* [PATCH 0/3] s390/probes: Various fixes
@ 2026-10-12 8:36 Heiko Carstens
2026-10-12 8:36 ` [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup Heiko Carstens
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-10-12 8:36 UTC (permalink / raw)
To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-kernel, linux-s390
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(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup
2026-10-12 8:36 [PATCH 0/3] s390/probes: Various fixes Heiko Carstens
@ 2026-10-12 8:36 ` Heiko Carstens
2026-10-12 8:36 ` [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic Heiko Carstens
2026-10-12 8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-10-12 8:36 UTC (permalink / raw)
To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-kernel, linux-s390
The last byte of the cgrb instruction is 0xe4, however the probes code
compares against 0xe6. Fix it.
Fixes: 6b169ac9b434 ("s390/kprobes: add support for compare and branch instructions")
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/lib/probes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c
index 1e184a03442d..049300b68ddd 100644
--- a/arch/s390/lib/probes.c
+++ b/arch/s390/lib/probes.c
@@ -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 */
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic
2026-10-12 8:36 [PATCH 0/3] s390/probes: Various fixes Heiko Carstens
2026-10-12 8:36 ` [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup Heiko Carstens
@ 2026-10-12 8:36 ` Heiko Carstens
2026-10-12 8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-10-12 8:36 UTC (permalink / raw)
To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-kernel, linux-s390
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_TAKEN instead of the default FIXUP_PSW_NORMAL
to reflect that.
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
---
arch/s390/lib/probes.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c
index 049300b68ddd..3e7654223b05 100644
--- a/arch/s390/lib/probes.c
+++ b/arch/s390/lib/probes.c
@@ -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 */
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib
2026-10-12 8:36 [PATCH 0/3] s390/probes: Various fixes Heiko Carstens
2026-10-12 8:36 ` [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup Heiko Carstens
2026-10-12 8:36 ` [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic Heiko Carstens
@ 2026-10-12 8:36 ` Heiko Carstens
2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-10-12 8:36 UTC (permalink / raw)
To: Alexander Gordeev, Sven Schnelle, Vasily Gorbik, Christian Borntraeger
Cc: linux-kernel, linux-s390
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 <hca@linux.ibm.com>
---
arch/s390/lib/probes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c
index 3e7654223b05..66221ec16822 100644
--- a/arch/s390/lib/probes.c
+++ b/arch/s390/lib/probes.c
@@ -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;
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-12 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 8:36 [PATCH 0/3] s390/probes: Various fixes Heiko Carstens
2026-10-12 8:36 ` [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup Heiko Carstens
2026-10-12 8:36 ` [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic Heiko Carstens
2026-10-12 8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®