From: bugzilla-daemon@bugzilla.kernel.org
To: linux-ext4@vger.kernel.org
Subject: [Bug 40512] New: EXT4_IOC_MIGRATE is dangerous on directories
Date: Thu, 4 Aug 2011 01:51:00 GMT [thread overview]
Message-ID: <bug-40512-13602@https.bugzilla.kernel.org/> (raw)
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.
next reply other threads:[~2011-08-04 1:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 1:51 bugzilla-daemon [this message]
2011-08-04 6:31 ` [Bug 40512] EXT4_IOC_MIGRATE is dangerous on directories bugzilla-daemon
2011-08-04 13:26 ` bugzilla-daemon
2012-01-17 14:10 ` bugzilla-daemon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-40512-13602@https.bugzilla.kernel.org/ \
--to=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).