This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17523] open() and openat() ignore 'mode' with O_TMPFILE

--- Comment #10 from cvs-commit at gcc dot <cvs-commit at gcc dot> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.19/master has been updated
       via  9d328da0a82c8cba8dd7f9e537af2dd8ca60ebdf (commit)
      from  66986dec455c2011085a04b72a5bd55d9f9c7d1c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------;h=9d328da0a82c8cba8dd7f9e537af2dd8ca60ebdf

commit 9d328da0a82c8cba8dd7f9e537af2dd8ca60ebdf
Author: Eric Rannaud <>
Date:   Tue Feb 24 13:12:26 2015 +0530

    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.
        * ports/sysdeps/unix/sysv/linux/generic/open.c (__libc_open): Likewise.
        (__open_nocancel): Likewise.
        * ports/sysdeps/unix/sysv/linux/generic/open64.c (__libc_open64):
        * sysdeps/unix/sysv/linux/open64.c (__libc_open64): Likewise.
        * sysdeps/unix/sysv/linux/openat.c (__OPENAT): Likewise.

    (cherry picked from commit 65f6f938cd562a614a68e15d0581a34b177ec29d)


Summary of changes:
 ChangeLog                                      |   25 ++++++++++++++++++++++++
 NEWS                                           |    6 ++--
 io/bits/fcntl2.h                               |   18 ++++++++--------
 io/fcntl.h                                     |   14 +++++++++++-
 io/open.c                                      |    4 +-
 io/open64.c                                    |    4 +-
 io/open64_2.c                                  |    4 +-
 io/open_2.c                                    |    4 +-
 io/openat.c                                    |    4 +-
 io/openat64.c                                  |    4 +-
 io/openat64_2.c                                |    4 +-
 io/openat_2.c                                  |    4 +-
 ports/sysdeps/unix/sysv/linux/generic/open.c   |    6 ++--
 ports/sysdeps/unix/sysv/linux/generic/open64.c |    4 +-
 sysdeps/mach/hurd/open.c                       |    4 +-
 sysdeps/mach/hurd/openat.c                     |    4 +-
 sysdeps/posix/open64.c                         |    4 +-
 sysdeps/unix/sysv/linux/dl-openat64.c          |    2 +-
 sysdeps/unix/sysv/linux/open64.c               |    4 +-
 sysdeps/unix/sysv/linux/openat.c               |    6 ++--
 20 files changed, 82 insertions(+), 47 deletions(-)

You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]