mirror of https://github.com/coturn/coturn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tag:
Branch:
Tree:
4.11.0
copilot/fix-1649
debian/buster
debian/buster-backports
debian/master
debian/stretch
debian/stretch-backports
dh2066
fix-oauth
fix_msvc_analyzer
input-validation
libevent.rpm
macos_upgrade
master
move_to_verbose
pristine-tar
sparc64
sparc64-rebase
sparc64-rebase-slim
try-fix-docker
turnbis
upstream/latest
wferi/callback
4.10.0
4.11.0
4.4.5.3
4.4.5.4
4.5.0.1
4.5.0.2
4.5.0.3
4.5.0.4
4.5.0.5
4.5.0.6
4.5.0.7
4.5.0.8
4.5.1.0
4.5.1.1
4.5.1.2
4.5.1.3
4.5.2
4.6.0
4.6.1
4.6.2
4.6.3
4.7.0
4.8.0
4.9.0
debian/4.5.0.2-3
debian/4.5.0.2-3_bpo8+1
debian/4.5.0.3-1
debian/4.5.0.4-1
debian/4.5.0.4-4
debian/4.5.0.5-1
debian/4.5.0.5-1+deb9u1
debian/4.5.0.5-1+deb9u2
debian/4.5.0.5-1+deb9u3
debian/4.5.0.6-1
debian/4.5.0.7-1
debian/4.5.0.8-1
debian/4.5.1.0-1
debian/4.5.1.0-1_bpo9+1
debian/4.5.1.1-1
debian/4.5.1.1-1.1
debian/4.5.1.1-1.1+deb10u1
debian/4.5.1.1-1.1+deb10u2
debian/4.5.1.1-1.2
debian/4.5.1.3-1
debian/4.5.2-1
debian/4.5.2-1_bpo10+1
debian/4.5.2-2
debian/4.5.2-3
docker/4.10.0-r0
docker/4.10.0-r1
docker/4.5.2-r0
docker/4.5.2-r1
docker/4.5.2-r10
docker/4.5.2-r11
docker/4.5.2-r12
docker/4.5.2-r13
docker/4.5.2-r14
docker/4.5.2-r2
docker/4.5.2-r3
docker/4.5.2-r4
docker/4.5.2-r5
docker/4.5.2-r6
docker/4.5.2-r7
docker/4.5.2-r8
docker/4.5.2-r9
docker/4.6.0-r0
docker/4.6.0-r1
docker/4.6.1-r0
docker/4.6.1-r1
docker/4.6.1-r2
docker/4.6.1-r3
docker/4.6.2-r0
docker/4.6.2-r1
docker/4.6.2-r10
docker/4.6.2-r11
docker/4.6.2-r12
docker/4.6.2-r13
docker/4.6.2-r2
docker/4.6.2-r3
docker/4.6.2-r4
docker/4.6.2-r5
docker/4.6.2-r6
docker/4.6.2-r7
docker/4.6.2-r8
docker/4.6.2-r9
docker/4.6.3-r0
docker/4.6.3-r1
docker/4.6.3-r2
docker/4.6.3-r3
docker/4.7.0-r0
docker/4.7.0-r1
docker/4.7.0-r2
docker/4.7.0-r3
docker/4.7.0-r4
docker/4.8.0-r0
docker/4.8.0-r1
docker/4.9.0-r0
upstream/4.0.0.0
upstream/4.0.0.1
upstream/4.0.0.2
upstream/4.0.1.2
upstream/4.0.1.3
upstream/4.1.0.1
upstream/4.1.0.2
upstream/4.1.1.1
upstream/4.1.2.1
upstream/4.2.1.2
upstream/4.2.2.2
upstream/4.2.3.1
upstream/4.3.1.1
upstream/4.3.1.2
upstream/4.3.1.3
upstream/4.3.2.1
upstream/4.3.2.2
upstream/4.3.3.1
upstream/4.4.1.1
upstream/4.4.1.2
upstream/4.4.2.1
upstream/4.4.2.2
upstream/4.4.2.3
upstream/4.4.4.1
upstream/4.4.4.2
upstream/4.4.5.1
upstream/4.4.5.2
upstream/4.4.5.3
upstream/4.4.5.4
upstream/4.5.0.1
upstream/4.5.0.2
upstream/4.5.0.3
upstream/4.5.0.4
upstream/4.5.0.5
upstream/4.5.0.6
upstream/4.5.0.7
upstream/4.5.0.8
upstream/4.5.1.0
upstream/4.5.1.1
upstream/4.5.1.3
upstream/4.5.2
${ noResults }
## Summary - Add a self-contained Fil-C build/test harness under `filc/` that mirrors the existing `fuzzing/` pattern: one host script (`filc/run-local.sh`) builds an Ubuntu 24.04 image with the [Fil-C](https://github.com/pizlonator/fil-c) optfil 0.678 toolchain, builds turnserver with `CC=filcc`/`CXX=fil++`, runs unit tests + system tests, and drops a per-run timestamped log directory with `SUMMARY.txt` + `ISSUES.txt`. - Fix the two real Fil-C compatibility bugs the harness surfaces by changing `ur_map_value_type` and `ur_addr_map_value_type` from `uintptr_t` to `void *` in `src/server/ns_turn_maps.h`. ## Why [Fil-C](https://fil-c.org) is a memory-safe C/C++ compiler (Clang 20 fork) that pairs every pointer with an "InvisiCap" capability and turns UB into deterministic panics with no `unsafe` escape hatch. Putting coturn through it answers two questions: (a) does it compile unmodified, and (b) does it run correctly under capability-enforced memory safety. After this PR, the answer is **yes** for both — turnserver, turnutils_peer, and turnutils_uclient relay TCP/TLS/UDP/DTLS traffic with full Fil-C enforcement, all unit tests pass, and `examples/run_tests_conf.sh` runs end-to-end. ## What's in the PR ### `filc/` harness (commit 1) | File | Purpose | |---|---| | `filc/Dockerfile` | Ubuntu 24.04 + Fil-C optfil 0.678 (extracts the nested `fil.tar.xz` to `/opt/fil`); `--platform linux/amd64` so it works on Apple Silicon under emulation. | | `filc/run-local.sh` | Host-side: build image, create `filc/logs/<UTC-ts>/`, run container with source mounted read-only and log dir mounted r/w. | | `filc/docker-entrypoint.sh` | In-container orchestrator. Phases: env / source-copy / build / unit-tests / system-cli / system-conf. Runs every phase even when a prior one fails (no aborting mid-pass). Captures per-phase logs + a combined `all.log` + JUnit XML for ctest. Greps panics/errors into `ISSUES.txt`. Downgrades `system-*` phases to FAIL when `examples/run_tests*.sh` prints `FAIL` despite exiting 0 (existing fragility in those scripts). | | `filc/build.sh` | `cmake … -DBUILD_TESTING=ON -DCMAKE_C_COMPILER=filcc -DCMAKE_CXX_COMPILER=fil++ -DCMAKE_BUILD_TYPE=RelWithDebInfo`, then build. | | `filc/.gitignore` | Ignore the on-host `logs/` dir. | The harness also bumps the post-launch sleep in `examples/run_tests.sh` from 2s to 6s **only inside the container** (sed-in-place on the copied source; upstream is untouched). Under linux/amd64 emulation the Fil-C-built turnserver isn't accepting TCP at 2s, so the first sub-test races and prints `FAIL`. Matches the 5s sleep already used by `run_tests_conf.sh`. ### Pointer-typedef fixes (commit 2) `src/server/ns_turn_maps.h`: ```diff -typedef uintptr_t ur_map_value_type; +typedef void *ur_map_value_type; ... -typedef uintptr_t ur_addr_map_value_type; +typedef void *ur_addr_map_value_type; ``` **Why this is necessary.** Both maps store pointers, but their value slot is integer-typed. Every existing `_put` site casts a pointer through `(ur_*_value_type)` to store, and every `_get` site casts back. Under standard C this is a well-defined no-op. Under Fil-C, casting a pointer to `uintptr_t` discards its InvisiCap; casting back yields a pointer with a non-null address but a NULL Fil-C object — the next dereference panics with `cannot read pointer with null object`. The harness caught two such panics, both in the auth-resume / relay-allocate flow: 1. `src/server/ns_turn_server.c:3248` — `ss->client_socket`, where `ss` came from `sessions_map` (a `ur_map`). 2. `src/apps/relay/turn_ports.c:225` — `tp->mutex`, where `tp` came from `ip_to_turnports_*` (a `ur_addr_map`) via `turnipports_add`. **Why this is also a correctness improvement on a normal build.** The new typedef makes the API strictly more type-safe — the compiler now enforces "you put a pointer in." It eliminates a class of accidental misuse (storing a non-pointer integer where a pointer was expected) that the integer typedef silently allowed. Same generated code on a normal build; different (correct) Fil-C semantics. **Audit.** Verified before changing: - All `ur_map_put` / `lm_map_put` / `ur_addr_map_put` callers store pointer-typed values exclusively (no callers store raw integers). - No internal arithmetic on the value type anywhere in `ns_turn_maps.c`. - `ur_map_del_func` / `ur_addr_map_func` implementations either don't exist (all `_del` callers pass `NULL`) or immediately cast their parameter to a real pointer type — no source change needed. - `KHASH_MAP_INIT_INT64(3, ur_map_value_type)` works identically with `void *`. - `ur_addr_map`'s `addr_elem.value` is assigned, read, compared for truthiness, and cleared with `= 0` — all valid for `void *`. ## Test plan - [ ] `filc/run-local.sh` reports all six phases PASS (env / source-copy / build / unit-tests / system-cli / system-conf), `ISSUES.txt` carries no Fil-C panic / safety / sanitizer entries. - [ ] Local `cmake -S . -B build -DBUILD_TESTING=ON && cmake --build build && ctest --test-dir build --output-on-failure` is green (no regression on the regular build). - [ ] `examples/run_tests.sh` and `examples/run_tests_conf.sh` are green on Linux per `CLAUDE.md`. - [ ] Existing `fuzzing/run-local.sh ASan 0 -runs=1` still passes (the new `filc/` directory is independent and shouldn't perturb anything). |
3 days ago | |
|---|---|---|
| .. | ||
| .gitignore | Filc harness and pointer typedefs (#1896) | 3 days ago |
| Dockerfile | Filc harness and pointer typedefs (#1896) | 3 days ago |
| build.sh | Filc harness and pointer typedefs (#1896) | 3 days ago |
| docker-entrypoint.sh | Filc harness and pointer typedefs (#1896) | 3 days ago |
| run-local.sh | Filc harness and pointer typedefs (#1896) | 3 days ago |