NetBSD Problem Report #49653

From www@NetBSD.org  Tue Feb 10 05:17:29 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id A58B3A6551
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 10 Feb 2015 05:17:29 +0000 (UTC)
Message-Id: <20150210051728.93BB6A65BB@mollari.NetBSD.org>
Date: Tue, 10 Feb 2015 05:17:28 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
X-Send-Pr-Version: www-1.0

>Number:         49653
>Category:       lib
>Synopsis:       tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 10 05:20:00 +0000 2015
>Closed-Date:    Tue Feb 17 09:48:39 +0000 2015
>Last-Modified:  Tue Feb 17 09:50:00 +0000 2015
>Originator:     Tetsuya Isaki
>Release:        NetBSD-current (2015/02/03)
>Organization:
>Environment:
NetBSD x68k.local 7.99.4 NetBSD 7.99.4 (GENERIC) #0: Thu Feb  5 15:13:36 JST 2015  isaki@XXXXXX:/var/obj/current/x68k/obj/sys/arch/x68k/compile/GENERIC x68k
>Description:
tests/lib/libc/gen/t_siginfo:sigbus_adraln is trying to confirm
that unaligned access issues the SIGBUS, but it never happens
on m68k (>= 68020).
>How-To-Repeat:
cd /usr/tests/lib/libc/gen
atf-run t_siginfo | atf -report
(on m68k)
>Fix:
Skip it on >= 68020 system, like below?
(I don't know about ColdFire)

Index: tests/lib/libc/gen/t_siginfo.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/gen/t_siginfo.c,v
retrieving revision 1.27
diff -u -r1.27 t_siginfo.c
--- tests/lib/libc/gen/t_siginfo.c	29 Dec 2014 18:36:27 -0000	1.27
+++ tests/lib/libc/gen/t_siginfo.c	9 Feb 2015 16:27:14 -0000
@@ -464,6 +464,9 @@
 	if (val == 0)
 		atf_tc_skip("No SIGBUS signal for unaligned accesses");
 #endif
+#if defined(__m68k__) && !defined(__mc68010__)
+	atf_tc_skip("No SIGBUS signal for unaligned accesses");
+#endif

 	sa.sa_flags = SA_SIGINFO;
 	sa.sa_sigaction = sigbus_action;

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Tue, 10 Feb 2015 10:51:44 +0100

 Please do not do it as a #ifdef compile time check, but use a proper sysctl
 variable to check at runtime.

 Other archtiectures use for example:

 	machdep.unaligned_sigbus = 1

 (e.g. on macppc and arm, where it depends on the concrete cpu model you are
 running on)


 Martin

From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@NetBSD.org
Cc: lib-bug-people@netbsd.org,
	gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Sat, 14 Feb 2015 12:04:27 +0900

 At Tue, 10 Feb 2015 09:55:00 +0000 (UTC),
 Martin Husemann wrote:
 >  Please do not do it as a #ifdef compile time check, but use a proper sysctl
 >  variable to check at runtime.
 >  
 >  Other archtiectures use for example:
 >  
 >  	machdep.unaligned_sigbus = 1
 >  
 >  (e.g. on macppc and arm, where it depends on the concrete cpu model you are
 >  running on)

 I see, I agree that mine is not good way if there are two types cpu
 in an arch.

 Then I re-read the kernel source code (to try to implement the sysctl)
 and if my understanding is correct, sun2's arch seems "m68000" not
 "m68k". Furthermore all m68k (except sun2) seems not support 68010.
 This means that the SIGBUS never happens on all m68k.

 If so, how about this?

 Index: tests/lib/libc/gen/t_siginfo.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/gen/t_siginfo.c,v
 retrieving revision 1.27
 diff -u -r1.27 t_siginfo.c
 --- tests/lib/libc/gen/t_siginfo.c	29 Dec 2014 18:36:27 -0000	1.27
 +++ tests/lib/libc/gen/t_siginfo.c	11 Feb 2015 14:17:18 -0000
 @@ -464,6 +464,9 @@
  	if (val == 0)
  		atf_tc_skip("No SIGBUS signal for unaligned accesses");
  #endif
 +#if defined(__m68k__)
 +	atf_tc_skip("No SIGBUS signal for unaligned accesses");
 +#endif

  	sa.sa_flags = SA_SIGINFO;
  	sa.sa_sigaction = sigbus_action;

 ---
 Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>

From: Martin Husemann <martin@duskware.de>
To: Tetsuya Isaki <isaki@pastel-flower.jp>
Cc: gnats-bugs@NetBSD.org, lib-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Sat, 14 Feb 2015 14:55:10 +0100

 On Sat, Feb 14, 2015 at 12:04:27PM +0900, Tetsuya Isaki wrote:
 > Then I re-read the kernel source code (to try to implement the sysctl)
 > and if my understanding is correct, sun2's arch seems "m68000" not
 > "m68k". Furthermore all m68k (except sun2) seems not support 68010.
 > This means that the SIGBUS never happens on all m68k.

 But the sun2 compiler (at least the slightly dated version I happen
 to have around) still defines __m68k__ as 1.

 Martin

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org, isaki@pastel-flower.jp
Cc: 
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Sat, 14 Feb 2015 15:08:14 +0100

 On Sat, Feb 14, 2015 at 02:00:01PM +0000, Martin Husemann wrote:
 >  But the sun2 compiler (at least the slightly dated version I happen
 >  to have around) still defines __m68k__ as 1.

 But I see your point: if it is statically restricted to a sun2 vs. other
 m68k ports, doing it with a simple #ifdef should be ok. Something like

 #if defined(__m68k__) && !defined(__mc68000__) && !defined(__mc68010__)
    atf_tc_skip(...)
 #endif

 should work.

 Martin

From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: Martin Husemann <martin@duskware.de>, gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Sun, 15 Feb 2015 16:35:41 +0900

 At Sat, 14 Feb 2015 15:08:14 +0100,
 Martin Husemann wrote:
 > >  But the sun2 compiler (at least the slightly dated version I happen
 > >  to have around) still defines __m68k__ as 1.
 > 
 > But I see your point: if it is statically restricted to a sun2 vs. other
 > m68k ports, doing it with a simple #ifdef should be ok. Something like
 > 
 > #if defined(__m68k__) && !defined(__mc68000__) && !defined(__mc68010__)
 >    atf_tc_skip(...)
 > #endif
 > 
 > should work.

 Thank you for understanding what I want to say.
 But both of m68k and sun2 seems define __mc68000__ (though
 I understand your intention of __mc68000__).

 % /var/obj/current/x68k/tools/bin/m68k--netbsdelf-gcc -dM -E t_siginfo.c | grep -e 'm.\?68' | sort
 #define __m68k__ 1
 #define __mc68000 1
 #define __mc68000__ 1
 #define __mc68020 1
 #define __mc68020__ 1
 #define mc68000 1
 #define mc68020 1

 % /var/obj/current/news68k/tools/bin/m68k--netbsdelf-gcc -dM -E t_siginfo.c | grep -e 'm.\?68' | sort
 #define __m68k__ 1
 #define __mc68000 1
 #define __mc68000__ 1
 #define __mc68020 1
 #define __mc68020__ 1
 #define mc68000 1
 #define mc68020 1

 % /var/obj/current/sun2/tools/bin/m68010--netbsdelf-gcc -dM -E t_siginfo.c | grep -e 'm.\?68' | sort
 #define __m68k__ 1
 #define __mc68000 1
 #define __mc68000__ 1
 #define __mc68010 1
 #define __mc68010__ 1
 #define mc68000 1
 #define mc68010 1


 So how about this again?

 Index: tests/lib/libc/gen/t_siginfo.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/libc/gen/t_siginfo.c,v
 retrieving revision 1.28
 diff -u -r1.28 t_siginfo.c
 --- tests/lib/libc/gen/t_siginfo.c	13 Feb 2015 16:56:57 -0000	1.28
 +++ tests/lib/libc/gen/t_siginfo.c	15 Feb 2015 06:40:07 -0000
 @@ -465,6 +465,10 @@
  	if (val == 0)
  		atf_tc_skip("No SIGBUS signal for unaligned accesses");
  #endif
 +#if defined(__m68k__) && !defined(__mc68010__)
 +	/* m68k except sun2 (i.e. >=68020) never issue SIGBUS (PR lib/49653) */
 +	atf_tc_skip("No SIGBUS signal for unaligned accesses");
 +#endif

  	sa.sa_flags = SA_SIGINFO;
  	sa.sa_sigaction = sigbus_action;

 ---
 Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>

From: Martin Husemann <martin@duskware.de>
To: Tetsuya Isaki <isaki@pastel-flower.jp>
Cc: gnats-bugs@netbsd.org
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Sun, 15 Feb 2015 10:09:47 +0100

 Argh, this is all too complicated ;-)

 Let's try it differently, but w/o kernel changes:

 	if (strcmp("m68k", MACHINE_ARCH) == 0)
 		atf_tc_skip(...)

 This tests what you are really after w/o relying on compiler defaults
 (which may also be subject to user defined -mcpu=... settings at build time).

 Martin

From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: Martin Husemann <martin@duskware.de>, gnats-bugs@netbsd.org
Cc: 
Subject: Re: lib/49653: tests/lib/libc/gen/t_siginfo:sigbus_adraln failed on m68k
Date: Tue, 17 Feb 2015 18:41:20 +0900

 At Sun, 15 Feb 2015 10:09:47 +0100,
 Martin Husemann wrote:
 > Argh, this is all too complicated ;-)
 > 
 > Let's try it differently, but w/o kernel changes:
 > 
 > 	if (strcmp("m68k", MACHINE_ARCH) == 0)
 > 		atf_tc_skip(...)
 > 
 > This tests what you are really after w/o relying on compiler defaults
 > (which may also be subject to user defined -mcpu=... settings at build time).

 That's it!  I'll commit it.
 Thank you.
 ---
 Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>

State-Changed-From-To: open->closed
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Tue, 17 Feb 2015 09:48:39 +0000
State-Changed-Why:
Commited.


From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/49653 CVS commit: src/tests/lib/libc/gen
Date: Tue, 17 Feb 2015 09:47:08 +0000

 Module Name:	src
 Committed By:	isaki
 Date:		Tue Feb 17 09:47:08 UTC 2015

 Modified Files:
 	src/tests/lib/libc/gen: t_siginfo.c

 Log Message:
 m68k (except sun2) never issue SIGBUS on unaligned accesses.
 PR lib/49653.  Thanks martin@.


 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/tests/lib/libc/gen/t_siginfo.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.