From owner-freebsd-bugs Fri Mar 29 19:20:14 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id C9A4A37B41E for ; Fri, 29 Mar 2002 19:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g2U3K1X07751; Fri, 29 Mar 2002 19:20:01 -0800 (PST) (envelope-from gnats) Received: from mailout02.sul.t-online.com (mailout02.sul.t-online.com [194.25.134.17]) by hub.freebsd.org (Postfix) with ESMTP id 4B59137B405 for ; Fri, 29 Mar 2002 19:18:50 -0800 (PST) Received: from fwd07.sul.t-online.de by mailout02.sul.t-online.com with smtp id 16r99p-00046r-01; Sat, 30 Mar 2002 04:03:57 +0100 Received: from spirit.zuhause.stoert.net (320050403952-0001@[217.82.55.8]) by fmrl07.sul.t-online.com with esmtp id 16r99j-0B2ypMC; Sat, 30 Mar 2002 04:03:51 +0100 Received: from elevation.zuhause.stoert.net (elevation.zuhause.stoert.net [192.168.66.46]) by spirit.zuhause.stoert.net (8.11.6/8.11.6) with ESMTP id g2U33oR52399 for ; Sat, 30 Mar 2002 04:03:50 +0100 (CET) (envelope-from corecode@corecode.ath.cx) Received: (from corecode@localhost) by elevation.zuhause.stoert.net (8.11.6/8.11.6) id g2U33ki38379; Sat, 30 Mar 2002 04:03:46 +0100 (CET) (envelope-from corecode) Message-Id: <200203300303.g2U33ki38379@elevation.zuhause.stoert.net> Date: Sat, 30 Mar 2002 04:03:46 +0100 (CET) From: "Simon 'corecode' Schubert" Reply-To: "Simon 'corecode' Schubert" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: kern/36522: stat outside procs in procfs succeeds from within a jail Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 36522 >Category: kern >Synopsis: stat outside procs in procfs succeeds from within a jail >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 29 19:20:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Simon 'corecode' Schubert >Release: FreeBSD 4.5-STABLE i386 >Organization: >Environment: System: FreeBSD elevation.zuhause.stoert.net 4.5-STABLE FreeBSD 4.5-STABLE #0: Fri Mar 22 19:08:08 CET 2002 corecode@elevation.zuhause.stoert.net:/usr/obj/i386/k7/usr/src/sys/ELEVATION i386 >Description: from within a jail: doing a stat(2) on a process' dir/file in procfs that doesn't belong to the jail returns a valid result and not ENOENT, though readdir doesn't list these directories/files >How-To-Repeat: # jail / elev 1 `which perl` \ -e 'stat "/proc/$ARGV[0]" and print "valid!\n" or print "invalid!\n"' 1 should print `invalid!', but doesn't do so. >Fix: i'm no kernel hacker, but i assume there is a PRISON_CHECK() missing; i didn't check that code, just assume that. no guarantee this will even compile neither work! --- /usr/src/sys/miscfs/procfs/procfs_vnops.c Wed Jan 23 02:00:54 2002 +++ procfs_vnops.c Sat Mar 30 04:00:51 2002 @@ -444,7 +444,7 @@ default: procp = PFIND(pfs->pfs_pid); if (procp == NULL || procp->p_cred == NULL || - procp->p_ucred == NULL) + procp->p_ucred == NULL || !PRISON_CHECK(curproc, procp)) return (ENOENT); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message