# apple-oss-distributions/libc — AlpLab Radar Static Code Audit

- Ring: `watch`
- Category: `dev`
- Overall score: `3.2/5`
- Implementation check: `verified`
- Maturity: `dormant`
- Audited commit: `71bbe350ab79` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-12-02T10:04:29Z
- Repository: https://github.com/apple-oss-distributions/libc
- Radar entry: https://radar.alplab.co/#repo/apple-oss-distributions/libc
- License: `NOASSERTION`
- Tags: `c`, `darwin`, `libc`, `posix`, `apple`, `system-programming`

## Summary

Apple's open-source drop of Darwin's Libc: POSIX/BSD headers, C runtime helpers, fortify checks, collections, exclave shims, and platform feature flags for macOS/iOS.

## Implementation Check

No README exists; the tree is exactly what it claims to be — Apple's Libc sources (Libc.xcodeproj, include/unistd.h, gen/FreeBSD/exec.c), a complete production codebase, not a scaffold.

## When to Use

Consult as the authoritative reference for macOS/iOS libc behavior (headers, compat symbol versioning, fortify internals, exclave shims); not for building or linking into your own projects.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 4.0/5 |
| usability | 2.5/5 |
| reliability | 3.0/5 |
| security | 4.0/5 |
| integration | 2.5/5 |

## Code Evidence

- gen/FreeBSD/exec.c implements exec family by mapping onto _execve with PATH search retry; include/unistd.h declares the Darwin surface with __DARWIN_ALIAS versioning
- secure/memcpy_chk.c through strlcpy_chk.c add _FORTIFY_SOURCE-style bounds-checked variants that abort via secure/chk_fail.c __chk_fail_overflow
- darwin/libc_hooks.c libc_set_introspection_hooks installs versioned will_read/will_write introspection hooks for sanitizers, ptrauth-signed per darwin/libc_hooks.h
- tests/Makefile wires ~90 suites (regex, FreeBSD ATF, darwintest) but includes $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest — Apple-internal only
- Compatibility.md documents Darwin's $-suffixed symbol versioning via __asm("_foo$V3") to ship incompatible API generations side by side
- exclave/_libc_shims.c stubs POSIX I/O with ENOSYS and forwards open/stat/read to host-provided _libc_functions for Apple Exclave

## Issues Found

None recorded.

## Key Risks

- Snapshot drop of Apple's internal repo: no releases, no CI, importer-only history; code lands only when Apple re-publishes sources
- Not buildable or testable outside Apple: tests/Makefile requires AppleInternal darwintest infra and /usr/lib/system/libsystem_collections
- License is APSL-2.0 in APPLE_LICENSE but the file isn't named LICENSE, so GitHub reports NOASSERTION
- gdtoa.tgz is a vendored binary tarball, so that subtree cannot be reviewed as text
- No README or build docs for outside consumers; Compatibility.md is the only developer guide

## Reviewed Files

- `Compatibility.md`
- `APPLE_LICENSE`
- `tests/Makefile`
- `darwin/libc_hooks.c`
- `darwin/libc_hooks.h`
- `gen/authentication.c`
- `Platforms/macosx/Makefile.inc`
- `collections/PublicHeader/collections.h`
- `tests/regex/README`
- `exclave/_libc_shims.c`
