History log of /src/tests/lib/libc/gen/posix_spawn |
Revision | Date | Author | Comments |
1.4 | 07-Nov-2021 |
martin | Fix linking for multi-source file tests, the second part of the tuple needs to be the C source file (not the base name)
|
1.3 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.2 | 14-Feb-2012 |
martin | branches: 1.2.4; Add a few more posix_spawn testcases, which should detect everything that was wrong in the initial version, causing the failure reported in PR kern/45991.
|
1.1 | 13-Feb-2012 |
martin | Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.2.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.2.4.1 | 14-Feb-2012 |
yamt | file Makefile was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file Makefile.inc was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.2 | 16-Mar-2025 |
riastradh | tests/lib/libc/gen/posix_spawn: Spruce up a bit.
- KNF - Don't touch files outside the test working directory. - No need to pre-clean files -- atf gives us an empty tempdir. - Use h_macros.h to simplify a lot of checks. - Use names for enumerated arguments, not magic numbers. - Check some more syscalls. - Add include guard.
|
1.1 | 07-Nov-2021 |
christos | branches: 1.1.4; new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.1.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.2 | 16-Mar-2025 |
riastradh | tests/lib/libc/gen/posix_spawn: Spruce up a bit.
- KNF - Don't touch files outside the test working directory. - No need to pre-clean files -- atf gives us an empty tempdir. - Use h_macros.h to simplify a lot of checks. - Use names for enumerated arguments, not magic numbers. - Check some more syscalls. - Add include guard.
|
1.1 | 07-Nov-2021 |
christos | branches: 1.1.4; new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.1.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.2 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file h_fileactions.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file h_nonexec.sh was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.3 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.2 | 02-May-2021 |
martin | Add test for POSIX_SPAWN_RESETIDS flag
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file h_spawn.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.3 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.2 | 21-Aug-2021 |
andvar | fix mainly same typos as in my previous commit but outside sys/dev/dm.
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file h_spawnattr.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.11 | 12-Jul-2025 |
gutteridge | t_fileactions.c: fix typos in comments
|
1.10 | 10-Jul-2025 |
martin | In the test code for PR 59523 move the redirect of stdout to the end of the fileactions, to avoid any interference with the assumptions of the test-relevant file actions. We can not guarantee anny of this anyway (but it did trigger the original problem and both paths in the kernel before the bug was fixed). Pointed out by kre.
|
1.9 | 09-Jul-2025 |
martin | Add two test cases triggereing the two paths in posix_spawn that cause PR 59523.
|
1.8 | 16-Mar-2025 |
riastradh | tests/lib/libc/gen/posix_spawn: Spruce up a bit.
- KNF - Don't touch files outside the test working directory. - No need to pre-clean files -- atf gives us an empty tempdir. - Use h_macros.h to simplify a lot of checks. - Use names for enumerated arguments, not magic numbers. - Check some more syscalls. - Add include guard.
|
1.7 | 07-Nov-2021 |
christos | branches: 1.7.4; new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.6 | 10-Jan-2017 |
christos | more tests needing <sys/stat.h>
|
1.5 | 09-Apr-2012 |
martin | branches: 1.5.2; 1.5.16; Fix asynchronous posix_spawn child exit status (and test for it).
|
1.4 | 08-Apr-2012 |
martin | Rework posix_spawn locking and memory management: - always provide a vmspace for the new proc, initially borrowing from proc0 (this part fixes PR 46286) - increase parallelism between parent and child if arguments allow this, avoiding a potential deadlock on exec_lock - add a new flag for userland to request old (lockstepped) behaviour for better error reporting - adapt test cases to the previous two and add a new variant to test the diagnostics flag - fix a few memory (and lock) leaks - provide netbsd32 compat
|
1.3 | 20-Feb-2012 |
martin | Add a test case to call posix_spawn with empty file actions, which reproduced the (now fixed) PR kern/46038.
|
1.2 | 14-Feb-2012 |
martin | branches: 1.2.2; Add a few more posix_spawn testcases, which should detect everything that was wrong in the initial version, causing the failure reported in PR kern/45991.
|
1.1 | 13-Feb-2012 |
martin | Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.2.2.2 | 12-Apr-2012 |
riz | Pull up following revision(s) (requested by martin in ticket #175): sys/kern/kern_exit.c: revision 1.238 tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.4 tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.5 sys/uvm/uvm_extern.h: revision 1.183 lib/libc/gen/posix_spawn_fileactions.c: revision 1.2 sys/kern/kern_exec.c: revision 1.348 sys/kern/kern_exec.c: revision 1.349 sys/compat/netbsd32/syscalls.master: revision 1.95 sys/uvm/uvm_glue.c: revision 1.159 sys/uvm/uvm_map.c: revision 1.317 sys/compat/netbsd32/netbsd32.h: revision 1.95 sys/kern/exec_elf.c: revision 1.38 sys/sys/spawn.h: revision 1.2 sys/sys/exec.h: revision 1.135 sys/compat/netbsd32/netbsd32_execve.c: revision 1.34 Rework posix_spawn locking and memory management: - always provide a vmspace for the new proc, initially borrowing from proc0 (this part fixes PR 46286) - increase parallelism between parent and child if arguments allow this, avoiding a potential deadlock on exec_lock - add a new flag for userland to request old (lockstepped) behaviour for better error reporting - adapt test cases to the previous two and add a new variant to test the diagnostics flag - fix a few memory (and lock) leaks - provide netbsd32 compat Fix asynchronous posix_spawn child exit status (and test for it).
|
1.2.2.1 | 20-Feb-2012 |
sborrill | Pull up the following revisions(s) (requested by martin in ticket #14): include/spawn.h: revision 1.2 sys/kern/kern_exec.c: revision 1.341 sys/uvm/uvm_glue.c: revision 1.157 tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.3
posix_spawn: fix kernel bug when passing empty fileactions (PR kern/46038) and add a test case for this. Fix potential race condition, doublefreeing of memory and memory leaks in error cases.
|
1.5.16.1 | 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.5.2.2 | 17-Apr-2012 |
yamt | sync with head
|
1.5.2.1 | 09-Apr-2012 |
yamt | file t_fileactions.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.7.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.12 | 16-Mar-2025 |
riastradh | tests/lib/libc/gen/posix_spawn: Spruce up a bit.
- KNF - Don't touch files outside the test working directory. - No need to pre-clean files -- atf gives us an empty tempdir. - Use h_macros.h to simplify a lot of checks. - Use names for enumerated arguments, not magic numbers. - Check some more syscalls. - Add include guard.
|
1.11 | 15-Mar-2025 |
riastradh | t_spawn: Add missing dup2 in t_spawn_sig.
Matches what h_execsig expects, and what t_execve_sig arranges: stdin is a pipe that the parent will write a single byte to after it has delivered SIGTERM.
Now this should have a higher chance of provoking the bug (though it was already good enough in cursory testing!).
PR kern/58091: after fork/execve or posix_spawn, parent kill(child, SIGTERM) has race condition making it unreliable
|
1.10 | 13-Mar-2025 |
riastradh | execve(2), posix_spawn(2): Don't flush _all_ pending signals.
We need only flush those pending signals whose dispositions have been reset to the default action when that action is to ignore them -- e.g., if the parent had a signal handler function for SIGCHLD or SIGWINCH, this is reset to the default disposition, which is to ignore the signal, so any pending SIGCHLD or SIGWINCH need to be flushed.
And we have logic to do this already in execsigs(9), via sigclearset(9), which clears the specified set of signals:
402 sigemptyset(&tset); 403 for (signo = 1; signo < NSIG; signo++) { 404 if (sigismember(&p->p_sigctx.ps_sigcatch, signo)) { 405 prop = sigprop[signo]; 406 if (prop & SA_IGNORE) { 407 if ((prop & SA_CONT) == 0) 408 sigaddset(&p->p_sigctx.ps_sigignore, 409 signo); 410 sigaddset(&tset, signo); 411 } 412 SIGACTION_PS(ps, signo).sa_handler = SIG_DFL; ... 420 sigclearall(p, &tset, &kq);
https://nxr.netbsd.org/xref/src/sys/kern/kern_sig.c?r=1.409#394
But back in 2003, when ksiginfo_t was introduced, before that logic was written, we sprouted an exithook to clear _all_ the signals (and, more importantly for the time, free the ksiginfo_t records to avoid leaking memory) -- and we wired it up as an _exechook_ too:
+/* + * free all pending ksiginfo on exit + */ +static void +ksiginfo_exithook(struct proc *p, void *v) +{ + ksiginfo_t *ksi, *hp = p->p_sigctx.ps_siginfo; + + if (hp == NULL) + return; + for (;;) { + pool_put(&ksiginfo_pool, ksi); + if ((ksi = ksi->ksi_next) == hp) + break; + } +} ... + exithook_establish(ksiginfo_exithook, NULL); + exechook_establish(ksiginfo_exithook, NULL);
https://mail-index.netbsd.org/source-changes/2003/09/14/msg133910.html
(The first iteration of ksiginfo_exithook had another bug, of course! But it was soon fixed; that's not the issue here.)
Later, during the newlock2 branch, sigclearall got added for execsigs to free only the ksiginfo_t records for those signals whose disposition is being reset to a default action of ignoring the signal:
void execsigs(struct proc *p) { ... + sigset_t tset; ... - for (signum = 1; signum < NSIG; signum++) { - if (sigismember(&p->p_sigctx.ps_sigcatch, signum)) { - prop = sigprop[signum]; + sigemptyset(&tset); + for (signo = 1; signo < NSIG; signo++) { + if (sigismember(&p->p_sigctx.ps_sigcatch, signo)) { + prop = sigprop[signo]; if (prop & SA_IGNORE) { if ((prop & SA_CONT) == 0) sigaddset(&p->p_sigctx.ps_sigignore, - signum); - sigdelset(&p->p_sigctx.ps_siglist, signum); + signo); + sigaddset(&tset, signo); ... } + sigclearall(p, &tset);
https://mail-index.netbsd.org/source-changes/2006/10/21/msg176390.html
And the _exithook_ was removed somewhere along the way in the newlock2 branch (in favour of simply calling sigclearall in exit1), but the _exechook_ remained:
-static void ksiginfo_exithook(struct proc *, void *); +static void ksiginfo_exechook(struct proc *, void *); ... - exithook_establish(ksiginfo_exithook, NULL); - exechook_establish(ksiginfo_exithook, NULL); + exechook_establish(ksiginfo_exechook, NULL); ... /* - * ksiginfo_exithook: + * ksiginfo_exechook: * - * Free all pending ksiginfo entries from a process on exit. + * Free all pending ksiginfo entries from a process on exec. * Additionally, drain any unused ksiginfo structures in the * system back to the pool. + * + * XXX This should not be a hook, every process has signals. */ static void -ksiginfo_exithook(struct proc *p, void *v) +ksiginfo_exechook(struct proc *p, void *v) {
https://mail-index.netbsd.org/source-changes/2007/02/05/msg180796.html
The symptom of this mistake is that a signal delivered _during_ execve(2) may be simply discarded, even if it should be caught and cause the process to terminate.
On the bright side, isn't it a nice feeling when you can solve problems by commits that consist exclusively of deletions?
PR kern/58091: after fork/execve or posix_spawn, parent kill(child, SIGTERM) has race condition making it unreliable
|
1.9 | 13-Mar-2025 |
riastradh | execve(2), posix_spawn(2): Add test case for an embarrassing bug.
PR kern/58091: after fork/execve or posix_spawn, parent kill(child, SIGTERM) has race condition making it unreliable
|
1.8 | 31-May-2022 |
andvar | branches: 1.8.4; s/disbale/disable/ and s/enbale/enable/ in comments. also one more typo fix.
|
1.7 | 22-Nov-2021 |
christos | undef a couple more.
|
1.6 | 20-Nov-2021 |
christos | Merge common code for the chdir cases (Piyush Sachdeva) I also deduplicated some more code
|
1.5 | 15-Nov-2021 |
christos | Add missing test
|
1.4 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.3 | 03-Sep-2021 |
andvar | s/existant/existent/ in comments and messages, plus few more similar fixes.
|
1.2 | 18-Oct-2014 |
snj | src is too big these days to tolerate superfluous apostrophes. It's "its", people!
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file t_spawn.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.8.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|
1.7 | 16-Mar-2025 |
riastradh | tests/lib/libc/gen/posix_spawn: Spruce up a bit.
- KNF - Don't touch files outside the test working directory. - No need to pre-clean files -- atf gives us an empty tempdir. - Use h_macros.h to simplify a lot of checks. - Use names for enumerated arguments, not magic numbers. - Check some more syscalls. - Add include guard.
|
1.6 | 23-May-2022 |
andvar | branches: 1.6.4; s/controll/control/ in comments.
|
1.5 | 07-Nov-2021 |
christos | new tests for posix_spawn_chdir from Piyush Sachdeva
|
1.4 | 02-May-2021 |
martin | Add test for POSIX_SPAWN_RESETIDS flag
|
1.3 | 21-Dec-2017 |
christos | Fix broken test: we can't assume that the current schedule priority range will overlap with the requested scheduler range, so get the new scheduler range, and then try to find a different priority. If that fails (to find a different scheduling range), give up here.
|
1.2 | 18-Dec-2017 |
christos | Don't use SCHED_OTHER.
|
1.1 | 13-Feb-2012 |
martin | branches: 1.1.4; 1.1.34; Move posix_spawn tests to lib/libc/gen/posix_spawn - they test both libc and kernel, but that is an implementation detail unrelated to the tests themselfs. Ok: releng
|
1.1.34.1 | 25-Jun-2018 |
martin | Additionally pull up following revision(s) (requested by maya in ticket #892):
tests/lib/libc/gen/posix_spawn/t_spawnattr.c: revision 1.2,1.3
Don't use SCHED_OTHER.
Fix broken test: we can't assume that the current schedule priority range will overlap with the requested scheduler range, so get the new scheduler range, and then try to find a different priority. If that fails (to find a different scheduling range), give up here.
|
1.1.4.2 | 17-Apr-2012 |
yamt | sync with head
|
1.1.4.1 | 13-Feb-2012 |
yamt | file t_spawnattr.c was added on branch yamt-pagecache on 2012-04-17 00:09:11 +0000
|
1.6.4.1 | 02-Aug-2025 |
perseant | Sync with HEAD
|