From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c95av-0008AG-4h for mharc-grub-devel@gnu.org; Tue, 22 Nov 2016 02:34:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c95at-0008A9-7s for grub-devel@gnu.org; Tue, 22 Nov 2016 02:34:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c95aq-0006rV-0z for grub-devel@gnu.org; Tue, 22 Nov 2016 02:34:19 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:49907) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c95ap-0006q5-Nl for grub-devel@gnu.org; Tue, 22 Nov 2016 02:34:15 -0500 Received: from nwb-ext-pat.microfocus.com ([10.120.13.103]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 22 Nov 2016 08:34:13 +0100 Received: from linux-9gqx.suse.de (nwb-a10-snat.microfocus.com [10.120.13.202]) by nwb-ext-pat.microfocus.com with ESMTP (TLS encrypted); Tue, 22 Nov 2016 07:33:49 +0000 Date: Tue, 22 Nov 2016 15:33:42 +0800 From: Michael Chang To: Andrei Borzenkov , Daniel Kiper , Vladimir =?utf-8?Q?'=CF=86-coder=2Fphcoder'?= Serbinenko , The development of GNU GRUB Subject: Re: [PATCH v2] grub-file: fix segmentation fault Message-ID: <20161122073342.GE17065@linux-9gqx.suse.de> Mail-Followup-To: Andrei Borzenkov , Daniel Kiper , Vladimir =?utf-8?Q?'=CF=86-coder=2Fphcoder'?= Serbinenko , The development of GNU GRUB References: <20160412062412.GA16964@linux-9gqx.suse> <20161117190849.GC7245@router-fw-old.local.net-space.pl> <20161122071008.GD17065@linux-9gqx.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161122071008.GD17065@linux-9gqx.suse.de> User-Agent: Mutt/1.5.24 (2015-08-30) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 195.135.221.5 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2016 07:34:20 -0000 I have to resend the mail as the attached kernel image is too big that may not reach the list eventually. Sorry if you get duplicated mail. If you still have problem with reproducing the problem please let me know. I could provide download link for the kernel file. On Fri, Nov 18, 2016 at 11:50:25AM +0300, Andrei Borzenkov wrote: > Hmm ... I must admit I am confused how we can get NULL here. Filters > are called after primary file->name is set and each filter copies > previous struct file, which means returned file will inherit pointer > to the same file name. No. I don't think so. Looking into gzio or xzio file filters they did not copy original handle to new allocated one. And the new handle gets initialized without file->name being set from original one. The new handle then returned to upper file layer with file->name being null. > Anyway, exactly because filters themselves do not free file->name this > patch means memory leak. Same reason above, as long as the filters did not allocate it, they did not need to free. > Michael, could you provide reproducer for it? I can still reproduce the segfault on latest git HEAD. Here is kernel image attached to reproduce the problem with. grub/build-xen # ./grub-file --is-x86_64-xen-domu /boot/vmlinux-4.8.4-1-default.gz Segmentation fault (core dumped) Thanks, Michael