ksmbd: keep group denials when a POSIX ACL entry decides access
Subsystems (3)
PATCH 1/1 ksmbd: keep group denials when a POSIX ACL entry decides access
When no ACE names the caller, Everyone or Authenticated Users, smb_check_perm_dacl() lets a POSIX ACL entry for the caller decide access. The entry's rights replace the result of the DACL walk. Deny ACEs for the caller's groups, and OWNER RIGHTS for the owner, are then lost.
For example, a deny of FILE_WRITE_DATA for one of the caller's groups should refuse writes. A POSIX ACL entry that gives the caller write access still lets the caller write.
Remove the requested rights that those ACEs deny from the entry's rights. The DACL walk already records them in grp_denied.
---
Notes:
A POSIX ACL entry that decides can still drop rights that ACEs for the caller's groups grant. The implicit allowances that every non-strict check adds are also unchanged.
For MAXIMUM_ALLOWED, only the rights named in the request are checked against these denials. Group deny ACEs still do not limit the rights that MAXIMUM_ALLOWED adds, as on the other paths of this check.
Tested with KASAN on ksmbd-for-next 4ab80fd4d1f1, and over SMB on a kernel whose fs/smb/server tree is identical to it. smbtorture results are unchanged.
This patch was developed with LLM assistance.
fs/smb/server/smbacl.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/smb/server/smbacl.c +9 -0
@@ -1764,6 +1764,15 @@ int smb_check_perm_dacl(struct ksmbd_conn *conn, const struct path *path,if (!access_bits) access_bits =SET_MINIMUM_RIGHTS ; +/* +* Only ACEs for the caller's groups, +* or OWNER RIGHTS for the owner, apply +* here. The POSIX ACL entry does not +* grant an explicitly requested right +* that they deny first in DACL order. +*/ + access_bits &= ~(grp_denied & + requested);posix_acl_release (posix_acls); goto check_access_bits; }
base-commit: 4ab80fd4d1f1c4363b336ddb3d8818ea37c4997d
Signature · 1 line
2.47.3
Quoted 14 lines · Ian Bridges
When no ACE names the caller, Everyone or Authenticated Users,
smb_check_perm_dacl()lets a POSIX ACL entry for the caller decide access. The entry's rights replace the result of the DACL walk. Deny ACEs for the caller's groups, and OWNER RIGHTS for the owner, are then lost.For example, a deny of
FILE_WRITE_DATAfor one of the caller's groups should refuse writes. A POSIX ACL entry that gives the caller write access still lets the caller write.Remove the requested rights that those ACEs deny from the entry's rights. The DACL walk already records them in
grp_denied.
Quoted 9 lines
Fixes 42ac1f1917ae ("ksmbd: grant a caller what its groups and OWNER RIGHTS ACEs allow")Reported-by Sashiko <[email protected]>Signed-off-by Ian Bridges <[email protected]>
Applied it to #ksmbd-for-next.
Thanks!