Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp504149iog; Fri, 17 Jun 2022 07:43:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTuW9hWKTThwysdYM8zWl/eKlJ5duzMTGiL/nxbqRx7PTfT1e7+Q01hmDrratqpxO33fMr X-Received: by 2002:a17:907:9721:b0:70c:65e7:2aa5 with SMTP id jg33-20020a170907972100b0070c65e72aa5mr9603497ejc.132.1655476989356; Fri, 17 Jun 2022 07:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655476989; cv=none; d=google.com; s=arc-20160816; b=vZk2suXIKcZ/9FBsMcoy/rNxJM+jHCwmsm6fQGzTK+I5L2hml1JPfGFex3k8ro9b2H 8n0HZ1Nt6zq122fgNfp4ynDIGC347JKXI//Mfs8vP+Re7Ebz/D59g6965R2n4RSmMgPA BbYuEK3vORIeGAeY4BThT+R5zbfAdlDA4jIG39PpESiX7VBz9xJGkU0KJ+xJJ/dY1xrM ssU68yIjQPGskJB5rDdrrXbEwk0Ubiix8RRLK1lR61e3U3CCeTgIyQPbBihZO28GKHro w99hv0mj9WZbTUPKgQELc1GEcrdPo8X4aHsDo4byLGHQbM3oMQfBRiKb+cDCiyrDRwLl hcjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=s48+XZroV3EtTjiSKpn6ew2kCrik7JfCW2Vjzd0vaYU=; b=kr4md6mS9fyNz4wFY1k1B+335c3QF/bIyD7tg42QgRuKlXjp+XhXZnm1YyX1htk6Zl qPpB19Zhb0B7xt4xZJiLfBPP7D8J2cEcGyIvKtquMXY56UotJNemM/RonIDCfTwtsHcQ tMeS2+BRBXH6EXkLgh8d1Nwg8JWOVa0CqqzcfHXWFS+1ZZSnfbg/FOEFF9Adq/FEM5XB ifoAGTuY3fhZbhLx5OkILEZOlttED8dTWuPNJdcALp7n2yrEkyY2a724HUiJw/nShAaz GxdtGPVGc8AzfDIEnWHgsb0nqTiByoBNZ8ZR7vKCqA92RtJkMjGqgaUscvIZcBrzNaP8 Hw0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PDlfWJH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du21-20020a17090772d500b006feb7fa40a2si5658591ejc.694.2022.06.17.07.42.38; Fri, 17 Jun 2022 07:43:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PDlfWJH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382714AbiFQOXi (ORCPT + 99 others); Fri, 17 Jun 2022 10:23:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382716AbiFQOXf (ORCPT ); Fri, 17 Jun 2022 10:23:35 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04EE04AE02 for ; Fri, 17 Jun 2022 07:23:33 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id l4so4167730pgh.13 for ; Fri, 17 Jun 2022 07:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s48+XZroV3EtTjiSKpn6ew2kCrik7JfCW2Vjzd0vaYU=; b=PDlfWJH2HoLU4NwlzMU+rq5k7uiuf05iH+c2Tb3fbzMPk47sse9YLNWJPcd4+ej2wS 7DLtSvHG5HqW4/beX7rieAZtpFsvMPcBtsElEJ4FCX24Ih3gZeD2fZH1AsXvBfemscGQ HwXWdwUQnch/yx1uiHGGR+x+gitM73Vjgx8aEKearnR9mFMOhJ42rAE76fEsQ4XRURrU XNWCB+Q/WK++XC0AnbQe+WBVEV/ZnvCNECY1rGhenup0i9woxAtEcyxDkZglA8Cq9KzO ifNTNQNb/u+O5mu353zEflSTv3BZ32Bw2bwTqyi6N2SMb5qBk0WKdRTAP5mPUTYdbPM1 54jQ== 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; bh=s48+XZroV3EtTjiSKpn6ew2kCrik7JfCW2Vjzd0vaYU=; b=qzZqEsc03XVVFuSf/Zq6lwQTIjZi/0o/MWkJj5Eh0UCtB2HQZoX99VGtp4GtOFcenJ za2g793L03gn3Y2dYU/tkO4ZTThAU+XNxm1VSXmESBJiiUO4xSTWElstVSmbp2QL3g90 gWvi1re6gJncaU3hbItQfjCoiNfW7Byrg1HMjbeB3diRMSJReglubSTvWsiNo/6kPPJ3 +DMhrMi8+XqQoaZaV8SOu70zsIyy5/jAtj07Qst8J4FJ8+ZOwWAkKtX/SRMlaVBNl0bw CRyisnsBr/5sE6zZ6ubr2wkgULzyPYzE5gH3xC+p2gwV0usBWwcIF3+TJ+mDWaM1E09O 5xBw== X-Gm-Message-State: AJIora92dlJaXwv2oijbzxTUh49anHRpm2yCAG49V3v/7ha9fcnrw48o Ql3wNDlBYZ085oE/HiaiRIl6hRdHTWoAeDv68Q8= X-Received: by 2002:a63:5522:0:b0:405:1ff7:33dd with SMTP id j34-20020a635522000000b004051ff733ddmr9429179pgb.86.1655475813003; Fri, 17 Jun 2022 07:23:33 -0700 (PDT) MIME-Version: 1.0 References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-6-kirill.shutemov@linux.intel.com> <20220616164440.vw7sqnof6grrmnvl@black.fi.intel.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 17 Jun 2022 07:22:57 -0700 Message-ID: Subject: Re: [PATCHv3 5/8] x86/uaccess: Provide untagged_addr() and remove tags before address check To: Peter Zijlstra Cc: "Kirill A. Shutemov" , "Edgecombe, Rick P" , "Lutomirski, Andy" , "dave.hansen@linux.intel.com" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "kcc@google.com" , "andreyknvl@gmail.com" , "ak@linux.intel.com" , "dvyukov@google.com" , "x86@kernel.org" , "ryabinin.a.a@gmail.com" , "glider@google.com" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2022 at 4:36 AM Peter Zijlstra wrote: > > On Thu, Jun 16, 2022 at 07:44:40PM +0300, Kirill A. Shutemov wrote: > > Any objection against this variant (was posted in the thread): > > > > #define untagged_addr(mm, addr) ({ \ > > u64 __addr = (__force u64)(addr); \ > > s64 sign = (s64)__addr >> 63; \ > > __addr &= (mm)->context.untag_mask | sign; \ > > (__force __typeof__(addr))__addr; \ > > }) > > > > ? > > Yeah, I suppose that should work fine. Won't the sign bit be put at the wrong place? -- H.J.