Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jun 2020 22:02:00 +0000
From:      Teran McKinney <sega01@go-beyond.org>
To:        Alfonso Siciliano <alfix86@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: An option to ignore sysctl CTLFLAG_ANYBODY
Message-ID:  <20200621220200.GA55789@daemon>
In-Reply-To: <20200621045803.70a373337b6df186fabc54ac@gmail.com>
References:  <20200618172721.GA28529@daemon> <20200621045803.70a373337b6df186fabc54ac@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2020-06-21 04-58-03    , Alfonso Siciliano wrote:
> This new change to kern_sysctl.c should solve the problem:
> 
> https://github.com/freebsd/freebsd/blob/master/sys/kern/kern_sysctl.c#L2122
> from
> 	/* Is this sysctl writable by only privileged users? */
> 	if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) {
> to
> 	/*
> 	 * Is this sysctl writable? Does it belong to the undocumented interface
> 	 * or sysctlinfo?
> 	 */
> 	if (req->newptr && !(SYSCTL_CHILDREN(&sysctl___sysctl) == oid->oid_parent)) {
> 
> 
> Testing
> 
> 	% uname -K
> 	1300093
> 	% sysctl hw.ncpu
> 	hw.ncpu: 1
> 	% nsysctl -NatGv hw.snd.default_unit
> 	hw.snd.default_unit: integer:  RD WR RW ANYBODY TUN RDTUN RWTUN NOFETCH: 0
> 	% sysctl hw.snd.default_unit
> 	hw.snd.default_unit: 0
> 	% sysctl hw.snd.default_unit=1
> 	hw.snd.default_unit: 0
> 	sysctl: hw.snd.default_unit=1: Operation not permitted
> 
> 
> Alfonso
> 
> --- 
> Alfonso S. Siciliano 
>    http://alfix.gitlab.io
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"

Hi Alfonso,

Your patch works perfectly. Thank you so much! I appreciate it.

Sincerely,

Teran



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200621220200.GA55789>