Skip to contentSkip to conversation

e1000e: Prevent crash from legacy interrupt firing after MSI-X enable

PATCH In review Laurent Vivier 6 participants 8 messages Aug 7, 2025 – Sep 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 e1000e: Prevent crash from legacy interrupt firing after MSI-X enable

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---
 hw/net/e1000e_core.c | 5 -----
 1 file changed, 5 deletions(-)
hw/net/e1000e_core.c +0 -5
index 24138587905b..06657bb3ac5c 100644
@@ -341,11 +341,6 @@ e1000e_intmgr_collect_delayed_causes(E1000ECore *core)
 {
     uint32_t res;
 
-    if (msix_enabled(core->owner)) {
-        assert(core->delayed_causes == 0);
-        return 0;
-    }
-
     res = core->delayed_causes;
     core->delayed_causes = 0;
 
Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 12 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

Quoted 7 lines

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

This description is better than my comment written in haste. Thank you for taking care of this.

Acked-by on v2 1/1
#2 lore raw
In reply to Laurent Vivier
Quoted 21 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Quoted 4 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---

Consider rc3 is out. Can this be applied directly by maintainers or a PULL request is expected?

Thanks

#3 lore raw
Quoted 27 lines · Jason Wang
Quoted 21 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Quoted 4 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---

Quoted 4 lines

Consider rc3 is out. Can this be applied directly by maintainers or a PULL request is expected?

The commit description doesn't mention whether this fixes a regression introduced since QEMU 10.0, whether there is a security impact, etc. In the absence of more information, this looks like a regular bug fix that does not need to be merged for -rc4.

Only release blockers will be merged for -rc4 (Tue 19 Aug). Please provide a justification if this commit is a release blocker. Reasoning:
- From -rc3 onwards the goal is to make the final release and adding additional patches risks introducing new issues that will delay the release further.
- Commits should include enough information to make the decision to merge easy and documented in git-log(1). Don't rely on me to judge the severity in areas of the codebase I'm not an expert in.

Thanks!

Stefan

#4 lore raw
Quoted 39 lines · Stefan Hajnoczi
Quoted 27 lines · Jason Wang
Quoted 21 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Quoted 4 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---

Quoted 4 lines

Consider rc3 is out. Can this be applied directly by maintainers or a PULL request is expected?

The commit description doesn't mention whether this fixes a regression introduced since QEMU 10.0, whether there is a security impact, etc. In the absence of more information, this looks like a regular bug fix that does not need to be merged for -rc4.

Quoted 8 lines

Only release blockers will be merged for -rc4 (Tue 19 Aug). Please provide a justification if this commit is a release blocker. Reasoning:
- From -rc3 onwards the goal is to make the final release and adding additional patches risks introducing new issues that will delay the release further.
- Commits should include enough information to make the decision to merge easy and documented in git-log(1). Don't rely on me to judge the severity in areas of the codebase I'm not an expert in.

I see, I think it's not a release blocker so we can defer this to the next release.

Thanks

Quoted 4 lines

Thanks!

Stefan

#5 lore raw

Hi Jason,

Quoted 49 lines · Jason Wang
Quoted 39 lines · Stefan Hajnoczi
Quoted 27 lines · Jason Wang
Quoted 21 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Quoted 4 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---

Quoted 4 lines

Consider rc3 is out. Can this be applied directly by maintainers or a PULL request is expected?

The commit description doesn't mention whether this fixes a regression introduced since QEMU 10.0, whether there is a security impact, etc. In the absence of more information, this looks like a regular bug fix that does not need to be merged for -rc4.

Quoted 8 lines

Only release blockers will be merged for -rc4 (Tue 19 Aug). Please provide a justification if this commit is a release blocker. Reasoning:
- From -rc3 onwards the goal is to make the final release and adding additional patches risks introducing new issues that will delay the release further.
- Commits should include enough information to make the decision to merge easy and documented in git-log(1). Don't rely on me to judge the severity in areas of the codebase I'm not an expert in.

Quoted 2 lines

I see, I think it's not a release blocker so we can defer this to the next release.

just a reminder not to forget to pull it now...

Thanks,
Laurent

#6 lore raw
Quoted 52 lines · Laurent Vivier

Hi Jason,

Quoted 49 lines · Jason Wang
Quoted 47 lines · Stefan Hajnoczi
Quoted 27 lines · Jason Wang
Quoted 21 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Quoted 4 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

---

Quoted 4 lines

Consider rc3 is out. Can this be applied directly by maintainers or a PULL request is expected?

The commit description doesn't mention whether this fixes a regression introduced since QEMU 10.0, whether there is a security impact, etc. In the absence of more information, this looks like a regular bug fix that does not need to be merged for -rc4.

Only release blockers will be merged for -rc4 (Tue 19 Aug). Please provide a justification if this commit is a release blocker. Reasoning:
- From -rc3 onwards the goal is to make the final release and adding additional patches risks introducing new issues that will delay the release further.
- Commits should include enough information to make the decision to merge easy and documented in git-log(1). Don't rely on me to judge the severity in areas of the codebase I'm not an expert in.

Quoted 4 lines
Quoted 2 lines

I see, I think it's not a release blocker so we can defer this to the next release.

just a reminder not to forget to pull it now...

Since Jason Acked the patch, I'll merge it via my hw-misc tree; thanks!

#7 lore raw
In reply to Laurent Vivier
Quoted 15 lines · Laurent Vivier

A race condition between guest driver actions and QEMU timers can lead to an assertion failure when the guest switches the e1000e from legacy interrupt mode to MSI-X. If a legacy interrupt delay timer (TIDV or RDTR) is active, but the guest enables MSI-X before the timer fires, the pending interrupt cause can trigger an assert in e1000e_intmgr_collect_delayed_causes().

This patch removes the assertion and executes the code that clears the pending legacy causes. This change is safe and introduces no unintended behavioral side effects, as it only alters a state that previously led to termination.

- when core->delayed_causes == 0 the function was already a no-op and remains so.

Quoted 8 lines

- when core->delayed_causes != 0 the function would previously crash due to the assertion failure. The patch now defines a safe outcome by clearing the cause and returning. Since behavior after the assertion never existed, this simply corrects the crash.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1863

It feels like this is a qemu-stable material. Picking it up for 10.0 & 10.1. And for 7.2 too.

Please let me know if I shouldn't.

Thanks,

/mjt

Quoted 16 lines
hw/net/e1000e_core.c +0 -5
index 24138587905b..06657bb3ac5c 100644
@@ -341,11 +341,6 @@ e1000e_intmgr_collect_delayed_causes(E1000ECore *core)
  {
      uint32_t res;
 
-    if (msix_enabled(core->owner)) {
-        assert(core->delayed_causes == 0);
-        return 0;
-    }
-
      res = core->delayed_causes;
      core->delayed_causes = 0;