From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC725606A322 for ; Fri, 4 Dec 2026 00:59:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=XQJx8K1b; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tcAOU0kF Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9FC4561BFD; Fri, 4 Dec 2026 00:59:08 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qO_Sl2fLIprF; Fri, 4 Dec 2026 00:59:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org E0F4D61BEB Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796345948; b=HZQfLPypnwZxXpcOa34mMsx/7Zha7yLdDwtZcJhdXZSTw+yXsmGZ++UNw3K9OmaikYan XtpDhHBQ5XckS+gMmh6ib+lXktoxdDgDhB84/UqUO1ESLlyG0QYoAwfMMu3dHDS1y6FZH 1Hps+WaBoaUT9+K+h+yVxQ0kTjSYnrOXHk7EJP8O0A2is3D3gv/bfu+hXaexqFKf44RM/ r0rCQkPuXMkMSGYlhiTAgjlLV1m/5l5j/eNIRg0zUXs48mGaadjtj+FEk/kzxPM5XYk18 4OIaxuQyrU9LfaY6Prizxco+2efghB63UV1shIaGQOe5dk2F2qxHblE6Mu2G175QGCg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796345948; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Mailman-Approved-At:X-BeenThere:X-Mailman-Version:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help: List-Subscribe:Errors-To; bh=HC1ioJkfYwO3GKLOTMRiiEAGfpr3tYObwa217bTXKCg=; b=BfMdoGScVn1PoAZKInPHvXlKgNLtg5dz9sj+XKpcvuLmsUO+IdtRA5zbad52+6/83la6 EZ3vEnOpeHI2VPAW19Zl0isGl3mTzKlhN49+MPyGXN+lCeCK332Mhp5nRQvcakIJEMmBp 9KeiLn9Yg2j9PNU59tqDepSMX9HdTPdSEEk5D42k/7vGMITRRmvQs60tXZSB6SYvsl7Rb SwccGYSiRkd70w5NdzejOn3Oe0qCf8bd4JvIWardNXITQkLML4+dMP3FC9fCfEJJ0a2k5 pj4JQhKMRoh+NcntrIW2BWVnZTF7/jemGnh893gllMXkksVBzFMOjjSrqO3Y0HE/WbA== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796345948; bh=HC1ioJkfYwO3GKLOTMRiiEAGfpr3tYObwa217bTXKCg=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=XQJx8K1bzN8wlXP2ps9PoY92Q1S359wgIbnQBIdvKs19j0hpiJuOiWZFyTm8kUxj3 Sv3oddYN2LtXoiv2PmSKuYafJ/d8eY8eoAe+j0MYYRi4FYZYhRluZPUsA79OPSaA57 /4ZAUgQ2bI2R0775Z+hgMYfRyHA9p3dbGOVtC7VSFU4MVb7feJUVuD28LEHK2iFh6+ v++NHmvW9lAYcJIIYHQGp/e8jwUdHlFCFLoVSCwJSaU2IHwb0Juyo+rAWfhSqynv7x 7KDn28Qw5Fj91a33A8JPcbsB+QsEnXgNVtf5RrlMzHDno5D87gtIeZcJ2hhAXIR6mD 4/CYTnBVb6jGA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id E0F4D61BEB; Fri, 4 Dec 2026 00:59:07 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 92D2D2FF for ; Thu, 3 Dec 2026 22:32:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 84743864D3 for ; Thu, 3 Dec 2026 22:32:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id hg86iymnodZd for ; Thu, 3 Dec 2026 22:32:53 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 2D81886105 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip="2607:f8b0:4864:20::32e" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::32e; helo=mail-ot1-x32e.google.com; envelope-from=oss.patchbox@gmail.com; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tcAOU0kF Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2D81886105 for ; Thu, 3 Dec 2026 22:32:51 +0000 (UTC) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-8633b750a12so65145a34.2 for ; Thu, 03 Dec 2026 14:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796337171; x=1796941971; darn=lists.u-boot-project.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=HC1ioJkfYwO3GKLOTMRiiEAGfpr3tYObwa217bTXKCg=; b=tcAOU0kFnF2l1vKFY3pDyJguyVKEcTncVwnfbEHCM5JA++TO2j+c19uqM6i4iUShFY xkBc023Mxkga7c70G5IZFN35E3UqBR2Gn4mZ8wDvfk2nLVeQqVkrnnAsYUasiGL3vKMD nGmf51O7RQoPHQ95+2AKNpeBWaszaJd3u19TiPpuzvGSW4bCS+t3HivnaCMACF6UcQFo Dhxc8N42j5R1q1pSVIj20Ui5muPQJIXtgGTVDjntwtDndmhN1jtYPDsM4Fjc9qMeOdHv 4p+je2ESofpiQYnQZzp52Y12Sw+8y/5MvaMBrK7ZR7YGpTU/xGRmTTw1OgrtMz2g6nP+ 7FDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796337171; x=1796941971; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HC1ioJkfYwO3GKLOTMRiiEAGfpr3tYObwa217bTXKCg=; b=rq4KRTlP0azU+/5eDWhL7JbbwrugFJeFWuTsa9xRxsA8dv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wszgX0SGWy0XmEbLuXNO0NSHsX8PEjv5JWczGMbC/ncKog2i0WJAv2pZuoX5jLv fUffO2Dp47xgsibywaHhX5IzAtEM2IIgMBNcnm5qKYN08CK6a0uKHnPiuKMEvcmjoS4XsVShnsZ KU+RicQfc8+F6VWWVRE6SOhofD5DgMo/0pfHX+tbQaY8aTzMDCijNtqTB9jKdPvnq2OA= X-Received: by 2002:a05:6830:90b:b0:822:978:f7bd with SMTP id 46e09a7af769-863f89e357cmr253332a34.28.1796337170835; Thu, 03 Dec 2026 14:32:50 -0800 (PST) Received: from tempest-testimage-cc-centos9-stream-server-1191361818 (chi-dyn-129-114-108-164.tacc.chameleoncloud.org. [129.114.108.164]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-863f8313e75sm311835a34.18.2026.12.03.14.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 14:32:50 -0800 (PST) From: Yuho Choi To: Tom Rini Cc: Francis Laniel , Anshul Dalal , u-boot@lists.u-boot-project.org, Yuho Choi Subject: [PATCH] cli: hush_modern: fix use after free of argv in pipelines Date: Thu, 3 Dec 2026 22:32:43 +0000 Message-ID: <20261203223248.2332373-2-oss.patchbox@gmail.com> X-Mailer: git-send-email 2.56.1 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 04 Dec 2026 00:59:05 +0000 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 run_pipe() frees argv_expanded after each command but does not clear it. In a pipeline such as "echo a | echo b", the next member then runs with the freed argv and frees it a second time, which corrupts the heap. Renesas R-Car boards use the modern parser, so typing a '|' at their prompt is enough to hit this. Clear the pointer after freeing it, as the non-U-Boot path does. Fixes: 74e425407f1c ("cli: hush_modern: Enable variables expansion for modern hush") Signed-off-by: Yuho Choi --- An LLM helped write and run this reproduction test. Tested on sandbox (origin/main d1caced3a43) with only the modern parser enabled, as in renesas_rcar.config, running 'echo first | echo second; echo after': Before: with UNIT_TEST: "first", then "Unknown command '' - try 'help'", then "common/dlmalloc.c:816: do_check_inuse_chunk: Assertion `inuse(p)' failed." without UNIT_TEST: the second member is a garbage command name, and U-Boot then hangs until the sandbox watchdog fires (3 of 3 runs) After: "first", "second", "after" in both builds. 'ut hush' passes (22 tests) before and after. Pipe members after the first are still run without variable expansion; I left that alone, as U-Boot has no real pipes and the old parser does not run them at all. common/cli_hush_upstream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/common/cli_hush_upstream.c b/common/cli_hush_upstream.c index c01ba00e475..f2406df5c31 100644 --- a/common/cli_hush_upstream.c +++ b/common/cli_hush_upstream.c @@ -10349,6 +10349,7 @@ static NOINLINE int run_pipe(struct pipe *pi) * argv, we need to free it. */ free(argv_expanded); + argv_expanded = NULL; /* * We also restore command->argv to its original value base-commit: d1caced3a435607435cb7969e34499051a4ac1e6 -- 2.56.1