From patchwork Mon Apr 27 03:38:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 1277301 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 499VrR5dT0z9sRY for ; Mon, 27 Apr 2020 13:39:19 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=KHZ3Yhvo; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 499VrR3pwtzDqKV for ; Mon, 27 Apr 2020 13:39:19 +1000 (AEST) X-Original-To: petitboot@lists.ozlabs.org Delivered-To: petitboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=geoff@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=KHZ3Yhvo; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 499Vqf5PjpzDqV5 for ; Mon, 27 Apr 2020 13:38:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Date:Cc:To:Subject:From:References: In-Reply-To:Message-Id:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Vj8x8fjtqU88h+g5OSvbXERLoeoErgl/gxQQz43Hg2Q=; b=KHZ3YhvoDMT4JcMUSCJaKn4vgR u/Rc2fBglH9BhaoOc/HHvHxuG3eWxp2+urem1XEVxY3lZMoCTJum79tZLHI1epB8qL12qq6imYqxS JiADYbZ7Odb3L+S+WVGpCziExbsJGXEVnoEPauHIuDBzmuTuAJ/pnEwRuSfk0NExwxcuFnfNO8Ubi /0hWYTkTJRglIExTuBXHd8TIol93TBEq9KEQ1wsGOMKZEU+hd0n7k498TXTJGbYVISXaGWpxtTlBm pRk5YtSqDjUy0ZR35X81UYZWrWDUqYmJVeqQRXgaBgIML9ndrDvvMu2Fi86DAUtXcNIFIXnAML+8e p3uS1F0Q==; Received: from geoff by merlin.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jSubH-0005VZ-9Q; Mon, 27 Apr 2020 03:38:31 +0000 Message-Id: In-Reply-To: References: From: Geoff Levand Patch-Date: Sun, 26 Apr 2020 20:14:07 -0700 Subject: [PATCH v1 5/5] ui-system: Use argv for talloc context To: Jeremy Kerr Date: Mon, 27 Apr 2020 03:38:31 +0000 X-BeenThere: petitboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Petitboot bootloader development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: petitboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Petitboot" Process instances are no longer allocated using talloc, so use the argv instance as the talloc context. Fixes runtime errors like these when using the --start-daemon option: talloc_chunk_from_ptr: Assertion `0 && "Bad talloc magic value - unknown value"' failed. Signed-off-by: Geoff Levand --- ui/common/ui-system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c index 02142db..dca581a 100644 --- a/ui/common/ui-system.c +++ b/ui/common/ui-system.c @@ -47,8 +47,8 @@ int pb_start_daemon(void *ctx) process = process_create(ctx); - argv = talloc_array(process, const char *, 2); - name = talloc_asprintf(process, "%s/sbin/pb-discover", + argv = talloc_array(NULL, const char *, 2); + name = talloc_asprintf(argv, "%s/sbin/pb-discover", pb_system_apps.prefix); argv[0] = name; @@ -59,6 +59,7 @@ int pb_start_daemon(void *ctx) result = process_run_async(process); process_release(process); + talloc_free(argv); return result; }