From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by sourceware.org (Postfix) with ESMTPS id 37A5A3858D28 for ; Tue, 29 Nov 2022 02:11:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 37A5A3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-12c8312131fso15417083fac.4 for ; Mon, 28 Nov 2022 18:11:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=pK8izT+/8w6pXEV0+II0S39RwjyODm+NFYyPM/YDMiw=; b=VvfGEC+L0RMUfXS5fK3qXHIB6+NGL/IFZBmPbJHSYTJOzsfPifxIOdH9FfZUXUvbS+ aNYJQdD/+r99Q1e5ZTgF1HeHQhcICKFkCZSUIEwNllMlkHudBJKkREaH8E/76hvfeVWk Ust3ZGQ1Fo2jUfwsR9GAGtf1XHYX4p9oDFTL+pms0et4VzuEWDpF2eCFeDWaNYdHVG0a 1WncDixHkX72+sA+iDPJbstcEkHm/ys6hcy3fbD6xz7ugTXi+DPEAmzpwZIgDX12zEf+ OtGznOXwU6AI7BBBnWWwvSoSCHyZ5EqeH/zw1yX1AzDCZ2yQD19S0OASfg2uWGIVFU6y Fvpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pK8izT+/8w6pXEV0+II0S39RwjyODm+NFYyPM/YDMiw=; b=AeXdZ/oNVhoo7t8r0Xgb9eyACiaH47RRbPmMlJR67LrR3/VQYpcgVhYqOta5ucZMcx FeOb0rMx4nza0ZF9YnZxz1Rg+x7uuqRNfbRS/gvBrmI68dBhQ73mwwwzTn+rArqmM5hS c1Ad8hPN4eWwQ+c3rgt03X1AQCtS4ZVW9ygvSYRFeRO/rxzo15Ec5i9EiJLxqQ3Mh1l5 3YHI21v8C50KpCU/JuSPE4OT0ocm62UDdsWHTLkh5398CYsxeOpj2AebP52hqiZoBN1e JnqcoaHJz8xNEXMJcYN3IH+Umwo15v4TP5o0Gb70bh04DDvXh8c0okbnKJqVQZOH2HmK U1+w== X-Gm-Message-State: ANoB5pk0urZaymUkNSqms0cJVwkTod+PGoihEdA+7yx88LEWQ3fw0tyg EDIfDmLN6P7P583cHmw2QSPqnBIBPMz5Y9BSrDA= X-Google-Smtp-Source: AA0mqf6wEHe3kmYKkDVYwSEt+uN3E/3Zl7WR3pi0XSQpl5PNE9XNo5gcW/1VHz8juVCZwovA5cdJikVATgm4MipwNNI= X-Received: by 2002:a05:6871:4501:b0:13c:5da4:7229 with SMTP id nj1-20020a056871450100b0013c5da47229mr24280519oab.266.1669687873563; Mon, 28 Nov 2022 18:11:13 -0800 (PST) MIME-Version: 1.0 References: <20221111012631.76776-1-hongtao.liu@intel.com> In-Reply-To: From: "H.J. Lu" Date: Mon, 28 Nov 2022 18:10:37 -0800 Message-ID: Subject: Re: [PATCH 0/2] Support HWASAN with Intel LAM To: =?UTF-8?Q?Martin_Li=C5=A1ka?= Cc: liuhongt , gcc-patches@gcc.gnu.org, crazylht@gmail.com, ubizjak@gmail.com, Florian Weimer Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3016.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham 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 Mon, Nov 28, 2022 at 6:40 AM Martin Li=C5=A1ka 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 s= everal > > target hooks(Many thanks to their work) so other backends can do simila= r > > things if they have similar feature. > > Intel LAM(linear Address Masking)[3 Charpter 14] supports similar fe= ature with > > the upper bits of pointers can be used as metadata, LAM support two mod= es: > > 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 re= ally > > 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 d= evelopper'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 =3D=3D 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? Since there are no clear usages for these LAM bits, we can leave them out for now. > 4) Can you please explain Florian's comment here: > https://gitlab.com/x86-psABIs/x86-64-ABI/-/merge_requests/13#note_1181396= 487 > > 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(+) > > > --=20 H.J.