# Reproducer for `fmemopen(NULL, 0, "w+")`

This directory is the complete material for one Openwall report. The email
attachments are:

- `05-fmemopen-zero-wplus.tar.gz`
- `README.md`

Archive SHA-256:

```text
b39503d2ed0abad2ff180be9fbdeefcf4d7fb0243325a4b82814533aab0ec6e2
```

The archive contains only this report's PoC files and `prepare.sh`:

```text
poc/linux/Dockerfile
poc/stdio/fmemopen-zero-wplus-guard.c
poc/stdio/run-fmemopen-zero-wplus.sh
prepare.sh
```

`prepare.sh` downloads the official musl 1.2.5 source archive from
`https://musl.libc.org/releases/musl-1.2.5.tar.gz`, verifies its SHA-256, and
places this report's `poc/` directory into the source tree.

Official source SHA-256:

```text
a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4
```

## Requirements

- Docker with Linux-container support and BuildKit.
- `curl` or `wget`, `tar`, and a SHA-256 utility.
- AMD64 container support, either native or through emulation.
- Network access for the official source and first base-image pull.
- About 2 GB of free Docker storage.
- No host musl toolchain is required.

## Reproduce

```sh
tar xzf 05-fmemopen-zero-wplus.tar.gz
./prepare.sh
cd musl-1.2.5
./poc/stdio/run-fmemopen-zero-wplus.sh
```

Observed output excerpt (addresses abbreviated):

```text
FMEMOPEN_ZERO_WPLUS=SEGV size=0x0000000000000518 \
    object=0x...ae8 fault=0x...000
```

The runner builds the required AMD64 musl 1.2.5 image from the source prepared
by `prepare.sh`, then compiles and runs the guarded-page probe.

## Tested environment

- Docker client/server 29.3.1
- Docker Desktop 4.68.0
- Host: macOS ARM64 (`darwin/arm64`)
- Docker server: `linux/arm64`
- Kernel: `6.12.76-linuxkit`
- Storage: overlayfs, cgroup v2
- CPUs: 12
- Docker memory: 7.652 GiB
- Base image: `gcc:12-bookworm` pinned by digest

The tested ARM64 host used Docker's AMD64 emulation for this PoC. A native
AMD64 host avoids the emulation cost.
