From patchwork Sun Aug 13 17:32:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 9897981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 294206038F for ; Sun, 13 Aug 2017 17:33:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F009628618 for ; Sun, 13 Aug 2017 17:33:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D433A2862D; Sun, 13 Aug 2017 17:33:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C178928618 for ; Sun, 13 Aug 2017 17:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751025AbdHMRcc (ORCPT ); Sun, 13 Aug 2017 13:32:32 -0400 Received: from imap.thunk.org ([74.207.234.97]:38798 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751047AbdHMRcb (ORCPT ); Sun, 13 Aug 2017 13:32:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=Message-Id:Date:Subject:Cc:To:From; bh=c/LfCX1OYeHKFGwjoUv6k8RTw2PunTFRJg5P1oyQY5s=; b=w0HnX0V0GH7lbM5/xejMsuqGUeZ0r2J3jsqM35J6hoZeCCg+NeLE+oK5qdHPk/qB/JILQZYasy65OsIwaW5leZkM9jQ3LqrQoT+kZPSFZXx+YU3tnX+kQYi4oacjNEk9A0qfNAViuYZ2ZPKgdIU7cWrN9G4oA3N1AJTe+jSp3K8=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.84_2) (envelope-from ) id 1dgwkY-0003Wz-4W; Sun, 13 Aug 2017 17:32:30 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 4BAECC00385; Sun, 13 Aug 2017 13:32:29 -0400 (EDT) From: Theodore Ts'o To: fstests@vger.kernel.org Cc: Theodore Ts'o Subject: [xfstest-bld PATCH 1/2] test-appliance: add safety check for "gen-image --out-tar" Date: Sun, 13 Aug 2017 13:32:23 -0400 Message-Id: <20170813173224.28900-1-tytso@mit.edu> X-Mailer: git-send-email 2.11.0.rc0.7.gbe5a750 X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The gen-image script must not be run as root when generating a tar file. This is because it uses fakechroot and fakeroot, and if run as root, the debootstrap script will end up damaging a large number of devices in the /dev directory. Signed-off-by: Theodore Ts'o Reviewed-by: Eric Biggers --- kvm-xfstests/test-appliance/gen-image | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kvm-xfstests/test-appliance/gen-image b/kvm-xfstests/test-appliance/gen-image index dbd9b84..e7bdb35 100755 --- a/kvm-xfstests/test-appliance/gen-image +++ b/kvm-xfstests/test-appliance/gen-image @@ -76,6 +76,10 @@ fi if test -n "$OUT_TAR" ; then if test "$FAKECHROOT" != "true" ; then + if test "$EUID" -eq 0 ; then + echo "This script MUST NOT be run as root with --out_tar" + exit 1; + fi set -- "${SAVE_ARGS[@]}" exec fakechroot $0 "$@" fi