From nobody Tue Jun 07 14:23:33 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 092E37CADE5; Tue, 7 Jun 2022 14:23:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LHXdx56hsz3rHc; Tue, 7 Jun 2022 14:23:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654611813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9jvjkv5xe/jtcK47sTjq8rgkRhEuNQQ/OziZSA6wmnw=; b=CeWBTfaNi18HKZD7763yy3zztlO6L0Bs+HcT/HqaJe29lXtEDh+9ZWhIzokLHBf2NwKfgi dVbbLa856NSD7yOApkfogV94Z2ZsuqM/s77z3EiaLRX99iPOdo86yhjdG5/nSz3IVXZeyi zBBI+/WtXqxIy5Xt020/FX347iqmPlcrKGqGk/wfDOobWpj6cuez6+ZKMJRA91/FjlHhAd eCS/DxabyxwAIPRhx8o/pz0sgzNTQfT8+y4uAumBv4oO99Mi1SBbit/vE3ohfDHqqTgLdL /SgxztPkrYEmg4DghvM21lEWZ/5J/XK9Z+JHVrZzeUiwSIBO21FYgrgltF6P9Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B4821C7CE; Tue, 7 Jun 2022 14:23:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 257ENXFS020380; Tue, 7 Jun 2022 14:23:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 257ENXqS020379; Tue, 7 Jun 2022 14:23:33 GMT (envelope-from git) Date: Tue, 7 Jun 2022 14:23:33 GMT Message-Id: <202206071423.257ENXqS020379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: e7219c3818d1 - stable/13 - Set mm before passing it to the UEFI firmware List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e7219c3818d1554830555278a32934c9fb4e7ac3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654611813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9jvjkv5xe/jtcK47sTjq8rgkRhEuNQQ/OziZSA6wmnw=; b=L0yTyHpD2fhYpkvf0mdpJUO5zZ7dIr8uZg8VYUnc8B/wLMeFt9Yu4XWxI6yoW5/zTLDj/y 5nr8S66/2VDVeTvPZt2O7mmSwVbaWwfafd3OmHkvd9FcG+DjouygU6rpWFhh6DcAPA9mtc m9Dj3lhtV6Doiv6m+5HaVYgOUUdWQYiGRCHi7ROtJapycy5MhSEIjAxe6NKoc//X0Bw3mu e7KRR6To8Skm4x6OO4zcOYTnf0trkHHhfas8BFPR3paq5c6LZvC8LhKs9sXIuvK74Yexuy INrgPFB8ysLbE3rvs5xmOAlmRbTMKPOo3zJcRTHkkPaTdQz+6ZRuHaNw6zhmMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654611813; a=rsa-sha256; cv=none; b=Nz94o5jV37VIpLaHFmFtCqllIe9zTTN+n69PeUMeEEyNYSsCfGWdNKwmJzC2AU4SI4AfMv VYgqzhDLFJh0SCLLeQPE4/McPkdf4PRO53c0QYa/ZPOkdasQHoNIl8FYywrYFF2mghsFF0 /L87q0/L1Nm4GZ3ZWF7+/7pOtOYo6uab+E7vvq584I9LjVVa8GJ6MLf8G3Wuxw/h6cc2zK cAApN6UUUaPr3jeVEBDEq/PU4/uMjW3vtkw+NZ2RRYujylwh6VBCmGyl2aybdA663LlVKZ avu3wBCbzdRyRRpX97g1LtXPXF5s0UJ9YKATMZy8eiZY+CBNzmYGvKSyKJgdjw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e7219c3818d1554830555278a32934c9fb4e7ac3 commit e7219c3818d1554830555278a32934c9fb4e7ac3 Author: Andrew Turner AuthorDate: 2022-05-21 10:45:41 +0000 Commit: Andrew Turner CommitDate: 2022-06-07 14:20:18 +0000 Set mm before passing it to the UEFI firmware When reading the UEFI memory map we pass in a pointer to the memory to hold the map. Unfortunately it wasn't initialised before the first use so clang decided it was undefined behaviour so the entire loop was removed. This leads to everything in bi_load after this to also be removed as dead code. The next function after bi_load in the binary is efi_copy_init. The above caused us to enter efi_copy_init with a return address of the start of the function. Because of this it would enter an infinite loop of calling the function, allocating memory, then returning to the start of the function. PR: 264021 (cherry picked from commit 0d6600b579be769b85f049ef421023316f21b5c3) --- stand/efi/loader/bootinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index bf98105eee93..92ca220e2bf9 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -350,6 +350,7 @@ bi_load_efi_data(struct preloaded_file *kfp) */ sz = 0; + mm = NULL; /* * Matthew Garrett has observed at least one system changing the