From nobody Thu Nov 09 14:41:19 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SR4QS3Gw3z4ywPZ; Thu, 9 Nov 2023 14:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SR4QS1DBHz3RXL; Thu, 9 Nov 2023 14:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699540880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6GCeVQZBBkb/NxqiR6NHyJEOmuz60P1XpqPYXL4w8kU=; b=xVzeHby1j03S7ihA/XkvHLt1VX++2JMBtiesM1bt+4CAemSs8wZXoCI9gEw/NVZOmmfMk4 DXFnP509ekNm+18EACb62NNeLOtKJsQASRQYTBrLW4ZdJhTT+dGGT6Z0eiAN0J/vY6IDCZ VIjyvtMg2VB0MgW17m7uiZduXoMbsCDEwWWhUHlZaDqBzgSMx1sZMQgmI7I5+SYTPl3qsJ eX93SJ8RIBa6GcfXJ4zmkBes3VqqOi6UaXW8u7Oa3U48aIN+/Nj3DKvQMA2jtaeTKd7ol2 gpbIJ2tSlBbFIuKzLA4AHsw0mUi+G+hRDmCUMB10wfX/G9VMy6lhbrR/9VaJjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699540880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6GCeVQZBBkb/NxqiR6NHyJEOmuz60P1XpqPYXL4w8kU=; b=VV7ZcJFWYAepCD312Yi4ef/yp+7lKYMSRqoDNufKQ09r4Z+S+qyx18+Q8We74rh5Urereq FTg2kddKFOB/FIbtaWrY9Qx3ONzFZD384Ncsrnr9U9EWgdS0OdECVSLwo7ZKSxotc50Zjy AZ9NSke3Pnc8HEil19PrrWBKiYTnYX2MQEpxg9mOtDKuN/SEQBnatIqFIOcDJXHFZhxBBC cD41pSbFWTho9nXbkCbZU0GOwe5BlrT1ETj+AYFsBZ4ftQFS1f891lS2wFaQAN3Pb+O1ji SEt4UPYP7q6L4cG2EyBAK95U3gd3alXMgAApUPDuVOeu0t99QAD/al4G2NoaGw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699540880; a=rsa-sha256; cv=none; b=NI08Z6aLBo+8+6rjvuCM/7lIOx9WlaIvSyqp9cqIU4emoJSQHwmqV5mxIDVeUyDRhFIsvS 1HuGnjHQtsnP84S47SXL34//R5rzWqKBydKU8PHxVF8mo1Ru5NijO7va/6kYyPtfjJDJIc rEbA+SCk8mt2Q8aNQDywrUhxUyXvcR/bl2RJXZQmJASp9LtR2fTqLm32g3Gt2k4s0YqAvR FN5zj8yud1PClvfSj/zkQqFP3n3W/r9Qsv1oWmeLmtbAOJxqgaBoF7Zt0iBxo3Z9LvVVqT gSCCMoD6nnGHqqbwodVoy2PFu193mlBkwvxAx1Dbcnl/GsNOvdCZVARmY4qncQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SR4QS0Dg2z4fT; Thu, 9 Nov 2023 14:41:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A9EfJjh078617; Thu, 9 Nov 2023 14:41:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A9EfJqv078614; Thu, 9 Nov 2023 14:41:19 GMT (envelope-from git) Date: Thu, 9 Nov 2023 14:41:19 GMT Message-Id: <202311091441.3A9EfJqv078614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 5a36abc20348 - stable/14 - makefs/zfs: Add a regression test which checks file access permissions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 5a36abc2034805cec066cf0ac54ec4d25e4a22c4 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5a36abc2034805cec066cf0ac54ec4d25e4a22c4 commit 5a36abc2034805cec066cf0ac54ec4d25e4a22c4 Author: Mark Johnston AuthorDate: 2023-11-08 12:04:33 +0000 Commit: Mark Johnston CommitDate: 2023-11-09 14:41:10 +0000 makefs/zfs: Add a regression test which checks file access permissions MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 7e5002e3d6038b69e23f6c1982caf20cd62139f7) --- usr.sbin/makefs/tests/makefs_zfs_tests.sh | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/usr.sbin/makefs/tests/makefs_zfs_tests.sh b/usr.sbin/makefs/tests/makefs_zfs_tests.sh index 1811b1bc8a8c..6e20ae33b354 100644 --- a/usr.sbin/makefs/tests/makefs_zfs_tests.sh +++ b/usr.sbin/makefs/tests/makefs_zfs_tests.sh @@ -794,6 +794,49 @@ used_space_props_cleanup() common_cleanup } +# Verify that file permissions are set properly. Make sure that non-executable +# files can't be executed. +atf_test_case perms cleanup +perms_body() +{ + local mode + + create_test_dirs + cd $TEST_INPUTS_DIR + + for mode in $(seq 0 511); do + mode=$(printf "%04o\n" $mode) + echo 'echo a' > $mode + atf_check chmod $mode $mode + done + + cd - + + atf_check $MAKEFS -s 1g -o rootpath=/ -o poolname=$ZFS_POOL_NAME \ + $TEST_IMAGE $TEST_INPUTS_DIR + + import_image + + check_image_contents + + for mode in $(seq 0 511); do + mode=$(printf "%04o\n" $mode) + if [ $(($mode & 0111)) -eq 0 ]; then + atf_check -s not-exit:0 -e match:"Permission denied" \ + ${TEST_INPUTS_DIR}/$mode + fi + if [ $(($mode & 0001)) -eq 0 ]; then + atf_check -s not-exit:0 -e match:"Permission denied" \ + su -m tests -c ${TEST_INPUTS_DIR}/$mode + fi + done + +} +perms_cleanup() +{ + common_cleanup +} + atf_init_test_cases() { atf_add_test_case autoexpand @@ -817,6 +860,7 @@ atf_init_test_cases() atf_add_test_case soft_links atf_add_test_case root_props atf_add_test_case used_space_props + atf_add_test_case perms # XXXMJ tests: # - test with different ashifts (at least, 9 and 12), different image sizes