Received: from eggs.gnu.org ([2001:4830:134:3::10]:59658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjKv5-0007Tg-V5 for qemu-devel@nongnu.org; Tue, 06 Oct 2015 01:36:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjKv1-0008Pm-Ur for qemu-devel@nongnu.org; Tue, 06 Oct 2015 01:36:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48228) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjKv1-0008Oq-Py for qemu-devel@nongnu.org; Tue, 06 Oct 2015 01:36:07 -0400 From: Markus Armbruster References: Date: Tue, 06 Oct 2015 07:36:02 +0200 In-Reply-To: (Namsun Ch'o's message of "Mon, 5 Oct 2015 18:58:12 -0400") Message-ID: <87a8rw36f1.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] Add syscalls for -runas and -chroot tothe seccomp sandbox List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Namsun Ch'o Cc: qemu-devel@nongnu.org, eduardo.otubo@profitbricks.com "Namsun Ch'o" writes: >> Drawback: complexity. If we decide to limit ourselves to the original >> threat model (rogue guest), and enter the sandbox only after setup, we >> can keep things simpler. > > We could do both without much complexity. This looks simple enough to me: > > rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(chroot), 1, > SCMP_A0(SCMP_CMP_EQ, chroot_dir)); > if (rc < 0) > goto seccomp_return; > > rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(chdir), 1, > SCMP_A0(SCMP_CMP_EQ, "/")); > if (rc < 0) > goto seccomp_return; > > The only time chroot_dir is ever used is in os-posix.c:139: > > if (chroot(chroot_dir) < 0) { I'm afraid this materially weakens the sandbox. chroot_dir is writable. We don't need to permit chroot(chroot_dir) if we enter the sandbox only after setup.