Skip to contentSkip to conversation

arm64: ptrace: Fix missing return in hw breakpoint code

PATCH In review Keno Fischer 2 participants 3 messages Feb 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: ptrace: Fix missing return in hw breakpoint code

This was found by inspection - I don't work with aarch32 very much, but I believe there is a missing return in this code, since the second force_sig_fault here would override the first, thus making the whole compat code here pointless.

---

This was left over in my working tree from when I was working through various aarch64 ptrace weirdness last year and I don't think I ever got around to submitting it, but I just looked through my work from back then and came across this again - my apologies if I'm wrong about this - it's been a while, so I'm not really read into this code anymore.

 arch/arm64/kernel/ptrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/ptrace.c +1 -0
index e7b01904f180..9309c41dbafe 100644
@@ -195,6 +195,7 @@ static void ptrace_hbptriggered(struct perf_event *bp,
 		arm64_force_sig_ptrace_errno_trap(si_errno,
 						  (void __user *)bkpt->trigger,
 						  desc);
+		return;
 	}
 #endif
 	arm64_force_sig_fault(SIGTRAP, TRAP_HWBKPT,
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw

Hi Keno,

Quoted 23 lines · Keno Fischer

This was found by inspection - I don't work with aarch32 very much, but I believe there is a missing return in this code, since the second force_sig_fault here would override the first, thus making the whole compat code here pointless.

---

This was left over in my working tree from when I was working through various aarch64 ptrace weirdness last year and I don't think I ever got around to submitting it, but I just looked through my work from back then and came across this again - my apologies if I'm wrong about this - it's been a while, so I'm not really read into this code anymore.

 arch/arm64/kernel/ptrace.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/ptrace.c +0 -0
index e7b01904f180..9309c41dbafe 100644

arch/arm64/kernel/ptrace.c static void ptrace_hbptriggered(struct perf_event *bp, · line 201

Quoted 7 lines
arch/arm64/kernel/ptrace.c +1 -0
@@ -195,6 +195,7 @@ static void ptrace_hbptriggered(struct perf_event *bp,
 		arm64_force_sig_ptrace_errno_trap(si_errno,
 						  (void __user *)bkpt->trigger,
 						  desc);
+		return;
 	}
 #endif
 	arm64_force_sig_fault(SIGTRAP, TRAP_HWBKPT,

Thanks, I'll apply this for 5.12. However, I was trying to rework the commit message to describe the impact of the issue and I'm not sure I agree with your assessment that the second signal overrides the first. My (admittedly brief) reading of __send_signal() is that the subsequent signal is effectively ignored. Am I missing something?

Cheers,

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw

Hi Will,

Quoted 5 lines

Thanks, I'll apply this for 5.12. However, I was trying to rework the commit message to describe the impact of the issue and I'm not sure I agree with your assessment that the second signal overrides the first. My (admittedly brief) reading of __send_signal() is that the subsequent signal is effectively ignored. Am I missing something?

Ah, I suppose you're probably right. I hadn't looked at this code in quite a while, so I must have mis-remembered what the impact was.

Keno

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel