From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by mx.groups.io with SMTP id smtpd.web09.9059.1583315570933353310 for ; Wed, 04 Mar 2020 01:52:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=NouqVSTZ; spf=pass (domain: linaro.org, ip: 209.85.128.65, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wm1-f65.google.com with SMTP id e26so1152508wme.5 for ; Wed, 04 Mar 2020 01:52:50 -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=NouqVSTZrmQflQ801NHGsVDFfUNMDeHThchic0opAYFGUqHePrxY+zeAAHA0/OS8M9 VePGXL8lr0mJCFWrfIVCKMf8SXUwC057w6EF+LhYf+8F2kBe0+2UWi25yJEnePmumzBo 0f8KJaNLG/Y/45MiI1nmOiMfrcGoVFnfl6hBqAoPm+fn66ibvFV/WArsdwgvUgL22AnB J/EEOKkFWgugHPpbjuwV3GPJ3j8GGcUo/iUWit/rdsSCT32GML3eT5DRwqLaBmE/NxsZ nw9EccxfWwQGsbVQWTMaloga2gRkjHzrmXKdcBMaVw1O3np75C7u+4lpxQ99EHjqigyI Nlcg== 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=cKtHlAsSKw8qe9RT/E24h8tw62c2LjaYhuXA6dpToQ5rVTUHD5Tmule6ZQAYB+7BBV 8qy9uVHvBEYpcwyVvZdeuDSSbDaB8UhPbQ1SPz4Fk/n1wJhrmB37bsmcbsFgWO+Gqle/ VAgiTM6C3kG/6COrNEvheV4EYL+iLM42Df93S5e6+WZwZAn62iTohaHNeT/8tJ+ipWEa H534KEaighoqNJVVX88NrB5F2bpVIpC2FcRz/nYPNpGq8gbhrK19tPB4unfnh0rU3EEd LdfQb0ujbsa5m1kOADPkXTfK8BihxR2NtQrpIOS/TfIG+PzJ1X0C9ftx6WXpQTR1nOW6 5rJQ== X-Gm-Message-State: ANhLgQ2G5ZeQYbbd3+KxJfIh5Fi6OdyzAKw0g3LSNurhMimt1LI05Arl dZcLLEDIFe5zLpjuNNkfrtxduuxFkZ09NA== X-Google-Smtp-Source: ADFU+vvhcrV+U0HHLi7zJondMQCPvxkOppilJmICThMOHgyJ73aYQBX/6//64hBBOGjKpM4NY0DNTg== X-Received: by 2002:a1c:c2c5:: with SMTP id s188mr2798354wmf.162.1583315569190; Wed, 04 Mar 2020 01:52:49 -0800 (PST) Return-Path: Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id v16sm20781095wrp.84.2020.03.04.01.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 01:52:48 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: lersek@redhat.com, Ard Biesheuvel Subject: [PATCH v2 07/14] OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line Date: Wed, 4 Mar 2020 10:52:26 +0100 Message-Id: <20200304095233.21046-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200304095233.21046-1-ard.biesheuvel@linaro.org> References: <20200304095233.21046-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