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

vault-agent: copy values retrieved from bolt #12534

Merged
merged 4 commits into from Sep 13, 2021

Conversation

tvoran
Copy link
Member

@tvoran tvoran commented Sep 11, 2021

Byte slices returned from Bolt are only valid during a transaction, and using them outside the transaction can cause an unexpected fault address panic so this makes a copy in the persistent caching functions.

Similar to the pattern in fsm.go:

vault/physical/raft/fsm.go

Lines 469 to 479 in 861454e

err := f.db.View(func(tx *bolt.Tx) error {
value := tx.Bucket(dataBucketName).Get([]byte(path))
if value != nil {
found = true
valCopy = make([]byte, len(value))
copy(valCopy, value)
}
return nil
})
if err != nil {

Byte slices returned from Bolt are only valid during a transaction, so
this makes a copy.
@vercel vercel bot temporarily deployed to Preview – vault September 11, 2021 01:20 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook September 11, 2021 01:20 Inactive
@tvoran tvoran added this to the 1.8.3 milestone Sep 11, 2021
@vercel vercel bot temporarily deployed to Preview – vault-storybook September 11, 2021 01:25 Inactive
@vercel vercel bot temporarily deployed to Preview – vault September 11, 2021 01:25 Inactive
changelog/12534.txt Outdated Show resolved Hide resolved
Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview – vault-storybook September 13, 2021 17:49 Inactive
@vercel vercel bot temporarily deployed to Preview – vault September 13, 2021 17:49 Inactive
@tvoran tvoran merged commit 39c9c73 into main Sep 13, 2021
@tvoran tvoran deleted the VAULT-3317/copy-bolt-get-value branch September 13, 2021 18:06
@tvoran tvoran modified the milestones: 1.8.3, 1.7.5 Sep 13, 2021
tvoran added a commit that referenced this pull request Sep 13, 2021
Byte slices returned from Bolt are only valid during a transaction, so
this makes a copy.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
tvoran added a commit that referenced this pull request Sep 13, 2021
Byte slices returned from Bolt are only valid during a transaction, so
this makes a copy.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
tvoran added a commit that referenced this pull request Sep 13, 2021
…12539)

Byte slices returned from Bolt are only valid during a transaction, so
this makes a copy.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
tvoran added a commit that referenced this pull request Sep 13, 2021
…12540)

Byte slices returned from Bolt are only valid during a transaction, so
this makes a copy.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants