Skip to content

ksmbd: follow-ups to the security descriptor codec

Ian Bridges linux-cifs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4ksmbd: match SIDs exactly when a DACL is mapped to POSIXfs/smb/server/smbacl.c+13 -130 replies
2/4ksmbd: replace only the CREATOR SIDs in inheritancefs/smb/server/smbacl.c+2 -20 replies
3/4ksmbd: skip SIDs with no sub-authority in the access checkfs/smb/server/smbacl.c+3 -30 replies
4/4ksmbd: build the SD from the inode if an inherited SD is not storedfs/smb/server/smbacl.c+5 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] ksmbd: follow-ups to the security descriptor codec

The codec series [1] added a decoder and an encoder for security descriptors (SDs) and replaced ksmbd's walks of raw SD bytes with them. It changed as few of the callers' decisions as it could.

The issues in this series were found during the work on the codec. They were held out of that series to reduce its changes in behavior. Now that the codec is merged, they are submitted here as four hardening changes. Each patch touches only smbacl.c, and its message describes the change.

Tests
=====

Tested on ksmbd-for-next f9208b7a4919, on x86_64 only.

- Each patch builds with W=1 and no warnings (GCC 14, with KASAN), and sparse reports nothing in fs/smb/server.
- KUnit under UML passes at each patch with GCC 14, and on the base and at the last patch with clang 22. The series adds no KUnit case.
- checkpatch --strict reports nothing.
- A script with a test for each patch was run over SMB under five modules, the base and each patch, on a KASAN kernel booted with kasan_multi_shot. Each test changed its result at its own patch and at no other. The test of patch 3 writes the stored SD into the xattr, since SET_INFO refuses the ACE that it needs.
- smbtorture smb2.acls, smb2.setinfo, smb2.getinfo, smb2.create, smb2.sdread, smb2.maximum_allowed, smb2.winattr, smb2.delete-on-close-perms, smb2.dosmode, and smb2.rename give the same results on the base and with the series. There is no KASAN report or warning, the kernel stays untainted, and kmemleak reports nothing.
- Out of tree, the functions that patches 1 and 2 change were run in userspace under ASan and UBSan against upstream's functions from before the codec series, compiled verbatim. That was about 1.2 million comparisons over generated and hand-written SDs for the QUERY_INFO reply, SET_INFO, and inheritance. Every difference is one that this series or the codec series lists. The comparison does not run the access check, and its store never fails, so patches 3 and 4 rest on the tests over SMB.

This series was developed with LLM assistance.

[1] https://lore.kernel.org/linux-cifs/[email protected]/

Ian Bridges (4):
ksmbd: match SIDs exactly when a DACL is mapped to POSIX
ksmbd: replace only the CREATOR SIDs in inheritance
ksmbd: skip SIDs with no sub-authority in the access check
ksmbd: build the SD from the inode if an inherited SD is not stored

 fs/smb/server/smbacl.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

base-commit: f9208b7a49196e36c0434637ab83e001f5800a1d

Signature · 1 line
2.47.3