All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories
@ 2011-08-04  1:51 bugzilla-daemon
  2011-08-04  6:31 ` [Bug 40512] " bugzilla-daemon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugzilla-daemon @ 2011-08-04  1:51 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=40512

           Summary: EXT4_IOC_MIGRATE is dangerous on directories
           Product: File System
           Version: 2.5
    Kernel Version: 2.6.39
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: high
          Priority: P1
         Component: ext4
        AssignedTo: fs_ext4@kernel-bugs.osdl.org
        ReportedBy: benjamin@python.org
        Regression: No


Using EXT4_IOC_MIGRATE on a non-extent directory seems to have terrible
consequences. Consider the following example. "dir" is a old directory without
extents.

$ ls -la dir/
total 12
drwxr-xr-x  2 benjamin benjamin 4096 Aug  3 20:42 .
drwxr-xr-x 47 benjamin benjamin 4096 Aug  3 20:42 ..
-rw-r-----  1 benjamin benjamin    7 Aug  3 20:42 something.txt
$ cat migrate.c
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

int
main(int argc, char **argv)
{
    const char *fn = argv[1];
    int fd, ret;

    fd = open(fn, O_RDONLY);
    /* This invokes EXT4_IOC_MIGRATE. */
    ret = ioctl(fd, 0x6609);
    close(fd);
    if (ret < 0) {
        fprintf(stderr, "ioctl failed\n");
        return 1;
    }
    printf("Migration successful?\n");
    return 0;
}
$ gcc -o migrate migrate.c
$ ./migrate dir
Migration successful?
$ ls -la dir
total 0 # !!!!!!!!!!!!!!

Also, we why are you allowed to migrate stuff with only O_RDONLY access?

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 40512] EXT4_IOC_MIGRATE is dangerous on directories
  2011-08-04  1:51 [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories bugzilla-daemon
@ 2011-08-04  6:31 ` bugzilla-daemon
  2011-08-04 13:26 ` bugzilla-daemon
  2012-01-17 14:10 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2011-08-04  6:31 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=40512


Tao Ma <tm@tao.ma> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tm@tao.ma




--- Comment #1 from Tao Ma <tm@tao.ma>  2011-08-04 06:31:42 ---
Tested with 3.0, and it works here. git log shows that a possible fix should be
74e4e6db3 which is included in 3.0.

One thing you could confirm is to run:
debugfs 'stat dir' /dev/sdx
to see whether the EXTENTS flags is set or not. If it isn't set, it should be
the root cause.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 40512] EXT4_IOC_MIGRATE is dangerous on directories
  2011-08-04  1:51 [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories bugzilla-daemon
  2011-08-04  6:31 ` [Bug 40512] " bugzilla-daemon
@ 2011-08-04 13:26 ` bugzilla-daemon
  2012-01-17 14:10 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2011-08-04 13:26 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=40512





--- Comment #2 from Benjamin Peterson <benjamin@python.org>  2011-08-04 13:26:33 ---
When I ran e2fsck on the partition, it reported EXTENTS_FL was not set.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 40512] EXT4_IOC_MIGRATE is dangerous on directories
  2011-08-04  1:51 [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories bugzilla-daemon
  2011-08-04  6:31 ` [Bug 40512] " bugzilla-daemon
  2011-08-04 13:26 ` bugzilla-daemon
@ 2012-01-17 14:10 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2012-01-17 14:10 UTC (permalink / raw)
  To: linux-ext4

https://bugzilla.kernel.org/show_bug.cgi?id=40512


Benjamin Peterson <benjamin@python.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |CODE_FIX




--- Comment #3 from Benjamin Peterson <benjamin@python.org>  2012-01-17 14:10:10 ---
Indeed, it is now fixed. Thanks.

-- 
Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-17 14:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04  1:51 [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories bugzilla-daemon
2011-08-04  6:31 ` [Bug 40512] " bugzilla-daemon
2011-08-04 13:26 ` bugzilla-daemon
2012-01-17 14:10 ` bugzilla-daemon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.