Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1010301rwi; Thu, 20 Oct 2022 07:44:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM40T7o+D8TW0UUnlOzSs3+HhfY/Jb8HvMLNqv/QZCUwdCkbp0+bVSX1n92lM997nVnbuEz/ X-Received: by 2002:a17:902:e807:b0:185:534d:4bd3 with SMTP id u7-20020a170902e80700b00185534d4bd3mr13766783plg.26.1666277043739; Thu, 20 Oct 2022 07:44:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666277043; cv=none; d=google.com; s=arc-20160816; b=yra9knJ8QBKF5NIs1kqtmtkEAqOnnZks2h/U3syU4C0eRumuZAP84v3d8cFKafC4Qj QMgp3xNWKkeW2eAKuOfOlkobHGuJGqUgYGy8hcVFEvR4KrdAA56ft3O5aJUCU3Xs/fBw jmilU0FzEYGNR4g9jtvTq4ezfaD6YJfH7sTPqK0ClIL99r7SM+n8rE0QzPgDMX+iD+TX MWNTVXivoOjAWfW810xVRKpA4Nt2PfuuzhZ9qZ/XJ7rKwkgGBSR+6eUQX1YdzjeAjqKs Wp51F15XnErwN9sukodHoBMIXWWVP/FQwrxMSwciyFpT51NyLCWS3XE3jMTtQE0wmcCa fmfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:from:mime-version :dkim-signature; bh=5o5pD45y32AbelgLP8vxzmETh5Mbe8IIWR8fIUkt/dY=; b=w2f8OM9oPRafEOKDz1JIQteD1pXHLNYRX+ut2JFJ6wXTWGZ8H3I7xtU3c4eRSVRxJD NOCKGVS49jt9/3hsWTkWu/ZWO6+1ViRiTty7s30g01p/+U2YzDH7DRseMOXL0RXnUl3t iye+FeCe5brM9n77lbWDN7Cvv/xi+5aAusmN+q4oL5udlWBIaJQ5FtKn5OGvo5r0NrSi vNpe0e5JhxSRROJ360q0bQAyo5lTv/19xqKthIWTzqYSE/Ze4H2y8GUjlMiDPy8qjp6h fPZYtYiI4g5s5Nh/lIRIzRouMh7sat7tvF5sJYR1FeorA6bKlLvjOXUKoVKg2pHFGSKB UPMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=u+5ZSZq2; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a1709027c8200b0017d8a86e524si20299858pll.506.2022.10.20.07.43.38; Thu, 20 Oct 2022 07:44:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=u+5ZSZq2; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230029AbiJTOd6 (ORCPT + 99 others); Thu, 20 Oct 2022 10:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230241AbiJTOd4 (ORCPT ); Thu, 20 Oct 2022 10:33:56 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76F0915D093 for ; Thu, 20 Oct 2022 07:33:55 -0700 (PDT) Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id E0B043F56D for ; Thu, 20 Oct 2022 14:33:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1666276433; bh=5o5pD45y32AbelgLP8vxzmETh5Mbe8IIWR8fIUkt/dY=; h=MIME-Version:From:Date:Message-ID:Subject:To:Content-Type; b=u+5ZSZq26LFa1vpY12TfOjrWjW534snO4CV9aVGV2VVmRWTh76sXmi8PPcR0oePtk Vinepq0PwRMMAW3Wy88VSX8Q9W8GVLiuiNlnHiHKBT9Ghg+NxawT2tAkwg/Lx3F60S kV75KvBZXrcujub3Cnwo0e5UdQY7hxOTmOeICMR8WjOpIRMrnOXBLLpyNPq8z06CEb uURQoeV4RNb5kt1KspuAfQ10/9n7VmwKWEGa+mx5N98SojZ33X2JnnKTD2Ln/PxzLw fdYpL6xZGUD9XM7naUAIZ1nZgyLTCIAlHHxHgNWgMAKm2YpwkqpGzRTYaLBZxERG7W h4B1F/2FMU0pg== Received: by mail-ed1-f70.google.com with SMTP id h13-20020a056402280d00b0045cb282161cso16424373ede.8 for ; Thu, 20 Oct 2022 07:33:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5o5pD45y32AbelgLP8vxzmETh5Mbe8IIWR8fIUkt/dY=; b=uFxCJD7VjaIrRDSwj8vRJmqgM8X/Rbpw+iL0nW4h12dztHwGl1fOXmopZRqHHiCx5y kIOga79MiexpIumY8OCKezVMtXqarj2V93+qxjDIHddLe/Az2E9vGqbRZX+NyfDq7In3 E3oJ3MmwYMieLxnd+wDfHNXLvxMYXP+cKyNaGUKmxn0WMsu0CyNYPKc0YvaIZ5gEF2zk ZSKiDFh2vnqAiLkwK6EyqDlUA8VO4M31tNH9ROoGQjhQRfADb8krPgME0X13/dNm6rKt vsm7sh/wvyJPP/mdNDNRw+QjHnoS9+A1dth1mdWh3mxROmoEpmiZOTe840UIrmmsGgXw x2Vw== X-Gm-Message-State: ACrzQf0deuIrpGjXTXbLJ+wylbMsg+YhyeEOqkZ+ldBzxq37XtHRyS6o zFe2COEXuy3+r/GdDMSnYr81ZFhZ6Sc/q/H9ECo7u7bO6cD4BnzkwDjjVOzqms6k+Nqn16sK71d 3uncMCNZAwDQvlleI4AFv4FHg9z7K2usKij+SQQ9eqEZNi7t55Xv4pA== X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr12762617edx.189.1666276433648; Thu, 20 Oct 2022 07:33:53 -0700 (PDT) X-Received: by 2002:a05:6402:5ca:b0:43b:6e01:482c with SMTP id n10-20020a05640205ca00b0043b6e01482cmr12762606edx.189.1666276433455; Thu, 20 Oct 2022 07:33:53 -0700 (PDT) MIME-Version: 1.0 From: Andreas Hasenack Date: Thu, 20 Oct 2022 11:33:42 -0300 Message-ID: Subject: Invalid free() in blkmapd, core dump To: linux-nfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi, this was brought up before in https://www.spinics.net/lists/linux-nfs/msg87598.html We recently got bug reports about the same issue, and it was only yesterday that I finally managed to reproduce it in a VM. My reproduction steps are: - add a scsi device to a vm (not virtio). Maybe works with sata too, but scsi reproduced it - add it to an LVM VG, and create an LV - run blkmapd -f: # blkmapd -f blkmapd: open pipe file /run/rpc_pipefs/nfs/blocklayout failed: No such file or directory double free or corruption (out) Aborted (core dumped) The "No such file or directory" has nothing to do with it. You can "modprobe blocklayoutdriver" to get rid of it, but the invalid free() still happens. in 2.6.1, gdb shows: #9 0x00005555555571e5 in bl_add_disk (filepath=0x7fffffffd480 "/dev/dm-2") at device-discovery.c:232 232 free(serial->data); (gdb) l 227 disk->dev = dev; 228 disk->size = size; 229 disk->valid_path = path; 230 } 231 if (serial) { 232 free(serial->data); 233 free(serial); 234 } 235 } 236 return; As lixiaokeng said in that first post, this should be just free(serial). Or use bl_free_scsi_string(), like his suggested patch does.