From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.web10.33860.1679921413322708037 for ; Mon, 27 Mar 2023 05:50:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=MjjuqItV; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: quicinc.com, ip: 205.220.180.131, mailfrom: quic_llindhol@quicinc.com) Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32RAM665012648; Mon, 27 Mar 2023 12:50:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=qcppdkim1; bh=cXDnr6/2XnBQr4AXKyoF7Q9J7wzzXiQ2ukcCHo5mQyo=; b=MjjuqItVbmDqcoO8Q5+BRODQs4XdkhxgtMoTGPmlLozQl/Yhx+G0S4myI4FDLNIx/6dr 3Oc8taA8IvvA4GLalN3DxHVKwTkrdN9Xr4m4tj/wRsgULsCWCmeQYMBZaONA6Vs+c3z8 FTzkJqHwfienMiJ+IHXt20QMqVM5BdtiFnkQmXvwzEuxEcciBg6vs5Xdr+3ackc5uOhT f88Myoko5fGauO9znfghLZa2oZ+rsMY7K77QPqlhLyxTR4d3j0ylEyTC29f/Sm63aI0E rUZo58CQDQ06/u7NICRQA9RkdtDwLvKyXuW/fnR3uUUIQcOxbFSdR4TdCu1v05ZZBWyn sw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3phte8c9e6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 12:50:02 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32RCo0JF020408 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Mar 2023 12:50:00 GMT Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 27 Mar 2023 05:49:57 -0700 Date: Mon, 27 Mar 2023 13:49:54 +0100 From: "Leif Lindholm" To: , CC: Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Sami Mujawar , Taylor Beebe , Marvin =?iso-8859-1?Q?H=E4user?= , Bob Feng Subject: Re: [edk2-devel] [PATCH v2 01/17] MdePkg/ProcessorBind AARCH64: Add asm macro to emit GNU BTI note Message-ID: References: <20230327110112.262503-1-ardb@kernel.org> <20230327110112.262503-2-ardb@kernel.org> MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: gCA1enI9Yn26P_VwSWIHteOL98_qbMbQ X-Proofpoint-ORIG-GUID: gCA1enI9Yn26P_VwSWIHteOL98_qbMbQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-24_11,2023-03-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 mlxscore=0 bulkscore=0 spamscore=0 phishscore=0 mlxlogscore=815 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303270100 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Mon, Mar 27, 2023 at 14:46:49 +0200, Ard Biesheuvel wrote: > On Mon, 27 Mar 2023 at 14:45, Leif Lindholm wrote: > > > > On Mon, Mar 27, 2023 at 13:00:56 +0200, Ard Biesheuvel wrote: > > > Implement a CPP macro that can be called from .S files to emit the .note > > > section carrying the annotation that informs the linker that the object > > > file is compatible with BTI control flow integrity checks. > > > > > > Signed-off-by: Ard Biesheuvel > > > --- > > > MdePkg/Include/AArch64/ProcessorBind.h | 31 ++++++++++++++++++++ > > > 1 file changed, 31 insertions(+) > > > > > > diff --git a/MdePkg/Include/AArch64/ProcessorBind.h b/MdePkg/Include/AArch64/ProcessorBind.h > > > index abe2571245c665f3..11814f1ffaef698a 100644 > > > --- a/MdePkg/Include/AArch64/ProcessorBind.h > > > +++ b/MdePkg/Include/AArch64/ProcessorBind.h > > > @@ -186,6 +186,37 @@ typedef INT64 INTN; > > > #define GCC_ASM_IMPORT(func__) \ > > > .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__) > > > > > > +#if defined(__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1 > > > +#define AARCH64_BTI(__type) \ > > > + .ifnc __type, ;\ > > > + bti __type ;\ > > > + .endif ;\ > > > > This didn't jump out at me until looking at the consumer side. > > This overlays two different sets of functionality depending on whether > > an option is given to the macro or not, which feels semantically > > suboptimal to me (i.e. it makes my head hurt). > > > > Could we split this into two macros - one that inserts the instruction > > and one that inserts the note, and expand the latter in the former? > > > > Yeah, fair point. > > So AARCH64_BTI_NOTE() to emit the note, and AARCH64_BTI() to emit the > instruction as well as the note. Yeah, exacty. > > >