From owner-freebsd-hackers@freebsd.org Sun Jun 21 22:02:10 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8D71336685 for ; Sun, 21 Jun 2020 22:02:10 +0000 (UTC) (envelope-from sega01@go-beyond.org) Received: from haggis.mythic-beasts.com (haggis.mythic-beasts.com [IPv6:2a00:1098:0:86:1000:0:2:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49qmjY5rgtz3TyX for ; Sun, 21 Jun 2020 22:02:09 +0000 (UTC) (envelope-from sega01@go-beyond.org) Received: from [160.3.200.8] (port=20821 helo=localhost) by haggis.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1jn82P-00085i-B0; Sun, 21 Jun 2020 23:02:06 +0100 Date: Sun, 21 Jun 2020 22:02:00 +0000 From: Teran McKinney To: Alfonso Siciliano Cc: freebsd-hackers@freebsd.org Subject: Re: An option to ignore sysctl CTLFLAG_ANYBODY Message-ID: <20200621220200.GA55789@daemon> References: <20200618172721.GA28529@daemon> <20200621045803.70a373337b6df186fabc54ac@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200621045803.70a373337b6df186fabc54ac@gmail.com> X-BlackCat-Spam-Score: 4 X-Spam-Status: No, score=0.4 X-Rspamd-Queue-Id: 49qmjY5rgtz3TyX X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of sega01@go-beyond.org designates 2a00:1098:0:86:1000:0:2:1 as permitted sender) smtp.mailfrom=sega01@go-beyond.org X-Spamd-Result: default: False [-2.41 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.994]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1098::86:1000:0:2:1]; NEURAL_HAM_LONG(-1.06)[-1.058]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_NOT_FQDN(0.50)[]; DMARC_NA(0.00)[go-beyond.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.46)[-0.461]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:44684, ipnet:2a00:1098::/32, country:GB]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[2a00:1098:0:86:1000:0:2:1:from] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2020 22:02:10 -0000 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