Summary: | syslog(3) prints parent's pid after fork() | ||||||
---|---|---|---|---|---|---|---|
Product: | Base System | Reporter: | Felix J. Ogris <fjo> | ||||
Component: | bin | Assignee: | Eugene Grosbein <eugen> | ||||
Status: | Closed FIXED | ||||||
Severity: | Affects Many People | CC: | eugen | ||||
Priority: | --- | ||||||
Version: | 12.4-RELEASE | ||||||
Hardware: | Any | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Felix J. Ogris
2022-12-31 10:16:09 UTC
Created attachment 239223 [details]
proposed fix
Please test attached patch. You need to rebuild and reinstall libc only. Full buildworld not required. fetch -o /tmp/syslog.c.diff https://bz-attachments.freebsd.org/attachment.cgi?id=239223 cd /usr/src/lib/libc make obj depend && make all install Running processes need restart to use fix. (In reply to Eugene Grosbein from comment #2) Apply the patch after fetching it: cd /usr/src patch < /tmp/syslog.c.diff Thanks, your patch resolved this: root@fbsd124:~ # freebsd-version -kru 12.4-RELEASE 12.4-RELEASE 12.4-RELEASE root@fbsd124:~ # ./t test 18410 - - before fork: 18410 test 18410 - - after fork: 18410 test 18411 - - after fork: 18411 root@fbsd124:~ # Had to build lib/libnetbsd before lib/libc, btw. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2ce3ef55035093cac7839e71e9ff91f5562ebc29 commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29 Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2023-01-03 08:53:47 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2023-01-03 08:58:36 +0000 syslog: fix PID of forking process Do not cache PID for a process that does not fabricate it, calls openlog() before forking and does not call exec() thereafter. PR: 268666 Fixes: e9ae9fa93745669b7dd0341d333257ad6cfe8e37 Tested by: kp MFC after: 3 days lib/libc/gen/syslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=77c0992af4e3b013915ae84ef3d831f470ea5dd5 commit 77c0992af4e3b013915ae84ef3d831f470ea5dd5 Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2023-01-03 08:53:47 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2023-01-06 04:40:42 +0000 syslog: fix PID of forking process Do not cache PID for a process that does not fabricate it, calls openlog() before forking and does not call exec() thereafter. PR: 268666 Fixes: e9ae9fa93745669b7dd0341d333257ad6cfe8e37 Tested by: kp (cherry picked from commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29) lib/libc/gen/syslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) A commit in branch stable/12 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f commit 14814ff45bb4f8e9accd0b45cc1f3bcf4fd9d32f Author: Eugene Grosbein <eugen@FreeBSD.org> AuthorDate: 2023-01-03 08:53:47 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2023-01-06 04:46:33 +0000 syslog: fix PID of forking process Do not cache PID for a process that does not fabricate it, calls openlog() before forking and does not call exec() thereafter. PR: 268666 Fixes: e9ae9fa93745669b7dd0341d333257ad6cfe8e37 Tested by: kp (cherry picked from commit 2ce3ef55035093cac7839e71e9ff91f5562ebc29) lib/libc/gen/syslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Thank you very much for the report. The issue is fixed in head and stable branches. |