From patchwork Fri Feb 2 06:40:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ekansh Gupta X-Patchwork-Id: 195625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp247157dyc; Thu, 1 Feb 2024 22:45:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqXknVNBy9IcbYKroUCiAIoWd8ohzAkM6kP//9MvRd3n0Vmo7Orh7HR996F0scd+h13wwg X-Received: by 2002:a05:6512:3056:b0:511:32b8:e352 with SMTP id b22-20020a056512305600b0051132b8e352mr2047970lfb.27.1706856338790; Thu, 01 Feb 2024 22:45:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706856338; cv=pass; d=google.com; s=arc-20160816; b=sbq2MApPaMJDKNvGf/MgOmhcfv7eVOXMDeChHcZxnYRnbNVscn/dFbBqXjsF1ADT5Q n9hLcPMidkNIqIeK9TX903INLvOrWHfoyg0jBZ9PnH2idulzpcNXLoYqD/UY8Bo6kNBK Ohfa19KcsOSR8506vmOFWCGz+j4c8RdQ44K15HXFSjIZon7iN7oGzHA1m6tLjLUMakHJ UejS48HO3zVY0XIZoITSFJUaAf+TdfSRxi9UDsJVwAVsKeO9TMfXk7/oroQgeCmzaTIm H6EEckrJ/8pBOCBlFw7rhkasL/R4DbIY8HnjSdIj0CY06f4S6iB1uq2H55SREj/j6zb9 5diA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=joizP/oCmG0LM1+iiXJ4kYTWEPaLDXDLpePwjwt1kV0=; fh=oCPWuF3E/flAshVWH2NtJqcZlrKHDgmvk57Jss/j8WA=; b=pCOhSaMkU15U6S0iq2jIS/GsDyAUBum6ektM3nfeD6Xn5jg5Crb0XxBtuT5bogBYpO lC911tgGw4xDKVBmCfYDtQ7RuvLxpQF+z6B0OLtb/o0YkSR6qclnjBEWIr/xRm4hn8wU 2ewy8ydIG8f3qjdKoNUXiIijO1Kfi9q8QInOzFd8dq4WFMI4D90F6wFLX/0bHzKPuJgt IfB1jk3b0IrZmS/JRB207rz5dZyxIb5jo6frE0GekupzqC+GnuvbZQTHQ/IUTW7FTxEG ZEcscPjj8kbkAVMCkX2gRuge65ZC73YNuddcL7hMAiqc7NNH+lpPatRSt03k7XUJjOy+ hHBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=eJ6aqHIm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-49293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com X-Forwarded-Encrypted: i=1; AJvYcCXxtckZHolSgFxhl5M3URlUmUb162n1foQSNPuCeA/bCnVHMzASsbX/5HgVCkFpAC7E0QCZPkmLKOe5tpE78fGffZ2R+w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id le13-20020a170907170d00b00a349982a383si534498ejc.751.2024.02.01.22.45.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 22:45:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49293-ouuuleilei=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=@quicinc.com header.s=qcppdkim1 header.b=eJ6aqHIm; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-49293-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49293-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.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 638B51F23EFE for ; Fri, 2 Feb 2024 06:45:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00047482C9; Fri, 2 Feb 2024 06:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="eJ6aqHIm" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 A937B481A5; Fri, 2 Feb 2024 06:41:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856088; cv=none; b=jvRGiG9imlAqpO7UpHot6urrnYUX0RKYebkjmOYOBLK/E2f/APm0Zih56LdkYfz5VMOv+sjh6ApnLzioJ+egPSIEu/PrOccmMQJHKv1grs7ID7929+3xQEK7+md3Bnr8jS/T5vyf6Hd3xJBHQ7hxSwcZlQlvRkxf2E/crMFSQ98= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706856088; c=relaxed/simple; bh=ZDnGKGfbR/v3Yx+LWz4vHfhF/MSvu7CCgdFnaeoJrQM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afUb2iRpfBuQkrP+2w4mWMSR1dulfosAdPVl35eqY65uV06rzIPh2+tjo5Xs0L8lXbbgH52M5jrjldUrFpoevrao+FEPZTLGPs3Co9j2dVq9EDXLpXJf3jgX0Gsz0eQM9sPbItp9awcdyRxZIGGGGteC5zt908syrzObGWuXm8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=eJ6aqHIm; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4124aHeJ005911; Fri, 2 Feb 2024 06:41:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=qcppdkim1; bh=joizP/oCmG0LM1+iiXJ4 kYTWEPaLDXDLpePwjwt1kV0=; b=eJ6aqHIm1IZ+4TntyRvYcDjEH6HLcT+fKvrH tXp2HOnjDOdHbkOza6lqfc3ji4jfHbgzJqPsy5ZqnvCvkkFN/rMBWRkSIIDUgF+d ahlQ9DUCneog5qj8as2WAiNiK3zrN0/nh0+UwL/1IVIefr9NwhzLFeAREs2QmIpe xDT4Ri3/7EpyeO1pH9+7mvTHQjrgOzggXYe2lU2sXS4eX+bSclZkNoEOUWa+bwWO lgWYmSh0UzPQwceL1J1PPiLlj9ahc/ae+iOb617UwlbRP4bMMQmxaX/ogK7NYi/W USFFyuDiApIQUxXcKvMxRg52w3bE6sLuVYSqpe1rxBnJHvX3YQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3w0ptu0nya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Feb 2024 06:41:24 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4126fNxW004876 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 2 Feb 2024 06:41:23 GMT Received: from hu-ekangupt-hyd.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 1 Feb 2024 22:41:21 -0800 From: Ekansh Gupta To: , CC: , Subject: [PATCH v1 16/16] misc: fastrpc: Add system unsigned PD support Date: Fri, 2 Feb 2024 12:10:39 +0530 Message-ID: <20240202064039.15505-17-quic_ekangupt@quicinc.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20240202064039.15505-1-quic_ekangupt@quicinc.com> References: <20240202064039.15505-1-quic_ekangupt@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 7oMHNIU_IpdEdGw41FrG_bnTeYlAvhMN X-Proofpoint-ORIG-GUID: 7oMHNIU_IpdEdGw41FrG_bnTeYlAvhMN 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-01_10,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 clxscore=1015 adultscore=0 priorityscore=1501 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2401310000 definitions=main-2402020047 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789768592044933952 X-GMAIL-MSGID: 1789768592044933952 Trusted CPU applications currently offload to signed PDs on CDSP to gain some additional services provided by root PD. Unsigned PDs have access to limited root PD services that may not be sufficient for all use-cases. Signed PDs have a higher dynamic loading latency which impacts the performance of applications. Limited root PD services could be opened up for unsigned PDs but that should be restricted for untrusted processes. For this requirement, System unsigned PD is introduced which will be same as Unsigned PD for most part but will have access to more root PD services. Add changes to offload trusted applications to System unsigned PD when unsigned offload is requested. Signed-off-by: Ekansh Gupta --- drivers/misc/fastrpc.c | 7 +++++++ include/uapi/misc/fastrpc.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4aa4e36bebc3..2f893c94dcc8 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2002,11 +2002,18 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, if (init.attrs & FASTRPC_MODE_UNSIGNED_MODULE) fl->is_unsigned_pd = true; + /* Disregard any system unsigned PD attribute from userspace */ + init.attrs &= (~FASTRPC_MODE_SYSTEM_UNSIGNED_PD); + if (is_session_rejected(fl, fl->is_unsigned_pd)) { err = -EACCES; goto err; } + /* Trusted apps will be launched as system unsigned PDs */ + if (!fl->untrusted_process && fl->is_unsigned_pd) + init.attrs |= FASTRPC_MODE_SYSTEM_UNSIGNED_PD; + if (init.filelen > INIT_FILELEN_MAX) { err = -EINVAL; goto err; diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h index 7053a5b6b16b..d0fb01e7277d 100644 --- a/include/uapi/misc/fastrpc.h +++ b/include/uapi/misc/fastrpc.h @@ -63,6 +63,8 @@ enum fastrpc_proc_attr { FASTRPC_MODE_SYSTEM_PROCESS = (1 << 5), /* Macro for Prvileged Process */ FASTRPC_MODE_PRIVILEGED = (1 << 6), + /* Macro for system unsigned PD */ + FASTRPC_MODE_SYSTEM_UNSIGNED_PD = (1 << 17), }; /* Fastrpc attribute for memory protection of buffers */