Skip to contentSkip to conversation

cifs: reinstate original behavior again for forceuid/forcegid

PATCH Superseded Takayuki Nagata 4 participants 5 messages Apr 6, 2023 – Apr 7, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: reinstate original behavior again for forceuid/forcegid

forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api") changed the behavior. This patch reinstates original behavior to overriding uid/gid with specified uid/gid.

Fixes 24e0a1eff9e2 ("cifs: switch to new mount api")
---
 fs/cifs/fs_context.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/fs_context.c +2 -0
index ace11a1a7c8a..6f7c5ca3764f 100644
@@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
 			goto cifs_parse_mount_err;
 		ctx->linux_uid = uid;
 		ctx->uid_specified = true;
+		ctx->override_uid = 1;
 		break;
 	case Opt_cruid:
 		uid = make_kuid(current_user_ns(), result.uint_32);
@@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
 			goto cifs_parse_mount_err;
 		ctx->linux_gid = gid;
 		ctx->gid_specified = true;
+		ctx->override_gid = 1;
 		break;
 	case Opt_port:
 		ctx->port = result.uint_32;
Signature · 1 line
2.40.0
reviewer
#1 lore raw
Quoted 6 lines · Takayuki Nagata

forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api") changed the behavior. This patch reinstates original behavior to overriding uid/gid with specified uid/gid.

Fixes 24e0a1eff9e2 ("cifs: switch to new mount api")

This looks correct, but I'd love to hear Ronnie's call. Looking at that commit, was it simply an oversight to set override_{uid,gid}? It kind of looks that way, but...

Tom.

Quoted 25 lines
---
  fs/cifs/fs_context.c | 2 ++
  1 file changed, 2 insertions(+)
fs/cifs/fs_context.c +2 -0
index ace11a1a7c8a..6f7c5ca3764f 100644
@@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
  			goto cifs_parse_mount_err;
  		ctx->linux_uid = uid;
  		ctx->uid_specified = true;
+		ctx->override_uid = 1;
  		break;
  	case Opt_cruid:
  		uid = make_kuid(current_user_ns(), result.uint_32);
@@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
  			goto cifs_parse_mount_err;
  		ctx->linux_gid = gid;
  		ctx->gid_specified = true;
+		ctx->override_gid = 1;
  		break;
  	case Opt_port:
  		ctx->port = result.uint_32;
#2 lore raw

Yeah, an oversight.
Acked-by me

Quoted 41 lines · Tom Talpey via samba-technical
Quoted 6 lines · Takayuki Nagata

forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api") changed the behavior. This patch reinstates original behavior to overriding uid/gid with specified uid/gid.

Fixes 24e0a1eff9e2 ("cifs: switch to new mount api")

This looks correct, but I'd love to hear Ronnie's call. Looking at that commit, was it simply an oversight to set override_{uid,gid}? It kind of looks that way, but...

Tom.

Quoted 25 lines
---
  fs/cifs/fs_context.c | 2 ++
  1 file changed, 2 insertions(+)
fs/cifs/fs_context.c +2 -0
index ace11a1a7c8a..6f7c5ca3764f 100644
@@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                      goto cifs_parse_mount_err;
              ctx->linux_uid = uid;
              ctx->uid_specified = true;
+             ctx->override_uid = 1;
              break;
      case Opt_cruid:
              uid = make_kuid(current_user_ns(), result.uint_32);
@@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                      goto cifs_parse_mount_err;
              ctx->linux_gid = gid;
              ctx->gid_specified = true;
+             ctx->override_gid = 1;
              break;
      case Opt_port:
              ctx->port = result.uint_32;
#3 lore raw
In reply to Takayuki Nagata

Tentatively merged into cifs-2.6.git for-next

Any thoughts on priority sending it upstream soon?

Quoted 35 lines · Takayuki Nagata

forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api") changed the behavior. This patch reinstates original behavior to overriding uid/gid with specified uid/gid.

Fixes 24e0a1eff9e2 ("cifs: switch to new mount api")
---
 fs/cifs/fs_context.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/fs_context.c +2 -1
index ace11a1a7c8a..6f7c5ca3764f 100644
@@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                        goto cifs_parse_mount_err;
                ctx->linux_uid = uid;
                ctx->uid_specified = true;
+               ctx->override_uid = 1;
                break;
        case Opt_cruid:
                uid = make_kuid(current_user_ns(), result.uint_32);
@@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                        goto cifs_parse_mount_err;
                ctx->linux_gid = gid;
                ctx->gid_specified = true;
+               ctx->override_gid = 1;
                break;
        case Opt_port:
                ctx->port = result.uint_32;
--

2.40.0

Signature · 3 lines
Thanks,

Steve
#4 lore raw

Thank you for reviewing my patch.
I have no thoughts on the priority. So If it does not bother you to send the v2 patch, I will resend the v2 patch soon with a revised commit message to clarify "what breaks".

Takayuki Nagata

2023年4月7日(金) 13:13 Steve French <[email protected]>:

Quoted 48 lines

Tentatively merged into cifs-2.6.git for-next

Any thoughts on priority sending it upstream soon?

Quoted 33 lines · Takayuki Nagata

forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit 24e0a1eff9e2 ("cifs: switch to new mount api") changed the behavior. This patch reinstates original behavior to overriding uid/gid with specified uid/gid.

Fixes 24e0a1eff9e2 ("cifs: switch to new mount api")
---
 fs/cifs/fs_context.c | 2 ++
 1 file changed, 2 insertions(+)
fs/cifs/fs_context.c +2 -1
index ace11a1a7c8a..6f7c5ca3764f 100644
@@ -972,6 +972,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                        goto cifs_parse_mount_err;
                ctx->linux_uid = uid;
                ctx->uid_specified = true;
+               ctx->override_uid = 1;
                break;
        case Opt_cruid:
                uid = make_kuid(current_user_ns(), result.uint_32);
@@ -1000,6 +1001,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
                        goto cifs_parse_mount_err;
                ctx->linux_gid = gid;
                ctx->gid_specified = true;
+               ctx->override_gid = 1;
                break;
        case Opt_port:
                ctx->port = result.uint_32;
--
Quoted 2 lines

2.40.0

--
Thanks,

Steve