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 71EA73845188 for ; Mon, 28 Nov 2022 14:40:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71EA73845188 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 4D28821B23; Mon, 28 Nov 2022 14:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669646450; 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=VUNIB+zqxloC6DkNR2a2XIP87uDlJy/BqlMocDhFc2k=; b=XBdijO+g0sTsg1fpVKT3aNbE2Lykd8gH7Req8dyDihZusT24AW+XCAOwyO8Oh/yBXbp9YP j6A5tM5IeLUvQ6+UHuSwmwM0vv1Bk/KBWgcZAmS2K3XJSCyc1nCb4W+0jgdFLIpgU2vyzL nSLYBQxPVUWcO6mjJfeXovF8kVWdKXU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669646450; 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=VUNIB+zqxloC6DkNR2a2XIP87uDlJy/BqlMocDhFc2k=; b=hWVYGBzQF4E625cUYtS8TCZDz02uruznCKFaa+aI/X/iYeFE294YyX1yAs3mV7JC+eH/ep LEn3NMjI84vAAWDw== 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 2B1D81326E; Mon, 28 Nov 2022 14:40:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IzOJCXLIhGNTLgAAMHmgww (envelope-from ); Mon, 28 Nov 2022 14:40:50 +0000 Message-ID: Date: Mon, 28 Nov 2022 15:40:49 +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: liuhongt , gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, 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: <20221111012631.76776-1-hongtao.liu@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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/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 2) the description speaks about bits [48-62] or [57-62], can explain why the patch contains: + /* 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(+) >