fix(control): the control bridge's socket folder may not be a link #3014
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3014
Loading…
Reference in a new issue
No description provided.
Delete branch "PedroRossi/Longshot:fix/control-folder-no-link"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The control bridge (
HOS_CONTROL: a local socket tools drive the game through, its input and menu, and withHOS_CONTROL_MEMits memory) listens only in a folder that is this user's and that no one else can write to(
folder_private,host/control.c), so no other user of the machine can reach or replace it. The check usedstat,which follows a symbolic link: on a shared Linux machine, another user can make
/tmp/xa link to one of your privatefolders;
HOS_CONTROL=/tmp/x/control.sockthen passes the check, and as the link is theirs, they can point it at afolder of their own later, where a tool connecting to that path reaches their socket instead of the game.
lstatrefuses a link, and the log says the folder "is not there, or is a link". POSIX only: on Windows the bridge is anamed pipe with its own access list. Players are not affected: the bridge is a developer's tool, and the folder
longshot_bridge.pymakes is no link.Read first:
folder_private.Testing
Tested: in the game, Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless: the game built with this change, from the Market entrance repository
save to play; the bridge listened in its own private folder, answered
option_get(118 options) and the quit; exit 0.Game-free: the new case of
tests/control_test.c(a socket path whose folder is a link to a private folder) fails onmain, the bridge serving there, and passes here, with
tests/test_control.py's other cases; the host's C compiled forWindows with llvm-mingw (
check_host_compile.py: 0 failed;folder_privateis POSIX only).mise run test(--strict) on main @1938a302, and on main with this change merged (together with #3009, #3010, #3011, #3012, #3013, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end.Still to test:
None
Measurements
Nothing to measure: one system call, once at the bridge's start.
Risks
A developer who points
HOS_CONTROLat a path through a link has to use the real path (the log says why). Playersare not affected.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.The 145 checks of
mise run testthat fail on main @1938a302on this PC too, with or without this change97 need a tool this PC doesn't have on PATH (
--strictfails them):48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py
Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them.
Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01, headless: from the Market entrance repository save to play, the control bridge listened in its own private folder, answered option_get (118 options) and the quit; exit 0
WIP: fix(control): the control bridge's socket folder may not be a linkto fix(control): the control bridge's socket folder may not be a linkControl bridge has been mostly rewritten on
mod-apibranch btw, please retest therePull request closed