Re: [PATCH] ext4: fix a bug when we try to open a file with O_TMPFILE flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 23, 2013 at 01:39:39PM +0000, jon ernst wrote:
> > Ah, actually I used the following program to hit the bug.  Just for your
> > information.  Please let me know if you have any question.
> >
> > Regards,
> >                                                 - Zheng
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> >
> > #include <unistd.h>
> > #include <sys/types.h>
> > #include <fcntl.h>
> >
> > #define __O_TMPFILE     020000000
> > #define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
> >
> > int main(int argc, char *argv[])
> > {
> >         int fd;
> >
> >         fd = open(argv[1], O_RDWR|O_TMPFILE);
> >         if (fd < 0) {
> >                 perror("open ");
> >                 return -1;
> >         }
> >         close(fd);
> >         return 0;
> > }
> 
> Thank you Zheng!  Pardon if this is a dumb question: why do we need to
> manually define "O_TMPFILE"? Not like "O_APPEND" etc. ?

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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux