From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 E49DD1DC997 for ; Fri, 5 Dec 2025 13:45:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764942347; cv=none; b=PGFIossCf54wsxuKa5/2qpJ/ojn70Y3tqYAtCpzzLl1/C1zTztyy6gNDDHgBe8VhSgojawaT9/e9i4V2pZcMtK6eAylHUPO60U/StCvhHnHS05wwGG9yySBwm4aFcsAaRyQc9a8690FLvspXfLn/bBYfO3xSIDV3XhIQFbBgAlU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764942347; c=relaxed/simple; bh=J5IY+w5+XXEbm4ihZJtAyvqcEp8ETGb53aWX4wTe59I=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=l+RKe6LtCzvhnRfDe+XcgfURpe4h2uRFAlqXcjvweAoF9EfiK97cal8IqORc3v8jKD5YmEdS41/E2wtiyqsXTIjEO3VflwJkjFoDO8LtcMEC1TSS+Ku6o2oDkm087z8MZY0nofDm91Lks+j91TM+tJ+e+6zrkTwCQcNewbnYJJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=W2RWH2A+; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=iqb9OoTw; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="W2RWH2A+"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="iqb9OoTw" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5B5AjeeW3136982 for ; Fri, 5 Dec 2025 13:45:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 3sl8Rjg+GpX/yS2Dz6T16538XX/lIJ0ynq5UJxUVvk8=; b=W2RWH2A+SBkAWlZQ 7nYMJwmcmBg1D2pVENp8s6uIp+oHboyEu0Xoe3JxDUwmq2+xxwtzGwB14ZdKMeFl uLKzDsh+vO0Iyo+gt/nmE2RItg3XnpDyanwziDWzW/AJH+3Rz7ryvbO/E7Pwrw/K gwtqAYPzrCuyI9AYHHOrhWnw72LIsjiDLDrAc8NpUM7zAnbDMWHLLB0BgYy4zPt5 VSl/2AUpm+YSac9fycLbJkEMfabCEH4poh2cL9AUca40sWRA5ZdocjfhfyCOvVTg l7JTxbnmdWCOwH9+3Xj5UlT7ZFk7YyAci/6CcS1VBJhJhn5ewLy/ESOzW4JfVpl9 lGUOjA== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4aupa8ss7g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 05 Dec 2025 13:45:38 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-29d7b9e7150so18782215ad.0 for ; Fri, 05 Dec 2025 05:45:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1764942337; x=1765547137; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=3sl8Rjg+GpX/yS2Dz6T16538XX/lIJ0ynq5UJxUVvk8=; b=iqb9OoTw+6zk6k0PAEosKPwUWNWFBKD3mkE5Ca6lZrjPO3E/MLFzJfVg89TTpTq0gI DrUr3RBn+Ww2Prey5EpKjdD+HOEiJjKPk9jyAaFGaqvRbY8fRVNNttYZW1gDrXN/Zd3L QmgGHtyP5PqTCWa3wW/h/rTnuyxdpMFv15TyctJdIsC7EWKJaU1ooKSMDFq5OmJBgvPj vTnNeWOoeavp3FB/tMrs3S8gazCBnj9uRAgln4D8YAAzLkaabUIo4fZZskMmG7odKMOZ CxKjyJRS1/Npl7RqLlR+6r704tsvqh8Cthh4hvyjXKFIyeHwjd7CWYXcPHld7r+e+J/d ubZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764942337; x=1765547137; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3sl8Rjg+GpX/yS2Dz6T16538XX/lIJ0ynq5UJxUVvk8=; b=rw4mzouue7Lwx/iiBBESWM/gO78Y/41ZKqF5oghR1cKvryDA+j6rnxFWJM6ePzicn+ ZiebzBA/dyXdVNlLVNgtzsL6w8+oNVU0DuD0UzU8NZC9UzEaIhmoNcI+TyVIRYqkuuZ7 qMqZI9JL87DbDnPN6D/ugUO4BDDoWIEAoD2LS7O0SRjKMxdoUHHXPgn+bhQsZgysAS2j icE8oeEgf9UKv3pa5dteD0BH2BP1R9tGpsvMvT1hKwEgGVm9kmjszexs7Y2JXURznDOg RjtufNngc+IpS0NH2VFCw9ogkZlrSfgsDVhCeFQbaui77v4+dCXF4PwDvEnP6KlYC1jY lGfA== X-Forwarded-Encrypted: i=1; AJvYcCUtn6D22Z4rOlRNRFbUNoRlm0mu0IHuLDhebVIBTYRPlYJiPlT9DrclNQpYSjLkREhXtmj7grvDjir37CE=@vger.kernel.org X-Gm-Message-State: AOJu0YzXFzfCS2ViCJen8lb8jBToE8xfHO8tzWarXQLqZ+qVRqkql2Ly 3jkcwXLgPVJTdeXzcPfl5Stqd4hWyqN25flEYc6SeMgU3rawnZEqMvHYgKdnPDDbHY0K9wUJl5L t55pF1+rxN5Owjedb14C5EzWL57mqIByZjdh+D2I1p5nzF3/myA8pCPFejR/TNgUegjo= X-Gm-Gg: ASbGncu5fGcx88cu1Ay6qAIeJSaOoCfz7sprHNo2JvfadrjopOQRxxuxG3vm4oGMQGN xtQFzHAXi9WX9t28fcwmWLxel5Sakn8cHPaGpyjUZKbXI7dcQvrsaJVvwmhk8CLLbMU83DE8cLz 9eO7K/1uG6RY8yjuwZS6/m1GMgX6jyEN8QG/44620s2uxh116SKZno2Wq1rqg+o/kj5pPQfVvj3 KeslzVBRDwU9E0D0v9ZLIeqv1ohb/Iri1zuYcEcsVOPKU4X1y9RdRJf9dsfJujMGjENXTY0J1jY 7+dboGUoZmL9Zxwf+ush/y/zCYvsGQNMwJZSt5+Bnl25uDpvZDvOqUY2DNf0fMV09c1cPOjCC6b qYvQOJppZTfb0Xs/AADS9171LufTV0D8= X-Received: by 2002:a17:902:fc87:b0:267:a1f1:9b23 with SMTP id d9443c01a7336-29d682f2fd2mr118720015ad.18.1764942337141; Fri, 05 Dec 2025 05:45:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQItCN2pv1meTC+2kJm5EbTCziAT3dxjYamZYJ6XTWaTUtpDBXJSNwvI2VARxGJQ3jjTIVAg== X-Received: by 2002:a17:902:fc87:b0:267:a1f1:9b23 with SMTP id d9443c01a7336-29d682f2fd2mr118719575ad.18.1764942336600; Fri, 05 Dec 2025 05:45:36 -0800 (PST) Received: from [192.168.29.116] ([49.37.148.233]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29dae99fa59sm50494375ad.58.2025.12.05.05.45.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Dec 2025 05:45:35 -0800 (PST) From: Harshal Dev X-Google-Original-From: Harshal Dev Message-ID: <45b5f14b-3746-4b05-a4b4-dc9f88e89e52@oss.qualcomm.com> Date: Fri, 5 Dec 2025 19:15:26 +0530 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] tee: fix tee_ioctl_object_invoke_arg padding To: Jens Wiklander , Arnd Bergmann Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Amirreza Zarrabi , Sumit Garg , Arnd Bergmann , Sumit Garg , Alexandre Ghiti , Etienne Carriere , Randy Dunlap , op-tee@lists.trustedfirmware.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org References: <20251204101730.1036671-1-arnd@kernel.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=ZqDg6t7G c=1 sm=1 tr=0 ts=6932e202 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=v+kbWGyw1T97G6+vs1uYIQ==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=-jCBhvvmAAAA:20 a=VwQbUJbxAAAA:8 a=xFIYUFTxM1JpX5VCbgAA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjA1MDA5OCBTYWx0ZWRfX4lqRRKyQuLpn UN4JOe2u6MSweEnZCTnxqiT6cLL0iEh7onOXLZD7BKSv428Uj671SLyIipzpnR8dos1YtSngV9G bVHF0oJB0kfnzkX8khDq8ddJwFsTnaobZ2N5KQ0suGnRB38SdPhVjS8Zh3e5C9gpWmHXeoPzLI/ Q3dpErYDidhrWqRN4kvm+58h+54iFHaOTalQiJqD0/X34rBWunLaDdVzvJ3C0duwIr5IVVBfc3G 7sWI/GynPOCBqXEng+FPHxXc9kce1ej45Ug/h+h+BsHyfXM1qGB2yQmYHkbxoyxWbun6DfXhF3g WGoRoKwJaBt0KKJKesTuCX0ByGMZiMuzy1oIiUQIutWTNBu9sIeaw3yJDbnIkFe9tucfJ9N8UlS 4pYCqnDjlUJAYCwh7KhsUCfnf5iXlg== X-Proofpoint-ORIG-GUID: qpLh-yTVPOUfRFcwTeRTxw8I3d241XyM X-Proofpoint-GUID: qpLh-yTVPOUfRFcwTeRTxw8I3d241XyM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-05_04,2025-12-04_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 clxscore=1015 phishscore=0 spamscore=0 bulkscore=0 impostorscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512050098 Hi, On 12/4/2025 6:57 PM, Jens Wiklander wrote: > Hi, > > On Thu, Dec 4, 2025 at 11:17 AM Arnd Bergmann wrote: >> >> From: Arnd Bergmann >> >> The tee_ioctl_object_invoke_arg structure has padding on some >> architectures but not on x86-32 and a few others: >> >> include/linux/tee.h:474:32: error: padding struct to align 'params' [-Werror=padded] >> >> I expect that all current users of this are on architectures that do >> have implicit padding here (arm64, arm, x86, riscv), so make the padding >> explicit in order to avoid surprises if this later gets used elsewhere. >> >> Fixes: d5b8b0fa1775 ("tee: add TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF") >> Signed-off-by: Arnd Bergmann >> --- >> The new interface showed up in 6.18, but I only came across this after >> that was released. Changing it now is technically an ABI change on >> architectures with unusual padding rules, so please consider carefully >> whether we want to do it this way or not. >> >> Working around the ABI differences without an ABI change is possible, >> but adds a lot of complexity for compat handling. > > This is currently only used by the recently introduced qcomtee backend > driver. So it's only used on a few arm64 Qualcomm platforms right now. > > I think we should take this patch, but let's hear what others think. > > Thanks, > Jens > The only user-space client which is currently using this ABI (as per our knowledge) is the libqcomtee library: https://github.com/quic/quic-teec/blob/main/libqcomtee/src/linux/tee.h#L432 If I understand Arnd's concern correctly, if a compiler used to build the user-space client skips the padding for tee_ioctl_object_invoke_arg, it could lead to issues. Let's wait for Amir's view here as well, however I do think the explicit padding would benefit here. Regards, Harshal >> --- >> include/uapi/linux/tee.h | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/include/uapi/linux/tee.h b/include/uapi/linux/tee.h >> index cab5cadca8ef..5203977ed35d 100644 >> --- a/include/uapi/linux/tee.h >> +++ b/include/uapi/linux/tee.h >> @@ -470,6 +470,7 @@ struct tee_ioctl_object_invoke_arg { >> __u32 op; >> __u32 ret; >> __u32 num_params; >> + __u32 :32; >> /* num_params tells the actual number of element in params */ >> struct tee_ioctl_param params[]; >> }; >> -- >> 2.39.5 >>