Module Name:    src
Committed By:   riastradh
Date:           Sun Jul 10 09:59:22 UTC 2022

Modified Files:
        src/sys/sys: cpuio.h

Log Message:
cpuio.h: Use uint8_t, not bool.

In principle bool can only store two values, 0 and 1, but occupies
eight bits of storage (on all NetBSD platforms to my knowledge),
meaning there are 254 other values which might be trap
representations which would be undefined behaviour to use but which
userland can control the bits of.

To placate ubsan, just use uint8_t here instead of bool.  No bump or
anything because the ABI is the same: one-byte field with one-byte
alignment.

Reported-by: syzbot+3bc3d6837da151448...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/cpuio.h

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

Modified files:

Index: src/sys/sys/cpuio.h
diff -u src/sys/sys/cpuio.h:1.9 src/sys/sys/cpuio.h:1.10
--- src/sys/sys/cpuio.h:1.9	Sat Jan  5 16:36:38 2013
+++ src/sys/sys/cpuio.h	Sun Jul 10 09:59:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuio.h,v 1.9 2013/01/05 16:36:38 dsl Exp $	*/
+/*	$NetBSD: cpuio.h,v 1.10 2022/07/10 09:59:22 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2009, 2012 The NetBSD Foundation, Inc.
@@ -47,9 +47,9 @@
  */
 typedef struct cpustate {
 	u_int		cs_id;		/* matching ci_cpuid */
-	bool		cs_online;	/* running unbound LWPs */
-	bool		cs_intr;	/* fielding interrupts */
-	bool		cs_unused[2];	/* reserved */
+	uint8_t		cs_online;	/* running unbound LWPs */
+	uint8_t		cs_intr;	/* fielding interrupts */
+	uint8_t		cs_unused[2];	/* reserved */
 	int32_t		cs_lastmod;	/* time of last state change */
 	char		cs_name[16];	/* reserved */
 	int32_t		cs_lastmodhi;	/* time of last state change */

Reply via email to