From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web08.8023.1624973460977232642 for ; Tue, 29 Jun 2021 06:31:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Nr4gkoqf; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624973460; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B2PIvUfs3D0apow1C3/ql1uLoaKXkIOb4DSk+xq6v2Y=; b=Nr4gkoqfnH/+vl5g95VD/q4a4Sz3KK898h4JKla+UAwXn3D8aF7K+CtkGvLujcVQ6sPuiP rEvW1K5LWuFskeNq4zvLQ0z96lsGdlgXxIIubOTVGp5UcxQoM0tznwY3PRDcJ2SrLp5Lc6 +r+jSFEzULsToOVkRv/XL3hwXHZbeKs= 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-227-T0J0qp3BOPWfpTDsVkCLdA-1; Tue, 29 Jun 2021 09:30:56 -0400 X-MC-Unique: T0J0qp3BOPWfpTDsVkCLdA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 364DB1023F41; Tue, 29 Jun 2021 13:30:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-158.ams2.redhat.com [10.36.114.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B71B660583; Tue, 29 Jun 2021 13:30:53 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v3 0/5] OvmfPkg: Use QemuKernelLoaderFs to read cmdline/initrd To: Dov Murik , devel@edk2.groups.io Cc: Ard Biesheuvel , Jordan Justen , James Bottomley , Tobin Feldman-Fitzthum References: <20210628105110.379951-1-dovmurik@linux.ibm.com> <65d9fc4d-998f-1b94-4d79-1ff9df26c93f@redhat.com> From: "Laszlo Ersek" Message-ID: Date: Tue, 29 Jun 2021 15:30:52 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 06/29/21 15:03, Dov Murik wrote: > Out of curiousity, I wonder regarding the leak fixes -- is there a way > to see that the fix works? Is there some accounting of used pages that > we can check that decreases after the fix? You could try a UEFI memmap comparison, but the cmdline is a pool allocation, not a page allocation, so I don't think the difference is noticeable in the UEFI memmap (the allocation is really small, so it is likely satisfied from one of the preallocated "bins"). However, in DEBUG and NOOPT builds of OVMF, FreePool() should actually wipe (part of) the freed area (with the PcdDebugClearMemoryValue=0xAF byte value), and then a double-free would trigger an assertion failure (signature missing), if I remember correctly. See the CoreFreePoolI() function in "MdeModulePkg/Core/Dxe/Mem/Pool.c", in particular the signature checks on top, and later DEBUG_CLEAR_MEMORY(). Thanks Laszlo