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

Re: Kernel Oops when issuing fcntl on an AUFS directory



On Tue, 2016-08-30 at 22:33 +0200, Marcin Szewczyk wrote:
> Hi,
> 
> the wheezy kernel upgrade from 3.2.78-1 to 3.2.81-1 added the SETFL
> fcntl support code (#627782) which unfortunately results in a kernel
> Oops when the fcntl is called on a directory. This breaks e.g. copying
> files from an AUFS filesystem on a remote machine using scp.
> 
> Minimal code to reproduce the problem:
> #v+
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> 
> int main (int argc, char **argv) {
>         const char *fname = NULL;
>         int fd;
>         if (argc != 2)
>                 exit (1);
>         fname = argv[1];
>         fd = open (fname, O_RDONLY|O_NONBLOCK);
>         printf ("fd %d\n", fd);
>         fcntl (fd, F_SETFL, O_RDONLY);
>         return 0;
> }
> #v-
> 
> Call the program on regular a file (nothing happens) and then on a
> directory (Oops).
>
> The Oops happens in fs/fcntl.c:
> #v+
> if (!error && filp->f_op->owner &&
>     !strcmp(filp->f_op->owner->name, "aufs") &&
>     strstr(filp->f_op->owner->version, "+setfl"))
>         error = filp->f_op->setfl(filp, arg);
> #v-
> 
> > 
> > From fs/aufs/inode.c:
> #v+
> case S_IFREG:
>         [...]
> 	inode->i_fop = &aufs_file_fop;
>         [...]
> case S_IFDIR:
>         [...]
> 	inode->i_fop = &aufs_dir_fop;
> #v-
> 
> The aufs_file_fop structure sets the value of the .setfl member to
> aufs_setfl (f_op.c). aufs_dir_fop (dir.c) on the other hand does not.

Thanks for finding this; I'll fix it.

[...]
> BTW, changelog link on the package's page[1] is dead.
[...]

This is unfortunately true for all packages updated in wheezy-security
since the last point release.  (And generally true for security
updates, but then only until they get copied into the main archive.)

Ben.

-- 
Ben Hutchings
Anthony's Law of Force: Don't force it, get a larger hammer.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: