https://bugs.kde.org/show_bug.cgi?id=513151

Zamundaaa <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/kwin/-/commit/30a7f52841 |ma/kwin/-/commit/ef4504320d
                   |dd1c449965d0c9d5cd4915697ab |e2c3a7c7aebcf083d75db361f80
                   |129                         |2ae

--- Comment #27 from Zamundaaa <[email protected]> ---
Git commit ef4504320de2c3a7c7aebcf083d75db361f802ae by Xaver Hugl.
Committed on 12/12/2025 at 14:11.
Pushed by zamundaaa into branch 'Plasma/6.5'.

core/sessions: don't take ownership of an fd that Qt will close

QDBusUnixFileDescriptor closes the file descriptor in its destructor, if we
want to take ownership of it, we need to duplicate the file descriptor.
If we don't duplicate it, but directly take "ownership" of the file descriptor,
the following sequence of events can happen:

1. ~QDBusUnixFileDescriptor closes file descriptor A
2. some new fd B is allocated, which happens to have the same handle as fd A
3. ~FileDescriptor closes fd A, but it has the same handle as fd, so it
actually
   closes fd B!
4. whenever fd B is used, we run into problems

To make such issues easier to debug in the future, this also adds debug logging
for when closing a file descriptor fails.
(cherry picked from commit 30a7f52841dd1c449965d0c9d5cd4915697ab129)

M  +1    -1    src/core/session_consolekit.cpp
M  +1    -1    src/core/session_logind.cpp
M  +19   -3    src/utils/filedescriptor.cpp

https://invent.kde.org/plasma/kwin/-/commit/ef4504320de2c3a7c7aebcf083d75db361f802ae

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to