From nobody Wed Nov 08 12:31:47 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 4SQPbS0bSwz50Jk4; Wed, 8 Nov 2023 12:31:48 +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 4SQPbS07YZz3Xhl; Wed, 8 Nov 2023 12:31:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699446708; 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=KR+3VvAgI4B6AS0XQoU0XbjqqwHYywLfdYuM3v2jsR8=; b=eLUH0xbSlBlFMVxM+0xbq8bWKxccjsHTNTOneiiYXTsvFx75sheeLnIsAR/l/MtgGccLzB 6KYgZ6E1b5qhUFS4lujTXBvDcAYjxrg5sYBv4jA5SuyPoiwWmIoGFythptE5Co7AMXlALK cYteA6Qmh7sm2ZyQAcuD/x/zsQ7ov9Fhd1mZMua2I6WZ5QdsW10A4HIFbi3PJjuuumlpIQ FxLZSPfEsEmdTX1HocQKrB8BZUe5ED0OLm3mwNafNemeMEX3Veoe/k4/yrnbp1YEy536X3 rPrSMMzXsSpqdcC5tYCGV0jEN4XUc9rymwnk+j8NEvFhPS8DzaV2LEk3o3lIEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699446708; 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=KR+3VvAgI4B6AS0XQoU0XbjqqwHYywLfdYuM3v2jsR8=; b=XqiSYqvRuUKr6mxWH67ppOH/bsDgQ0pXR9CQvePjeEwBem1VAmih1p7U/Xk5VVFFwi3Jf4 9icx1ssn9odkhK82h09wlNhcwBULFhSQrOfIsAbikyyB6aEEhtn9eq9xmVM7OIj2LccKWF hO7rTSu6smrW2jBeEZQHZBsTlJKOCXt98gut6aBdoU++6BiBueZJZccMf9iAxtfvnAooD6 eVZB2AuK/kPeUITAfLbl36ewoAXufyDfKo73lED1ZZvoM4x0eMrvswfsX98iUtS3BcNYp0 s2XM4jBQPo+lJZ43n+HCsf6GkTnXVaVsDA8xx0j0AfSBDva2Zbpi10SGjna7EQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699446708; a=rsa-sha256; cv=none; b=P/BOE8F4if4feH4QZaTsyt8DGzawVcGXMQNWDXyi7A4dWFFKdSsyvTlMLiH604DE29E5cu n+aCKvgWqFB73ElKOB9nHP3378KS1z8XOGqd0Iy9JfSl9AYlV+xQk8FR8/TAPC8MKsK0hY xhFBNMv4rnpWegSLJwzOfP5x/9Z20AArwpGlT3cODcqGeu7+bheZKHF3wh22GXTtLUCIfJ MwF8R1zYk0KJTLhvMjfnIIphGA0SI611zgJ9xIT4pVrymbrQFNksS3H7AU+MhlImPaUNdU upg4pFRM94WT87jW2g/z1/67+VbQ1fMpBb22E1/AYIfi2KpxzoW7I52XYvI1QA== 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 4SQPbR6L1bzYKt; Wed, 8 Nov 2023 12:31:47 +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 3A8CVlhR056825; Wed, 8 Nov 2023 12:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A8CVla9056822; Wed, 8 Nov 2023 12:31:47 GMT (envelope-from git) Date: Wed, 8 Nov 2023 12:31:47 GMT Message-Id: <202311081231.3A8CVla9056822@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 7e5002e3d603 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 7e5002e3d6038b69e23f6c1982caf20cd62139f7 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7e5002e3d6038b69e23f6c1982caf20cd62139f7 commit 7e5002e3d6038b69e23f6c1982caf20cd62139f7 Author: Mark Johnston AuthorDate: 2023-11-08 12:04:33 +0000 Commit: Mark Johnston CommitDate: 2023-11-08 12:18:58 +0000 makefs/zfs: Add a regression test which checks file access permissions MFC after: 3 days Sponsored by: The FreeBSD Foundation --- 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