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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C2BDC43334 for ; Fri, 17 Jun 2022 15:28:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D8EF6B0085; Fri, 17 Jun 2022 11:28:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 587C06B0087; Fri, 17 Jun 2022 11:28:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42A436B0088; Fri, 17 Jun 2022 11:28:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2F6806B0085 for ; Fri, 17 Jun 2022 11:28:24 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 00CF33502C for ; Fri, 17 Jun 2022 15:28:23 +0000 (UTC) X-FDA: 79588109328.02.E637A00 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by imf01.hostedemail.com (Postfix) with ESMTP id 6130B400BA for ; Fri, 17 Jun 2022 15:28:23 +0000 (UTC) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-3177f4ce3e2so22178097b3.5 for ; Fri, 17 Jun 2022 08:28:23 -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=a48xYoaImngZlwAokNKt+6RLtl7rqDoLCq/X4qxbRH0=; b=bNNK+PbIKT8CKkpoxpziC+W02MjORV2Gv4DmjRzlDqzgiPXk1/ZBmWCGxt0sRDxz/g eNeEjmAFCfTmLWtCMsWks8/f4/n74eaSxs9jIEFA4A1ul66IyswOiziFir+wIgaT/DuG JmV3WKlNMujJrkNJxbZ5OquOMCa20BeaGLCKmfm3hGTBN0+WSAJWQfEJPXgU0MJKhn1z jD3P8unNV5OdR1zKJFsUhZia2BjyUSaH2zhaY8bHL9lC6zXwV8iv7l2kGB4t3KLStMiI csK87t1Bh9Zj5GkiK+HKGIGR6RwD2eSgIL1smm6iDY8kH+pLKjG6rHgmluud78SLEk6e FF7g== 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=a48xYoaImngZlwAokNKt+6RLtl7rqDoLCq/X4qxbRH0=; b=KGML6LZJLV/ottrxwYS0KcFbl/SFVVI134ZAD70ohXLjtvcicFbkGrp7qo8qKNbu1k qGrOqEku6HFaz0Fzm0AA+iMUISJWgrj7xlXIYUj5pg/9HnJdqmTPmuDXk5Dg6Pnorjz1 mWK76Tfj5LaJJQMTvUdx0bNJ85r7xgY+0BdQvHHukGrgZZAlmUezYby78br7rwj5WtYf ew8YvThLwTe4Rq+ZVumGQL4W8EqfW7vMgJRKkUqtHviIBFlemnnDoF805R25gqD2lizX j02ZvJyVzQtcl2w1vJv6lIcYlzkfHQ/Lgab1U+fAVE2xN4vpLaQdCUoNVg04d5j0xhkB tXww== X-Gm-Message-State: AJIora/1HnglMSvSa55PugmE/dl9f/DbVOPSOCbGYP7oiScWcYbAAP0H wX+TUxJbT5NGRXDWfK6pKi6PAOY1bImN/9yzB/WGrw== X-Google-Smtp-Source: AGRyM1vm0LaLx48BzcMc4o0Q/G6JwLSkBtWx44Q5XnkRQNuj3EzjAK+wsdbcMm3Y4UXskMFFeS48BcHiyRAHYBz7MRc= X-Received: by 2002:a0d:dbd7:0:b0:30f:a269:6da5 with SMTP id d206-20020a0ddbd7000000b0030fa2696da5mr11876279ywe.344.1655479702282; Fri, 17 Jun 2022 08:28:22 -0700 (PDT) MIME-Version: 1.0 References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-4-kirill.shutemov@linux.intel.com> In-Reply-To: <20220610143527.22974-4-kirill.shutemov@linux.intel.com> From: Alexander Potapenko Date: Fri, 17 Jun 2022 17:27:46 +0200 Message-ID: Subject: Re: [PATCHv3 3/8] mm: Pass down mm_struct to untagged_addr() To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655479703; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=a48xYoaImngZlwAokNKt+6RLtl7rqDoLCq/X4qxbRH0=; b=C9NO/13aS+A7Z1nWUNjMiu6GBBpw/N+Nkp3HJpLGmqiCEFFM2GoZEMqc3yRX4tXJVU6Xbo rwveS2qfWQPx4uV3r7OBz2ST7qt/tXMxqix5lcQ6YuihhAnA4v0CuqYgZvn9GeznHu4AuH WBWMgQROyK31G7aKdYU3C06xiFOUv/c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655479703; a=rsa-sha256; cv=none; b=Z9yu3uieJdMFgqp2O+5fMVQwfViILXNU1atHb+5i1YPriYxbh/FRQ2oYchqfEUb0z+P2qf OX+DIodd2ar5bG35f+dIhUM4jxB6hBZ149KU3zySUvxa43W04L4OijQK3Gc6NLcNoC6sAj mY5QMEsFfxi/jrAeP3kK/h8auo/9RFM= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bNNK+PbI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of glider@google.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=glider@google.com Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bNNK+PbI; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf01.hostedemail.com: domain of glider@google.com designates 209.85.128.181 as permitted sender) smtp.mailfrom=glider@google.com X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 6130B400BA X-Stat-Signature: g3o4i4up78irpwc3xfwbiwcba3q8fyma X-HE-Tag: 1655479703-440373 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jun 10, 2022 at 4:35 PM Kirill A. Shutemov wrote: > > Intel Linear Address Masking (LAM) brings per-mm untagging rules. Pass > down mm_struct to the untagging helper. It will help to apply untagging > policy correctly. > > In most cases, current->mm is the one to use, but there are some > exceptions, such as get_user_page_remote(). Wouldn't it be easier to keep using current->mm in untagged_addr(addr) by default, and introduce a separate macro for the exceptions? > > +/* > + * Architectures that support memory tagging (assigning tags to memory r= egions, > + * embedding these tags into addresses that point to these memory region= s, and > + * checking that the memory and the pointer tags match on memory accesse= s) > + * redefine this macro to strip tags from pointers. > + * It's defined as noop for architectures that don't support memory tagg= ing. > + */ > +#ifndef untagged_addr > +#define untagged_addr(mm, addr) (addr) > +#endif The comment above should probably be extended to explain the effect of `mm`= . --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Falls Sie diese f=C3=A4lschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, l=C3=B6schen Sie alle Kopien und Anh=C3=A4nge davon und lassen Sie = mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.