remoting Linux multi-process: Bind session services via DesktopSessionConnectionEvents [chromium/src : main]

0 views
Skip to first unread message

Yuwei Huang (Gerrit)

unread,
Apr 1, 2026, 3:20:08 AM (3 days ago) Apr 1
to Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
Attention needed from Joe Downing

Yuwei Huang voted and added 1 comment

Votes added by Yuwei Huang

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 12 (Latest):
Yuwei Huang . resolved

PTAL thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • Joe Downing
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
Gerrit-Change-Number: 7719387
Gerrit-PatchSet: 12
Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
Gerrit-Attention: Joe Downing <joe...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Apr 2026 07:19:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Yuwei Huang (Gerrit)

unread,
Apr 1, 2026, 3:30:49 AM (3 days ago) Apr 1
to Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
Attention needed from Joe Downing

Yuwei Huang added 1 comment

File remoting/host/mojom/remoting_host.mojom
Line 70, Patchset 12 (Latest): pending_receiver<ChromotingSessionServices> receiver);
Yuwei Huang . resolved

Note that this is the `Session` services instead of the `Host` services ([chromoting_host_services.mojom](https://source.chromium.org/chromium/chromium/src/+/main:remoting/host/mojom/chromoting_host_services.mojom;l=1;drc=f479adcb5631c7050b0dcd65267466f7cf03d15b)). Binding `ChromotingHostServices` into `ClientSession` doesn't make much sense, since some processes keep `ChromotingHostServices` bound all the time and expect `ChromotingSessionServices` to only be available when the CRD client is connected.

Gerrit-Comment-Date: Wed, 01 Apr 2026 07:30:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Joe Downing (Gerrit)

unread,
Apr 1, 2026, 3:54:31 PM (2 days ago) Apr 1
to Yuwei Huang, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
Attention needed from Yuwei Huang

Joe Downing voted and added 1 comment

Votes added by Joe Downing

Code-Review+1

1 comment

File remoting/host/daemon_process_linux.cc
Line 347, Patchset 12 (Latest): receivers_.Add(this, std::move(receiver), std::move(connection_info));
Joe Downing . unresolved

*AI suggestion* You should verify that `connection_info->credentials` is valid (on Linux, it should contain the peer's UID) before adding it to the receiver set. If the credentials are not available, the binding should likely be rejected.

*Joedow* IIRC you can't reliably get the peer_pid on Linux so you use IPC security which requires that the peer binary exists in the same directory as the current process. Is that correct?

Open in Gerrit

Related details

Attention is currently required from:
  • Yuwei Huang
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
    Gerrit-Change-Number: 7719387
    Gerrit-PatchSet: 12
    Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
    Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
    Gerrit-Comment-Date: Wed, 01 Apr 2026 19:54:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yuwei Huang (Gerrit)

    unread,
    Apr 1, 2026, 4:25:58 PM (2 days ago) Apr 1
    to Chromium IPC Reviews, Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
    Attention needed from Chromium IPC Reviews

    Yuwei Huang voted and added 2 comments

    Votes added by Yuwei Huang

    Commit-Queue+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 13 (Latest):
    Yuwei Huang . resolved

    Thanks! Adding IPC reviewer..

    File remoting/host/daemon_process_linux.cc
    Line 347, Patchset 12: receivers_.Add(this, std::move(receiver), std::move(connection_info));
    Joe Downing . resolved

    *AI suggestion* You should verify that `connection_info->credentials` is valid (on Linux, it should contain the peer's UID) before adding it to the receiver set. If the credentials are not available, the binding should likely be rejected.

    *Joedow* IIRC you can't reliably get the peer_pid on Linux so you use IPC security which requires that the peer binary exists in the same directory as the current process. Is that correct?

    Yuwei Huang

    It is interesting that when I ran the AI check, it made no suggestions and claimed that the CL looked good. Maybe it's a good idea to run the check multiple times even if the CL hasn't changed :)

    *AI suggestion* You should verify that `connection_info->credentials` is valid (on Linux, it should contain the peer's UID) before adding it to the receiver set. If the credentials are not available, the binding should likely be rejected.

    I'm not very sure what AI meant by verifying `connection_info->credentials`. We can't validate `uid` this early since it is supposed to be (and is) checked in `BindSessionServices`. It sounds like it is asking for a null check. `connection_info` could be null even though the underlying IPC server always provides it, but I've added a null check anyway. `connection_info->credentials` is not nullable since it's just a struct with int fields in the storage of `ConnectionInfo`.

    I've also added some comment to explain the verification logic.

    *Joedow* IIRC you can't reliably get the peer_pid on Linux so you use IPC security which requires that the peer binary exists in the same directory as the current process. Is that correct?

    You *can* reliably get the `peer_pid` on Linux. The problem is any PID-based security checks are susceptible of PID reuse attacks. `IsTrustedMojoEndpoint()` does the binary path check you just mentioned, but it's not safe enough because it looks up the binary path from the PID (and I got bugs filed by AI because of that 🙂). One reason I changed the server to pass `connection_info` is that the socket `credentials` gives you the peer's UID, which is not spoofable. You could technically lookup a process' UID with its PID, but it will have the same PID reuse problem.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Chromium IPC Reviews
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Gerrit-Change-Number: 7719387
      Gerrit-PatchSet: 13
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Attention: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-Comment-Date: Wed, 01 Apr 2026 20:25:48 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Joe Downing <joe...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      gwsq (Gerrit)

      unread,
      Apr 1, 2026, 4:27:07 PM (2 days ago) Apr 1
      to Yuwei Huang, Chromium IPC Reviews, Fred Shih, Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
      Attention needed from Fred Shih

      Message from gwsq

      From googleclient/chrome/chromium_gwsq/ipc/config.gwsq:
      IPC: ff...@chromium.org

      📎 It looks like you’re making a possibly security-sensitive change! 📎 IPC security review isn’t a rubberstamp, so your friendly security reviewer will need a fair amount of context to review your CL effectively. Please review your CL description and code comments to make sure they provide context for someone unfamiliar with your project/area. Pay special attention to where data comes from and which processes it flows between (and their privilege levels). Feel free to point your security reviewer at design docs, bugs, or other links if you can’t reasonably make a self-contained CL description. (Also see https://cbea.ms/git-commit/).

      IPC reviewer(s): ff...@chromium.org


      Reviewer source(s):
      ff...@chromium.org is from context(googleclient/chrome/chromium_gwsq/ipc/config.gwsq)

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fred Shih
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Gerrit-Change-Number: 7719387
      Gerrit-PatchSet: 13
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Fred Shih <ff...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Fred Shih <ff...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Apr 2026 20:26:59 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Fred Shih (Gerrit)

      unread,
      Apr 1, 2026, 7:15:34 PM (2 days ago) Apr 1
      to Yuwei Huang, Chromium IPC Reviews, Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org
      Attention needed from Yuwei Huang

      Fred Shih voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Yuwei Huang
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Gerrit-Change-Number: 7719387
      Gerrit-PatchSet: 13
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Fred Shih <ff...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Apr 2026 23:15:21 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Yuwei Huang (Gerrit)

      unread,
      Apr 1, 2026, 7:15:52 PM (2 days ago) Apr 1
      to Fred Shih, Chromium IPC Reviews, Joe Downing, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org

      Yuwei Huang voted and added 1 comment

      Votes added by Yuwei Huang

      Commit-Queue+2

      1 comment

      Patchset-level comments
      File-level comment, Patchset 13 (Latest):
      Yuwei Huang . resolved

      Thanks!

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Gerrit-Change-Number: 7719387
      Gerrit-PatchSet: 13
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Fred Shih <ff...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Comment-Date: Wed, 01 Apr 2026 23:15:40 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      Apr 1, 2026, 7:19:04 PM (2 days ago) Apr 1
      to Yuwei Huang, Fred Shih, Chromium IPC Reviews, Joe Downing, AyeAye, chromium...@chromium.org, chromotin...@chromium.org, mac-r...@chromium.org, ipc-securi...@chromium.org

      Chromium LUCI CQ submitted the change

      Change information

      Commit message:
      remoting Linux multi-process: Bind session services via DesktopSessionConnectionEvents

      This is for routing the ChromotingSessionServices to the correct
      ClientSession in case of multi-user. The old code path was
      DaemonProcess->RemotingHostControl->ChromotingHost->ClientSession. In
      order to make the old path work, I'd need to plump client_id through the
      pipeline. I gave it a try in https://crrev.com/c/7713292, which worked,
      but the code is awkward for Windows and single-process hosts.

      This CL does this differently. The daemon process will instead find the
      desktop session associated with the calling process, then pass the
      receiver together with the terminal_id to the
      IpcDesktopEnvironmentFactory via DesktopSessionConnectionEvents. This is
      a cleaner approach since it doesn't affect the single-process code path,
      and it is directly targeting the desktop session instead of `client_id`,
      which isn't really used much in the mojo IDL.
      Bug: 492619234
      Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Reviewed-by: Joe Downing <joe...@chromium.org>
      Commit-Queue: Yuwei Huang <yuw...@chromium.org>
      Reviewed-by: Fred Shih <ff...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1608848}
      Files:
      • M remoting/host/chromoting_host.cc
      • M remoting/host/chromoting_host.h
      • M remoting/host/chromoting_host_services_server.cc
      • M remoting/host/chromoting_host_services_server.h
      • M remoting/host/chromoting_host_services_server_unittest.cc
      • M remoting/host/client_session.cc
      • M remoting/host/client_session.h
      • M remoting/host/client_session_events.h
      • M remoting/host/daemon_process_linux.cc
      • M remoting/host/daemon_process_win.cc
      • M remoting/host/desktop_session_proxy.cc
      • M remoting/host/desktop_session_proxy.h
      • M remoting/host/host_mock_objects.h
      • M remoting/host/ipc_desktop_environment.cc
      • M remoting/host/ipc_desktop_environment.h
      • M remoting/host/linux/desktop_session_factory_linux.cc
      • M remoting/host/linux/desktop_session_factory_linux.h
      • M remoting/host/linux/passwd_utils.h
      • M remoting/host/mac/agent_process_broker.cc
      • M remoting/host/mac/agent_process_broker.h
      • M remoting/host/mojom/remoting_host.mojom
      • M remoting/host/remoting_me2me_host.cc
      Change size: M
      Delta: 22 files changed, 189 insertions(+), 33 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Fred Shih, +1 by Joe Downing
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8616f2fe2a797d15a6c95559221b943e14301fe0
      Gerrit-Change-Number: 7719387
      Gerrit-PatchSet: 14
      Gerrit-Owner: Yuwei Huang <yuw...@chromium.org>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Fred Shih <ff...@chromium.org>
      Gerrit-Reviewer: Joe Downing <joe...@chromium.org>
      Gerrit-Reviewer: Yuwei Huang <yuw...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages