From patchwork Wed Jan 18 11:49:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9523647 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3FF98601B7 for ; Wed, 18 Jan 2017 13:04:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31BF5285AC for ; Wed, 18 Jan 2017 13:04:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 266E7285B4; Wed, 18 Jan 2017 13:04:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98B73285AC for ; Wed, 18 Jan 2017 13:04:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754637AbdARNEB (ORCPT ); Wed, 18 Jan 2017 08:04:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:59678 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754632AbdARND6 (ORCPT ); Wed, 18 Jan 2017 08:03:58 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id ECD14AC5B; Wed, 18 Jan 2017 11:49:59 +0000 (UTC) Subject: Re: gdb log of crashed "btrfs-image -s" To: Christoph Groth , Chris Murphy References: <87o9z7dzvd.fsf@grothesque.org> <42eaf69b-c444-fc50-2128-3a1fbd18b335@suse.de> <871sw2cbzb.fsf@grothesque.org> <6f5ba97f-0c13-4ad1-fda3-a10db7024ef7@suse.de> <87lgu9cu2v.fsf@grothesque.org> <877f5tcmgk.fsf@grothesque.org> <87wpdsc03i.fsf_-_@grothesque.org> Cc: Btrfs BTRFS From: Goldwyn Rodrigues Message-ID: Date: Wed, 18 Jan 2017 05:49:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <87wpdsc03i.fsf_-_@grothesque.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 01/18/2017 01:13 AM, Christoph Groth wrote: > Christoph Groth wrote: >> Chris Murphy wrote: >>> On Tue, Jan 17, 2017 at 1:25 PM, Christoph Groth >>> wrote: >>>> Any ideas on what could be done? If you need help to debug the >>>> problem with >>>> btrfs-image, please tell me what I should do. I can keep the broken >>>> file >>>> system around until an image can be created at some later time. >>> >>> Try 4.9, or even 4.8.5, tons of bugs have been fixed since 4.7.3 >>> although I don't know off hand if this particular bug is fixed. I did >>> recently do a btrfs-image with btrfs-progs v4.9 with -s and did not >>> get a segfault. >> >> I compiled btrfs-image.static from btrfs-tools 4.9 (from git) and >> started it from Debian testing's initramfs. The exact command that I >> use is: >> >> /mnt/btrfs-image.static -c3 -s /dev/sda2 /mnt/mim-s.bim >> >> It runs for a couple of seconds (enough to write 20263936 bytes of >> output) and then quits with >> >> *** Error in `/mnt/btrfs-image.static`: double free or corruption >> (!prev): 0x00000000009f0940 *** >> ====== Backtrace: ====== >> [0x45fb97] >> [0x465442] >> [0x465c1e] >> [0x402694] >> [0x402dcb] >> [0x4031fe] >> [0x4050ff] >> [0x405783] >> [0x44cb73] >> [0x44cdfe] >> [0x400b2a] >> >> (I had to type the above off the other screen, but I double checked >> that there are no errors.) >> >> The executable that I used can be downloaded from >> http://groth.fr/btrfs-image.static >> Its md5sum is 48abbc82ac6d3c0cb88cba1e5edb85fd. >> >> I hope that this can help someone to see what's going on. > > I ran the same executable under gdb from a live system. The log is > attached. > Thanks Christoph for the backtrace. I am unable to reproduce it, but looking at your backtrace, I found a bug. Would you be able to give it a try and check if it fixes the problem? case BTRFS_DIR_ITEM_KEY: diff --git a/image/main.c b/image/main.c index 58dcecb..0158844 100644 --- a/image/main.c +++ b/image/main.c @@ -550,7 +550,7 @@ static void sanitize_name(struct metadump_struct *md, u8 *dst, return; } - memcpy(eb->data, dst, eb->len); + memcpy(eb->data, src->data, src->len); switch (key->type) {