Commit Graph

19 Commits

Author SHA1 Message Date
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
Florian Weimer fd70af4552 Add the statx function 2018-07-10 16:14:45 +02: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
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Eric Rannaud 65f6f938cd linux: open and openat ignore 'mode' with O_TMPFILE in flags
Both open and openat load their last argument 'mode' lazily, using
va_arg() only if O_CREAT is found in oflag. This is wrong, mode is also
necessary if O_TMPFILE is in oflag.

By chance on x86_64, the problem wasn't evident when using O_TMPFILE
with open, as the 3rd argument of open, even when not loaded with
va_arg, is left untouched in RDX, where the syscall expects it.

However, openat was not so lucky, and O_TMPFILE couldn't be used: mode
is the 4th argument, in RCX, but the syscall expects its 4th argument in
a different register than the glibc wrapper, in R10.

Introduce a macro __OPEN_NEEDS_MODE (oflag) to test if either O_CREAT or
O_TMPFILE is set in oflag.

Tested on Linux x86_64.

	[BZ #17523]
	* io/fcntl.h (__OPEN_NEEDS_MODE): New macro.
	* io/bits/fcntl2.h (open): Use it.
	(openat): Likewise.
	* io/open.c (__libc_open): Likewise.
	* io/open64.c (__libc_open64): Likewise.
	* io/open64_2.c (__open64_2): Likewise.
	* io/open_2.c (__open_2): Likewise.
	* io/openat.c (__openat): Likewise.
	* io/openat64.c (__openat64): Likewise.
	* io/openat64_2.c (__openat64_2): Likewise.
	* io/openat_2.c (__openat_2): Likewise.
	* sysdeps/mach/hurd/open.c (__libc_open): Likewise.
	* sysdeps/mach/hurd/openat.c (__openat): Likewise.
	* sysdeps/posix/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
	* sysdeps/unix/sysv/linux/generic/open.c (__libc_open): Likewise.
	(__open_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/generic/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__OPENAT): Likewise.
2015-02-24 13:19:22 +05:30
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Marek Polacek 5ac3ea17df Fix attributes for fortify functions. 2012-04-29 15:34:20 +02:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper e5f484c622 bits/poll2.h needs __BEGIN/__END_DECLS 2012-01-08 21:57:15 -05:00
Ulrich Drepper d9a216c037 Add checking versions of poll and ppoll 2012-01-08 11:55:32 -05:00
Ulrich Drepper a784e50247 Remove pre-ISO C support
No more __const.
2012-01-07 23:57:22 -05:00
Ulrich Drepper 3a50811c2f * rt/Versions (librt): Export __mq_open_2@@GLIBC_2.7.
* rt/Makefile (headers): Add bits/mqueue2.h.
	* rt/mqueue.h: Include bits/mqueue2.h if -D_FORTIFY_SOURCE=2,
	optimizing with GCC and __va_arg_pack_len is defined.
	* rt/bits/mqueue2.h: New file.
	* rt/mq_open.c (__mq_open): Renamed from mq_open.
	(mq_open): New strong_alias.
	(__mq_open_2): New function.
	* sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Renamed from mq_open.
	(mq_open): New strong_alias.
	(__mq_open_2): New function.
	* debug/Versions (libc): Export __fortify_fail@@GLIBC_PRIVATE.
	* Versions.def (librt): Add GLIBC_2.7 version.
	* debug/fortify_fail.c (__fortify_fail): Add libc_hidden_def.
	* include/stdio.h (__fortify_fail): Add libc_hidden_proto.

	* misc/sys/cdefs.h (__errordecl, __va_arg_pack_len): Define.
	* io/fcntl.h: Include bits/fcntl2.h when __va_arg_pack_len
	is defined rather than when not C++.
	* io/bits/fcntl2.h (__open_alias, __open64_alias, __openat_alias,
	__openat64_alias): New redirects.
	(__open_too_many_args, __open_missing_mode, __open64_too_many_args,
	__open64_missing_mode, __openat_too_many_args, __openat_missing_mode,
	__openat64_too_many_args, __openat64_missing_mode): New __errordecls.
	(open, open64, openat, openat64): Rewrite as __extern_always_inline
	functions instead of function-like macros.
2007-09-15 22:35:27 +00:00
Jakub Jelinek 9accc268ff * io/bits/fcntl2.h (open, open64, openat, openat64): Add
__extension__ around the whole statement expression.
2007-08-04  Jakub Jelinek  <jakub@redhat.com>

	* io/bits/fcntl2.h (open, open64, openat, openat64): Add
	__extension__ around the whole statement expression.
2007-08-04 20:09:21 +00:00
Ulrich Drepper 47ad95ab96 * io/bits/fcntl2.h (__open_2): Add nonnull attribute.
(open): Fix comment typos.  Don't call __open_2 if flags
	is a compile time constant without O_CREAT.
	(__open64_2): Add nonnull attribute.
	(open64): Fix comment typos.  Don't call __open64_2 if flags
	is a compile time constant without O_CREAT.
	(__openat_2): Add nonnull attribute, fix nonnull attribute
	on redirect.
	(openat): Fix comment typos.  Don't call __openat_2 if flags
	is a compile time constant without O_CREAT.
	(__openat64_2): Add nonnull attribute, fix nonnull attribute
	on redirect.
	(openat64): Fix comment typos.  Don't call __openat64_2 if flags
	is a compile time constant without O_CREAT.
2007-05-25 14:41:55 +00:00
Ulrich Drepper 0a54ab53f2 * sysdeps/powerpc/tls.h (tcbhead_t): Add gscope_flag.
(THREAD_GSCOPE_FLAG_UNUSED, THREAD_GSCOPE_FLAG_USED,
	THREAD_GSCOPE_FLAG_WAIT): Define.
	(THREAD_GSCOPE_GET_FLAG, THREAD_GSCOPE_SET_FLAG,
	THREAD_GSCOPE_RESET_FLAG, THREAD_GSCOPE_WAIT): Define.
	* sysdeps/i386/tls.h (THREAD_GSCOPE_WAIT): Don't use
	PTR_DEMANGLE.
	(THREAD_GSCOPE_GET_FLAG): Define.
	* sysdeps/x86_64/tls.h (THREAD_GSCOPE_GET_FLAG): Define.
	* allocatestack.c (__wait_lookup_done): Use THREAD_GSCOPE_GET_FLAG
	instead of ->header.gscope_flag directly.
2007-05-25 05:21:07 +00:00
Ulrich Drepper ddfd053577 * Makerules (sysd-rules): Define PTW for ptw-* files.
* Versions: Define GLIBC_2.7 for libc.
	* include/stdio.h: Declare __fortify_fail.
	* debug/fortify_fail.c: New file.
	* debug/Makefile (routines): Add fortify_fail.
	* debug/chk_fail.c: Use __fortify_fail.
	* debug/stack_chk_fail.c: Likewise.
	* io/Versions: Export __open_2, __open64_2, __openat_2, and
	__openat64_2 for GLIBC_2.7.
	* io/fcntl.h: When compiling with fortification, include bits/fcntl2.h.
	* io/open.c: Define *_2 variant of function which checks for O_CREAT
	and fails if necessary.
	* io/open64.c: Likewise.
	* io/openat.c: Likewise.
	* io/openat64.c: Likewise.
	* sysdeps/unix/sysv/linux/open64.c: Likewise.
	* sysdeps/unix/sysv/linux/openat.c: Likewise.
	* sysdeps/unix/sysv/linux/openat64.c: Likewise.
	* io/bits/fcntl2.h: New file.
	* include/fcntl.h: Declare __open_2, __open64_2, __openat_2, and
	__openat64_2.
	* include/bits/fcntl2.h: New file.
	* sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines):
	Add open_2.
	* sysdeps/unix/sysv/linux/open_2.c: New file.
2007-05-24 23:55:28 +00:00