CVS commit: src/tests/kernel

2018-05-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 22 04:32:56 UTC 2018

Modified Files:
src/tests/kernel: h_segv.c t_trapsignal.sh

Log Message:
Extend ATF tests in t_trapsignal.sh to verify software breakpoint traps

There are at least four types of SIGTRAP events:
 - software/hardware single step (trace trap)
 - software breakpoint
 - hardware breakpoint/watchpoint
 - kernel event (exec, fork, vfork, vfork-done, lwp-create, lwp-exit)

A program can execute software breakpoint without the context of being
traced and this is a regular crash signal emitting SIGTRAP (TRAP_BRKPT).

Rename original trap_* tests (trap_simple, trap_handle, trap_mask,
trap_handle_recurse and trap_ignore) to segv_* tests and restrict them for
SIGSEGV.

Add new tests: trap_* testing the same scenarios as segv_ ones, however
verifying the software breakpoint trap (SIGTRAP).

Keep the original name of h_segv.c, and extend it for software breakpoint
events.

The purpose of these tests is to verify SIGTRAP kernel paths without the
ptrace(2) context.

All tests pass.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/kernel/h_segv.c
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/t_trapsignal.sh

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

Modified files:

Index: src/tests/kernel/h_segv.c
diff -u src/tests/kernel/h_segv.c:1.3 src/tests/kernel/h_segv.c:1.4
--- src/tests/kernel/h_segv.c:1.3	Mon May 21 08:49:03 2018
+++ src/tests/kernel/h_segv.c	Tue May 22 04:32:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_segv.c,v 1.3 2018/05/21 08:49:03 kamil Exp $	*/
+/*	$NetBSD: h_segv.c,v 1.4 2018/05/22 04:32:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: h_segv.c,v 1.3 2018/05/21 08:49:03 kamil Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.4 2018/05/22 04:32:56 kamil Exp $");
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -57,21 +59,41 @@ static struct {
 	{ "ignore",	F_IGNORE }
 };
 
+static int sig;
+static struct {
+	const char *n;
+	int v;
+} sn[] = {
+	{ "segv",	SIGSEGV },
+	{ "trap",	SIGTRAP }
+};
+
 static void
 foo(int s)
 {
 char buf[64];
 int i = snprintf(buf, sizeof(buf), "got %d\n", s);
 write(2, buf, i);
-	if (flags & F_RECURSE)
-		*p = 0;
+	if (flags & F_RECURSE) {
+		if (sig == SIGSEGV)
+			*p = 0;
+		else if (sig == SIGTRAP) {
+#ifdef PTRACE_BREAKPOINT_ASM
+			PTRACE_BREAKPOINT_ASM;
+#else
+			/* port me */
+#endif
+		}
+	}
 exit(EXIT_SUCCESS);
 }
 
 static __dead void
 usage(void)
 {
-	fprintf(stderr, "Usage: %s recurse|mask|handle ...\n", getprogname());
+	const char *pname = getprogname();
+
+	fprintf(stderr, "Usage: %s recurse|mask|handle|ignore ...\n", pname);
 	exit(EXIT_FAILURE);
 }
 
@@ -83,16 +105,21 @@ main(int argc, char *argv[])
 
 	for (int i = 1; i < argc; i++) {
 		size_t j;
-		for (j = 0; j < __arraycount(nv); j++)
+		for (j = 0; j < __arraycount(nv); j++) {
 			if (strcmp(nv[j].n, argv[i]) == 0) {
 flags |= nv[j].v;
 break;
 			}
+			if (strcmp(sn[j].n, argv[i]) == 0) {
+sig = sn[j].v;
+break;
+			}
+		}
 		if (j == __arraycount(nv))
 			usage();
 	}
 
-	if (flags == 0)
+	if (flags == 0 || sig == 0)
 		usage();
 
 	if (flags & F_HANDLE) {
@@ -101,7 +128,7 @@ main(int argc, char *argv[])
 		sa.sa_flags = SA_RESTART;
 		sa.sa_handler = foo;
 		sigemptyset(_mask);
-		if (sigaction(SIGSEGV, , NULL) == -1)
+		if (sigaction(sig, , NULL) == -1)
 			err(EXIT_FAILURE, "sigaction");
 	}
 
@@ -109,7 +136,7 @@ main(int argc, char *argv[])
 		sigset_t set;
 
 		sigemptyset();
-		sigaddset(, SIGSEGV);
+		sigaddset(, sig);
 		if (sigprocmask(SIG_BLOCK, , NULL) == -1)
 			err(EXIT_FAILURE, "sigprocmask");
 	}
@@ -120,10 +147,18 @@ main(int argc, char *argv[])
 		memset(, 0, sizeof(sa));
 		sa.sa_handler = SIG_IGN;
 		sigemptyset(_mask);
-		if (sigaction(SIGSEGV, , NULL) == -1)
+		if (sigaction(sig, , NULL) == -1)
 			err(EXIT_FAILURE, "sigaction");
 	}
 
-*p = 1;
+	if (sig == SIGSEGV)
+	*p = 1;
+	else if (sig == SIGTRAP) {
+#ifdef PTRACE_BREAKPOINT_ASM
+		PTRACE_BREAKPOINT_ASM;
+#else
+		/* port me */
+#endif
+	}
 	return EXIT_SUCCESS;
 }

Index: src/tests/kernel/t_trapsignal.sh
diff -u src/tests/kernel/t_trapsignal.sh:1.2 src/tests/kernel/t_trapsignal.sh:1.3
--- src/tests/kernel/t_trapsignal.sh:1.2	Mon May 21 08:49:03 2018
+++ src/tests/kernel/t_trapsignal.sh	Tue May 22 04:32:56 2018
@@ -1,4 +1,4 @@
-# $NetBSD: t_trapsignal.sh,v 1.2 2018/05/21 08:49:03 kamil Exp $
+# $NetBSD: t_trapsignal.sh,v 1.3 2018/05/22 04:32:56 kamil Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -29,60 +29,128 @@
 #
 
 HELPER=$(atf_get_srcdir)/h_segv
+atf_test_case segv_simple
+segv_simple()
+{
+	atf_set "descr" "Test unhandled SIGSEGV with the right exit code"
+}
+segv_simple_body()
+{
+	atf_check -s signal:11 -o 

CVS commit: src/lib/libc/sys

2018-05-21 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue May 22 05:39:45 UTC 2018

Modified Files:
src/lib/libc/sys: sigaction.2

Log Message:
Remove reference to itself.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/sys/sigaction.2

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

Modified files:

Index: src/lib/libc/sys/sigaction.2
diff -u src/lib/libc/sys/sigaction.2:1.50 src/lib/libc/sys/sigaction.2:1.51
--- src/lib/libc/sys/sigaction.2:1.50	Tue May 22 03:07:50 2018
+++ src/lib/libc/sys/sigaction.2	Tue May 22 05:39:44 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sigaction.2,v 1.50 2018/05/22 03:07:50 kamil Exp $
+.\"	$NetBSD: sigaction.2,v 1.51 2018/05/22 05:39:44 wiz Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -394,7 +394,6 @@ below is unsafe to use in signal handler
 .Xr setsockopt 2 ,
 .Xr setuid 2 ,
 .Xr shutdown 2 ,
-.Xr sigaction 2 ,
 .Xr sigaddset 3 ,
 .Xr sigdelset 3 ,
 .Xr sigemptyset 3 ,



CVS commit: src/lib/libc/sys

2018-05-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 22 03:07:50 UTC 2018

Modified Files:
src/lib/libc/sys: sigaction.2

Log Message:
Minor improvement in sigaction(2)

Note that SIGCHLD covers process continued event.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/lib/libc/sys/sigaction.2

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

Modified files:

Index: src/lib/libc/sys/sigaction.2
diff -u src/lib/libc/sys/sigaction.2:1.49 src/lib/libc/sys/sigaction.2:1.50
--- src/lib/libc/sys/sigaction.2:1.49	Mon Jul 25 22:00:36 2016
+++ src/lib/libc/sys/sigaction.2	Tue May 22 03:07:50 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sigaction.2,v 1.49 2016/07/25 22:00:36 wiz Exp $
+.\"	$NetBSD: sigaction.2,v 1.50 2018/05/22 03:07:50 kamil Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sigaction.2	8.2 (Berkeley) 4/3/94
 .\"
-.Dd July 9, 2016
+.Dd May 22, 2018
 .Dt SIGACTION 2
 .Os
 .Sh NAME
@@ -192,7 +192,7 @@ signal,
 the
 .Dv SIGCHLD
 signal will be generated only when a child process exits,
-not when a child process stops.
+not when a child process stops or continues.
 .It Dv SA_NOCLDWAIT
 If set, the system will not create a zombie when the child exits,
 but the child process will be automatically waited for.



CVS commit: src/share/misc

2018-05-21 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Tue May 22 02:54:32 UTC 2018

Modified Files:
src/share/misc: acronyms

Log Message:
Add M, ROM, and SWOT


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.272 src/share/misc/acronyms:1.273
--- src/share/misc/acronyms:1.272	Tue May 22 02:46:19 2018
+++ src/share/misc/acronyms	Tue May 22 02:54:32 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.272 2018/05/22 02:46:19 ginsbach Exp $
+$NetBSD: acronyms,v 1.273 2018/05/22 02:54:32 ginsbach Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -326,6 +326,7 @@ LOL	laughing out loud
 LP	long playing [record]
 LTNS	long time no see
 LWYL	laugh with you later
+M	management & operations
 M8	mate
 MAD	mutually assured destruction
 MBA	master of business administration
@@ -453,6 +454,7 @@ RLC	rod length check
 RMS	Richard Matthew Stallman
 ROFL	rolling on floor laughing
 ROFLMAO	rolling on floor laughing my ass off
+ROM	rough order of magnitude
 ROI	return on investment
 ROTFL	rolling on the floor laughing
 RP	responsible person
@@ -490,6 +492,7 @@ SUX2BU	sucks to be you
 SWAG	silly, wild-assed guess
 SWAHBI	silly, wild-assed hare-brained idea
 SWMBO	she who must be obeyed
+SWOT	strength, weaknesses, opportunities, threats
 SYS	see you soon
 TA	teaching assistant
 TANSTAAFL	there ain't no such thing as a free lunch



CVS commit: src/doc

2018-05-21 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Mon May 21 14:48:55 UTC 2018

Modified Files:
src/doc: 3RDPARTY

Log Message:
Postfix 3.1.9/3.2.6/3.3.1 has released.


To generate a diff of this commit:
cvs rdiff -u -r1.1523 -r1.1524 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1523 src/doc/3RDPARTY:1.1524
--- src/doc/3RDPARTY:1.1523	Sat May  5 00:13:01 2018
+++ src/doc/3RDPARTY	Mon May 21 14:48:55 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1523 2018/05/05 00:13:01 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1524 2018/05/21 14:48:55 taca Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1174,7 +1174,7 @@ now to do a new import.
 
 Package:	Postfix
 Version:	3.1.4
-Current Vers:	3.1.6/3.2.2
+Current Vers:	3.1.6/3.2.6/3.3.1
 Maintainer:	Wietse Venema 
 Archive Site:	ftp://postfix.cloud9.net/official/
 Home Page:	http://www.postfix.org/



CVS commit: src/sys/arch/arm/cortex

2018-05-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 21 10:28:13 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
Replace stable_read/write debug printfs with event counters


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/cortex/gtmr.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.27 src/sys/arch/arm/cortex/gtmr.c:1.28
--- src/sys/arch/arm/cortex/gtmr.c:1.27	Mon May 14 17:15:54 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Mon May 21 10:28:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.27 2018/05/14 17:15:54 joerg Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.28 2018/05/21 10:28:13 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.27 2018/05/14 17:15:54 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.28 2018/05/21 10:28:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,29 +51,27 @@ __KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.2
 #include 
 
 #define stable_write(reg) \
+static struct evcnt reg ## _write_ev; \
 static void \
 reg ## _stable_write(struct gtmr_softc *sc, uint64_t val) \
 { \
-	static int max_retry = 0; \
 	int retry; \
 	reg ## _write(val); \
 	retry = 0; \
 	while (reg ## _read() != (val) && retry++ < 200) \
 		reg ## _write(val); \
-	if (retry > max_retry) { \
-		aprint_verbose_dev(sc->sc_dev, #reg "_write max retries %d -> %d\n", \
-		max_retry, retry); \
-		max_retry = retry; \
+	if (retry > reg ## _write_ev.ev_count) { \
+		reg ## _write_ev.ev_count = retry; \
 	} \
 }
 
 stable_write(gtmr_cntv_tval);
 
 #define stable_read(reg) \
+static struct evcnt reg ## _read_ev; \
 static uint64_t \
 reg ## _stable_read(struct gtmr_softc *sc) \
 { \
-	static int max_retry = 0; \
 	uint64_t oval, val; \
 	int retry = 0; \
 	val = reg ## _read(); \
@@ -83,10 +81,8 @@ reg ## _stable_read(struct gtmr_softc *s
 		if (val == oval) \
 			break; \
 	} \
-	if (retry > max_retry) { \
-		aprint_verbose_dev(sc->sc_dev, #reg "_read max retries %d -> %d\n", \
-		max_retry, retry); \
-		max_retry = retry; \
+	if (retry > reg ## _read_ev.ev_count) { \
+		reg ## _read_ev.ev_count = retry; \
 	} \
 	return val; \
 }
@@ -175,6 +171,15 @@ gtmr_attach(device_t parent, device_t se
 	evcnt_attach_dynamic(>sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "missing interrupts");
 
+	evcnt_attach_dynamic(_cntv_tval_write_ev, EVCNT_TYPE_MISC, NULL,
+	device_xname(self), "CNTV_TVAL write retry max");
+	evcnt_attach_dynamic(_cntv_cval_read_ev, EVCNT_TYPE_MISC, NULL,
+	device_xname(self), "CNTV_CVAL read retry max");
+	evcnt_attach_dynamic(_cntvct_read_ev, EVCNT_TYPE_MISC, NULL,
+	device_xname(self), "CNTVCT read retry max");
+	evcnt_attach_dynamic(_cntpct_read_ev, EVCNT_TYPE_MISC, NULL,
+	device_xname(self), "CNTPCT read retry max");
+
 	if (mpcaa->mpcaa_irq != -1) {
 		sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK,
 		IST_LEVEL | IST_MPSAFE, gtmr_intr, NULL);



CVS commit: src/sys/external/bsd/drm2/nouveau

2018-05-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon May 21 08:58:47 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_pci.c

Log Message:
disable drm2 on modern nouveau cards (Pascal-based).

our older drm doesn't have any support for modern Pascal or
the second version of Maxwell (but not disabled here yet)
but the driver tries to attach on any nvidia gpu.

this should workaround PR#53258, and other issues reported
with modern nvidia chipsets.

XXX: pullup-7, pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c

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

Modified files:

Index: src/sys/external/bsd/drm2/nouveau/nouveau_pci.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8 src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.9
--- src/sys/external/bsd/drm2/nouveau/nouveau_pci.c:1.8	Tue Apr 19 06:57:37 2016
+++ src/sys/external/bsd/drm2/nouveau/nouveau_pci.c	Mon May 21 08:58:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_pci.c,v 1.8 2016/04/19 06:57:37 mrg Exp $	*/
+/*	$NetBSD: nouveau_pci.c,v 1.9 2018/05/21 08:58:47 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.8 2016/04/19 06:57:37 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_pci.c,v 1.9 2018/05/21 08:58:47 mrg Exp $");
 
 #include 
 #include 
@@ -91,6 +91,30 @@ nouveau_pci_match(device_t parent, cfdat
 	if (PCI_CLASS(pa->pa_class) != PCI_CLASS_DISPLAY)
 		return 0;
 
+#define IS_BETWEEN(x,y) \
+	(PCI_PRODUCT(pa->pa_id) >= (x) && PCI_PRODUCT(pa->pa_id) <= (y))
+
+	/*
+	 * NetBSD drm2 doesn't support Pascal-based cards:
+	 *   0x1580-0x15ff 	GP100
+	 *   0x1b00-0x1b7f 	GP102
+	 *   0x1b80-0x1bff 	GP104
+	 *   0x1c00-0x1c7f 	GP106
+	 *   0x1c80-0x1cff 	GP107
+	 *   0x1d00-0x1d7f 	GP108
+	 *   0x1d80-0x1dff 	GV100
+	 */
+	
+	if (IS_BETWEEN(0x1580, 0x15ff) ||
+	IS_BETWEEN(0x1b00, 0x1b7f) ||
+	IS_BETWEEN(0x1b80, 0x1bff) ||
+	IS_BETWEEN(0x1c00, 0x1c7f) ||
+	IS_BETWEEN(0x1c80, 0x1cff) ||
+	IS_BETWEEN(0x1d00, 0x1d7f) ||
+	IS_BETWEEN(0x1d80, 0x1dff))
+		return 0;
+#undef IS_BETWEEN
+
 	return 6;		/* XXX Beat genfb_pci...  */
 }
 



CVS commit: src/tests/kernel

2018-05-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon May 21 08:49:03 UTC 2018

Modified Files:
src/tests/kernel: h_segv.c t_trapsignal.sh

Log Message:
Add new ATF test: t_trapsignal:trap_ignore

Test ignored trap with right exit code.

This test passes.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/kernel/h_segv.c
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/t_trapsignal.sh

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

Modified files:

Index: src/tests/kernel/h_segv.c
diff -u src/tests/kernel/h_segv.c:1.2 src/tests/kernel/h_segv.c:1.3
--- src/tests/kernel/h_segv.c:1.2	Fri Dec  8 14:40:45 2017
+++ src/tests/kernel/h_segv.c	Mon May 21 08:49:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_segv.c,v 1.2 2017/12/08 14:40:45 christos Exp $	*/
+/*	$NetBSD: h_segv.c,v 1.3 2018/05/21 08:49:03 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: h_segv.c,v 1.2 2017/12/08 14:40:45 christos Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.3 2018/05/21 08:49:03 kamil Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ static int flags;
 #define F_RECURSE 	1
 #define F_HANDLE	2
 #define F_MASK		4
+#define F_IGNORE	8
 
 static struct {
 	const char *n;
@@ -53,6 +54,7 @@ static struct {
 	{ "recurse",	F_RECURSE },
 	{ "handle",	F_HANDLE },
 	{ "mask",	F_MASK },
+	{ "ignore",	F_IGNORE }
 };
 
 static void
@@ -112,6 +114,16 @@ main(int argc, char *argv[])
 			err(EXIT_FAILURE, "sigprocmask");
 	}
 
+	if (flags & F_IGNORE) {
+		struct sigaction sa;
+
+		memset(, 0, sizeof(sa));
+		sa.sa_handler = SIG_IGN;
+		sigemptyset(_mask);
+		if (sigaction(SIGSEGV, , NULL) == -1)
+			err(EXIT_FAILURE, "sigaction");
+	}
+
 *p = 1;
 	return EXIT_SUCCESS;
 }

Index: src/tests/kernel/t_trapsignal.sh
diff -u src/tests/kernel/t_trapsignal.sh:1.1 src/tests/kernel/t_trapsignal.sh:1.2
--- src/tests/kernel/t_trapsignal.sh:1.1	Thu Dec  7 19:46:40 2017
+++ src/tests/kernel/t_trapsignal.sh	Mon May 21 08:49:03 2018
@@ -1,4 +1,4 @@
-# $NetBSD: t_trapsignal.sh,v 1.1 2017/12/07 19:46:40 christos Exp $
+# $NetBSD: t_trapsignal.sh,v 1.2 2018/05/21 08:49:03 kamil Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -85,10 +85,23 @@ trap_handle_recurse_body()
 		${HELPER} handle recurse
 }
 
+atf_test_case trap_ignore
+trap_ignore()
+{
+	atf_set "descr" "Test ignored trap with right exit code"
+}
+
+trap_ignore_body()
+{
+	atf_check -s signal:11 -o "inline:" -e "inline:" \
+		${HELPER} ignore
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case trap_simple
 	atf_add_test_case trap_handle
 	atf_add_test_case trap_mask
 	atf_add_test_case trap_handle_recurse
+	atf_add_test_case trap_ignore
 }