All of lore.kernel.org
 help / color / mirror / Atom feed
* [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; 7+ 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] 7+ 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:41   ` sashiko-bot
  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, 1 reply; 7+ 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 related	[flat|nested] 7+ 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:46   ` sashiko-bot
  2026-10-12  8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
  2 siblings, 1 reply; 7+ 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 related	[flat|nested] 7+ 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
  2026-10-12  8:38   ` sashiko-bot
  2 siblings, 1 reply; 7+ 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 related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib
  2026-10-12  8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
@ 2026-10-12  8:38   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-12  8:38 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Christian Borntraeger, linux-s390, Alexander Gordeev,
	Vasily Gorbik, Heiko Carstens

> 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>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012083629.2109206-1-hca@linux.ibm.com?part=3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup
  2026-10-12  8:36 ` [PATCH 1/3] s390/probes: Fix wrong opcode for cgrb fixup Heiko Carstens
@ 2026-10-12  8:41   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-12  8:41 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Alexander Gordeev, Christian Borntraeger, Vasily Gorbik,
	linux-s390, Heiko Carstens

> 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>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012083629.2109206-1-hca@linux.ibm.com?part=1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic
  2026-10-12  8:36 ` [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic Heiko Carstens
@ 2026-10-12  8:46   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-10-12  8:46 UTC (permalink / raw)
  To: Heiko Carstens
  Cc: Vasily Gorbik, Alexander Gordeev, Heiko Carstens, linux-s390,
	Christian Borntraeger

> 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>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261012083629.2109206-1-hca@linux.ibm.com?part=2


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-12  8:46 UTC | newest]

Thread overview: 7+ 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:41   ` sashiko-bot
2026-10-12  8:36 ` [PATCH 2/3] s390/probes: Add missing fixup for bctgr and bic Heiko Carstens
2026-10-12  8:46   ` sashiko-bot
2026-10-12  8:36 ` [PATCH 3/3] s390/probes: Fix wrong mnemonic comment for clgib Heiko Carstens
2026-10-12  8:38   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.