From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.2196.1663383219882918845 for ; Fri, 16 Sep 2022 19:53:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=VAglbGKo; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663383219; x=1694919219; h=from:to:cc:subject:date:message-id:mime-version; bh=wCVlkfIYprsUNOs3mJ54viEgKqQSUeRWAr9cDoFQOgE=; b=VAglbGKoNJ/MlXt+nCgiW1o0lINOTDv7kpYl1GuetlCYm+aHcD3wxpOL iMUGBswmsXTYKZK0xlpmIM8OSDeTAMp70x8v8eyRhgZGkjiHrPqVZawah SHPZy2ed5MeVtMBbk4TGSVsUrtbpeGneeVzKAebYHTDKqCQUgt+o2pOTd jnVkNrIwli0RUg4N3ZPO+V85q+mCCwIOGKs9olcyRopiKyyQRG0/10AKY +ePQGmM9tjvIL72bPeL4j7TnO+2IiK367zKJu7Ky0oGrmeRNFM79yajgZ WqUXNu7/+sGF7xr7Em/qZdk98xidQHUBE/F6o/UGQnNsjGKl/g0zEXDIK w==; X-IronPort-AV: E=McAfee;i="6500,9779,10472"; a="325396110" X-IronPort-AV: E=Sophos;i="5.93,322,1654585200"; d="scan'208,217";a="325396110" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 19:53:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,322,1654585200"; d="scan'208,217";a="686352996" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga004.fm.intel.com with ESMTP; 16 Sep 2022 19:53:39 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 19:52:23 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 19:52:23 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Fri, 16 Sep 2022 19:52:23 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Fri, 16 Sep 2022 19:52:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QA09UThaTLlg2bBmKmWlP1Cic2npBTQma+TiKdDxgRBn/F9REIV91cQeHFDpkoDRwWVN53qFAMuGQ+ZcQxyXQrorhHufZaA7+AGQbyN9eqxHZXly07AdysE33tmkjiRoBm1U18cGZPDXJ0F7F2HkX59hImCK0IU/tsER9yi8M0gKAc6FFSxlvkpThKqAKcmp4tXncJ3LPFzxca4gLZ4b8Gpo1ZTblyJqFEK9BzgBcqEPIQ0QWoUYLhwPh7YC7tT2z+VA+GYDDVT7yTJYl8ajWaWIbYpopwzMfPPzkZxDXQJtAhgmBTcOQS6ZhytsRvzhXUWKKgaokZILjPtEOlc/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y4CEggt1j7oyY++heig6U85gs0/RzB3yC9OjINRRxso=; b=JOKKPWXmtO5bNPNknF/xiQFUsvWk8XNUjW0WYTeeCFqR7Q7yVzyIEU1O+v8J0jkWmlas9AdSXYoR96YG7leXULe+tuME/Hh9mZiF4WuVa4+LGppISb/OHy8v1JNlPzGh/Z6leo0C4i6qKGgWOGW1iPQM01TYO7QUmShMb0Qw0OfvWlZzHA0+NL2j1d/cjRZYPWALLikJcr11BPh27hidlP2cyaGMamijy1QLxUJ1z4AVF240SAYc6pmWoVlR7+QP+NIgXwsmPRNylLTVoj+w420NVUWwnmgeJ9R92batPN7/Kywl06wUduIV4MqfnznG58Dy/6Fw94huWfzYRSDzoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by DM8PR11MB5656.namprd11.prod.outlook.com (2603:10b6:8:38::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Sat, 17 Sep 2022 02:52:19 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ec3f:8428:41d6:3284]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::ec3f:8428:41d6:3284%4]) with mapi id 15.20.5632.017; Sat, 17 Sep 2022 02:52:18 +0000 From: "Min Xu" To: Ard Biesheuvel , "devel@edk2.groups.io" CC: "Aktas, Erdem" , James Bottomley , "Yao, Jiewen" , "Xu, Min M" , Gerd Hoffmann Subject: measurement to command-line/initrd for loading kernel via -kernel option Thread-Topic: measurement to command-line/initrd for loading kernel via -kernel option Thread-Index: AdjKQCUJCucPSYUVRCu0arGCE/7NLw== Date: Sat, 17 Sep 2022 02:52:18 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR11MB5064:EE_|DM8PR11MB5656:EE_ x-ms-office365-filtering-correlation-id: da475a1e-04d0-4db4-f8ce-08da9857a29f x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: xSHpkLkbPREj0Et67JIQ6l+xY5DQ3QNlsujXFeDLjOEH6C3xMQaH203Yc5XI8gxxQGLiqAgnS1eE7QqnSGxd7efM6L1g2fIkqILPCI7AvWeSaNoWD+/LgmGGybAEncGqDc4hH11yXQI0G1KIm+KA/505f8hhXYCq5xcptnThs5EzN3gGgTxU4YXgZkG1lVoI6uDhtrAbM5rBTzCkU0c1kwf+7DuHMUIly5OXpoKrB/3ORw3Grz/R9iBXqi4WRid3RIKyd/TGPvnSCo6HoJIRjhRs/2NFgu7mtJZsGcJUVav2iyw992lwsruB5ArIXHOBjG5B4P39upaBP8Rb9ptOE7UKPjoZAxI7BvBKmsYVH5csgcgwctBaQpagtM1L2AY2HRJz6AvYp/fNdlBQJ/v2Ma8CzCSV6XyO5IXcPsFXehcS3HmKMOviklA2YDhL51ttH4VGoAs2ca1Uw9AUpEWuWxHPEBqpyY3r98XxbgleYbKmNa2j4Oes46d/ADENYl+1q/5qvBx29FE+Vn4B06pXLqoQJPLf2q8LjeAZjYfEHMnlBnZns8iEjxC7nYY52EIRK7rsUJdstf8caYpJ9I8rsruy1fykxgraIhocWcsunyoRN6tUETmDR7knN7n8WY1ghFTRguQ/9CI09axQ2n5I0CS211qdMuPVpj31GOFKP8VbiZDNtkCT7h2E4E05a8q2/oV5f+Ju3EG+t9elQQMw83kwqjM5ziFANB/iOZkAiv1HhWLexmbUQmn5iH+Uh21QU7xIr+T2Z4DJ8D5nA5nhjE6prRyfyo8INq9Sk4yzu9I= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(366004)(136003)(39860400002)(396003)(346002)(84040400005)(451199015)(4326008)(186003)(38100700002)(166002)(83380400001)(82960400001)(38070700005)(122000001)(2906002)(5660300002)(8936002)(41300700001)(52536014)(55016003)(478600001)(8676002)(71200400001)(26005)(6506007)(9686003)(966005)(7696005)(316002)(76116006)(66446008)(54906003)(110136005)(66476007)(33656002)(66946007)(66556008)(86362001)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?PXQz9QAWwT180PusFJ6b2C1L6ycLhBHCzo0exF2rLwQp/v/4rrrZV/u+4+Z+?= =?us-ascii?Q?KMkNruqWdT3FiqFV1QKzjjCzHmJVYxSIYjAWKKebomJ/4zW8KU5UfLR78AU9?= =?us-ascii?Q?YxRww5b1JyWL4d3NxsuqbStdB/XhOrdbzBtAjogYDMIIzZqo9T7xa0gEyJTJ?= =?us-ascii?Q?MxDAa3k34iR4QeUDXQAbnpLDNEH5Zsu2xaiQ0+4lHTDwl9PkAa30zWiREsbp?= =?us-ascii?Q?nWyErwV5s3cS0vCanSETQlSlSsUP0ycdZOZyrVmo/YWtM/+88QfuPJ6Lf4oY?= =?us-ascii?Q?fen7ov+HxVUVFFplzowK4OgOSDRZuHlZqCLsf89/QxbiEFRCM8QNZah2NEeM?= =?us-ascii?Q?xtmUJZmZmbLHKw0MgnJ47fgENWt9ha0jct3/3wJ6BTFD8DJqMWvDQn1MV9M6?= =?us-ascii?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xoJ4pMcb5Ezhs7wzHGAViXCA?= =?us-ascii?Q?L0hj7By1G8K7hwLP10I1TgmSnh4vWGiAqDps/6J5sq6dk2gRAyYLQiLarU/R?= =?us-ascii?Q?/hzlWS+Qr0acE+d6WpGzaqokxMrDCfjjsQi5KreDURMHdBchojMc8DplXkwI?= =?us-ascii?Q?+EcMYOa+tQn2BeJVT8XG9bMgk/Ti5sBsJptJNr93plQOZlDH+PisvGNu2q81?= =?us-ascii?Q?0BIcNyF2QP3O3dyupgKwAbt6Fz3SGQpMqTTZT1YV642TgR7EkyT+/vKK6Ofp?= =?us-ascii?Q?gjxwcvVo3/9wBNybdBIyakWBL7hDnfC+Lp5mAWDZ?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: da475a1e-04d0-4db4-f8ce-08da9857a29f X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2022 02:52:18.4159 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: PV8UZTvb0kiqBGRvl0bkh8CWeSyunQtWV/KzQeYtga4wh6Gl+CtSMtd2kdaO+szU7eprCNBIeBwmHYnOxwu3Cw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5656 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_PH0PR11MB50644F564BA1A112DF60D44EC54B9PH0PR11MB5064namp_" --_000_PH0PR11MB50644F564BA1A112DF60D44EC54B9PH0PR11MB5064namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Ard I am checking the measurement behavior when loading the kernel via the QEMU= -kernel option. I find it is implemented by below 2 driver/lib: - OvmfPkg/QemuKernelLoaderFsDxe This is a separate DXE driver that exposes the virtual SimpleFileSystem im= plementation that carries the kernel and initrd passed via the QEMU command= line. - OvmfPkg/Library/X86QemuLoadImageLib This is the library that consumes above driver and call LoadImage/StartIm= age so that the kernel image gets authenticated and/or measured. See https://edk2.groups.io/g/devel/message/55381 I have some questions about the implementation need your help. 1. In the QemuKernelLoaderFsDxe, AllocatePool is called to allocate memory.= Why not call AllocatePages? Kernel image size may be around 15 MB, but ini= trd size maybe much bigger. 2. Kernel image is authenticated and/or measured in LoadImage. I am wonderi= ng if "command line" is measured as well? "Command line" can be treated as = an external input and in my opinion it should be measured too. 3. The same question to initrd. Is it measured? Thanks Min --_000_PH0PR11MB50644F564BA1A112DF60D44EC54B9PH0PR11MB5064namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi, Ard

I am checking the measurement behavior when loading = the kernel via the QEMU -kernel option. I find it is implemented by below 2= driver/lib:

- OvmfPkg/QemuKernelLoaderFsDxe

 This is a separate DXE driver that exposes the= virtual SimpleFileSystem implementation that carries the kernel and initrd= passed via the QEMU command line.

- OvmfPkg/Library/X86QemuLoadImageLib

  This is the library that consumes above drive= r and call LoadImage/StartImage so that the kernel image gets authenticated= and/or measured.

See https://edk2.groups.io/g/devel/message/55381

 

I have some questions about the implementation need = your help.

1. In the QemuKernelLoaderFsDxe, AllocatePool is cal= led to allocate memory. Why not call AllocatePages? Kernel image size may b= e around 15 MB, but initrd size maybe much bigger.

2. Kernel image is authenticated and/or measured in = LoadImage. I am wondering if “command line” is measured as well= ? “Command line” can be treated as an external input and in my = opinion it should be measured too.

3. The same question to initrd. Is it measured?=

 

Thanks

Min

--_000_PH0PR11MB50644F564BA1A112DF60D44EC54B9PH0PR11MB5064namp_--