git: 337b2a037299 - stable/13 - identcpu: Let the hw.model be readable in capability mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 11 Jan 2024 14:35:23 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=337b2a037299915af419723fc57d7d6d46bd5e1e

commit 337b2a037299915af419723fc57d7d6d46bd5e1e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-01-04 13:26:53 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-01-11 14:33:16 +0000

    identcpu: Let the hw.model be readable in capability mode
    
    On some platforms this static information can be derived directly from
    the CPU, and there doesn't seem much use in restricting it.
    
    Reviewed by:    emaste, imp, kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D43281
    
    (cherry picked from commit 0aba5dd2af57ea3ae90eb49d7745c4c5b6f0ab6b)
---
 sys/arm/arm/identcpu-v6.c  | 2 +-
 sys/arm64/arm64/identcpu.c | 2 +-
 sys/powerpc/powerpc/cpu.c  | 2 +-
 sys/x86/x86/identcpu.c     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/arm/arm/identcpu-v6.c b/sys/arm/arm/identcpu-v6.c
index 5e52645d39af..baae9ac360ad 100644
--- a/sys/arm/arm/identcpu-v6.c
+++ b/sys/arm/arm/identcpu-v6.c
@@ -56,7 +56,7 @@ SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
 	machine, 0, "Machine class");
 
 static char cpu_model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD,
     cpu_model, sizeof(cpu_model), "Machine model");
 
 static char hw_buf[81];
diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c
index c46747be1bd5..200841782f03 100644
--- a/sys/arm64/arm64/identcpu.c
+++ b/sys/arm64/arm64/identcpu.c
@@ -99,7 +99,7 @@ SYSCTL_PROC(_hw, HW_MACHINE, machine, CTLTYPE_STRING | CTLFLAG_RD |
 	CTLFLAG_MPSAFE, NULL, 0, sysctl_hw_machine, "A", "Machine class");
 
 static char cpu_model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD,
 	cpu_model, sizeof(cpu_model), "Machine model");
 
 #define	MAX_CACHES	8	/* Maximum number of caches supported
diff --git a/sys/powerpc/powerpc/cpu.c b/sys/powerpc/powerpc/cpu.c
index bf676b8e08e1..d450044780a9 100644
--- a/sys/powerpc/powerpc/cpu.c
+++ b/sys/powerpc/powerpc/cpu.c
@@ -239,7 +239,7 @@ static void	cpu_6xx_print_cacheinfo(u_int, uint16_t);
 static int	cpu_feature_bit(SYSCTL_HANDLER_ARGS);
 
 static char model[64];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, model, 0, "");
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD, model, 0, "");
 
 static const struct cputab	*cput;
 
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index 6a51c48ab604..92a88ede5f79 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -158,7 +158,7 @@ SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
 #endif
 
 char cpu_model[128];
-SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_MPSAFE,
+SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD | CTLFLAG_CAPRD | CTLFLAG_MPSAFE,
     cpu_model, 0, "Machine model");
 
 static int hw_clockrate;