This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 843830 - NFSv4 ACL bug fixes
NFSv4 ACL bug fixes
Status: CLOSED DUPLICATE of bug 822871
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel (Show other bugs)
6.4
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: nfs-maint
Filesystem QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-27 09:36 EDT by Andy Adamson
Modified: 2013-03-03 19:22 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-27 10:18:13 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
tar ball with patches back ported to 2.6.32-285 (10.00 KB, application/x-tar)
2012-07-27 09:36 EDT, Andy Adamson
no flags Details

  None (edit)
Description Andy Adamson 2012-07-27 09:36:58 EDT
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@redhat.com>
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@redhat.com>
Reported-by: Jian Li <jiali@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>


From 5a00689930ab975fdd1b37b034475017e460cf2a Mon Sep 17 00:00:00 2001
From: Sachin Prabhu <sprabhu@redhat.com>
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@redhat.com>
Reported-by: Jian Li <jiali@redhat.com>
[Trond: Fixed a size_t vs unsigned int printk() warning]
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Comment 2 RHEL Product and Program Management 2012-07-27 10:00:13 EDT
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 10:16:21 EDT
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 10:18:13 EDT

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

Note You need to log in before you can comment on or make changes to this bug.