diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-10-28 10:18:04 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2024-10-28 10:18:04 +0000 |
commit | 669b28a560bc46a3bb3866c9f01de1261bdfdca1 (patch) | |
tree | 679e86c7d05bfd3e1e3cd6471d2c807aa69f3849 /sys/arch/sparc64 | |
parent | d4ced6060887d5c0d2ba01ba8712d8c18882845a (diff) |
Unlock KERN_ALLOWKMEM. The `allowkmem' is atomically accessed integer.
Also use atomic_load_int(9) to load `securelevel'. sysctl_securelevel()
is mp-safe, but will be under kernel lock until all existing
`securelevel' loading became mp-safe too.
ok mpi
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/mem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c index acd60dd5fca..19b8152295d 100644 --- a/sys/arch/sparc64/sparc64/mem.c +++ b/sys/arch/sparc64/sparc64/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.21 2024/06/23 22:08:37 kettenis Exp $ */ +/* $OpenBSD: mem.c,v 1.22 2024/10/28 10:18:03 mvs Exp $ */ /* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */ /* @@ -50,6 +50,7 @@ #include <sys/proc.h> #include <sys/rwlock.h> #include <sys/conf.h> +#include <sys/atomic.h> #include <machine/conf.h> #include <machine/ctlreg.h> @@ -68,7 +69,8 @@ mmopen(dev_t dev, int flag, int mode, struct proc *p) switch (minor(dev)) { case 0: case 1: - if (securelevel <= 0 || allowkmem) + if (atomic_load_int(&securelevel) <= 0 || + atomic_load_int(&allowkmem)) break; return (EPERM); case 2: |