From owner-freebsd-hackers Thu Jun 20 14:13:25 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from prioris.mini.pw.edu.pl (prioris.mini.pw.edu.pl [194.29.178.2]) by hub.freebsd.org (Postfix) with ESMTP id 9844A37B406 for ; Thu, 20 Jun 2002 14:13:13 -0700 (PDT) Received: from localhost (localhost.mini.pw.edu.pl [127.0.0.1]) by prioris.mini.pw.edu.pl (Postfix) with ESMTP id 0BC0D7CEFE for ; Thu, 20 Jun 2002 23:13:09 +0200 (CEST) Received: by prioris.mini.pw.edu.pl (Postfix, from userid 1091) id 1959B7CEC8; Thu, 20 Jun 2002 23:13:03 +0200 (CEST) Date: Thu, 20 Jun 2002 23:13:02 +0200 From: Pawel Jakub Dawidek To: freebsd-hackers@freebsd.org Subject: Procfs patch (for FreeBSd 4.x). Message-ID: <20020620231302.A57333@prioris.mini.pw.edu.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i X-PGP-Key-URL: http://garage.freebsd.pl/jules.pgp X-OS: FreeBSD 4.5-STABLE i386 X-Virus-Scanned: by AMaViS perl-11 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG What You think about something like that: [17:33:39] [ttyv8] [61] leila:root:/sys/miscfs/procfs# diff procfs_subr.c.orig procfs_subr.c 42a43 > #include 80a82,119 > > SYSCTL_NODE(_vfs, OID_AUTO, procfs, CTLFLAG_RW, 0, "vfs-procfs-level"); > > int procfsumask = 077; > > static int > sysctl_vfs_procfsumask(SYSCTL_HANDLER_ARGS) > { > int error, umask, mn, pfsu, tmpumask; > > pfsu = procfsumask; > for (umask = 0, mn = 1; pfsu > 0; mn *= 10) { > umask += (pfsu % 8) * mn; > pfsu /= 8; > } > > error = sysctl_handle_int(oidp, &umask, 0, req); > > if (error || !req->newptr) > return (error); > > tmpumask = pfsu = umask; > for (umask = 0, mn = 1; pfsu > 0; mn *= 8) { > umask += (pfsu % 10) << mn; > pfsu /= 10; > } > > if (tmpumask < 0 || tmpumask > 0777) > return (EPERM); > > procfsumask = tmpumask; > > return (error); > } > > SYSCTL_PROC(_vfs_procfs, OID_AUTO, umask, CTLTYPE_INT|CTLFLAG_RW, > 0, 0, sysctl_vfs_procfsumask, "I", "Current procfs umask"); > 203a243,245 > > if (pfs->pfs_type != Pcurproc) > pfs->pfs_mode &= ~procfsumask; This gives us new sysctl (vfs.procfs.umask) and with this we can control permissions of procfs files (this works like umask(2)). Or maybe just: [17:33:39] [ttyv8] [61] leila:root:/sys/miscfs/procfs# diff procfs_subr.c.orig procfs_subr.c.2 51a52,53 > extern int ps_showallprocs; > 203a206,208 > > if ((!ps_showallprocs) && pfs->pfs_type != Pcurproc) > pfs->pfs_mode &= 0700; Hmm? -- Paweł Jakub Dawidek UNIX Systems Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message