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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 722E8C05027 for ; Thu, 9 Feb 2023 14:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjBIOKx (ORCPT ); Thu, 9 Feb 2023 09:10:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229761AbjBIOKu (ORCPT ); Thu, 9 Feb 2023 09:10:50 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 088905D3CA for ; Thu, 9 Feb 2023 06:10:46 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id bg26so1553532wmb.0 for ; Thu, 09 Feb 2023 06:10:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.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=2cJbXIc6sUIZ1i94zwcO4sqv/3DWkbU7YDfCfI7tRws=; b=ha/BiTuHrB/wTAitAvR41ZEFDItgv+gg+2CCyDuNY2W03MoqjyfL+2kJk930XfZmlU iiT4DBYnp6FGvVyuZkYR+LrfvQsopxvgrXVYil8uO2Gfnc7F+bQH9zFTYOEJ/rMquSv2 yztSAU3SRJG0YAFJDIDyyObNtp7J/K/OjvOvt02Nzz/uUV2llphLcohPwjDtweFY0MqK UXWP5IHHT1eGbsV5aOz6A7VFJi2ud6YHJFAoY9Ax9GK6eH3s63uLavhYsTm0wdK/JCS1 I6jTSmEAgDcIeiMBQkjoEnljP8jxbj/8vqQX8J2UFEf3NwjcjOHxdvjCrF+ULsHh3wDL VAog== 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=2cJbXIc6sUIZ1i94zwcO4sqv/3DWkbU7YDfCfI7tRws=; b=XCw2JolwJaZ/fZVqBXJ7R4JnAC+VsexvTb3K/4HTqoR6lHBCaNOxQAMttaBuPd3nQa 8OYJNvwYpC2BvLWk2K/8RF65UAI8JB9FqUCogJUczQkJE0Z9AbhWO8EgT1Qb0nRxkbWN jmajnRBRJOCdNGeCW0bFsnbwzKeeonFGHf+HKpSl/7MxBXtGNohykYm2aVC/bRo9KLAA QN3JbbdoUexQgG02Mbud0E0ar5aiLzG7g0X0fqBIDfSxr3XcJ13w3LBeJABYGjb9m3nS sxytuxW5yJf5vkgX3aRP83bXjoBZt6Fi0zdbdvr5DksQSUF2kflaaaep1FDCk1sWNySA HnMA== X-Gm-Message-State: AO0yUKXrW2sF/2ASHyzNXq64LxxnqjAUfA+bbwhE8WfnoNqVI1BIkBs9 PdQXXEMSfc+3ByT/YFNWoJOtSLiv1Jbw6QvYtcLHsw== X-Google-Smtp-Source: AK7set+veevx98XIJAiGJtc7Cal/+34P2vCmciNiu9Y/kYU7oHAwHt6eWolln0SD7AYnFjM7x7/xsqq8IbEZ9Kqf3Rg= X-Received: by 2002:a7b:c2e8:0:b0:3e0:196:208b with SMTP id e8-20020a7bc2e8000000b003e00196208bmr506757wmk.162.1675951844523; Thu, 09 Feb 2023 06:10:44 -0800 (PST) MIME-Version: 1.0 References: <20230123220500.21077-1-kirill.shutemov@linux.intel.com> <20230123220500.21077-7-kirill.shutemov@linux.intel.com> In-Reply-To: <20230123220500.21077-7-kirill.shutemov@linux.intel.com> From: Alexander Potapenko Date: Thu, 9 Feb 2023 15:10:07 +0100 Message-ID: Subject: Re: [PATCHv15 06/17] x86/uaccess: Provide untagged_addr() and remove tags before address check To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Taras Madan , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Bharata B Rao , Jacob Pan , Ashok Raj , Linus Torvalds , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 23, 2023 at 11:05 PM Kirill A. Shutemov wrote: > > untagged_addr() is a helper used by the core-mm to strip tag bits and > get the address to the canonical shape based on rules of the current > thread. It only handles userspace addresses. > > The untagging mask is stored in per-CPU variable and set on context > switching to the task. > > The tags must not be included into check whether it's okay to access the > userspace address. Strip tags in access_ok(). > > Signed-off-by: Kirill A. Shutemov > Acked-by: Peter Zijlstra (Intel) Tested-by: Alexander Potapenko