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

NPE/panic when seal config is missing #28547

Open
taitelman opened this issue Oct 1, 2024 · 2 comments
Open

NPE/panic when seal config is missing #28547

taitelman opened this issue Oct 1, 2024 · 2 comments
Labels
bug Used to indicate a potential bug core/seal

Comments

@taitelman
Copy link

taitelman commented Oct 1, 2024

scenario : vault cluster with HA enabled , leader lost leadership for some reason the standby see this:

case c.seal.BarrierSealConfigType().IsSameAs(barrierSealConfig.Type):

c.PhysicalBarrierSealConfig(ctx) at top of

barrierSealConfig, err := c.PhysicalBarrierSealConfig(ctx)

can return nil,nil under some edge cases.
and then the code will fail in the next pointer usage since barrierSealConfig == nil

and the result is :

vault debug not reloading seals config since there is no seal generation info in storage

vault error panic: runtime error: invalid memory address or nil pointer dereference
vault [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x33db0ce]
vault goroutine 232 [running]:
vault github.com/hashicorp/vault/vault.(*Core).migrateMultiSealConfig(0xc0001b1000, {0xc656e30, 0xc0038ecdc0})
	/opt/app-root/src/vault/core.go:3203 +0xae
vault github.com/hashicorp/vault/vault.(*Core).migrateSeal(0xc656e30?, {0xc656e30?, 0xc0038ecdc0?})
	/opt/app-root/src/vault/core.go:1906 +0xc17
vault github.com/hashicorp/vault/vault.(*Core).waitForLeadership(0xc0001b1000, 0x0?, 0xc003a9f740, 0xc003a9f920)
	/opt/app-root/src/vault/ha.go:604 +0x77f
vault github.com/hashicorp/vault/vault.(*Core).runStandby.func9()
	/opt/app-root/src/vault/ha.go:475 +0x25

solution: switch case should handle nil values for barrierSealConfig more gracefully.

@taitelman
Copy link
Author

debug line from :

c.logger.Debug("not reloading seals config since there is no seal generation info in storage")

@taitelman taitelman changed the title NPE when seal config is missing NPE/panic when seal config is missing Oct 1, 2024
@heatherezell heatherezell added bug Used to indicate a potential bug core/seal labels Oct 2, 2024
@aphorise
Copy link
Contributor

aphorise commented Nov 1, 2024

@taitelman out of interest - how did you achieve the seal change? - was it through a config change to an existing seal stanza & then a reload?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug core/seal
Projects
None yet
Development

No branches or pull requests

3 participants