Module Name:    src
Committed By:   kamil
Date:           Wed May 30 17:48:13 UTC 2018

Modified Files:
        src/tests/kernel: h_segv.c
        src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Add a comment for the workaround in trigger_bus()

Explain PROT_READ|PROT_WRITE.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/h_segv.c
cvs rdiff -u -r1.10 -r1.11 src/tests/lib/libc/sys/t_ptrace_wait.h

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.6 src/tests/kernel/h_segv.c:1.7
--- src/tests/kernel/h_segv.c:1.6	Wed May 30 17:31:34 2018
+++ src/tests/kernel/h_segv.c	Wed May 30 17:48:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: h_segv.c,v 1.6 2018/05/30 17:31:34 kamil Exp $	*/
+/*	$NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: h_segv.c,v 1.6 2018/05/30 17:31:34 kamil Exp $");
+__RCSID("$NetBSD: h_segv.c,v 1.7 2018/05/30 17:48:13 kamil Exp $");
 
 #include <sys/types.h>
 #include <sys/mman.h>
@@ -119,7 +119,12 @@ trigger_bus(void)
 	if (fp == NULL)
 		err(EXIT_FAILURE, "tmpfile");
 
-	/* Map an empty file with mmap(2) to a pointer. */
+	/*
+	 * Map an empty file with mmap(2) to a pointer.
+	 *
+	 * PROT_READ handles read-modify-write sequences emitted for
+	 * certain combinations of CPUs and compilers (e.g. Alpha AXP).
+	 */
 	p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
 	if (p == MAP_FAILED)
 		err(EXIT_FAILURE, "mmap");

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.10 src/tests/lib/libc/sys/t_ptrace_wait.h:1.11
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.10	Wed May 30 17:31:34 2018
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Wed May 30 17:48:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.10 2018/05/30 17:31:34 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.11 2018/05/30 17:48:13 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -574,7 +574,12 @@ trigger_bus(void)
 	fp = tmpfile();
 	FORKEE_ASSERT_NEQ((uintptr_t)fp, (uintptr_t)NULL);
 
-	/* Map an empty file with mmap(2) to a pointer. */
+	/*
+	 * Map an empty file with mmap(2) to a pointer.
+	 *
+	 * PROT_READ handles read-modify-write sequences emitted for
+	 * certain combinations of CPUs and compilers (e.g. Alpha AXP).
+	 */
 	p = mmap(0, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fileno(fp), 0);
 	FORKEE_ASSERT_NEQ((uintptr_t)p, (uintptr_t)MAP_FAILED);
 

Reply via email to