Skip to content

ports/target: don't crash on transport to an uninitialized bridge#84

Open
Matheus Tavares Bernardino @ Qualcomm (quic-mathbern) wants to merge 1 commit into
qualcomm:mainfrom
quic-mathbern:mathbern/fix-null-def
Open

ports/target: don't crash on transport to an uninitialized bridge#84
Matheus Tavares Bernardino @ Qualcomm (quic-mathbern) wants to merge 1 commit into
qualcomm:mainfrom
quic-mathbern:mathbern/fix-null-def

Conversation

@quic-mathbern

Copy link
Copy Markdown
Contributor

A QemuTargetSocket's bridge is only wired up to its QEMU instance once
init()/init_with_mr() runs. Before that, m_inst is null and the socket
cannot service a transaction.

Nothing stops a transaction from arriving early, though: a gs::loader
loads its image at end_of_elaboration, and that access can be routed by
the router to a bridge that hasn't been initialized yet. b_transport
then dereferences the null m_inst and segfaults.

Bail out early with TLM_OK_RESPONSE when the bridge is uninitialized so
the access is a harmless no-op instead of a crash.

Signed-off-by: Matheus Tavares Bernardino matheus.bernardino@oss.qualcomm.com

A QemuTargetSocket's bridge is only wired up to its QEMU instance once
init()/init_with_mr() runs. Before that, m_inst is null and the socket
cannot service a transaction.

Nothing stops a transaction from arriving early, though: a gs::loader
loads its image at end_of_elaboration, and that access can be routed by
the router to a bridge that hasn't been initialized yet. b_transport
then dereferences the null m_inst and segfaults.

Bail out early with TLM_OK_RESPONSE when the bridge is uninitialized so
the access is a harmless no-op instead of a crash.

Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
@quic-mathbern

Copy link
Copy Markdown
Contributor Author

CC
Mark Burton (@markfoodyburton)
Brian Cain (@androm3da)
mahmdkamel

(For some reason, I'm not allowed to ask for reviews)

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.

1 participant