Received: by 2002:a05:7208:3188:b0:7e:5202:c8b4 with SMTP id r8csp869149rbd; Fri, 23 Feb 2024 06:11:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWfT+c0k2tQte0uEwrPheOO7hUQAaTbqgjw+3IV9uSeLl2qw9YOVc9ptlFO3h3LAorMgvWtCB1AqOZ/143WlQlfsmkGkECRGuf6ep1qlg== X-Google-Smtp-Source: AGHT+IF8RVLyKtUwPm0Bw+kuIhbvJxrUTMztYnOLeXJmU9h2ycNesUuFRrBMv0chPBjXoieEyWUy X-Received: by 2002:aa7:c693:0:b0:565:3a6b:9825 with SMTP id n19-20020aa7c693000000b005653a6b9825mr1245885edq.18.1708697506809; Fri, 23 Feb 2024 06:11:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708697506; cv=pass; d=google.com; s=arc-20160816; b=jtbK5UwiYywqYf4LEguIHpMJpPegVoTXG5TX4t4HApU4YZQcr4/1BXbWrYUTezgmBT RjRePDi/2ns59lyeLODHQPxm/jzohFKK/FktkY7Lll4de/vkNSJfoJQSI+ZFzK3ea+EN O44NK7VDlWoaTSlddL4ZEF27Z3yXSdmzmBs6swKqF6jlphgnNAWCDXLRLbzReeN6CFxp bik7DCVbosHckfrqykwPnffGAp8wM/QuYI0BHfMX9bTh+fcxP0IhDUrxvz8fIpbCvM3K 0LtpRVvhIsrvHTMzX2Sz4xaJpLKv+UjymUs55wd3dkMRXzTbvYRzLYIao7gz/YXZAvxc 3uEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=BtiOK7zNGmf7T/HNpNbS7LRFrHlD65J1Nz54bRzladI=; fh=7i/BVvZve9ANVdDALq7VnhylqhcsEeA/wHd5WNYuAfU=; b=CxtFv4wwYo0T9xmiXQ6vY9LUb/JPWplFO3/XGz1nOH5XNVH/tIE3UFFyaDJr4Ks0U1 mlyyv1MIlxMEPEvuj3cGPBt734e8730oGBaAZGJVEVvgtrJj8ZxGjJ/4m34Eh724vJLi 4M33NTFjf+cvdpKN3cUDDWYAfrkZlHoIXR4RmgQW4xs+zrZb7TyytshDTyHWjtVPDqlq wUPjJheiJldNzs5IA+SxHW6WfKu1a+LM45LXITxqMv546it+DUDXswhR+p2Spsbf37UU YjWc9uJZvhW99hHXGi2dAoh7eBnOZDN8kKiDz5oeppR9PSeKANpGp+wOS8oSuXxZt0Ow UjTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=pCt+DOqE; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-78449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u4-20020a509504000000b0056459db288dsi5069315eda.277.2024.02.23.06.11.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 06:11:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=pCt+DOqE; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-78449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 547171F2287A for ; Fri, 23 Feb 2024 14:11:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6A9E6FBF; Fri, 23 Feb 2024 14:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="pCt+DOqE" Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 749937FBD7; Fri, 23 Feb 2024 14:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697490; cv=none; b=WIgD21VCmEFguy8hPY2zd6obNV72mV4hK46JuytjXNnIBGRUnOu1SomYSpenOPHL8nRqQilhSkCR5x2wcjWG/087r8vFKDMTmDWn1w1QPFjXJULxc2C+7Q/fQ8m5g0h9cyKnDnoGGaj5toPmLec0X0INShM33VSrGOlXQljQzlE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708697490; c=relaxed/simple; bh=lrm5L7yNNJvaTYZvuDy4wqTrXSwaAHUq7sLAbGr3+9k=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=K0AxdcJUm7+AWTSh8Pk2GWgH50KrAj7Phjjwa8siNZJAb/+PIJdKlsoRf6jSaG3OgVWNXtbMcuSh2fmio4FFcfwkmDYl7kdmAYPFuMhIwgJjHouzv0FgQqi5c1SrOkKrpZ7Ar9M443340IQ9lWia117Ibysg3HJvpMqfphBxs0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=pCt+DOqE; arc=none smtp.client-ip=185.132.182.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41N8C67k012818; Fri, 23 Feb 2024 15:11:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=BtiOK7zNGmf7T/HNpNbS7LRFrHlD65J1Nz54bRzladI=; b=pC t+DOqE5VNZYO1AF14Au2IruOE4S9FDoF3BkLNh6k7+/2X+Bh3XFjyzpTbA0vfw14 ifnMSoqHxO1FGhffD86z63Plq+2shAbSKNSowLIt6Qbpka9JNoTzso30Z6SfpUi4 qXaMFYNisKMw26zDwOwgHrfFmPvcNFwIPzLNocjYeGP+H+qlc3XzQ6iDLkaQKzs7 sy8cykZ2WEd3fv2IZA3DPogrIZCRZFyD4/L3hhXmhDNFpKLxiQ0hvF5e84TiuMyW mpKsALRzc1TtPDGwScf8zSk82JETDKV2i8kdg2P/rD00vgSAQtNRN9IoifuF9bUC GnUqi1WSAfTz2AZFYpTA== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3weqn41faw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 15:11:07 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 464FF4002D; Fri, 23 Feb 2024 15:10:59 +0100 (CET) Received: from Webmail-eu.st.com (eqndag1node5.st.com [10.75.129.134]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D0DB42A14CB; Fri, 23 Feb 2024 15:10:05 +0100 (CET) Received: from SAFDAG1NODE1.st.com (10.75.90.17) by EQNDAG1NODE5.st.com (10.75.129.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 23 Feb 2024 15:10:05 +0100 Received: from [10.252.31.57] (10.252.31.57) by SAFDAG1NODE1.st.com (10.75.90.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 23 Feb 2024 15:10:04 +0100 Message-ID: Date: Fri, 23 Feb 2024 15:10:03 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/7] Introduction of a remoteproc tee to load signed firmware Content-Language: en-US To: Naman Jain , Bjorn Andersson , Mathieu Poirier , "Jens Wiklander" , Rob Herring , Krzysztof Kozlowski , Conor Dooley CC: , , , , , References: <20240214172127.1022199-1-arnaud.pouliquen@foss.st.com> <8af59b01-53cf-4fc4-9946-6c630fb7b38e@quicinc.com> From: Arnaud POULIQUEN Organization: STMicroelectronics In-Reply-To: <8af59b01-53cf-4fc4-9946-6c630fb7b38e@quicinc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SAFDAG1NODE1.st.com (10.75.90.17) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-23_01,2023-05-22_02 On 2/22/24 10:55, Naman Jain wrote: > On 2/22/2024 2:17 PM, Arnaud POULIQUEN wrote: >> Hello Naman, >> >> On 2/22/24 06:43, Naman Jain wrote: >>> On 2/14/2024 10:51 PM, Arnaud Pouliquen wrote: >>>> Updates from the previous version [1]: >>>> >>>> This version proposes another approach based on an alternate load and boot >>>> of the coprocessor. Therefore, the constraint introduced by tee_remoteproc >>>> is that the firmware has to be authenticated and loaded before the resource >>>> table can be obtained. >>>> >>>> The existing boot sequence is: > >>>>     1) Get the resource table and store it in a cache, >>>>        calling rproc->ops->parse_fw(). >>>>     2) Parse the resource table and handle resources, >>>>        calling rproc_handle_resources. >>>>     3) Load the firmware, calling rproc->ops->load(). >>>>     4) Start the firmware, calling rproc->ops->start(). >>>>    => Steps 1 and 2 are executed in rproc_fw_boot(), while steps 3 and 4 are >>>>      executed in rproc_start(). >>>> => the use of rproc->ops->load() ops is mandatory >>>> >>>> The boot sequence needed for TEE boot is: >>>> >>>>     1) Load the firmware. >>>>     2) Get the loaded resource, no cache. >>>>     3) Parse the resource table and handle resources. >>>>     4) Start the firmware. >>> >>> Hi, >>> What problem are we really addressing here by reordering load, parse of >>> FW resources? >> >> The feature introduced in TEE is the signature of the firmware images. That >> means that before getting the resource table, we need to first authenticate the >> firmware images. >> Authenticating a firmware image means that we have to copy the firmware into >> protected memory that cannot be corrupted by the non-secure and then verify the >> signature. >> The strategy implemented in OP-TEE is to load the firmware into destination >> memory and then authenticate it. >> This strategy avoids having a temporary copy of the whole images in a secure >> memory. >> This strategy imposes loading the firmware images before retrieving the resource >> table. >> >>> Basically, what are the limitations of the current design you are referring to? >>> I understood that TEE is designed that way. >> >> The limitation of the current design is that we obtain the resource table before >> loading the firmware. Following the current design would impose constraints in >> TEE that are not straightforward. Step 1 (getting the resource table and storing >> it in a cache) would require having a copy of the resource table in TEE after >> authenticating the images. However, authenticating the firmware, as explained >> before, depends on the strategy implemented. In TEE implementation, we load the >> firmware to authenticate it in the destination memory. >> >> Regards, >> Arnaud > > > Hello Arnaud, > I think now I got your point. In TEE, you don't want to do anything(read > resource table) with FW images, until its loaded and authenticated. > Since current design was not allowing you to do it, you had to reorganize the > code so that this can be achieved. > > Generally speaking, in current design, if authentication fails for some > reason later, one can handle it, but it depends on the implementation of > parse_fw op if the damage is already done. > > Please correct me if this is wrong assumption. That's correct. Regards, Arnaud > Patch looks good to me. > > Regards, > Naman Jain