# Reproducer for `posix_memalign()` extreme alignment

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

- `04-posix-memalign-extreme-align.tar.gz`
- `README.md`

Archive SHA-256:

```text
7364c4cd44fe756fb3fa138509eb53ef29d68373564bd869d259dd1069ae8788
```

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

```text
poc/malloc/Dockerfile
poc/malloc/posix-memalign-extreme.c
poc/malloc/run-extreme-align.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.
- ARM64 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.
- About 8 GB of virtual address space for the allocation; physical memory
  commitment is normally small under overcommit.
- No host musl toolchain is required.

## Reproduce

```sh
tar xzf 04-posix-memalign-extreme-align.tar.gz
./prepare.sh
cd musl-1.2.5
./poc/malloc/run-extreme-align.sh
```

Observed output:

```text
before posix_memalign
EXTREME_ALIGN_CRASH=1 signal=11 exit=139
```

## 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

A restrictive memory cgroup may turn the observed crash into `ENOMEM`; the
8 GiB virtual mapping is the relevant requirement for this PoC.
