Repository navigation
fix: return no slots when C_GetSlotList counts none - #382
Open
davidgraeff wants to merge 1 commit into
Open
davidgraeff wants to merge 1 commit into
davidgraeff wants to merge 1 commit into
Conversation
With no slots, get_slots asked again with an empty buffer. p11-kit's client module answers that with CKR_BUFFER_TOO_SMALL and a count of 0, so the retry loop never ended and the caller spun at full CPU. Signed-off-by: David Gräff <66436+davidgraeff@users.noreply.github.com>
davidgraeff
force-pushed
the
fix/get-slots-zero-count
branch
from
November 18, 2026 20:51
8dc9605 to
60f5d76
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_slots, which backsget_all_slotsandget_slots_with_token, first asksC_GetSlotListfor the count. It then calls again with a buffer of that size, and loops while the module answersCKR_BUFFER_TOO_SMALL.p11-kit-client.so, talking to ap11-kit serverthat exports no token) answers that withCKR_BUFFER_TOO_SMALLand a count of 0. The loop never ends: the caller spins at full CPU, and so does the server answering it.cargo build,cargo fmt --checkandcargo clippy --all-targets -D warningspass. SoftHSM always offers a free slot, so the test suite cannot reach this path.