Page MenuHomeFreeBSD

proc: Add new process hold facility.
Needs ReviewPublic

Authored by dchagin on Apr 26 2022, 4:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 11, 4:25 PM
Unknown Object (File)
Sat, Mar 9, 3:40 PM
Unknown Object (File)
Thu, Mar 7, 3:45 PM
Unknown Object (File)
Tue, Mar 5, 3:36 PM
Unknown Object (File)
Tue, Mar 5, 2:38 PM
Unknown Object (File)
Tue, Mar 5, 3:00 AM
Unknown Object (File)
Jan 11 2024, 10:24 AM
Unknown Object (File)
Dec 15 2023, 4:37 AM
Subscribers

Details

Reviewers
kib
Summary

Linux kernel allows access to some of /proc/<pid>/* entries where the
process <pid> is in the zombie state. To follow Linux behavior add
a new p_lockreap counter which is intended to hold process vmspace
from release in proc_reap(). Use new facility in pseudofs code to hold
process when needed if node has PFS_ZOMBIE flag set.

We discussed this a while ago, I did.
However, the kern.wait_dequeue_sigchld knob does not allow to get CLD_KILLED.
I see it's not easy to do. If you point me to the right direction, I'll try.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45384
Build 42272: arc lint + arc unit

Event Timeline

dchagin added a reviewer: kib.
dchagin changed the repository for this revision from rS FreeBSD src repository - subversion to rG FreeBSD src repository.
dchagin edited the summary of this revision. (Show Details)

I do not quite understand this. Am I right that the intent is to see zombies under linprocfs? If yes, what exact entries from the pid directory should be exposed?

In D35068#794803, @kib wrote:

I do not quite understand this. Am I right that the intent is to see zombies under linprocfs? If yes, what exact entries from the pid directory should be exposed?

yes, you are right.
linprocfs_doprocstatus, PFS_ZOMBIE flag of pfs_create_xxx()

In D35068#794803, @kib wrote:

I do not quite understand this. Am I right that the intent is to see zombies under linprocfs? If yes, what exact entries from the pid directory should be exposed?

yes, you are right.
linprocfs_doprocstatus, PFS_ZOMBIE flag of pfs_create_xxx()

You did not answered the second part of the question, what is the entries from the pid directory, that you want to expose for zombies?

[I do not think this patch can work at all]

In D35068#794805, @kib wrote:
In D35068#794803, @kib wrote:

I do not quite understand this. Am I right that the intent is to see zombies under linprocfs? If yes, what exact entries from the pid directory should be exposed?

yes, you are right.
linprocfs_doprocstatus, PFS_ZOMBIE flag of pfs_create_xxx()

You did not answered the second part of the question, what is the entries from the pid directory, that you want to expose for zombies?

[I do not think this patch can work at all]

Sorry, if I understood your question correctly, for zombies - nothing. I expose <pid>/status to others who can see that pid, usually their parent.

Glibc modified their tests suite, was added support library which is uses <pid>/status entry to check process status. Yet another Linux-ism.
I do not think that this technic will be used in a real applications (but who knows?) but this annoe me as I should check every failed test when new glibc version released.
Anyway, with that change some tests fails, as CLD_KILLED can't be 'queued'.

Ha, on x86-64 glibc-2.35 tests fails only in 83 cases (4920 passed), while some years ago was failed more than 1000 tests.
Arm64 need more attention, mostly due to signals delivery. Machine dependent futexes part is done, but uncommited while sigtramp is not ready.

sys/kern/kern_exit.c
980

Ok, so this 'lockreap' does not have anything to do with vmspace at all, it is just a hold on reuse of the struct proc/p_pid while linprocfs might expose the pid?

If I am right, shouldn't this check/wait appear at the start of the function, while all linkage is still valid?

sys/sys/proc.h
678

Why uint32 and not just uint?

dchagin edited the summary of this revision. (Show Details)

yes, you are right. fixed both comments