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.
This is required to remove temporary directories which contain
temporary files. Previously, FIFO order meant that directory
removal was attempted when the directory still contained files,
which meant that temporary directory cleanup was essentially
unsupported.
sys/socket.h includes sys/uio.h to get the definition of the iovec
structure.
POSIX allows sys/socket.h to make all sys/uio.h symbols visible.
However, all of sys/uio.h is XSI-shaded, so for non-XSI POSIX this
results in conformtest failures (for sys/socket.h and other headers
that include it):
Namespace violation: "UIO_MAXIOV"
Namespace violation: "readv"
Namespace violation: "writev"
Now, there is some ambiguity in POSIX about what namespace
reservations apply in this case - see
http://austingroupbugs.net/view.php?id=1127 - but glibc convention
would still avoid declaring readv and writev, for example, for feature
test macros that don't include them (if only headers from the relevant
standard are included), even if such declarations are permitted, so
there is a bug here according to glibc conventions.
This patch moves the struct iovec definition to a new
bits/types/struct_iovec.h header and includes that from sys/socket.h
instead of including the whole of sys/uio.h. This fixes the namespace
issue; however, three files in glibc that were relying on the implicit
inclusion needed to be updated to include sys/uio.h explicitly. So
there is a question of whether sys/socket.h should continue to include
sys/uio.h under some conditions, such as __USE_XOPEN or __USE_MISC or
__USE_XOPEN || __USE_MISC, for greater compatibility with code that
(wrongly) expects this optional inclusion to be present there. (I
think the three affected files in glibc should still have explicit
sys/uio.h inclusions added in any case, however.)
Tested for x86_64.
[BZ #21426]
* misc/bits/types/struct_iovec.h: New file.
* misc/Makefile (headers): Add bits/types/struct_iovec.h.
* include/bits/types/struct_iovec.h: New file.
* bits/uio.h (struct iovec): Replace by inclusion of
<bits/types/struct_iovec.h>.
* sysdeps/unix/sysv/linux/bits/uio.h (struct iovec): Likewise.
* socket/sys/socket.h: Include <bits/types/struct_iovec.h> instead
of <sys/uio.h>.
* nptl/tst-cancel4.c: Include <sys/uio.h>
* posix/test-errno.c: Likewise.
* support/resolv_test.c: Likewise.
* conform/Makefile (test-xfail-POSIX2008/arpa/inet.h/conform):
Remove.
(test-xfail-POSIX2008/netdb.h/conform): Likewise.
(test-xfail-POSIX2008/netinet/in.h/conform): Likewise.
(test-xfail-POSIX2008/sys/socket.h/conform): Likewise.
Simplify the Linux accept4 implementation based on the assumption
that it is available in some way. __ASSUME_ACCEPT4_SOCKETCALL was
previously unused, so remove it.
For ia64, the accept4 system call (and socket call) were backported
in kernel version 3.2.18. Reflect this in the installation
instructions.
* stdio-common/bug25.c: Include stdlib.h.
* support/tst-support_format_dns_packet.c: Include stdio.h,
stdlib.h, and string.h.
* support/tst-support_record_failure.c: Include string.h.
* support/tst-support_record_failure-2.sh: Adjust line number
expectations and correct a typo in an error message.
Before this change, the loop iterating over RRs in the answer
section stopped at the first CNAME record, never printing them.
The CNAME and PTR record contents was extracted from the wrong
buffer (whole packet instead RDATA). This desynced the parsing
after the first CNAME or PTR record.
Also fix the AAAA record parsing by checking their sizes.
The commit documents the ownership rules around 'struct pthread' and
when a thread can read or write to the descriptor. With those ownership
rules in place it becomes obvious that pd->stopped_start should not be
touched in several of the paths during thread startup, particularly so
for detached threads. In the case of detached threads, between the time
the thread is created by the OS kernel and the creating thread checks
pd->stopped_start, the detached thread might have already exited and the
memory for pd unmapped. As a regression test we add a simple test which
exercises this exact case by quickly creating detached threads with
large enough stacks to ensure the thread stack cache is bypassed and the
stacks are unmapped. Before the fix the testcase segfaults, after the
fix it works correctly and completes without issue.
For a detailed discussion see:
https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html
This causes more test programs to link in the support_record_failure
function, which triggers an early call to mmap from an ELF
constructor, but this should not have side effects intefering
with the functionality actually under test (unlike, say, a call
to malloc).
The support/tst-support_record_failure-2.out test attempts to run
built code even if run-built-tests = no, so failing with
build-many-glibcs.py for all architectures whose code cannot be run on
the system running the script. This patch disables the test in that
case.
Tested for x86_64 (native), and for aarch64 with build-many-glibcs.py.
* support/Makefile (tests-special): Make definition conditional on
[$(run-built-tests) = yes].
($(objpfx)tst-support_record_failure-2.out): Make rule conditional
on [$(run-built-tests) = yes].
This patch adds a simple SYSV message queue test to check for correct
argument passing on kernel. The idea is neither to be an extensive
testing nor to check for any specific Linux test.
* sysvipc/Makefile (tests): Add test-sysvmsg.
* sysvipc/test-sysvmsg.c: New file.
* test-skeleton.c (FAIL_UNSUPPORTED): New define.
The new functions support_record_failure records a test failure,
but does not terminate the process. The macros TEST_VERIFY
and TEST_VERIFY_EXIT check that a condition is true.
The new test driver in <support/test-driver.c> has feature parity with
the old one. The main difference is that its hooking mechanism is
based on functions and function pointers instead of macros. This
commit also implements a new environment variable, TEST_COREDUMPS,
which disables the code which disables coredumps (that is, it enables
them if the invocation environment has not disabled them).
<test-skeleton.c> defines wrapper functions so that it is possible to
use existing macros with the new-style hook functionality.
This commit changes only a few test cases to the new test driver, to
make sure that it works as expected.