From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web10.12695.1583415980443440111 for ; Thu, 05 Mar 2020 05:46:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Oh2UyNpQ; spf=pass (domain: linaro.org, ip: 209.85.221.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f67.google.com with SMTP id 6so1664127wre.4 for ; Thu, 05 Mar 2020 05:46:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SRqztSxFLwD+9oQO01D50QoC+lWiEAqyatg6dIP8qpU=; b=Oh2UyNpQCe/eDKfNVpkiTfEPS1NV4ulEXfTfoCu9dL+Gu90HLMdrBdcEduBrir2ntb a2vHTSRBnakjhcr5J5W6M1YU2sKuAAwiu9/KLIZYH37rW+P3uxckSBAwv65NqJUiIFfZ Xt9NGUjVNf5ZudyBZ9XZlxVGo4Qg1mLuC+LBextsrru8YEM46bCHYN/XWGKhf8o5olPH OOJdBUmtWEtDUCWinh5l3TugMJKr0ZTPO4J1hViOwWo45SJIpWnAixGxy2BExliz4u6O EItKbIvJKp5mYSrc9vTjnASiGouqxYhvMWDCzhDcT9uD/yR/GtsqoTdyBiWSau5Nmvr/ wnyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SRqztSxFLwD+9oQO01D50QoC+lWiEAqyatg6dIP8qpU=; b=uT8Q8Ur+EYXUVM+qubyodrdePCwqs3C/bOlR+NZzcJyq5tJWUdQyHw224u56sRtP4B Rl/cjTl7AbFzzdD63zgcOckG81o9Zf9jX7BspwbcOzA6CddE3jfacvnuLm60+mRXqtha KEfuiPg3RG8ZqijGwpb9IQyK7QguDBRKSCeGefL1boAdvJCEAXQNnVChcnrf85+6pENU 5J2WMPKNqSl+GioD/x3gwgT+1cultA2u2g8jYYb+2VkY65qJrpaEc3f22mfnjiPDxzAa 9u0nCoMWRl8EFrnVCuWOOU3y0R0X0e1UV9u9a/fj6aWEq2VJHPehmSE78eMgie0IqipO 1Byw== X-Gm-Message-State: ANhLgQ2cshOHubN9KtUkQ6pmefr+B7gIl4eCb+PZkf9/ThTbHJgQu2PH PiLLbWOGX5vLt9ZRRJLB9tIUYiFSpq9Epw== X-Google-Smtp-Source: ADFU+vsjOyWKELbvKbfRfzhTEuueP0+okyNqHGhQVXOqB73HRds8WbBEPaegxfgH47WCF0paNH06AA== X-Received: by 2002:adf:b345:: with SMTP id k5mr10912101wrd.55.1583415978697; Thu, 05 Mar 2020 05:46:18 -0800 (PST) Return-Path: Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id m19sm9278701wmc.34.2020.03.05.05.46.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 05:46:17 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: lersek@redhat.com, Ard Biesheuvel Subject: [PATCH v3 07/14] OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line Date: Thu, 5 Mar 2020 14:46:00 +0100 Message-Id: <20200305134607.20125-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200305134607.20125-1-ard.biesheuvel@linaro.org> References: <20200305134607.20125-1-ard.biesheuvel@linaro.org> We have no need for exposing the kernel command line as a file, so remove support for that. Since the remaining blobs (kernel and initrd) are typically much larger than a page, switch to the page based allocator for blobs at the same time. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2566 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c index e4539ec2fbe5..dc86a48af378 100644 --- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c +++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c @@ -30,7 +30,6 @@ typedef enum { KernelBlobTypeKernel, KernelBlobTypeInitrd, - KernelBlobTypeCommandLine, KernelBlobTypeMax } KERNEL_BLOB_TYPE; @@ -45,7 +44,6 @@ typedef struct { STATIC KERNEL_BLOB mKernelBlob[KernelBlobTypeMax] = { { QemuFwCfgItemKernelSize, QemuFwCfgItemKernelData, L"kernel" }, { QemuFwCfgItemInitrdSize, QemuFwCfgItemInitrdData, L"initrd" }, - { QemuFwCfgItemCommandLineSize, QemuFwCfgItemCommandLineData, L"cmdline" } }; STATIC UINT64 mTotalBlobBytes; @@ -865,7 +863,7 @@ FetchBlob ( // // Read blob. // - Blob->Data = AllocatePool (Blob->Size); + Blob->Data = AllocatePages (EFI_SIZE_TO_PAGES ((UINTN)Blob->Size)); if (Blob->Data == NULL) { DEBUG ((DEBUG_ERROR, "%a: failed to allocate %Ld bytes for \"%s\"\n", __FUNCTION__, (INT64)Blob->Size, Blob->Name)); @@ -969,7 +967,8 @@ QemuKernelLoaderFsDxeEntrypoint ( while (BlobType > 0) { CurrentBlob = &mKernelBlob[--BlobType]; if (CurrentBlob->Data != NULL) { - FreePool (CurrentBlob->Data); + FreePages (CurrentBlob->Data, + EFI_SIZE_TO_PAGES ((UINTN)CurrentBlob->Size)); CurrentBlob->Size = 0; CurrentBlob->Data = NULL; } -- 2.17.1