From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id CDC81385843D for ; Wed, 30 Nov 2022 14:07:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CDC81385843D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 08BB321B04; Wed, 30 Nov 2022 14:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669817253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O/kfu9CwhtcmJ53YI64Zju37hK//eOzECoGUuEKnHSs=; b=PVk/hNjKy7YtRk1BtkhFcdV7UZHZFpJArq0bLixMvmCYdOt7Uxnzc2YWAnT4/EVjNHsuwi Yr0RIFt204PV1glL0UXvwew0fDxFzRP3JmlA+vifHZpOCPEEJsyEvnqccJ234K9Vj7rQF6 lMZa73bNEQIi7fZDODGI/nUeYsMIlqE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669817253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O/kfu9CwhtcmJ53YI64Zju37hK//eOzECoGUuEKnHSs=; b=geOXjwxfoFZXPzhP4AOUIirRybjlpcdDNINkJNbeGqBqmn6N+HmErb57+Q+bntvkFHN1PJ SPgcbiqeJ5Mg5lCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D97A313A70; Wed, 30 Nov 2022 14:07:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l1sVNKRjh2MndAAAMHmgww (envelope-from ); Wed, 30 Nov 2022 14:07:32 +0000 Message-ID: Date: Wed, 30 Nov 2022 15:07:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 0/2] Support HWASAN with Intel LAM Content-Language: en-US To: Hongtao Liu Cc: liuhongt , gcc-patches@gcc.gnu.org, hjl.tools@gmail.com, ubizjak@gmail.com, Florian Weimer References: <20221111012631.76776-1-hongtao.liu@intel.com> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,NICE_REPLY_A,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/29/22 03:37, Hongtao Liu wrote: > On Mon, Nov 28, 2022 at 10:40 PM Martin Liška wrote: >> >> On 11/11/22 02:26, liuhongt via Gcc-patches wrote: >>> 2 years ago, ARM folks support HWASAN[1] in GCC[2], and introduced several >>> target hooks(Many thanks to their work) so other backends can do similar >>> things if they have similar feature. >>> Intel LAM(linear Address Masking)[3 Charpter 14] supports similar feature with >>> the upper bits of pointers can be used as metadata, LAM support two modes: >>> LAM_U48:bits 48-62 can be used as metadata >>> LAM_U57:bits 57-62 can be used as metedata. >>> >>> These 2 patches mainly support those target hooks, but HWASAN is not really >>> enabled until the final decision for the LAM kernel interface which may take >>> quite a long time. We have verified our patches with a "fake" interface locally[4], and >>> decided to push the backend patches to the GCC13 to make other HWASAN developper's work >>> easy. >> >> Hello. >> >> A few random comments I noticed: >> >> 1) please document the new target -mlam in extend.texi > I will. Thanks. >> 2) the description speaks about bits [48-62] or [57-62], can explain why the patch contains: >> > Kernel will use bit 63 for special purposes, and here we want to > extract the tag by shifting right the pointer 57 bits, and need to > manually mask off bit63. And thanks for the explanation. Martin >> + /* Mask off bit63 when LAM_U57. */ >> + if (ix86_lam_type == lam_u57) >> ? >> >> 3) Shouldn't the -lman option emit GNU_PROPERTY_X86_FEATURE_1_LAM_U57 or GNU_PROPERTY_X86_FEATURE_1_LAM_U48 >> .gnu.property note? >> >> 4) Can you please explain Florian's comment here: >> https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13#note_1181396487 >> >> Thanks, >> Martin >> >>> >>> [1] https://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html >>> [2] https://gcc.gnu.org/pipermail/gcc-patches/2020-November/557857.html >>> [3] https://www.intel.com/content/dam/develop/external/us/en/documents/architecture-instruction-set-extensions-programming-reference.pdf >>> [4] https://gitlab.com/x86-gcc/gcc/-/tree/users/intel/lam/master >>> >>> >>> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. >>> Ok for trunk? >>> >>> liuhongt (2): >>> Implement hwasan target_hook. >>> Enable hwasan for x86-64. >>> >>> gcc/config/i386/i386-expand.cc | 12 ++++ >>> gcc/config/i386/i386-options.cc | 3 + >>> gcc/config/i386/i386-opts.h | 6 ++ >>> gcc/config/i386/i386-protos.h | 2 + >>> gcc/config/i386/i386.cc | 123 ++++++++++++++++++++++++++++++++ >>> gcc/config/i386/i386.opt | 16 +++++ >>> libsanitizer/configure.tgt | 1 + >>> 7 files changed, 163 insertions(+) >>> >> > >