From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.18130.1583170313101466765 for ; Mon, 02 Mar 2020 09:31:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dsWHVvUh; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583170312; 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: in-reply-to:in-reply-to:references:references; bh=VBHj/79P3MEnidyJ6gHe/U05Z9R4m3jAiNdgHZz8jas=; b=dsWHVvUhiqsubV9qLmcvJLIpYf1B0snMxM4KwV+c7yAD7Gb5eYfXcHdhpFKvJ8uIlTOgHd DpVwQGEFGhasNc6Bc8S7PqmjNT0CGLUNvU5lq2pZXwC98ZMBVtosYEzJ1AW93rb+NKI340 Ju4ph6H0VvAGcC495TFBLnvigsRUVMo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-472-1agEZz3GNMmfcUooPcV0eA-1; Mon, 02 Mar 2020 12:31:50 -0500 X-MC-Unique: 1agEZz3GNMmfcUooPcV0eA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C1F6280269B; Mon, 2 Mar 2020 17:31:49 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-197.ams2.redhat.com [10.36.117.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15C4060BF7; Mon, 2 Mar 2020 17:31:48 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 07/13] OvmfPkg/QemuKernelLoaderFsDxe: don't expose kernel command line To: devel@edk2.groups.io, ard.biesheuvel@linaro.org References: <20200302072936.29221-1-ard.biesheuvel@linaro.org> <20200302072936.29221-8-ard.biesheuvel@linaro.org> From: "Laszlo Ersek" Message-ID: <7e67006b-cbd0-9b5c-62f8-2eaca7821bbd@redhat.com> Date: Mon, 2 Mar 2020 18:31:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200302072936.29221-8-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 03/02/20 08:29, Ard Biesheuvel wrote: > We have no need for exposing the kernel command line as a file, > so remove support for that. OK > 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. Not sure why this matters, but I don't mind. However: > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2566 > Signed-off-by: Ard Biesheuvel > --- > OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c > index efecbd817da1..b8d64e2781fc 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 (Blob->Size)); (1) EFI_SIZE_TO_PAGES expects a UINTN, but KERNEL_BLOB.Size is UINT32. Please cast the argument. > 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,7 @@ QemuKernelLoaderFsDxeEntrypoint ( > while (BlobType > 0) { > CurrentBlob = &mKernelBlob[--BlobType]; > if (CurrentBlob->Data != NULL) { > - FreePool (CurrentBlob->Data); > + FreePages (CurrentBlob->Data, EFI_SIZE_TO_PAGES (CurrentBlob->Size)); (2) Same as (1). > CurrentBlob->Size = 0; > CurrentBlob->Data = NULL; > } > With (1) and (2) fixed: Reviewed-by: Laszlo Ersek Thanks Laszlo