From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF7DC28CC6 for ; Tue, 4 Jun 2019 12:28:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12BFE23F50 for ; Tue, 4 Jun 2019 12:28:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="a6FgIBxg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727731AbfFDM2o (ORCPT ); Tue, 4 Jun 2019 08:28:44 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42330 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727495AbfFDM2n (ORCPT ); Tue, 4 Jun 2019 08:28:43 -0400 Received: by mail-qt1-f193.google.com with SMTP id s15so13409509qtk.9 for ; Tue, 04 Jun 2019 05:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=piwrTztXhC39aA20VdmSLRCidVge2JjKgB3c0ijpNGA=; b=a6FgIBxgNByE1AswojUTFyEmYC72QqH/LQqqHz7ixlPVsXOPCgYd6mlw3XQTwnM2uh oSGphZh6q0/2oLSC/6UR/PVOiDLxeNrPqz3Xwh66LKb+PMN/RXj9Mb0rZNkmDNbLDRnv CDWrRylaRnKOork+/GTVzWguM6veviFxYDrHZyjqWmhP2Vq2sYJ9UIswPK1qUkGaukdi k6ldM/RmNazR5Btl5NCkOzRIKY7xN77rgF9vRVvC1DB/O3CaVrJjdtoBXxCeg/JcPdxV dPdKuKgQLxyqTRqoGtEBLBY4RwLUOzQy0WyfZWfqmqxAPStw46U6hbvqjfP22IPycU4j 75jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=piwrTztXhC39aA20VdmSLRCidVge2JjKgB3c0ijpNGA=; b=pkvbWsea9qKo4nlf7jKVqAQ3WTVdIwvOvO5QjWvIX3VshoP3IYRe0YflaRUaXs+bHH cNVQYBfVch8gSLyP4ZlXwFcOUBMsDxrPjch6VEE0gH86KTPQDP9v4ZXYjMwJhzagUFLv 1nyyKeE1RVCSae1Jya4vZ4jjfCkNcZZt8bd+5KhThXS+FgqZrpT30ilvRkYAVl9ty9Eo 1FNzZYEScpD8wfyHWagN3LNigK0YMlOKNaKhukMnRhHDAO0zVJ3pzRvaxCHMpQqbVt7l auk1Omlp0kkMUtw6jph+aMtaDwLt7RgZJFnKHl0/7Be84z7OHj1RueLOd4NdNl92LA+e pQwQ== X-Gm-Message-State: APjAAAWu46hpsl1Sa/e1JNHE8KmYB3eblfcVw9XDlqpR0tIqKfiSDhzq j2Hfn+iZcuthgzgfKKLFvU8Okw== X-Google-Smtp-Source: APXvYqz1oMF9jOCQzUyuq8/gZIjlw5l60lDqJs2tR/Yg0Za5sOTQcYevs45DA2dZqbA4i3Qtsa1ReA== X-Received: by 2002:ac8:2c7d:: with SMTP id e58mr28082215qta.243.1559651322669; Tue, 04 Jun 2019 05:28:42 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id e133sm13448610qkb.76.2019.06.04.05.28.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Jun 2019 05:28:42 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hY8YT-00042G-HE; Tue, 04 Jun 2019 09:28:41 -0300 Date: Tue, 4 Jun 2019 09:28:41 -0300 From: Jason Gunthorpe To: Andrey Konovalov Cc: Linus Torvalds , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Catalin Marinas , Vincenzo Frascino , Will Deacon , Mark Rutland , Andrew Morton , Greg Kroah-Hartman , Kees Cook , Yishai Hadas , Felix Kuehling , Alexander Deucher , Christian Koenig , Mauro Carvalho Chehab , Jens Wiklander , Alex Williamson , Leon Romanovsky , Luc Van Oostenryck , Dave Martin , Khalid Aziz , enh , Christoph Hellwig , Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Robin Murphy , Kevin Brodsky , Szabolcs Nagy Subject: Re: [PATCH v2] uaccess: add noop untagged_addr definition Message-ID: <20190604122841.GB15385@ziepe.ca> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 02:04:47PM +0200, Andrey Konovalov wrote: > Architectures that support memory tagging have a need to perform untagging > (stripping the tag) in various parts of the kernel. This patch adds an > untagged_addr() macro, which is defined as noop for architectures that do > not support memory tagging. The oncoming patch series will define it at > least for sparc64 and arm64. > > Acked-by: Catalin Marinas > Reviewed-by: Khalid Aziz > Signed-off-by: Andrey Konovalov > include/linux/mm.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 0e8834ac32b7..dd0b5f4e1e45 100644 > +++ b/include/linux/mm.h > @@ -99,6 +99,17 @@ extern int mmap_rnd_compat_bits __read_mostly; > #include > #include > > +/* > + * Architectures that support memory tagging (assigning tags to memory regions, > + * embedding these tags into addresses that point to these memory regions, and > + * checking that the memory and the pointer tags match on memory accesses) > + * redefine this macro to strip tags from pointers. > + * It's defined as noop for arcitectures that don't support memory tagging. > + */ > +#ifndef untagged_addr > +#define untagged_addr(addr) (addr) Can you please make this a static inline instead of this macro? Then we can actually know what the input/output types are supposed to be. Is it static inline unsigned long untagged_addr(void __user *ptr) {return ptr;} ? Which would sort of make sense to me. Jason