NetBSD Problem Report #52867
From martin@duskware.de Wed Dec 27 19:29:50 2017
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id B88627A1AE
for <gnats-bugs@gnats.NetBSD.org>; Wed, 27 Dec 2017 19:29:50 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: arm sofware breakpoint asm is slightly off
X-Send-Pr-Version: 3.95
>Number: 52867
>Category: port-arm
>Synopsis: arm sofware breakpoint asm is slightly off
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-arm-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 27 19:30:01 +0000 2017
>Closed-Date: Fri Nov 05 18:18:52 +0000 2021
>Last-Modified: Fri Nov 05 18:18:52 +0000 2021
>Originator: Martin Husemann
>Release: NetBSD 8.99.9
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD space-truckin.duskware.de 8.99.9 NetBSD 8.99.9 (SUNXI) #10: Tue Dec 26 13:50:30 CET 2017 martin@night-owl.duskware.de:/usr/src/sys/arch/evbarm/compile/SUNXI evbarm
Architecture: earmv7hfeb
Machine: evbarm
>Description:
ARM uses an undefined instruction to emulate a software breakpoint.
However, the ptrace.h instruction on the one hand, and gdb/the kernel
disagree on the exact value.
This causes PTRACE_BREAKPOINT_ASM to generate a SIGILL instead of a SIGTRAP.
>How-To-Repeat:
code inspection
>Fix:
Index: ptrace.h
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/include/ptrace.h,v
retrieving revision 1.11
diff -u -r1.11 ptrace.h
--- ptrace.h 12 Apr 2017 18:17:59 -0000 1.11
+++ ptrace.h 27 Dec 2017 19:26:21 -0000
@@ -64,7 +64,12 @@
#define PTRACE_REG_SP(_r) (_r)->r_sp
#define PTRACE_REG_INTRV(_r) (_r)->r[0]
-#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xe7, 0xff, 0xff, 0xfe })
-#define PTRACE_BREAKPOINT_INSN 0xe7fffffe
+#ifdef __ARMEB__
+#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xfe, 0xde, 0xff, 0xe7 })
+#define PTRACE_BREAKPOINT_INSN 0xfedeffe7
+#else
+#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xe7, 0xff, 0xde, 0xfe })
+#define PTRACE_BREAKPOINT_INSN 0xe7ffdefe
+#endif
#define PTRACE_BREAKPOINT_ASM __asm __volatile (".word " ___STRING(PTRACE_BREAKPOINT_INSN) )
#define PTRACE_BREAKPOINT_SIZE 4
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52867 CVS commit: src/sys/arch/arm/include
Date: Wed, 27 Dec 2017 14:35:05 -0500
Module Name: src
Committed By: christos
Date: Wed Dec 27 19:35:05 UTC 2017
Modified Files:
src/sys/arch/arm/include: ptrace.h
Log Message:
PR/52867: Martin Husemann: arm sofware breakpoint asm is slightly off
ARM uses an undefined instruction to emulate a software breakpoint.
However, the ptrace.h instruction on the one hand, and gdb/the kernel
disagree on the exact value.
This causes PTRACE_BREAKPOINT_ASM to generate a SIGILL instead of a SIGTRAP.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/ptrace.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 11:33:15 +0000
State-Changed-Why:
Is this good now? (if so, we need pullups)
State-Changed-From-To: feedback->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 05 Nov 2021 18:18:52 +0000
State-Changed-Why:
fixed
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.