Skip to content

The mounts discoverer cache usage is racey #731

@cpuguy83

Description

@cpuguy83

The mount cache is read here without locking:

func (d *mounts) Mounts() ([]Mount, error) {
if d.lookup == nil {
return nil, fmt.Errorf("no lookup defined")
}
if d.cache != nil {
d.logger.Debugf("returning cached mounts")
return d.cache, nil
}

But it is set here while locked:

Best case here is you end up with 2 (or technically possibly more) things running the mounts code needlessly.
Worse cases could be undefined behavior due to the go memory model.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions