Repository navigation
client: fix fscrypt error-path bugs - #69880
Conversation
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
16 similar comments
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run. |
|
ok to test |
| @@ -7398,7 +7400,8 @@ int Client::fscrypt_dummy_encryption() { | |||
| memcpy(key_spec.u.identifier, keyid, FSCRYPT_KEY_IDENTIFIER_SIZE); | |||
| arg.removal_status_flags = 0; | |||
| arg.key_spec = key_spec; | |||
| r = remove_fscrypt_key(&arg); | |||
| // Preserve the original failure; don't mask it with the removal result. | |||
| remove_fscrypt_key(&arg); | |||
There was a problem hiding this comment.
Good catch on preserving the original failure. I think it's important to have a marker of sorts if remove_fscrypt_key fails. What about an error message here and another up where it attempts to set policy and error message on failure?
There was a problem hiding this comment.
Thanks, done. Added error messages at both case.
777596e to
51bd065
Compare
chrisphoffman
left a comment
There was a problem hiding this comment.
The added messages look good. Thanks for that!
One more thing, this will need to be backported to umbrella, can you create a tracker and update your commit message referencing it?
mount() holds client_lock through a unique_lock (cl), but the dummy encryption path unlocked and relocked the underlying mutex directly, bypassing cl. On fscrypt_dummy_encryption() failure it returns early without relocking, so cl's destructor then unlocks an already-unlocked mutex, which is undefined behavior. Only reachable when client_fscrypt_dummy_encryption is enabled. Unlock/relock through cl so its ownership state stays consistent. Fixes: https://tracker.ceph.com/issues/78246 Signed-off-by: Sun Yuechi <[email protected]>
_wrap_name() returns bool, but two encryption error paths did "return r" with r < 0, which converts to true. Callers then treated the failure as success and used the unencrypted name. Return false instead. Fixes: https://tracker.ceph.com/issues/78246 Signed-off-by: Sun Yuechi <[email protected]>
When add_fscrypt_key() failed it jumped to the err label, which then read the uninitialized keyid buffer into a key specifier and issued a key removal for it. add_fscrypt_key() only populates keyid on success, so this read uninitialized stack memory. Return the error directly instead, since no key was added and there is nothing to remove. Also stop overwriting the original error with remove_fscrypt_key()'s return value on the policy-set failure path, so the real failure is reported to the caller. Fixes: https://tracker.ceph.com/issues/78246 Signed-off-by: Sun Yuechi <[email protected]>
51bd065 to
d440950
Compare
|
@chrisphoffman Sure, updated. |
|
This PR has been added to main integration testing by choffman started 2026-07-15-15:47. |
|
jenkins test make check |
mount(): the dummy-encryption path unlocked/relocked the mutex underclient_lockdirectly instead of through theunique_lock, so onfscrypt_dummy_encryption()failure it returned without relocking andthe lock guard's destructor double-unlocked.
_wrap_name(): two encryption error paths didreturn r(r < 0) from aboolfunction, which converts totrue, so callers used theunencrypted name on failure.
fscrypt_dummy_encryption(): onadd_fscrypt_key()failure it jumped tothe err label and read the uninitialized
keyidbuffer to issue a keyremoval. Return the error directly; also stop overwriting the original
error with
remove_fscrypt_key()'s return on the policy-set failure path.Fixes: https://tracker.ceph.com/issues/78246
Checklist