Skip to content

Conversation

@Karlson2k
Copy link
Contributor

Number of fixes around using PID of forked or parent process.

A subset of commits from #1292, as requested here.

@Karlson2k
Copy link
Contributor Author

@alejandro-colomar Modified and added in separate PR as requested.

@alejandro-colomar
Copy link
Collaborator

Please use one space after period in the commit message. That would help readability of it.

@Karlson2k Karlson2k changed the title Fixes and improvements related to use of forked PID Fixes related to use of forked PID Jul 18, 2025
@Karlson2k
Copy link
Contributor Author

Please use one space after period in the commit message. That would help readability of it.

16 hours ago you asked to correct commit messages to use two spaces after period.
From this comment:

Please use two spaces after period in commit messages. One space is wrong.

See https://web.archive.org/web/20171217060354/http://www.heracliteanriver.com/?p=324.

Please choose one of the two.

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
@alejandro-colomar
Copy link
Collaborator

alejandro-colomar commented Jul 18, 2025

Please use one space after period in the commit message. That would help readability of it.

16 hours ago you asked to correct commit messages to use two spaces after period. From this comment:

Please use two spaces after period in commit messages. One space is wrong.
See https://web.archive.org/web/20171217060354/http://www.heracliteanriver.com/?p=324.

Oops, I meant to write here "two" too. My brain was probably thinking of "don't use one" and ended up writing something with a one. :)

Please choose one of the two.

Please use two spaces after period.

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
The correct utmp update functionality was broken mainly by commit
91fc513, which moved update of utmp
after forking (when PAM is used).  It was also misinterpretation of
GNU/Linux utmp specifications, where is specified that ut_pid must be
the PID of the **login** process (not a PID of any forked process).
Wrong ut_pid also prevents utmp cleanup, which performed by init process
and should clean entry with the same ut_pid as started login process.
GNU/Linux description of utmp updates can be found at the next url:
https://man7.org/linux/man-pages/man5/utmp.5.html

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
When PAM is not used, login does not fork itself so its own PID should
be checked instead of parent PID.

Fixes: b44a6c3 (26-12-2007; "If started as init, login and sulogin need to start a new session.")
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
@Karlson2k
Copy link
Contributor Author

Updated as requested (except this comment).

Copy link
Collaborator

@alejandro-colomar alejandro-colomar left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

Reviewed-by: Alejandro Colomar <alx@kernel.org>

I'll merge now, but CC: @hallyn in case he has any comments.

@alejandro-colomar alejandro-colomar merged commit 90042ad into shadow-maint:master Jul 18, 2025
10 checks passed
@Karlson2k Karlson2k deleted the fork-fix-partial branch July 19, 2025 09:26
@Karlson2k Karlson2k restored the fork-fix-partial branch July 19, 2025 09:26
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.

2 participants