Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue: make queue pools safer #3

Merged
merged 1 commit into from
Jun 6, 2024
Merged

queue: make queue pools safer #3

merged 1 commit into from
Jun 6, 2024

Conversation

RaduBerinde
Copy link
Member

@RaduBerinde RaduBerinde commented Jun 6, 2024

The automatic sharing of queue pools, together with the queue API returning *T pointers can lead to code inadvertently or maliciously reading from/writing into the values from another queue (even from a separate package, if the type T is exported).

We remove the singleton map and require the caller to pass a pool.


This change is Reviewable

The automatic sharing of queue pools, together with the queue API
returning `*T` pointers can lead to code inadvertently or maliciously
reading from/writing into the values from another queue (even from a
separate package, if the type T is exported).

We remove the singleton map and require the caller to pass a pool.
@RaduBerinde
Copy link
Member Author

CC @ajwerner

Copy link

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. This is probably better anyway from a performance perspective. The other alternative is to unexport the Queue structure.

Reviewable status: 0 of 3 files reviewed, all discussions resolved

@RaduBerinde
Copy link
Member Author

Thanks. Yeah I might still unexport it (I was planning to look around in Pebble to see if any code would benefit from it). The automatic singleton map is not very useful anyway if it's only used internally.

@RaduBerinde RaduBerinde merged commit 0bbfbd9 into main Jun 6, 2024
15 of 16 checks passed
@RaduBerinde RaduBerinde deleted the queue-safer branch June 6, 2024 20:48
@RaduBerinde RaduBerinde restored the queue-safer branch June 6, 2024 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants