From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACCB2C4361B for ; Wed, 16 Dec 2020 17:07:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1342322DBF for ; Wed, 16 Dec 2020 17:07:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1342322DBF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52754 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpaHF-0007WI-1T for qemu-devel@archiver.kernel.org; Wed, 16 Dec 2020 12:07:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpa0q-0002aC-53 for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:50:52 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:40089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kpa0o-0002mX-8o for qemu-devel@nongnu.org; Wed, 16 Dec 2020 11:50:51 -0500 Received: by mail-wm1-x332.google.com with SMTP id a3so3093612wmb.5 for ; Wed, 16 Dec 2020 08:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=jqVBo9wHFRKpQhPXb68Xt/ocbHSUWoZPL4MytMDcHhg=; b=bCkNd7OebbwD6ryC5XRVfTV6Irzz0NlNweoN87qq9dFje0qLnimPjgvFqyUhbXqKI3 vCLkddvIGjhe29PnMXI/giSeJ9ARXQWy9voIeueuFLDbgyvnYjaGS1FCOM2WxtWqG5/l dYCjlmBGIfBIoAYGvAZlITkpQEFnbPj092eTRxzZe9exA7t6R9V6/f5asgz/x7ddXe5E 12A8inWgT9bkF+tubNbJQZJ/COn+3vBpihO/l7ee93PSlmbHiNLywxvzos5gTGoy0G21 1zVrPpxGmtn/3obJ7agCRWvIs+6J+NMGb/5zVEZk6dvIHo/T98RosXs93o9iDRnVuseQ AXXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=jqVBo9wHFRKpQhPXb68Xt/ocbHSUWoZPL4MytMDcHhg=; b=b9rZLwTNkvqc40ixmBA/ThT+AHQtAnqDpifKknXu6WafzPekcUIZBdACvb4G7QEpVm WJ/SDQZKxAjD9L5cl9gmS8no6t7OG+vBYreZjSc6lUMOJyid75BDCzMuxUH4ytpYbeKW h5iu+qQfvw9MaKUmipaRUaOPVaxnXy8935iHFrWXrbWoV9bbOmsxULQdRCjnjlumO5L9 UYJxslHHg2laScV3ozRj9dsTb4o9fLRHfpB4ciHBxiucXkAWy1Go10uuKInA9p6DO0vt mf0t/c1b98p/BNRiM0uKP1nVNdSS3QrZ+bSUaS+YOoPkifXAYoLA+Uep3hGJo6cuBl8Q VTEQ== X-Gm-Message-State: AOAM5305RE+/fRP1DiIwDwCUwRX+EYPptfVxgDw2VgVufp0deLal9CkH iOl2AbogRgkTW88QrkgIrUe5xw== X-Google-Smtp-Source: ABdhPJwIIMRByfFDC9PEkqbmBmEq9WJaV1/eH41kjs4NzrfJHJET0n2wdRr8mzaIg072U6SNEL6Rnw== X-Received: by 2002:a1c:2394:: with SMTP id j142mr4316840wmj.42.1608137448646; Wed, 16 Dec 2020 08:50:48 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n12sm4016619wrg.76.2020.12.16.08.50.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 08:50:46 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B8DB11FF7E; Wed, 16 Dec 2020 16:50:45 +0000 (GMT) References: <20201215224133.3545901-1-ehabkost@redhat.com> <20201215224133.3545901-2-ehabkost@redhat.com> User-agent: mu4e 1.5.7; emacs 28.0.50 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: Eduardo Habkost Subject: Re: [PATCH 1/2] test-char: Destroy chardev correctly at char_file_test_internal() Date: Wed, 16 Dec 2020 16:50:08 +0000 In-reply-to: <20201215224133.3545901-2-ehabkost@redhat.com> Message-ID: <87o8itsniy.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Paolo Bonzini , =?utf-8?Q?Daniel_P=2E_Berrang=C3=A9?= , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Eduardo Habkost writes: > commit 1e419ee68fa5 ("chardev: generate an internal id when none > given") changed the reference ownership semantics of > qemu_chardev_new(NULL, ...): now all chardevs created using > qemu_chardev_new() are added to the /chardevs QOM container, and > the caller does not own a reference to the newly created object. > > However, the code at char_file_test_internal() had not been > updated and was calling object_unref() on a chardev object it > didn't own. This makes the chardev be destroyed, but leaves a > dangling pointer in the /chardev container children list, and > seems to be the cause of the following char_serial_test() crash: > > Unexpected error in object_property_try_add() at ../qom/object.c:1220: \ > attempt to add duplicate property 'serial-id' to object (type 'cont= ainer') > ERROR test-char - too few tests run (expected 38, got 9) > > Update the code to use object_unparent() at the end of > char_file_test_internal(), to make sure the chardev will be > correctly removed from the QOM tree. > > Fixes: 1e419ee68fa5 ("chardev: generate an internal id when none given") > Signed-off-by: Eduardo Habkost Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Previously I could get a failure within a 100 runs so I think the soak test is good ;-) Results summary: 0: 1000 times (100.00%), avg time 2.256 (0.00 varience/0.00 deviation) Ran command 1000 times, 1000 passes > --- > tests/test-char.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/test-char.c b/tests/test-char.c > index 953e0d1c1f..06102977b6 100644 > --- a/tests/test-char.c > +++ b/tests/test-char.c > @@ -1298,7 +1298,7 @@ static void char_file_test_internal(Chardev *ext_ch= r, const char *filepath) > g_assert(strncmp(contents, "hello!", 6) =3D=3D 0); >=20=20 > if (!ext_chr) { > - object_unref(OBJECT(chr)); > + object_unparent(OBJECT(chr)); > g_unlink(out); > } > g_free(contents); --=20 Alex Benn=C3=A9e