* [PATCH] ecryptfs lower_file largefile issue
@ 2007-02-21 10:07 Dmitriy Monakhov
2007-02-21 13:06 ` [Ecryptfs-devel] " Michael Halcrow
0 siblings, 1 reply; 3+ messages in thread
From: Dmitriy Monakhov @ 2007-02-21 10:07 UTC (permalink / raw)
To: linux-kernel; +Cc: ecryptfs-devel, devel
[-- Attachment #1: Type: text/plain, Size: 1975 bytes --]
Where is largefile issue in ecryptfs.
Even if we want open file on ia32 with explicit O_LARGEFILE, lower_file will
be opened without O_LARGEFILE flag this result in various errors in dmesg
and data corruption.
Testcase:
#### write 'a' chars beyond 2Gb
# strace ./writer_test root/file
open("root/file", O_WRONLY|O_CREAT|O_LARGEFILE, 0666) = 3
lseek(3, 2147483640, SEEK_SET) = 2147483640
write(3, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"..., 10240) = 10240
##check content
# hexdump root/file4
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
7ffffff0 0000 0000 0000 0000 6161 6161 6161 6161
80000000 6161 6161 6161 6161 6161 6161 6161 6161
*
800027f0 6161 6161 6161 6161
800027f8
#umount root
# mount -tecryptfs pr/dir/ root/ -ocipher=aes
## check content after remount
# hexdump root/file4
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
7ffffff0 0000 0000 0000 0000 6161 6161 6161 6161
80000000 6161 6161 6161 6161 6161 6161 6161 6161
*
800027f0 6161 6161 6161 6161 0000 0000 0000 0000
80002800 0000 0000 0000 0000 0000 0000 0000 0000
*
80003000 ee3d e793 c410 3bd4 c642 5774 ad71 7932
80003010 17a6 443c 4621 9e4a cf15 babd 19d0 f5e7
*
80004000 ce32 49ed 217c f87d 5539 3e96 517c 961c
80004010 17a6 443c 4621 9e4a cf15 babd 19d0 f5e7
*
80005000
### Wow content was changed, kernel complain with folowing messages:
Error opening lower file for lower_dentry [0xf73a111c], lower_mnt [0xf7d8b1c0], and flags [0x0]
Error opening lower_file to read header region
Error attempting to read the [user.ecryptfs] xattr from the lower file; return value = [4294967201]
Valid metadata not found in header region or xattr region; treating file as unencrypted
Lets explicitly add O_LARGEFILE to opened lower file flags as it done in unionfs
and nfsd. Also remove unnecessery #define from ecryptfs_initialize_file().
Signed-off-by: Dmitriy Monakhov <dmonakhov@openvz.org>
[-- Attachment #2: diff-mm-ecryptfs-largefile-fix --]
[-- Type: text/plain, Size: 990 bytes --]
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index bd969ad..7a7d25d 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -205,6 +205,7 @@ int ecryptfs_open_lower_file(struct file **lower_file,
{
int rc = 0;
+ flags |= O_LARGEFILE;
dget(lower_dentry);
mntget(lower_mnt);
*lower_file = dentry_open(lower_dentry, lower_mnt, flags);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 27fd14a..a1fe8b4 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -200,9 +200,6 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
inode = ecryptfs_dentry->d_inode;
crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR;
-#if BITS_PER_LONG != 32
- lower_flags |= O_LARGEFILE;
-#endif
lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
/* Corresponding fput() at end of this function */
if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Ecryptfs-devel] [PATCH] ecryptfs lower_file largefile issue
2007-02-21 10:07 [PATCH] ecryptfs lower_file largefile issue Dmitriy Monakhov
@ 2007-02-21 13:06 ` Michael Halcrow
2007-02-21 13:45 ` Dmitriy Monakhov
0 siblings, 1 reply; 3+ messages in thread
From: Michael Halcrow @ 2007-02-21 13:06 UTC (permalink / raw)
To: Dmitriy Monakhov; +Cc: linux-kernel, ecryptfs-devel, devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
On Wed, Feb 21, 2007 at 01:07:22PM +0300, Dmitriy Monakhov wrote:
> Where is largefile issue in ecryptfs.
Thanks for your thorough work on resolving such issues. We will
integrate your patches and testcases into the next release as soon as
we get a chance to review and test.
Mike
.___________________________________________________________________.
Michael A. Halcrow
Security Software Engineer, IBM Linux Technology Center
GnuPG Fingerprint: 419C 5B1E 948A FA73 A54C 20F5 DB40 8531 6DCA 8769
"To prohibit sharing software is to cut the bonds of society."
- Richard Stallman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iQEVAwUBRdxDsdtAhTFtyodpAQPT0wf/amu/FboyQXHXwnn7pUEdPqqkxXpbZGrR
L8hknVilgVA8pvgK/RrUNuakrHRWZTBokbSbiUA/xgpHlUTHa6T3VE/JOe5pLzG+
vDEo8+Ya+yjRAMJ/970oLz1T4sUXvalgJlYRaKKqKEsZmFIQwMKoK7lmc+Th+p2J
R/ZfJ3olWmskPMlLHhN4j9EEVoAGQLUqiH+bBkx4AqLJNVq9S69fFBwGFVk4t+/y
Z6KJNhJsjHnOj6ADjSlObXmB5JFIWsUl4P0fouELB4lxTYh1C42S0hy5Pl60Sq1o
MrmXIvkAdm1klYwbhaF174zu2XDzDJICXq4475v3WWVxT65HYkanMQ==
=3zMo
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Ecryptfs-devel] [PATCH] ecryptfs lower_file largefile issue
2007-02-21 13:06 ` [Ecryptfs-devel] " Michael Halcrow
@ 2007-02-21 13:45 ` Dmitriy Monakhov
0 siblings, 0 replies; 3+ messages in thread
From: Dmitriy Monakhov @ 2007-02-21 13:45 UTC (permalink / raw)
To: Michael Halcrow; +Cc: Dmitriy Monakhov, linux-kernel, ecryptfs-devel, devel
Michael Halcrow <lkml@halcrow.us> writes:
> On Wed, Feb 21, 2007 at 01:07:22PM +0300, Dmitriy Monakhov wrote:
>> Where is largefile issue in ecryptfs.
>
> Thanks for your thorough work on resolving such issues. We will
> integrate your patches and testcases into the next release as soon as
> we get a chance to review and test.
BTW previously i've sent some patches for ecryptfs to lkml but forgot add
ecryptfs-devel@lists.sourceforge.net to CC:.
links to patches:
"ecryptfs lower_file handling issues" http://lkml.org/lkml/2007/2/19/147
"ecryptfs_read_super path_lookup" errh fix http://lkml.org/lkml/2007/2/19/171
>
> Mike
> .___________________________________________________________________.
> Michael A. Halcrow
> Security Software Engineer, IBM Linux Technology Center
> GnuPG Fingerprint: 419C 5B1E 948A FA73 A54C 20F5 DB40 8531 6DCA 8769
>
> "To prohibit sharing software is to cut the bonds of society."
> - Richard Stallman
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-21 13:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-21 10:07 [PATCH] ecryptfs lower_file largefile issue Dmitriy Monakhov
2007-02-21 13:06 ` [Ecryptfs-devel] " Michael Halcrow
2007-02-21 13:45 ` Dmitriy Monakhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox