Skip to content

fix(libwebrtc): compile libfvad with -fno-sanitize=shift for the sanitizer job - #15927

Open
xXPBSXx wants to merge 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/libwebrtc-fvad-no-sanitize-shift
Open

xXPBSXx wants to merge 1 commit into
boykopovar:mainfrom
xXPBSXx:fix/libwebrtc-fvad-no-sanitize-shift

Conversation

@xXPBSXx

@xXPBSXx xXPBSXx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

What

guest_webrtc_vad fails in the nightly Sanitizers runs of 2026-11-02, 2026-11-03 and 2026-11-04 with 3rdparty/libfvad/src/signal_processing/resample_by_2_internal.c:141:37: runtime error: left shift of negative value -32490. The sanitizer build uses -fno-sanitize-recover=undefined, so the first report stops the test.

The line is in the 3rdparty/libfvad submodule, pinned to 532ab666c20d3cfda38bca63abbb0f152706c369, which is the newest commit of the upstream repository (2024-02-19); upstream has no fix. The code shifts a negative 16-bit sample left, which is undefined in C. libfvad already marks its functions that overflow with RTC_NO_SANITIZE("signed-integer-overflow") (src/common.h:29, used at resample_by_2_internal.c:31, :127 and :206 and at vad/vad_core.c:115), but not this shift.

This PR adds target_compile_options(fvad PRIVATE $<$<C_COMPILER_ID:GNU,Clang,AppleClang>:-fno-sanitize=shift>) after the fvad target is created in core/libs/CMakeLists.txt. The consequence, stated plainly: UBSan no longer checks shifts in libfvad. Its other checks, and every other target, stay on, and the generated code is unchanged (outside the sanitizer builds the flag has no effect). A technical debt entry in docs/dev/debt/libwebrtc.md says so.

There is no precedent in the repository for -fno-sanitize on a third-party target (git grep on b11c7bf84f). The nearest cases are the global -fno-sanitize=function in CMakeLists.txt:110 and the no_sanitize("address") attributes on three functions of our own code. I did not take two other routes: a line in .github/sanitizer-known-failures.txt would be permanent, because there is no upstream fix to wait for (the existing guest_vorbis_dec line pointed at an upstream fix, #11480), and an UBSan suppression file for the test is not measured and has no precedent here. The repository has no mechanism to patch a submodule's files.

Tested

Ubuntu 24.04, GCC 13.3, ASan + UBSan configured as in sanitizers.yml (-fno-sanitize-recover=undefined), ASAN_OPTIONS=detect_leaks=0, UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1, on 2026-11-04 from 16:50 UTC to 16:51 UTC, on main b11c7bf84f5d2f636ff60166cc3371bd071e24d5 plus the change:

  • With the change: guest_webrtc_vad Passed in 3 of 3 runs; the compile command of resample_by_2_internal.c contains -fno-sanitize=shift.
  • core/libs/CMakeLists.txt from main (red): Failed in 3 of 3 runs with the message above, and the compile command does not contain the flag.
  • Change restored: Passed in 3 of 3 runs. cmake and ninja exited 0 in every arm.
  • These runs used an earlier version of this commit whose core/libs/CMakeLists.txt is byte for byte the same file (blob 90e03222b390362fe2563db13d464656d2f26264); only the debt entry was reworded and moved.

MinGW GCC 15.2.0 (WinLibs) on Windows 10, 2026-11-04 at 17:08 UTC: cmake -S . -B build exited 0, ninja -C build fvad exited 0, and the compile command of resample_by_2_internal.c contains -fno-sanitize=shift.

python -I tools/check_conventions.py --base b11c7bf84f5d2f636ff60166cc3371bd071e24d5 passed at 17:10 UTC; git diff --check is clean.

Not run: Clang and AppleClang (the expression lists them; no Clang was available here), MSVC (the expression leaves it out), and the nightly's own GCC 15 on ubuntu-latest.

Overlap

Checked against main d63781e with the 1879 open PRs listed at 22:51 UTC on 2026-11-04 (scan from 22:50 UTC on 2026-11-04 to 00:03 UTC on 2026-11-05); the changed files of each PR come from git diff --name-only against its merge base. 67 PRs change core/libs/CMakeLists.txt, 34 change docs/dev/debt/libwebrtc.md and 2 change .github/sanitizer-known-failures.txt; together they are 102 PRs. No open PR changes 3rdparty/libfvad or core/libs/tests/GuestWebrtcVad.cpp, and no open PR title mentions fvad, webrtc_vad or resample_by_2. #15905 had no fetchable ref at that time; its file list from the API (core/libs/tests/GuestPad.cpp) does not touch these files. Measured against this head with git merge-tree: 85 are clean. The other 17 also conflict with main alone, so this PR does not cause any of them. The branch is based on b11c7bf84f; against current main 41eee370ea9a946b1a78699461042baa4f812aa8 (checked on 2026-11-05 at 00:19 UTC) it merges cleanly.

#15165 adds a guest_webrtc_vad line to .github/sanitizer-known-failures.txt. It does not conflict with this PR, which does not touch that file, but once both are merged the test passes and the line would be listed as known but passed. Depends on: none.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

…tizer job

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 8cceb3d merged onto main b611e63 · tested 2026-11-05 02:11 UTC · 28 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 3,868 passed · 16 failed (0 new, 14 also fail on main, 2 unstable on main) · 62 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Vulkan validation ✅ no new validation IDs vs main (1405 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.3 s, ⚠️ agc_driver_graphics_maps_fallback 100.8 s, ⚠️ agc_driver_graphics 93.4 s, ⚠️ public_headers 48.0 s, ⚠️ agc_driver_bda_device 45.6 s
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 9 of the last 10 main runs
agc_driver_two_sample_alpha_to_coverage_sample_mask_export: failed in 4 of the last 10 main runs
Failing on main too (14, not counted against this PR)
agc_driver_alpha_to_coverage_sample_mask_export
agc_driver_guest_memory_lifetime_direct
agc_driver_image_gather_volume
agc_driver_image_table
agc_driver_job_manager_compute_capacity
agc_driver_native_depth_bda_clear
agc_driver_native_depth_buffer_clear
agc_driver_native_depth_clears
agc_driver_native_multisample_depth
agc_driver_submit_progress
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (4 IDs in 811 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (811 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_draw_space_reuse_held, agc_driver_address_draw_space_reuse_off, agc_driver_address_draw_space_reuse_transitions, agc_driver_address_draw_space_reuse_verify, agc_driver_address_passes, and 803 more
VUID-vkCmdCopyImage-srcImage-01548 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-vkCmdCopyImage-srcImage-01551 (11 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store_image_copy, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_partially_unmapped_plane, agc_driver_depth_plane_unmapped_plane, and 3 more
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (2 tests): agc_driver_prepared_exports, agc_driver_srgb8_color_target
Skipped (62)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_copied_writer_label_order_drain: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergp
Reproduce
git fetch origin 8cceb3d1cf91e6c3d44b2ceb9ac6874c340d948c b611e634f7fc024f0c13e342d96de744448ef1d9
git checkout b611e634f7fc024f0c13e342d96de744448ef1d9 && git merge --no-ff 8cceb3d1cf91e6c3d44b2ceb9ac6874c340d948c
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 12 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 16 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

Automated build and test on a contributor's AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants