serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LoginServer: Track user sockets by sid instead of uid

Open petelliott opened this issue 1 year ago • 1 comments

This PR moves user sockets to per login session instead of per user id. This has two important advantages:

  1. Commands run as root with pls(1) will use the correct servers
  2. There can be multiple concurrent logged in sessions with the same user each running their own services.

Currently there is one major issue with this PR and that is that clients need to unveil /proc/all and /etc/passwd and pledge proc. I can think of a few solutions to this:

  1. Remove or make optional the process.username field in ProcessStatisticsReader to get rid of the required /etc/passwd unveil, which is the biggest security issue.
  2. Add a getrootsid(2) to implement Core::session::root_session_id() in the kernel. this would prevent any reads and be very simple to implement.

petelliott avatar Sep 06 '22 06:09 petelliott

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

BuggieBot avatar Sep 06 '22 06:09 BuggieBot