From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phillip Lougher Subject: Re: [UPDATED PATCH] fix memory corruption from misinterpreted bad_inode_ops return values Date: Fri, 5 Jan 2007 06:37:27 -0800 (PST) Message-ID: <8178968.post@talk.nabble.com> References: <459C3E45.7090306@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from www.nabble.com ([72.21.53.35]:39239 "EHLO talk.nabble.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161125AbXAEPBj (ORCPT ); Fri, 5 Jan 2007 10:01:39 -0500 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1H2qCF-00053n-BD for linux-fsdevel@vger.kernel.org; Fri, 05 Jan 2007 06:37:27 -0800 To: linux-fsdevel@vger.kernel.org In-Reply-To: <459C3E45.7090306@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Eric Sandeen wrote: >but Al felt that it was probably better to create an EIO-returner for each >actual op signature. Since so few ops share a signature, I just went ahead >& created an EIO function for each individual file & inode op that returns >a value. Hmm, the problem with this is it bloats bad_inode.o with lots of empty functions that return -EIO. Even though we're not interested in the parameters, GCC doesn't know this, and doesn't fold the functions into only the couple of definitions that return different types. Text size of original bad_inode.o: Idx Name Size VMA LMA File off Algn 0 .text 0000006c 00000000 00000000 00000034 2**2 == 108 bytes Size with patch applied: Idx Name Size VMA LMA File off Algn 0 .text 0000016b 00000000 00000000 00000034 2**2 patch applied: == 363 bytes, or over three times larger! >I originally had coded up the fix by creating a return_EIO_ macro >for each return type, This adds two extra functions (return for ssize_t and long), which gives an increase in size of only 12 bytes: Idx Name Size VMA LMA File off Algn 0 .text 00000078 00000000 00000000 00000034 2**2 == 120 bytes. Isn't this better? Thanks Phillip -- View this message in context: http://www.nabble.com/-UPDATED-PATCH--fix-memory-corruption-from-misinterpreted-bad_inode_ops-return-values-tf2916716.html#a8178968 Sent from the linux-fsdevel mailing list archive at Nabble.com.