safe_setuid: skip if testing on CIFS
Subsystems (3)
PATCH 1/1 safe_setuid: skip if testing on CIFS
As CIFS is not supporting setuid operations.
--- include/tst_fs.h | 1 + lib/safe_macros.c | 16 ++++++++++++++++ lib/tst_fs_type.c | 2 ++ lib/tst_safe_macros.c | 8 ++++++++ 4 files changed, 27 insertions(+)
include/tst_fs.h +1 -0
@@ -42,6 +42,7 @@#define TST_NILFS_MAGIC 0x3434#define TST_EXOFS_MAGIC 0x5DF5#define TST_OVERLAYFS_MAGIC 0x794c7630 +#define TST_CIFS_MAGIC 0xfe534d42enum {TST_BYTES =1 ,
lib/safe_macros.c +16 -0
@@ -277,6 +277,14 @@ int safe_seteuid(const char *file, const int lineno, void (*cleanup_fn) (void), uid_t euid) {int rval; +long fs_type; + + fs_type =tst_fs_type (NULL ,"." ); +if (fs_type ==TST_CIFS_MAGIC ) { +tst_brkm (TCONF , cleanup_fn, +"seteuid is not supported on %s filesystem" , +tst_fs_type_name (fs_type)); + } rval =seteuid (euid);if (rval ==-1 ) {
@@ -307,6 +315,14 @@ int safe_setuid(const char *file, const int lineno, void (*cleanup_fn) (void), uid_t uid) {int rval; +long fs_type; + + fs_type =tst_fs_type (NULL ,"." ); +if (fs_type ==TST_CIFS_MAGIC ) { +tst_brkm (TCONF , cleanup_fn, +"setuid is not supported on %s filesystem" , +tst_fs_type_name (fs_type)); + } rval =setuid (uid);if (rval ==-1 ) {
lib/tst_fs_type.c +2 -0
@@ -84,6 +84,8 @@ const char *tst_fs_type_name(long f_type)return "EXOFS" ;case TST_OVERLAYFS_MAGIC :return "OVERLAYFS" ; +case TST_CIFS_MAGIC : +return "CIFS" ;default :return "Unknown" ; }
lib/tst_safe_macros.c +8 -0
@@ -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)); + } +return rval; }
Signature · 1 line
2.21.0
Hi Murphy,
Quoted 1 line
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?
Quoted 13 lines
lib/tst_safe_macros.c +1
-0@@ -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 ) {
lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 128
Quoted 9 lines
lib/tst_safe_macros.c +6
-0@@ -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()
lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 131
Quoted 3 lines
lib/tst_safe_macros.c +1
-0+return rval; }
Kind regards,
Petr
Also note that we are working on patches to improve saving of mode bits and ownership information even in cases where the server does not support POSIX Extensions.
Currently mount options cifsacl and idsfromsid can be used for some use cases but they are being extended.
Quoted 40 lines · Petr Vorel
Hi Murphy,
Quoted 1 line
As CIFS is not supporting setuid operations.
Any reference to this?
fs/cifs/cifsfs.cand other parts of kernel cifs works withCIFS_MOUNT_SET_UID. Alsosamba_setreuid()fromlib/util/setid.cfrom samba git (I guess used in samba libraries works withSYS_setreuidsyscall orsetreuid()libc wrapper. What am I missing?Quoted 13 lines
lib/tst_safe_macros.c +1
-0@@ -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 ) {lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 128
Quoted 9 lines
lib/tst_safe_macros.c +6
-0@@ -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 insafe_seteuid()andsafe_setuid()lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 131
Quoted 3 lines
lib/tst_safe_macros.c +1
-0+return rval; }Kind regards,
Petr
Signature · 3 lines
Thanks, Steve
Hi Petr and Steve,
Thanks for reviewing! Steve you are right that this is more about mode bits and ownership. Great to know the development work progress. Most of the tests fail after setuid because chmod/chown operations before that does not take effect, which is expected now I guess. Now I am testing option "dynperm".
Self nack for this patch. Don't skip them.
Thanks!
M
Quoted 55 lines · Steve French
Also note that we are working on patches to improve saving of mode bits and ownership information even in cases where the server does not support POSIX Extensions.
Currently mount options cifsacl and idsfromsid can be used for some use cases but they are being extended.
Quoted 40 lines · Petr Vorel
Hi Murphy,
Quoted 1 line
As CIFS is not supporting setuid operations.
Any reference to this?
fs/cifs/cifsfs.cand other parts of kernel cifs works withCIFS_MOUNT_SET_UID. Alsosamba_setreuid()fromlib/util/setid.cfrom samba git (I guess used in samba libraries works withSYS_setreuidsyscall orsetreuid()libc wrapper. What am I missing?Quoted 13 lines
lib/tst_safe_macros.c +1
-0@@ -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 ) {lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 128
Quoted 9 lines
lib/tst_safe_macros.c +6
-0@@ -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 insafe_seteuid()andsafe_setuid()lib/tst_safe_macros.c int safe_setreuid(const char *file, const int lineno, · line 131
Quoted 3 lines
lib/tst_safe_macros.c +1
-0+return rval; }Kind regards,
PetrSignature · 3 lines
Thanks, Steve