# GHSA-gmq2-39ff-f5qg: A failed upgrade may lead to hung goroutines

> A failed upgrade in the tableflip library can cause hung goroutines in the parent process, leading to a denial of service.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Not stated
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 May 2021

## What is GHSA-gmq2-39ff-f5qg?

GHSA-gmq2-39ff-f5qg is a denial of service vulnerability in github.com/cloudflare/tableflip, published on 21 May 2021. 

### Official description

### Impact
Processes using tableflip may encounter hung goroutines in the parent process, after a failed upgrade.

The Go runtime has annoying behaviour around setting and clearing
O_NONBLOCK: exec.Cmd.Start() ends up calling os.File.Fd() for any
file in exec.Cmd.ExtraFiles. os.File.Fd() disables both the use
of the runtime poller for the file and clears O_NONBLOCK from
the underlying open file descriptor.

This can lead to goroutines hanging in a parent process, after at least
one failed upgrade. The bug manifests in goroutines which rely on
either a deadline or interruption via Close() to be unblocked being stuck
in read or accept like syscalls. As far as I can tell we've not experienced
this problem in production, so it's most likely quite rare.

### Patches
The problem has been fixed in v1.2.2.

### Workarounds
None.

### References
* https://github.com/cloudflare/tableflip/commit/cae714b289e199db5da5f08af861ea65be6232c0

## Which versions are affected by GHSA-gmq2-39ff-f5qg?

2 open source packages ship an affected version, including github.com/cloudflare/tableflip.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/cloudflare/tableflip` | Go | All versions | 1.2.2 |
| `github.com/cloudflare/tableflip` | Go | All versions | 1.2.2 |

## How do I fix GHSA-gmq2-39ff-f5qg?

Upgrade github.com/cloudflare/tableflip to 1.2.2 or later.

## Is GHSA-gmq2-39ff-f5qg being exploited?

There is no known exploitation of GHSA-gmq2-39ff-f5qg in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-gmq2-39ff-f5qg and fix it if it is affected.

What it is: GHSA-gmq2-39ff-f5qg is a denial of service vulnerability in github.com/cloudflare/tableflip, published on 21 May 2021. 
Exploitation: There is no known exploitation of GHSA-gmq2-39ff-f5qg in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/cloudflare/tableflip (Go): affected all versions; fixed in 1.2.2
- github.com/cloudflare/tableflip (Go): affected all versions; fixed in 1.2.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-gmq2-39ff-f5qg/ (Markdown: https://insights.sbomify.com/GHSA-gmq2-39ff-f5qg/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-gmq2-39ff-f5qg

---
From sbomify Insights: https://insights.sbomify.com/GHSA-gmq2-39ff-f5qg/
Summaries are generated and may contain mistakes; the official description above is the record.
