From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by sourceware.org (Postfix) with ESMTPS id 8EFB33858C5E for ; Mon, 28 Nov 2022 03:35:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8EFB33858C5E 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-yw1-x112d.google.com with SMTP id 00721157ae682-3b56782b3f6so92928317b3.13 for ; Sun, 27 Nov 2022 19:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JLqXSVoCqq5gi6fJqymH5WTXJejP5R85KTFAVfQzmrk=; b=DeN9cc6nlHVZvc92CxUg5RXZY0RdNpw7V2kToZobKeHlAuAsBCSbX4ANNscgzOXEh2 bPtgY2kTAcAaMMiUyjXYDKoPCWXTi7sf/H13rL1JZlgrJUdJP8gEhJHTzOY/PZridkwO LddfOUsLMSWWiBx+tc6dmpb+sqgs+RChP/WUpyu9ODnP4qs1j89n+uN8FQS5rnaKYeAw EJ6dV1KWo9A6zBlg8JrNFnQTYaXQdbUyiHWveLDN4Eu+FiB/thbEo7W237jgudfu9kZe 52nFdD86Ol6VZ9115BVhhnhm8I8tEuzwE4FSKw3wRlDo9ETiupB8utRQ1ct1/rpRDyEW 47TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=JLqXSVoCqq5gi6fJqymH5WTXJejP5R85KTFAVfQzmrk=; b=V5DX1eb4k4zy+FT7NGLwbTkjFdr7hqpmeK/I5eGK8G944ceK/xh/TbXOTYusE/2dcR goX8j1pA+V/zUNLuMvCuaUQuvP41eXxz8mVS9xFYbWkC4c0K7Rng5VRcP/2YM6KZ3e1c ongklKQvfyGrmYe09BLDBNLhk7Fie+Ho5ACkOuQU+T+QedUHcuj5gSMvvMZPH/Yk8td9 8wH4LlAXrWQ+YXdJWRD3K/TxdhRRN/SpSXTuyQbNvNuj5w0kJMKeelh7txICyYGInctd QNw0RNf1ars0AOAbegeWb9ZMvkNwHPPg322hUEgPAq7zF+O8P/yisGNrSEvwypOkNlVz Zozg== X-Gm-Message-State: ANoB5pmaTFwGEevzhM/JaT0ZfFn3EOfHldQJneUMsIryHOIZEzz6cSh1 A366h3jCzfoj5nn1n7XEnprb3BhvZ0Bzftj+fMQ= X-Google-Smtp-Source: AA0mqf7OVASbExPdfBkxTw47WdEzXAjYnJHMXd3iaqRhy9F1YekQJemMHTPRMThzu7avOmZOlUsE8ahrhNbWVIxolww= X-Received: by 2002:a05:690c:c81:b0:368:4707:a61a with SMTP id cm1-20020a05690c0c8100b003684707a61amr30849643ywb.344.1669606547938; Sun, 27 Nov 2022 19:35:47 -0800 (PST) MIME-Version: 1.0 References: <20221111012631.76776-1-hongtao.liu@intel.com> In-Reply-To: <20221111012631.76776-1-hongtao.liu@intel.com> From: Hongtao Liu Date: Mon, 28 Nov 2022 11:35:37 +0800 Message-ID: Subject: Re: [PATCH 0/2] Support HWASAN with Intel LAM To: liuhongt Cc: gcc-patches@gcc.gnu.org, hjl.tools@gmail.com, ubizjak@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.5 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 Fri, Nov 11, 2022 at 9:26 AM liuhongt 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. > > [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? I'll install 2 patches if there's no objections in next 7 days. > > 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(+) > > -- > 2.18.1 > -- BR, Hongtao