Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp270868pxb; Wed, 22 Sep 2021 22:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6rgcOUzZ4LpXp60ozKWAr5Eo+CmLmUZ0SaXYNiNEHBz00IFvNA1zxg4oKAarjDQigwLST X-Received: by 2002:a05:6e02:1cad:: with SMTP id x13mr2281491ill.60.1632375417679; Wed, 22 Sep 2021 22:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632375417; cv=none; d=google.com; s=arc-20160816; b=bAUW0tQ0EeOW5cNwQ7c1tamF1v5AdqXq9Dy1zTDBuuizAIa0M1wXmYyXQKvyaCtX6J 9ywNFvO/k4Q4nd23K3Kx41HrKB7/3HblkyVDg1k2D3DQTDk96dTGdivSPr8B8/iQk/fi rUlJwLYIVXMhLJN3AMHCQ2+cd7XJnSuTwKJCTXhS16gytvCFlTcO4iZBGsGYJthfzUy6 EwMXLpFKwm4MNj+fkWrF9D8iYbFmKNwXyZY0PbZA27sULRRkRadudlPS4zQ9qeF5nptu ftCQ9fPYmwZuHNnmEVa/frtnLX8taS9v/pBqWAUbvCal0NXD3HSt8mZuUo4zYk0BQUw9 x+dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1X6LECpSC8sOgZ2IPShM8TcXogbm9qgnqSa48C/9ums=; b=unLxO9k1DsM15l74Ja7n02ywmt50GEN/fZNgtXC8Dy++yuwroXU0b5opK2p+R66lvq 8vqPnoyLMFr2z1/+Ry7h0Xi1YHMNXHoldrfVMz06Z0O93RezEtu46VgdDpc88JyCXsuw maq9HMb1tWFTzfk9P24tWZSksXH3d+fAFGVxsbOo9DJJw+gimySH438jL8Mg0Py9udhY OfF6zZJ69jMmZKP4Jrktr8ehUns579ENl32HYonEaAPoJIOpahbiaTpXD4ZTwjUk2xUJ HaUDQQlHfKuMcNwZrtPqBXiNFczYf1r36ZeHL1ooGDXpJYXixFnvkiPskuLijZgTpvnw xhaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Xygv4l8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c5si5267571ile.17.2021.09.22.22.36.45; Wed, 22 Sep 2021 22:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Xygv4l8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239192AbhIWFhR (ORCPT + 99 others); Thu, 23 Sep 2021 01:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbhIWFhR (ORCPT ); Thu, 23 Sep 2021 01:37:17 -0400 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24D45C061574 for ; Wed, 22 Sep 2021 22:35:45 -0700 (PDT) Received: by mail-oi1-x22e.google.com with SMTP id r26so8130838oij.2 for ; Wed, 22 Sep 2021 22:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=1X6LECpSC8sOgZ2IPShM8TcXogbm9qgnqSa48C/9ums=; b=Xygv4l8wYFBY2H7zQS5hEsNS8yv5YUdVWM4iBGel+oXovkmpFoChdiosY5IUM7IRYJ jD8UrjPZZwWqlWAcTxc3gcZF15gfGNN/XwSiQct5cz4XfLCKb0cxTJZXQL9qfqK7n+78 Y9WGoyznoWQe0JODshjtqnryzv4By+phaGHbL1kI7RVQu6gtQ+YZmfr92PpHl0lhLy8I LLLrRZcOc2MaHLRyJTqkMJfmNQEqe4JVON0S8xQpi8O4v85QaZcNZqiCosdtiozHlMqq wF7h+GB3m99B97KcTUbb4jX7JDh9tVacFrPxbjlcsDR6qaJkCf1ZLFHIfAGNt1PtwQf+ wjVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=1X6LECpSC8sOgZ2IPShM8TcXogbm9qgnqSa48C/9ums=; b=iruOC3JhCfzutjLtDLK0UR7lCFeAHu8rD2CRyUjeaiS+Kg34+lXe+MlEelYVPvsaqR theihDKGNsq2h09UW/DZXh7/joLNKBF9dj7fFUG7zu9Wm+u6Qjzhd63UJLf0cXEn+1r2 aVSZ74tk/mThEQaMQrLi9IFn3pUrd2e1lW08zhM7d3Chu9nmtDqmy1hHxqFcTxzJtO4E J/X0RjUGtMgXqo7hkEHwjQ3zKfLrsO3AyjmX1JSikR0e9Bh5W2IeYk6XDrun5vCTmSV8 sWaunyNuiUBK2EIybqetNTx+rwmfjfdfxB/iAIs/dFUc0Nmtr7oRSFCPApLXDCEmaUq3 tN+Q== X-Gm-Message-State: AOAM532yt413HryD+fXpG13JDAwHDapJ1wq0y1mwxPdRjZPYo34v9B+N rP0WVPR/UBr09hwpIgUyBk0JxNJED6raQALHpClPBA== X-Received: by 2002:aca:f189:: with SMTP id p131mr11333080oih.128.1632375345048; Wed, 22 Sep 2021 22:35:45 -0700 (PDT) MIME-Version: 1.0 References: <20210205151631.43511-1-kirill.shutemov@linux.intel.com> <20210207141104.ikxbdxhoisgqaoio@box> In-Reply-To: From: Dmitry Vyukov Date: Thu, 23 Sep 2021 07:35:33 +0200 Message-ID: Subject: Re: [RFC 0/9] Linear Address Masking enabling To: "H.J. Lu" Cc: "Zhang, Xiang1" , "Kirill A. Shutemov" , "Kirill A. Shutemov" , Dave Hansen , "Lutomirski, Andy" , Peter Zijlstra , "the arch/x86 maintainers" , Andrey Ryabinin , Alexander Potapenko , Catalin Marinas , Will Deacon , Andi Kleen , Linux-MM , LKML , "Carlos O'Donell" , Marco Elver , Taras Madan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 23 Sept 2021 at 02:15, H.J. Lu wrote: > > > On Wed, 22 Sept 2021 at 03:15, Zhang, Xiang1 = wrote: > > > > > > > > There are already in llvm.org. > > > > One of my old patch is https://reviews.llvm.org/D102472 which has b= een committed by https://reviews.llvm.org/D102901 and https://reviews.llvm= .org/D109790 > > > > > > Hi Xiang, > > > > > > Good sanitizer patches are upstream! > > > > > > Please help me to understand the status of other pieces (H.J. you > > > probably talked about this yesterday, but I wasn't able to build a > > > complete picture during the talk, I think it will be useful to have > > > this in written form). > > > > > > 1. The presentation mentions "GCC: enable memory tagging with LAM in > > > x86 codegen". > > > What exactly is needed? Isn't LAM transparent for codegen? What's the > > > status in gcc? Does a corresponding change need to be done in llvm? > > > > > > 2. "Enable LAM in binutils". > > > This is already upstream in binutils 2.36, right? > > > > > > 3. The mentioned glibc patch: > > > http://patchwork.ozlabs.org/project/glibc/patch/20210211173711.71736-= 1-hjl.tools@gmail.com/ > > > Not upstream yet, targeting glibc 2.34. > > > > Do we need any support in other libc's, e.g. Android bionic? > > Here is my tagged address API proposal: > > https://sourceware.org/pipermail/libc-alpha/2021-August/130382.html Thank you, I got the large picture now. > > > 4. "Avoid pointer operations incompatible with LAM. memmove: mask out > > > memory tags before comparing pointers". > > > Is this upstream? Where is the patch? Are there other similar patches= ? > > > > > > As a side note, regarding the memmove change: do we really need it? > > > Memory regions can overlap only if they come from the same > > > allocation/base object. If they come from different allocations, they > > > can't overlap (undefined behavior already). > > > > > > 5. Do we need any additional enabling changes in clang/llvm? > > > > > > 6. The kernel patches (this email thread) depend on the CET patches > > > (for the interface part only). And the CET patches is this, right? > > > https://lore.kernel.org/linux-doc/?q=3Dx86%2Fcet%2Fshstk > > > > > > 7. Do I miss anything else? > > > > > > H.J. please upload your slides here: > > > https://linuxplumbersconf.org/event/11/contributions/1010/ > > > It would help with links and copy-pasting text. > > > > > > FTR here is the link to the Plumbers talk: > > > https://youtu.be/zUw0ZVXCwoM?t=3D10456 > > > > > > Thank you > > > > > > > > > > BR > > > > Xiang > > > > > > > > -----Original Message----- > > > > From: H.J. Lu > > > > Sent: Wednesday, September 22, 2021 1:16 AM > > > > To: Dmitry Vyukov > > > > Cc: Kirill A. Shutemov ; Kirill A. Shutemov <= kirill.shutemov@linux.intel.com>; Dave Hansen = ; Lutomirski, Andy ; Peter Zijlstra = ; the arch/x86 maintainers ; Andrey Ryabinin ; Alexander Potapenko ; Catalin Marinas ; Will Deacon ; Andi Kleen ; Linux-MM ; LKML ; Carlos O'Donell ; Marco Elver ; Ta= ras Madan ; Zhang, Xiang1 > > > > Subject: Re: [RFC 0/9] Linear Address Masking enabling > > > > > > > > On Tue, Sep 21, 2021 at 9:52 AM Dmitry Vyukov = wrote: > > > > > > > > > > On Sun, 7 Feb 2021 at 15:11, Kirill A. Shutemov wrote: > > > > > > > > > > > > On Sun, Feb 07, 2021 at 09:24:23AM +0100, Dmitry Vyukov wrote: > > > > > > > On Fri, Feb 5, 2021 at 4:16 PM Kirill A. Shutemov > > > > > > > wrote: > > > > > > > > > > > > > > > > Linear Address Masking[1] (LAM) modifies the checking that = is > > > > > > > > applied to 64-bit linear addresses, allowing software to us= e of > > > > > > > > the untranslated address bits for metadata. > > > > > > > > > > > > > > > > The patchset brings support for LAM for userspace addresses= . > > > > > > > > > > > > > > > > The most sensitive part of enabling is change in tlb.c, whe= re > > > > > > > > CR3 flags get set. Please take a look that what I'm doing m= akes sense. > > > > > > > > > > > > > > > > The patchset is RFC quality and the code requires more test= ing > > > > > > > > before it can be applied. > > > > > > > > > > > > > > > > The userspace API is not finalized yet. The patchset extend= s API > > > > > > > > used by > > > > > > > > ARM64: PR_GET/SET_TAGGED_ADDR_CTRL. The API is adjusted to = not > > > > > > > > imply ARM > > > > > > > > TBI: it now allows to request a number of bits of metadata > > > > > > > > needed and report where these bits are located in the addre= ss. > > > > > > > > > > > > > > > > There's an alternative proposal[2] for the API based on Int= el > > > > > > > > CET interface. Please let us know if you prefer one over an= other. > > > > > > > > > > > > > > > > The feature competes for bits with 5-level paging: LAM_U48 = makes > > > > > > > > it impossible to map anything about 47-bits. The patchset m= ade > > > > > > > > these capability mutually exclusive: whatever used first wi= ns. > > > > > > > > LAM_U57 can be combined with mappings above 47-bits. > > > > > > > > > > > > > > > > I include QEMU patch in case if somebody wants to play with= the feature. > > > > > > > > > > > > > > Exciting! Do you plan to send the QEMU patch to QEMU? > > > > > > > > > > > > Sure. After more testing, once I'm sure it's conforming to the = hardware. > > > > > > > > > > A follow up after H.J.'s LPC talk: > > > > > https://linuxplumbersconf.org/event/11/contributions/1010/ > > > > > (also +Carlos) > > > > > > > > > > As far as I understood, this kernel series depends on the Intel C= ET patches. > > > > > > > > > > Where are these compiler-rt patches that block gcc support? > > > > > > > > Hi Xiang, > > > > > > > > Please share your compiler-rt changes for LAM. > > > > > > > > -- > > > > H.J. > > > > -- > H.J.