From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 3ED3E394EC0F for ; Wed, 17 Feb 2021 21:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3ED3E394EC0F Received: by mail-ot1-x32b.google.com with SMTP id o10so45297ote.13 for ; Wed, 17 Feb 2021 13:59:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aedmoCAH1lPtOGDk3IAX0eWgFnzgc8/9GlXw5qClemA=; b=eAgxA4fXDwoXDLB8/I/HtL0wJbNjJHVBfUaea8SZTgj0fb2JsxHhNZRpql9gGj+wus XTZQWCG6SlteaPRMla/k+ib0g7vDEDKmjPc1VWAwNmrLM7qZzGNT1cYkphbcs5z+whrH zMNBHAqsafXYWEUGJOjY8556O8h7UeDfLFFC/pfEVP3xxrAqJB0miBJ3YgP6CaNPSbmh HdpigpvslrUN1CekzH4htBIO15xkt5dcg13rN1Gc2sY1br6Jrg6CTWOwnd8G33GccdEF Eadg+EK3b5r3CwsCVJcQ3yYKIfw3VgUHv24pkAHKNETrHBzSdNMoHNORL5H23DAOj4ig qLvw== X-Gm-Message-State: AOAM532SwgzBKfAT9d+7Ks6S/U+atZuNjgd2cbtJ19EbQY8kKns8NdhM SEEtjvVqOAhmWaUSgcB1pc5mNPAwO48WzAeS18g= X-Google-Smtp-Source: ABdhPJwZqOFa3QqAOXH1RRcgnDKiJ1a+Dmw2YdJLfFXBO0S38FcQVU4tWbAHgUcEeGHkxaDY/hST/sr2qqY0DzvDpiE= X-Received: by 2002:a9d:bcb:: with SMTP id 69mr837039oth.269.1613599152586; Wed, 17 Feb 2021 13:59:12 -0800 (PST) MIME-Version: 1.0 References: <20210211173711.71736-1-hjl.tools@gmail.com> <877dndmxj3.fsf@oldenburg.str.redhat.com> In-Reply-To: From: "H.J. Lu" Date: Wed, 17 Feb 2021 13:58:36 -0800 Message-ID: Subject: Re: [RFC] : An API for tagged address To: Florian Weimer , "Kirill A. Shutemov" , "Shanbhogue, Vedvyas" Cc: "H.J. Lu via Libc-alpha" , Joseph Myers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3030.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2021 21:59:14 -0000 On Wed, Feb 17, 2021 at 10:43 AM H.J. Lu wrote: > > On Fri, Feb 12, 2021 at 5:06 AM H.J. Lu wrote: > > > > On Fri, Feb 12, 2021 at 1:43 AM Florian Weimer wrote: > > > > > > * H. J. Lu via Libc-alpha: > > > > > > > On Thu, Feb 11, 2021 at 12:28 PM Joseph Myers wrote: > > > >> > > > >> On Thu, 11 Feb 2021, H.J. Lu via Libc-alpha wrote: > > > >> > > > >> > An API for tagged address: > > > >> > > > >> Please write a longer commit message, discussing what "tagged address" is, > > > >> which architectures have such a thing (the API should try to cover > > > >> whatever is common between architectures as far as possible - is this > > > >> meant to relate to AArch64 MTE, how does it relate to the MTE code we > > > > > > > > This API is for Intel LAM: > > > > > > > > https://www.phoronix.com/scan.php?page=news_item&px=Intel-LAM-Glibc#:~:text=Intel%20Linear%20Address%20Masking%20(LAM,bit%20linear%20addresses%20for%20metadata.&text=With%20LAM%20enabled%2C%20the%20processor,linear%20address%20to%20access%20memory. > > > > > > > > and ARM TBI: > > > > > > > > https://en.wikichip.org/wiki/arm/tbi > > > > > > Do the setters/getters change process or thread properties? > > > > On x86-64, mask is stored in TCB. TCB will be updated. It applies > > to all threads. > > > > > The interface assumes that the tag bits are uniform across pointer > > > types. I think that's not true, at least from a historical perspective. > > > > This is true for LAM and TBI. > > > > > People complained that our protection key interfaces are too slow to be > > > useful. Do we need to find a way to inline the tag/untag operations? > > > > > > > The internal interface is inlined. We can also inline the public interface > > if needed. But set_tagged_address_mask isn't inlined at all. > > > > -- > > H.J. > > Add Ved and Kirill. > Kirill raised a question what should happen when /* Set the mask for address bits used in address translation. Return 0 on success. Return -1 on error. */ extern int set_tagged_address_mask (uintptr_t __mask); was called in a thread. It won't work when 2 threads have different address masks. I think set_tagged_address_mask should be disallowed in child threads and in parent thread when there are any active child threads. -- H.J.