lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGW2f1H-ED40251bxNGUtwUEfBe9kP9McUh-cH5=BnuxJG_iUw@mail.gmail.com>
Date:	Thu, 25 Jul 2013 01:17:11 +0000
From:	jon ernst <jonernst07@...il.com>
To:	jon ernst <jonernst07@...il.com>, linux-ext4@...r.kernel.org,
	Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] vfs: add missing check for __O_TMPFILE in fcntl_init()
 (Re: [PATCH] ext4: fix...)

On Thu, Jul 25, 2013 at 12:13 AM, Zheng Liu <gnehzuil.liu@...il.com> wrote:
> On Wed, Jul 24, 2013 at 09:58:45PM +0000, jon ernst wrote:
>> > My purpose is to trigger this bug and fix it.  So I manually define this
>> > flag for my convenience.
>> >
>> >> I saw it has
>> >> been defined in header file. (fcntl.h) Did I miss anything?
>> >
>> > I guess that you might 'include <fcntl.h>' header file, right?  But the
>> > O_TMPFILE is defined in $LINUX/include/uapi/asm-generic/fcntl.h.  So
>> > maybe compiler couldn't find this header file.
>> >
>> > Regards,
>> >                                                 - Zheng
>> --
>> Got it. Thank you.  BTW, the weird thing is I didn't see any
>> discussion on ext4 mailing list before Al Viro committed this change.
>> The first time I heard about this is someone reporting a bug about it.
>> Document about this FLAG might be necessary.
>
> Oh, this flag has been discussed in linux-fsdevel mailing list [1].
> Maybe you don't subscribe it.
>
> 1. https://lkml.org/lkml/2013/7/3/181
>
>> Also, about this code:
>>
>> /* a horrid kludge trying to make sure that this will fail on old kernels */
>> #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
>>
>> why not doing something like this:
>>
>> #ifndef O_TMPFILE
>> /* a horrid kludge trying to make sure that this will fail on old kernels */
>> #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
>> #endif
>
> Sorry, I don't take a closer look at that thread.  I look at the code,
> and it seems that there is no any rule about adding '#ifndef XXX'.
> Meanwhile, I notice a comment:
>
> /*
>  * When introducing new O_* bits, please check its uniqueness in fcntl_init().
>  */
>
> But we are missing adding O_TMPFILE flag in fcntl_init().  So I attach a
> patch below.
>

Great. I think this is the reason O_TMPFILE is unrecognizable in user
space. As the problem I reported 2 days ago in the thread that you
fixed another bug.

> Al, could you please answer this question?  Thanks.
>
> Regards,
>                                                 - Zheng
>
> Subject: [PATCH] vfs: add missing check for __O_TMPFILE in fcntl_init()
>
> From: Zheng Liu <wenqing.lz@...bao.com>
>
> As comment in include/uapi/asm-generic/fcntl.h described, when
> introducing new O_* bits, we need to check its uniqueness in
> fcntl_init().  But __O_TMPFILE bit is missing.  So fix it.
>
> Signed-off-by: Zheng Liu <wenqing.lz@...bao.com>
> ---
> *This patch is against ext4/dev tree.*
>
>  fs/fcntl.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fcntl.c b/fs/fcntl.c
> index 6599222..65343c3 100644
> --- a/fs/fcntl.c
> +++ b/fs/fcntl.c
> @@ -730,14 +730,14 @@ static int __init fcntl_init(void)
>          * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
>          * is defined as O_NONBLOCK on some platforms and not on others.
>          */
> -       BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
> +       BUILD_BUG_ON(20 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
>                 O_RDONLY        | O_WRONLY      | O_RDWR        |
>                 O_CREAT         | O_EXCL        | O_NOCTTY      |
>                 O_TRUNC         | O_APPEND      | /* O_NONBLOCK | */
>                 __O_SYNC        | O_DSYNC       | FASYNC        |
>                 O_DIRECT        | O_LARGEFILE   | O_DIRECTORY   |
>                 O_NOFOLLOW      | O_NOATIME     | O_CLOEXEC     |
> -               __FMODE_EXEC    | O_PATH
> +               __FMODE_EXEC    | O_PATH        | __O_TMPFILE
>                 ));
>
>         fasync_cache = kmem_cache_create("fasync_cache",
> --
> 1.7.9.7
>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ