Commit Graph

23 Commits

Author SHA1 Message Date
Adhemerval Zanella b79dc8d0fe posix: Fix tst-spawn.c issue from commit 805334b26c
Checked on powerpc64le-linux-gnu.

	* posix/tst-spawn.c (do_test): Extend spargv to new required size and
	fix typo.
2019-01-05 11:58:47 -02:00
Adhemerval Zanella 805334b26c posix: Clear close-on-exec for posix_spawn adddup2 (BZ#23640)
Austin Group issue #411 [1] proposes that posix_spawn file action
posix_spawn_file_actions_adddup2 resets the close-on-exec when
source and destination refer to same file descriptor.

It solves the issue on multi-thread applications which uses
close-on-exec as default, and want to hand-chose specifically
file descriptor to purposefully inherited into a child process.
Current approach to achieve this scenario is to use two adddup2 file
actions and a temporary file description which do not conflict with
any other, coupled with a close file action to avoid leaking the
temporary file descriptor.  This approach, besides being complex,
may fail with EMFILE/ENFILE file descriptor exaustion.

This can be more easily accomplished with an in-place removal of
FD_CLOEXEC.  Although the resulting adddup2 semantic is slight
different than dup2 (equal file descriptors should be handled as
no-op), the proposed possible solution are either more complex
(fcntl action which a limited set of operations) or results in
unrequired operations (dup3 which also returns EINVAL for same
file descriptor).

Checked on aarch64-linux-gnu.

	[BZ #23640]
	* posix/tst-spawn.c (do_prepare, handle_restart, do_test): Add
	posix_spawn_file_actions_adddup2 test to check O_CLOCEXEC reset.
	* sysdeps/unix/sysv/linux/spawni.c (__spawni_child): Add
	close-on-exec reset for adddup2 file action.
	* sysdeps/posix/spawni.c (__spawni_child): Likewise.

[1] http://austingroupbugs.net/view.php?id=411
2019-01-03 14:38:01 -02:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Adhemerval Zanella c70271662a Use libsupport for tst-spawn.c
No function changes is done.  Checked on x86_64-linux-gnu.

	* posix/tst-spawn.c (do_prepare, handle_restart, do_test):
	Use libsupport.
2018-09-25 10:49:23 -03:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Szabolcs Nagy 5ba41de9ed fix posix/tst-spawn test
The test spawns two children but only waited for one.
The fix avoids printing to stderr.

	* posix/tst-spawn.c (do_test): Wait for both children.
2017-10-12 15:07:34 +01:00
Florian Weimer c22553effb support: Prevent multiple deletion of temporary files
Otherwise, another user might recreate these files after the first
deletion.  Particularly with temporary directories, this could result
in the removal of unintended files through symbol link attacks.
2017-05-08 16:20:40 +02:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Paul Pluzhnikov 850c67606e 2016-06-11 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #19670]
	[BZ #19672]

	* io/test-lfs.c (do_prepare): Use xmalloc.
	* io/tst-fcntl.c (do_prepare): Likewise.
	* libio/tst-fopenloc.c (do_bz17916): Likewise.
	* libio/tst-mmap2-eofsync.c (do_prepare): Likewise.
	* posix/tst-exec.c (do_prepare): Likewise.
	* posix/tst-pathconf.c (prepare): Likewise.
	* posix/tst-spawn.c (do_prepare): Likewise.
	* posix/tst-truncate.c (do_prepare): Likewise.
	* rt/tst-aio.c (do_prepare): Likewise.
2016-06-11 14:50:16 -07:00
Adhemerval Zanella 2a69f853c0 posix: Fix posix_spawn invalid memory access
Current Linux posix_spawn spawn do not test if the pid argument is
valid before trying to update it for success case.  This patch fixes
it.

Tested on x86_64 and i686.

	* sysdeps/unix/sysv/linux/spawni.c (__spawnix): Fix invalid memory
	access where posix_spawn success and pid argument is null.
	* posix/tst-spawn.c (do_test): Add posix_spawn null pid argument for
	success case.
2016-03-20 18:17:52 -03:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Florian Weimer 89e435f355 posix_spawn_file_actions_addopen needs to copy the path argument (BZ 17048)
POSIX requires that we make a copy, so we allocate a new string
and free it in posix_spawn_file_actions_destroy.

Reported by David Reid, Alex Gaynor, and Glyph Lefkowitz.  This bug
may have security implications.
2014-06-11 23:13:42 +02:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
H.J. Lu 4cf8f2098f Support run tst-exec and tst-spawn directly 2013-01-10 14:14:55 -08:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 30aa57851a [BZ #2526, BZ #3138, BZ #3143]
2006-09-12  Jakub Jelinek  <jakub@redhat.com>
	[BZ #2526]
	* README.libm: Fix a thinko in sqrt algorithm description.

	[BZ #3143]
	* manual/string.texi (argz_delete): Fix prototype.
	Patch by <alpt@freaknet.org>.

2006-08-26  Joseph Myers  <joseph@codesourcery.com>

	[BZ #3138]
	* io/test-lfs.c (do_prepare): Give name_len type size_t.
	* io/tst-fcntl.c (do_prepare): Likewise.
	* posix/tst-exec.c (do_prepare): Likewise.
	* posix/tst-preadwrite.c (do_prepare): Likewise.
	* posix/tst-spawn.c (do_prepare): Likewise.
	* posix/tst-truncate.c (do_prepare): Likewise.
	* rt/tst-aio.c (do_prepare): Likewise.
	* rt/tst-aio64.c (do_prepare): Likewise.
	* stdlib/test-canon2.c (do_prepare): Give test_dir_len type
	size_t.
2006-09-12 11:44:01 +00:00
Ulrich Drepper a334319f65 (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4. 2004-12-22 20:10:10 +00:00
Jakub Jelinek 0ecb606cb6 2.5-18.1 2007-07-12 18:26:36 +00:00
Andreas Jaeger 41bdb6e20c Update to LGPL v2.1.
2001-07-06  Paul Eggert  <eggert@twinsun.com>

	* manual/argp.texi: Remove ignored LGPL copyright notice; it's
	not appropriate for documentation anyway.
	* manual/libc-texinfo.sh: "Library General Public License" ->
	"Lesser General Public License".

2001-07-06  Andreas Jaeger  <aj@suse.de>

	* All files under GPL/LGPL version 2: Place under LGPL version
	2.1.
2001-07-06 04:58:11 +00:00
Ulrich Drepper 726b7b0f5c Update.
2000-10-26  Ulrich Drepper  <drepper@redhat.com>

	* posix/Makefile (tests): Add tst-chmod.
	(tst-chmod-ARGS): Define.
	* posix/tst-chmod.c: New file.

	* test-skeleton.c: Before calling user-defined function remove
	parameters from argument list.
	* posix/tst-exec.c: Adjust to this change.
	* posix/tst-spawn.c: Likewise.

	* sysdeps/unix/opendir.c (__opendir): Optimize a bit.  Add
	__builtin_expect.
2000-10-26 08:11:19 +00:00
Ulrich Drepper 08c7f6b008 Update.
2000-05-29  Ulrich Drepper  <drepper@redhat.com>

	* posix/Makefile (tests): Add tst-spawn.
	(tst-spawn-ARGS): New variable.
	* posix/tst-spawn.c: New file.

	* posix/spawn_faction_addclose.c: Correctly account for new entry.
	* posix/spawn_faction_adddup2.c: Likewise.
	* posix/spawn_faction_addopen.c: Likewise.
	* posix/spawni.c: Correctly test for success of dup2 calls.

	* posix/tst-preadwrite.c: Check success of malloc call.
2000-05-29 07:31:53 +00:00