[Devel] [PATCH] ecryptfs lower_file largefile issue

Dmitriy Monakhov dmonakhov at sw.ru
Wed Feb 21 02:07:22 PST 2007


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 at openvz.org>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-mm-ecryptfs-largefile-fix
URL: <http://lists.openvz.org/pipermail/devel/attachments/20070221/64a89672/attachment-0001.ksh>


More information about the Devel mailing list