Bug 843830

Summary: NFSv4 ACL bug fixes
Product: Red Hat Enterprise Linux 6 Reporter: Andy Adamson <andros>
Component: kernelAssignee: nfs-maint
Status: CLOSED DUPLICATE QA Contact: Filesystem QE <fs-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4CC: kzhang, sprabhu, steved
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-27 14:18:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
tar ball with patches back ported to 2.6.32-285 none

Description Andy Adamson 2012-07-27 13:36:58 UTC
Created attachment 600774 [details]
tar ball with patches back ported to 2.6.32-285

Description of problem:
bugzilla 767288 added a fix to enable the NFS client to process an ACL greater than a page. There are two bug fixes to this code upstream in the Linux 3.x kernels that fix Oops due to buffer overflows in corner cases.

1) When calling GETACL, if the size of the bitmap array, the length
attribute and the acl returned by the server is greater than the
allocated buffer(args.acl_len), we can Oops with a General Protection
fault at _copy_from_pages() when we attempt to read past the pages
allocated.

2) When attempting to cache ACLs returned from the server, if the bitmap
size + the ACL size is greater than a PAGE_SIZE but the ACL size itself
is smaller than a PAGE_SIZE, we can read past the buffer page boundary.

Version-Release number of selected component (if applicable):
RHEL 6.2, 6.3, and pre-release RHEL6.4 (2.6.32-285)


How reproducible:
100%


Steps to Reproduce:
1.Construct an ACL to be returned as per #1 or #2 above in the description section.
2.Call nfs4_getfacl
3.
  
Actual results:

Buffer overflow resulting in Oops or no ACL being displayed.


Expected results:
ACL displayed.


Additional info:

I've attached these two patches that fix the issue back ported to 2.6.32-285:

From 5794d21ef4639f0e33440927bb903f9598c21e92 Mon Sep 17 00:00:00 2001
From: Sachin Prabhu <sprabhu>
Date: Tue, 17 Apr 2012 14:36:40 +0100
Subject: [PATCH 1/1] Avoid beyond bounds copy while caching ACL

When attempting to cache ACLs returned from the server, if the bitmap
size + the ACL size is greater than a PAGE_SIZE but the ACL size itself
is smaller than a PAGE_SIZE, we can read past the buffer page boundary.

Signed-off-by: Sachin Prabhu <sprabhu>
Reported-by: Jian Li <jiali>
Signed-off-by: Trond Myklebust <Trond.Myklebust>


From 5a00689930ab975fdd1b37b034475017e460cf2a Mon Sep 17 00:00:00 2001
From: Sachin Prabhu <sprabhu>
Date: Tue, 17 Apr 2012 14:35:39 +0100
Subject: [PATCH 1/1] Avoid reading past buffer when calling GETACL

Bug noticed in commit
bf118a342f10dafe44b14451a1392c3254629a1f

When calling GETACL, if the size of the bitmap array, the length
attribute and the acl returned by the server is greater than the
allocated buffer(args.acl_len), we can Oops with a General Protection
fault at _copy_from_pages() when we attempt to read past the pages
allocated.

This patch allocates an extra PAGE for the bitmap and checks to see that
the bitmap + attribute_length + ACLs don't exceed the buffer space
allocated to it.

Signed-off-by: Sachin Prabhu <sprabhu>
Reported-by: Jian Li <jiali>
[Trond: Fixed a size_t vs unsigned int printk() warning]
Signed-off-by: Trond Myklebust <Trond.Myklebust>

Comment 2 RHEL Program Management 2012-07-27 14:00:13 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 3 Sachin Prabhu 2012-07-27 14:16:21 UTC
Hello Andy,

We discovered another bug introduced by the patch above when pulling those patches in for RHEL 6.  I have sent a separate patch in for the new bug.
http://www.spinics.net/lists/linux-nfs/msg31564.html

I'll mark this bz as duplicate of the bz already open for those patches. I will be resubmitting these patches to the internal list once the new patch has been accepted.

Sachin Prabhu

Comment 4 Sachin Prabhu 2012-07-27 14:18:13 UTC

*** This bug has been marked as a duplicate of bug 822871 ***