diff mbox series

[4/9] generic/317, afs: Allow for a filesystem not to honour the local uid/gid

Message ID 162194965595.4011860.7333324355639736586.stgit@warthog.procyon.org.uk (mailing list archive)
State New, archived
Headers show
Series Add support for using xfstests to test AFS | expand

Commit Message

David Howells May 25, 2021, 1:34 p.m. UTC
Each AFS cell has it's own set of user IDs that is uses internally, in its
ACL system and in its protection management protocol.  The user ID used by
the fileserver is selected from the set belonging to the fileserver's cell
according to the authentication token associated with an RPC operation -
and this is set as a file's user ID when it is created.

This means that tests that expect to set a UID and see the same UID still
set afterwards will fail.

Add a "_require_use_local_uidgid" clause to indicate that a test expects
internal UID/GID information to be seen in the stat output and should be
skipped if AFS's case.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-afs@lists.infradead.org
---

 common/rc                    |    9 +++++++++
 doc/requirement-checking.txt |    8 ++++++++
 tests/generic/317            |    1 +
 3 files changed, 18 insertions(+)

Comments

Darrick J. Wong May 25, 2021, 4:17 p.m. UTC | #1
On Tue, May 25, 2021 at 02:34:15PM +0100, David Howells wrote:
> Each AFS cell has it's own set of user IDs that is uses internally, in its
> ACL system and in its protection management protocol.  The user ID used by
> the fileserver is selected from the set belonging to the fileserver's cell
> according to the authentication token associated with an RPC operation -
> and this is set as a file's user ID when it is created.
> 
> This means that tests that expect to set a UID and see the same UID still
> set afterwards will fail.
> 
> Add a "_require_use_local_uidgid" clause to indicate that a test expects
> internal UID/GID information to be seen in the stat output and should be
> skipped if AFS's case.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: linux-afs@lists.infradead.org
> ---
> 
>  common/rc                    |    9 +++++++++
>  doc/requirement-checking.txt |    8 ++++++++
>  tests/generic/317            |    1 +
>  3 files changed, 18 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 4d4b0280..a04433da 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4622,6 +4622,15 @@ _require_sgid_inheritance()
>  	esac
>  }
>  
> +_require_use_local_uidgid()

I find "local uid" to be misleading here -- I read it as "requires
system to use local user/group ids", as opposed to getting user and
group data from an external service like NIS/YP/AD.

What you're really testing for is that new files inherit the fs[ug]id of
the process.  How about we make that explicit in the name:

_require_inherit_process_fsuid()
_require_inherit_process_fsgid()

?

--D

> +{
> +	case $FSTYP in
> +	afs)
> +		_notrun "$FSTYP doesn't honour local uid and gid"
> +		;;
> +	esac
> +}
> +
>  init_rc
>  
>  ################################################################################
> diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
> index 6efc8dc8..c945e16a 100644
> --- a/doc/requirement-checking.txt
> +++ b/doc/requirement-checking.txt
> @@ -19,6 +19,7 @@ they have.  This is done with _require_<xxx> macros, which may take parameters.
>  	_require_mknod
>  	_has_mknod
>  	_require_sgid_inheritance
> +	_require_use_local_uidgid
>  
>   (3) System call requirements.
>  
> @@ -113,6 +114,13 @@ _require_sgid_inheritance
>       of the SGID bit and the GID from a marked directory.  The test will be
>       skipped if not supported.
>  
> +_require_use_local_uidgid
> +
> +     The test requires that the $TEST_DEV filesystem sets the uid and gid of a
> +     newly created file to the creating process's fsuid and fsgid.  Remote
> +     filesystems, for example, may choose other settings or not even have these
> +     concepts available.  The test will be skipped if not supported.
> +
>  
>  ========================
>  SYSTEM CALL REQUIREMENTS
> diff --git a/tests/generic/317 b/tests/generic/317
> index 289dfabe..112e2e97 100755
> --- a/tests/generic/317
> +++ b/tests/generic/317
> @@ -46,6 +46,7 @@ _require_user
>  _require_ugid_map
>  _require_userns
>  _require_chown
> +_require_use_local_uidgid
>  qa_user_id=`id -u $qa_user`
>  
>  _filter_output()
> 
>
David Howells May 25, 2021, 4:41 p.m. UTC | #2
Darrick J. Wong <djwong@kernel.org> wrote:

> > +_require_use_local_uidgid()
> 
> I find "local uid" to be misleading here -- I read it as "requires
> system to use local user/group ids", as opposed to getting user and
> group data from an external service like NIS/YP/AD.
>
> What you're really testing for is that new files inherit the fs[ug]id of
> the process.  How about we make that explicit in the name:
> 
> _require_inherit_process_fsuid()
> _require_inherit_process_fsgid()
> 
> ?

Um.  I'm not sure "inherit" is the right verb here.  Or "require" for that
matter.  Would it make more sense to state it differently?  Maybe say what is
being checked:

	_test_expects_inode_to_get_fsuid
	_test_expects_inode_to_get_fsgid

or maybe:

	_expects_filesystem_to_set_owner_from_fsuid

though that could also be:

	_require_filesystem_to_set_owner_from_fsuid

David
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 4d4b0280..a04433da 100644
--- a/common/rc
+++ b/common/rc
@@ -4622,6 +4622,15 @@  _require_sgid_inheritance()
 	esac
 }
 
+_require_use_local_uidgid()
+{
+	case $FSTYP in
+	afs)
+		_notrun "$FSTYP doesn't honour local uid and gid"
+		;;
+	esac
+}
+
 init_rc
 
 ################################################################################
diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
index 6efc8dc8..c945e16a 100644
--- a/doc/requirement-checking.txt
+++ b/doc/requirement-checking.txt
@@ -19,6 +19,7 @@  they have.  This is done with _require_<xxx> macros, which may take parameters.
 	_require_mknod
 	_has_mknod
 	_require_sgid_inheritance
+	_require_use_local_uidgid
 
  (3) System call requirements.
 
@@ -113,6 +114,13 @@  _require_sgid_inheritance
      of the SGID bit and the GID from a marked directory.  The test will be
      skipped if not supported.
 
+_require_use_local_uidgid
+
+     The test requires that the $TEST_DEV filesystem sets the uid and gid of a
+     newly created file to the creating process's fsuid and fsgid.  Remote
+     filesystems, for example, may choose other settings or not even have these
+     concepts available.  The test will be skipped if not supported.
+
 
 ========================
 SYSTEM CALL REQUIREMENTS
diff --git a/tests/generic/317 b/tests/generic/317
index 289dfabe..112e2e97 100755
--- a/tests/generic/317
+++ b/tests/generic/317
@@ -46,6 +46,7 @@  _require_user
 _require_ugid_map
 _require_userns
 _require_chown
+_require_use_local_uidgid
 qa_user_id=`id -u $qa_user`
 
 _filter_output()