Skip to contentSkip to conversation

CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()

PATCH In review Eryu Guan 2 participants 4 messages Oct 24, 2016 – Nov 29, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH v2 1/1 CIFS: iterate over posix acl xattr entry correctly in ACL_to_cifs_posix()

Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly.

But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.

[root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- root

Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop.

---
v2:
- move "ace" definition outside for loop

 fs/cifs/cifssmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +2 -2
index 3f3185f..e3fed92 100644
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
 	__u16 rc = 0;
 	struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
 	struct posix_acl_xattr_header *local_acl = (void *)pACL;
+	struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
 	int count;
 	int i;
 
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
 		return 0;
 	}
 	for (i = 0; i < count; i++) {
-		rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],
-			(struct posix_acl_xattr_entry *)(local_acl + 1));
+		rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
 		if (rc != 0) {
 			/* ACE not converted */
 			break;
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): 1477313200-26317-1-git-send-email-guaneryu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#2 lore raw
Quoted 19 lines · Eryu Guan

Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly.

But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.

[root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- root

Quoted 5 lines

Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop.

Hi, any comments on this patch? I notice that it's not in 4.9-rc6, fstests generic/053 generic/105 generic/318 and generic/375 still fail when testing against samba 1.0 server. Will it be part of 4.9 kernel? It fixes a regression introduced in 4.9-rc1.

Thanks,
Eryu

Quoted 32 lines

---
v2:
- move "ace" definition outside for loop

 fs/cifs/cifssmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +2 -2
index 3f3185f..e3fed92 100644
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
 	__u16 rc = 0;
 	struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
 	struct posix_acl_xattr_header *local_acl = (void *)pACL;
+	struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
 	int count;
 	int i;
 
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
 		return 0;
 	}
 	for (i = 0; i < count; i++) {
-		rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],
-			(struct posix_acl_xattr_entry *)(local_acl + 1));
+		rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
 		if (rc != 0) {
 			/* ACE not converted */
 			break;
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): 20161121081658.GA1317-+7p9VZFSOIEFmhoHi+V13ACJwEvxM/[email protected]

#4 lore raw

Yes - I will send a merge request tomorrow for this (if too late, then we will add cc: stable and resend in a week or two)

Quoted 66 lines · Eryu Guan
Quoted 19 lines · Eryu Guan

Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly.

But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.

[root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- root

Quoted 5 lines

Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop.

Hi, any comments on this patch? I notice that it's not in 4.9-rc6, fstests generic/053 generic/105 generic/318 and generic/375 still fail when testing against samba 1.0 server. Will it be part of 4.9 kernel? It fixes a regression introduced in 4.9-rc1.

Thanks,
Eryu

Quoted 32 lines

---
v2:
- move "ace" definition outside for loop

 fs/cifs/cifssmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +2 -3
index 3f3185f..e3fed92 100644
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
      __u16 rc = 0;
      struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
      struct posix_acl_xattr_header *local_acl = (void *)pACL;
+     struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
      int count;
      int i;
 
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
              return 0;
      }
      for (i = 0; i < count; i++) {
-             rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],
-                     (struct posix_acl_xattr_entry *)(local_acl + 1));
+             rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
              if (rc != 0) {
                      /* ACE not converted */
                      break;
--

2.7.4

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): CAH2r5mtpPtnydUOsmBrx98mC9CXGhLLsxWf5dHmG8HLxZ9RBQA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

It is in mainline now - thanks

Quoted 77 lines · Steve French

Yes - I will send a merge request tomorrow for this (if too late, then we will add cc: stable and resend in a week or two)

Quoted 53 lines · Eryu Guan
Quoted 19 lines · Eryu Guan

Commit 2211d5ba5c6c ("posix_acl: xattr representation cleanups") removes the typedefs and the zero-length a_entries array in struct posix_acl_xattr_header, and uses bare struct posix_acl_xattr_header and struct posix_acl_xattr_entry directly.

But it failed to iterate over posix acl slots when converting posix acls to CIFS format, which results in several test failures in xfstests (generic/053 generic/105) when testing against a samba v1 server, starting from v4.9-rc1 kernel. e.g.

[root@localhost xfstests]# diff -u tests/generic/105.out /root/xfstests/results//generic/105.out.bad
--- tests/generic/105.out 2016-09-19 16:33:28.577962575 +0800
+++ /root/xfstests/results//generic/105.out.bad 2016-10-22 15:41:15.201931110 +0800 @@ -1,3 +1,4 @@
QA output created by 105
-rw-r--r-- root
+setfacl: subdir: Invalid argument
-rw-r--r-- root

Quoted 5 lines

Fix it by introducing a new "ace" var, like what cifs_copy_posix_acl() does, and iterating posix acl xattr entries over it in the for loop.

Hi, any comments on this patch? I notice that it's not in 4.9-rc6, fstests generic/053 generic/105 generic/318 and generic/375 still fail when testing against samba 1.0 server. Will it be part of 4.9 kernel? It fixes a regression introduced in 4.9-rc1.

Thanks,
Eryu

Quoted 19 lines

---
v2:
- move "ace" definition outside for loop

 fs/cifs/cifssmb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/cifssmb.c +1 -0
index 3f3185f..e3fed92 100644
@@ -3427,6 +3427,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
      __u16 rc = 0;
      struct cifs_posix_acl *cifs_acl = (struct cifs_posix_acl *)parm_data;
      struct posix_acl_xattr_header *local_acl = (void *)pACL;
+     struct posix_acl_xattr_entry *ace = (void *)(local_acl + 1);
      int count;
      int i;
 
Quoted 13 lines
Quoted 11 lines
fs/cifs/cifssmb.c +1 -3
@@ -3453,8 +3454,7 @@ static __u16 ACL_to_cifs_posix(char *parm_data, const char *pACL,
              return 0;
      }
      for (i = 0; i < count; i++) {
-             rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i],
-                     (struct posix_acl_xattr_entry *)(local_acl + 1));
+             rc = convert_ace_to_cifs_ace(&cifs_acl->ace_array[i], &ace[i]);
              if (rc != 0) {
                      /* ACE not converted */
                      break;
--
Quoted 2 lines

2.7.4

--
Thanks,

Steve

Signature · 3 lines
Thanks,

Steve