public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: "Kevin W. Rudd" <solgato@us.ibm.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: Memory corruption in nfs3_xdr_setaclargs()
Date: Fri, 06 Mar 2009 15:22:17 -0500	[thread overview]
Message-ID: <1236370937.7244.52.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0903051135040.3949-mupu0Q0mUPfkOmf+N4b0O9FgqiXiwxn+0E9HWUfgJXw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]

On Thu, 2009-03-05 at 11:49 -0800, Kevin W. Rudd wrote:
> On Thu, 5 Mar 2009, Trond Myklebust wrote:
> 
> > Going over that particular procedure reveals a number of bugs that all
> > should be fixed.
> 
> So true ;-)
> 
> > Trying to estimate how many bytes are free in the header is _WRONG_.
> > That memory is allocated with certain assumptions, which are set in the
> > definition of ACL3_setaclargs_sz. In this case, the assumptions appear
> > to be that we will fit a maximum of 5 ACEs in the header.
> > IOW: the real fix for your corruption problem is simply to set
> > len_in_head to 2*(2+5*3). Currently, the patch supplied by Sachin will
> > always set it to zero.
> 
> Does setting len_in_head to 2*(2+5*3) take into account the
> header space already consumed?  The initial patch was just a
> quick-n-dirty way of making sure we didn't overwrite the initial
> buffer, and a mechanism for generating some discussion around the
> other deficiencies in this procedure.  I'll take the blame for
> it being a quick hack to simply take the heat off for a critical
> customer situation :)
> 
> > Secondly, doing page allocation in the XDR routine is _WRONG_. For one
> > thing, look at the major memory leak which happens if the client needs
> > to resend the request (which can happen every now and again due to a
> > dropped tcp connection, or all the time due to UDP retransmits).
> > Those pages should have been allocated in nfs3_proc_getacl(), and indeed
> > that is where the wretched things are freed.
> 
> That's an issue I hadn't noticed, but this isn't really my area of
> expertice.  Thanks for taking a closer look at this area of code.

Does the attached patch help?

Trond


[-- Attachment #2: Type: application/x-dif, Size: 5542 bytes --]

  parent reply	other threads:[~2009-03-06 20:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 17:14 Memory corruption in nfs3_xdr_setaclargs() Sachin S. Prabhu
2009-01-20 18:15 ` Trond Myklebust
     [not found]   ` <1232475301.7055.14.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-01-21 14:55     ` Sachin S. Prabhu
2009-03-05 16:33     ` Kevin W. Rudd
     [not found]       ` <alpine.LFD.1.10.0903050829420.3949-mupu0Q0mUPfkOmf+N4b0O9FgqiXiwxn+0E9HWUfgJXw@public.gmane.org>
2009-03-05 18:53         ` Trond Myklebust
     [not found]           ` <1236279188.13361.30.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-05 19:49             ` Kevin W. Rudd
     [not found]               ` <alpine.LFD.1.10.0903051135040.3949-mupu0Q0mUPfkOmf+N4b0O9FgqiXiwxn+0E9HWUfgJXw@public.gmane.org>
2009-03-06 20:22                 ` Trond Myklebust [this message]
     [not found]                   ` <1236370937.7244.52.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-03-06 22:51                     ` Kevin W. Rudd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1236370937.7244.52.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@fys.uio.no \
    --cc=linux-nfs@vger.kernel.org \
    --cc=solgato@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox