1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00

Unlock fs_sysctl(). It is the only `suid_clear' variable - atomically

accessed integer.

ok bluhm
This commit is contained in:
mvs 2024-10-31 10:06:51 +00:00
parent 16df6568a5
commit 78b7da8824
3 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sysctl.c,v 1.450 2024/10/28 10:18:03 mvs Exp $ */
/* $OpenBSD: kern_sysctl.c,v 1.451 2024/10/31 10:06:51 mvs Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@ -262,6 +262,7 @@ sys_sysctl(struct proc *p, void *v, register_t *retval)
fn = net_sysctl;
break;
case CTL_FS:
dolock = 0;
fn = fs_sysctl;
break;
case CTL_VFS:

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vfs_subr.c,v 1.324 2024/10/18 05:52:32 miod Exp $ */
/* $OpenBSD: vfs_subr.c,v 1.325 2024/10/31 10:06:51 mvs Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@ -72,6 +72,11 @@
#include "softraid.h"
/*
* Locks used to protect data:
* a atomic
*/
void sr_quiesce(void);
enum vtype iftovt_tab[16] = {
@ -85,7 +90,7 @@ int vttoif_tab[9] = {
};
int prtactive = 0; /* 1 => print out reclaim of active vnodes */
int suid_clear = 1; /* 1 => clear SUID / SGID on owner change */
int suid_clear = 1; /* [a] 1 => clear SUID / SGID on owner change */
/*
* Insq/Remq for the vnode usage lists.

View File

@ -1,4 +1,4 @@
/* $OpenBSD: vfs_syscalls.c,v 1.368 2024/09/01 23:26:10 deraadt Exp $ */
/* $OpenBSD: vfs_syscalls.c,v 1.369 2024/10/31 10:06:51 mvs Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@ -2470,7 +2470,7 @@ dofchownat(struct proc *p, int fd, const char *path, uid_t uid, gid_t gid,
goto out;
if ((uid != -1 || gid != -1) &&
!vnoperm(vp) &&
(suser(p) || suid_clear)) {
(suser(p) || atomic_load_int(&suid_clear))) {
error = VOP_GETATTR(vp, &vattr, p->p_ucred, p);
if (error)
goto out;
@ -2523,7 +2523,7 @@ sys_lchown(struct proc *p, void *v, register_t *retval)
goto out;
if ((uid != -1 || gid != -1) &&
!vnoperm(vp) &&
(suser(p) || suid_clear)) {
(suser(p) || atomic_load_int(&suid_clear))) {
error = VOP_GETATTR(vp, &vattr, p->p_ucred, p);
if (error)
goto out;
@ -2573,7 +2573,7 @@ sys_fchown(struct proc *p, void *v, register_t *retval)
goto out;
if ((uid != -1 || gid != -1) &&
!vnoperm(vp) &&
(suser(p) || suid_clear)) {
(suser(p) || atomic_load_int(&suid_clear))) {
error = VOP_GETATTR(vp, &vattr, p->p_ucred, p);
if (error)
goto out;