[LTP] [PATCH] safe_setuid: skip if testing on CIFS

Petr Vorel pvorel@suse.cz
Mon May 13 16:34:13 CEST 2019


Hi Murphy,

> As CIFS is not supporting setuid operations.
Any reference to this?
fs/cifs/cifsfs.c and other parts of kernel cifs works with CIFS_MOUNT_SET_UID.
Also samba_setreuid() from lib/util/setid.c from samba git (I guess used in
samba libraries works with SYS_setreuid syscall or setreuid() libc wrapper.
What am I missing?

> diff --git a/lib/tst_safe_macros.c b/lib/tst_safe_macros.c
> index 0e59a3f98..36941ec0b 100644
> --- a/lib/tst_safe_macros.c
> +++ b/lib/tst_safe_macros.c
> @@ -111,6 +111,7 @@ int safe_setreuid(const char *file, const int lineno,
>  		  uid_t ruid, uid_t euid)
>  {
>  	int rval;
> +	long fs_type;

>  	rval = setreuid(ruid, euid);
>  	if (rval == -1) {
> @@ -119,6 +120,13 @@ int safe_setreuid(const char *file, const int lineno,
>  			 (long)ruid, (long)euid);
>  	}

> +	fs_type = tst_fs_type(".");
> +	if (fs_type == TST_CIFS_MAGIC) {
> +		tst_brk_(file, lineno, TCONF,
> +			 "setreuid is not supported on %s filesystem",
> +			 tst_fs_type_name(fs_type));
> +	}
I guess this check should be before setreuid() As it's in safe_seteuid() and
safe_setuid()
> +
>  	return rval;
>  }

Kind regards,
Petr


More information about the ltp mailing list