Skip to content

Put fluidsynth.lock in its own directory#1528

Merged
derselbst merged 1 commit intoFluidSynth:masterfrom
andrew-sayers:fix-1527
Apr 6, 2025
Merged

Put fluidsynth.lock in its own directory#1528
derselbst merged 1 commit intoFluidSynth:masterfrom
andrew-sayers:fix-1527

Conversation

@andrew-sayers
Copy link
Contributor

In some distributions (e.g. Fedora), /run/lock is only writable by root.

Create /run/lock/fluidsynth with appropriate permissions.

Fixes #1527.

Some issues with rolling this out:

I can't see where the cmake installer installs the .service files, so haven't added an equivalent to install fluidsynth.tmpfiles. If the installer doesn't do that, this is fine.

I've added the relevant line to contrib/fluidsynth.spec, and the documentation claims %{_tmpfilesdir} is the correct incantation, but I don't have a Fedora system to test on. Should we give the Fedora maintainer a heads-up somehow?

I haven't added the relevant line to contrib/debian.fluidsynth.install, because Debian's version of that file has drifted out of sync. To see their version, go to Debian's package page, download fluidsynth_2.4.4+dfsg-1.debian.tar.xz and take a look at debian/fluidsynth.install. The relevant line is probably */fluidsynth.tmpfiles usr/lib/tmpfiles.d/fluidsynth.conf - do you want to resync these, or shall I just send them a bug report explaining they'll need to fix their version?

In some distributions (e.g. Fedora), /run/lock is only writable by root.

Create /run/lock/fluidsynth with appropriate permissions.

Fixes FluidSynth#1527.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 4, 2025

Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of this!

I can confirm that the system service file isn't installed by CMake.

For RPM-based distros, this looks fine. I'll include a hint about that in the release notes of the next version, so no need to ping the maintainers, IMO.

@derselbst derselbst merged commit f8cdcb8 into FluidSynth:master Apr 6, 2025
49 of 55 checks passed
@andrew-sayers andrew-sayers deleted the fix-1527 branch April 6, 2025 17:59
DominusExult added a commit to DominusExult/fluidsynth-sans-glib that referenced this pull request Apr 7, 2025
* master: (51 commits)
  Put fluidsynth.lock in its own directory (FluidSynth#1528)
  Fix XG Drum bank selection (FluidSynth#1514)
  Stop SDL3 intercepting signals (FluidSynth#1520)
  Fix MSVC type truncation warnings (FluidSynth#1515)
  Fix SDL3.dll not included in prebuilt Windows Binaries (FluidSynth#1518)
  Fix Altitude test case
  Update testcases for FluidSynth#1508
  Apply *_FOR_BUILD environment variables to gentables (FluidSynth#1501)
  Add testfiles for FluidSynth#1496 and FluidSynth#1505
  Remove unused enum
  Bump to 2.4.4
  Fix ordering and dependencies in fluidsynth.service file (FluidSynth#1500)
  fluidsynth.1: Some remarks and a patch with editorial changes for this man page (FluidSynth#1499)
  Add support for SDL3 (FluidSynth#1485)
  Fix interruptions of real-time playback (FluidSynth#1494)
  Add two more test cases
  Log SysEX System ON Messages
  Return error code on server failure
  Rephrase error messages for clarity
  Only run one FluidSynth service at a time
  ...
@andrew-sayers
Copy link
Contributor Author

For the record, I've used this PR as the basis of the fix for an equivalent issue in bluez. The feedback here has helped significantly over there - thanks!

github-actions bot pushed a commit to tedd-an/bluez-upstream-test that referenced this pull request Apr 18, 2025
Obex is a device-oriented protocol, so only one instance can run per device.
But Linux file security is user-oriented, so obexd should be a user service.
Tell systemd to only run this service for the first non-system user to log in.

Without this patch, errors like the following will occur if you
use the "switch account" feature of your desktop environment,
then log in with another account:

Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00001133-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00001132-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 0000112f-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00001104-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00001106-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00001105-0000-1000-8000-00805f9b34fb which is already registered
Mar 26 15:20:38 andrews-2024-laptop bluetoothd[873]: src/profile.c:register_profile() :1.2016 tried to register 00005005-0000-1000-8000-0002ee000001 which is already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered
Mar 26 15:20:38 andrews-2024-laptop obexd[1795560]: bluetooth: RequestProfile error: org.bluez.Error.NotPermitted, UUID already registered

The above errors indicate the service completely failed to register, so this
does not change the user experience beyond removing the above messages.
Specifically, the first user who logs in to a multi-user system still retains
obex access to devices paired by users who log in later.

This is based on a pair of recent changes to the FluidSynth daemon:

FluidSynth/fluidsynth#1491
FluidSynth/fluidsynth#1528

This was discussed in the comments for a GitHub advisory available at
GHSA-fpgq-25xf-jcwv
but comments are not shown in the published version of the advisory.
To summarise the useful conversation with Luiz Augusto von Dentz:

Obex requires access to the user's home directory, so an attacker can only
transfer files between locations the user controls.  That may be a problem
if the user who runs obexd is different to the user who paired the device,
but solving that would involve pairing per-user, which causes other problems.
Bluetooth connections can be initiated by peripherals, so switching user could
trigger re-pairing and cause the original user to lose access to the device.
This may seem reasonable for file access, but for example users would likely
object to constantly re-pairing their Bluetooth keyboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/run/lock/fluidsynth.lock issue.

2 participants