Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 296513 Details for
Bug 435610
RHEL5.2: ecryptfs ecryptfs_prepare_write does not decrypt page
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Mike's patch, backported for RHEL5.2
ecryptfs-prepare.patch (text/plain), 4.00 KB, created by
Eric Sandeen
on 2008-03-02 15:04:17 UTC
(
hide
)
Description:
Mike's patch, backported for RHEL5.2
Filename:
MIME Type:
Creator:
Eric Sandeen
Created:
2008-03-02 15:04:17 UTC
Size:
4.00 KB
patch
obsolete
>Index: linux-2.6.18.x86_64/fs/ecryptfs/mmap.c >=================================================================== >--- linux-2.6.18.x86_64.orig/fs/ecryptfs/mmap.c >+++ linux-2.6.18.x86_64/fs/ecryptfs/mmap.c >@@ -263,52 +263,103 @@ out: > return 0; > } > >-/* This function must zero any hole we create */ >+/** >+ * ecryptfs_prepare_write >+ * @file: The eCryptfs file >+ * @page: The eCryptfs page >+ * @from: The start byte from which we will write >+ * @to: The end byte to which we will write >+ * >+ * This function must zero any hole we create >+ * >+ * Returns zero on success; non-zero otherwise >+ */ > static int ecryptfs_prepare_write(struct file *file, struct page *page, > unsigned from, unsigned to) > { >- int rc = 0; > loff_t prev_page_end_size; >+ int rc = 0; > > if (!PageUptodate(page)) { >- rc = ecryptfs_read_lower_page_segment(page, page->index, 0, >- PAGE_CACHE_SIZE, >- page->mapping->host); >- if (rc) { >- printk(KERN_ERR "%s: Error attemping to read lower " >- "page segment; rc = [%d]\n", __FUNCTION__, rc); >- ClearPageUptodate(page); >- goto out; >- } else >+ struct ecryptfs_crypt_stat *crypt_stat = >+ &ecryptfs_inode_to_private( >+ file->f_dentry->d_inode)->crypt_stat; >+ >+ if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED) >+ || (crypt_stat->flags & ECRYPTFS_NEW_FILE)) { >+ rc = ecryptfs_read_lower_page_segment( >+ page, page->index, 0, PAGE_CACHE_SIZE, >+ page->mapping->host); >+ if (rc) { >+ printk(KERN_ERR "%s: Error attemping to read " >+ "lower page segment; rc = [%d]\n", >+ __FUNCTION__, rc); >+ ClearPageUptodate(page); >+ goto out; >+ } else >+ SetPageUptodate(page); >+ } else if (crypt_stat->flags & ECRYPTFS_VIEW_AS_ENCRYPTED) { >+ if (crypt_stat->flags & ECRYPTFS_METADATA_IN_XATTR) { >+ rc = ecryptfs_copy_up_encrypted_with_header( >+ page, crypt_stat); >+ if (rc) { >+ printk(KERN_ERR "%s: Error attempting " >+ "to copy the encrypted content " >+ "from the lower file whilst " >+ "inserting the metadata from " >+ "the xattr into the header; rc " >+ "= [%d]\n", __FUNCTION__, rc); >+ ClearPageUptodate(page); >+ goto out; >+ } >+ SetPageUptodate(page); >+ } else { >+ rc = ecryptfs_read_lower_page_segment( >+ page, page->index, 0, PAGE_CACHE_SIZE, >+ page->mapping->host); >+ if (rc) { >+ printk(KERN_ERR "%s: Error reading " >+ "page; rc = [%d]\n", >+ __FUNCTION__, rc); >+ ClearPageUptodate(page); >+ goto out; >+ } >+ SetPageUptodate(page); >+ } >+ } else { >+ rc = ecryptfs_decrypt_page(page); >+ if (rc) { >+ printk(KERN_ERR "%s: Error decrypting page " >+ "at index [%ld]; rc = [%d]\n", >+ __FUNCTION__, page->index, rc); >+ ClearPageUptodate(page); >+ goto out; >+ } > SetPageUptodate(page); >+ } > } >- > prev_page_end_size = ((loff_t)page->index << PAGE_CACHE_SHIFT); > >- /* >- * If creating a page or more of holes, zero them out via truncate. >- * Note, this will increase i_size. >- */ >+ /* If creating a page or more of holes, zero them out via truncate. >+ * Note, this will increase i_size. */ > if (page->index != 0) { > if (prev_page_end_size > i_size_read(page->mapping->host)) { > rc = ecryptfs_truncate(file->f_dentry, > prev_page_end_size); > if (rc) { >- printk(KERN_ERR "Error on attempt to " >+ printk(KERN_ERR "%s: Error on attempt to " > "truncate to (higher) offset [%lld];" >- " rc = [%d]\n", prev_page_end_size, rc); >+ " rc = [%d]\n", __FUNCTION__, >+ prev_page_end_size, rc); > goto out; > } > } > } >- /* >- * Writing to a new page, and creating a small hole from start of page? >- * Zero it out. >- */ >- if ((i_size_read(page->mapping->host) == prev_page_end_size) && >- (from != 0)) { >+ /* Writing to a new page, and creating a small hole from start >+ * of page? Zero it out. */ >+ if ((i_size_read(page->mapping->host) == prev_page_end_size) >+ && (from != 0)) > memclear_highpage_flush(page, 0, PAGE_CACHE_SIZE); >- } > out: > return rc; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 435610
: 296513