Skip to content

Race condition in anycast manager VIP binding check-then-act #116

@poyrazK

Description

@poyrazK

Why is this an issue?

In internal/core/services/anycast_manager.go:96-101, the check-then-bind pattern is not atomic:

if !m.vipBound.Load() {
    if err := m.vipManager.Bind(ctx, m.vip, m.iface); err != nil {
        ...
    }
    m.vipBound.Store(true)
}

Two concurrent announce() calls could both see vipBound == false and attempt to bind simultaneously.

How can it be solved?

Use atomic CompareAndSwap or a mutex to make the check-then-bind atomic.

Category

  • Small
  • Medium
  • Large

Severity

  • Low
  • Medium
  • High
  • Critical

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions