Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp612366pxb; Tue, 5 Apr 2022 15:57:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbjin/K5LedfwWY8NuLKQ5w703gE1PKBWpmFBcw7O366p+uN0kX2tvbEKTYwMhY9coSzQk X-Received: by 2002:a17:903:18e:b0:156:b0e1:63d7 with SMTP id z14-20020a170903018e00b00156b0e163d7mr5741752plg.126.1649199467439; Tue, 05 Apr 2022 15:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649199467; cv=none; d=google.com; s=arc-20160816; b=CucUpIA704lrVNbBAWDVaB2OBwvU9nSD37ESjLSPZ6y0rRrcJ7FiDJk560Ml2GfpeA anYJN1pKsZw3UpKuTNGRxlpYyv1BBnbIALmL9VSfC35i6AGsKlJ47boBPnXkF0hXvEsZ QsY/lL0RLHytaflrJQqiGrI/AZci133JZmmftyUA3QxppGNBLehV1uAHt89Ddy1eyNg6 rRUw+4nvkq0J4pBFzDseRlTaujFxWASOc4ttUIeufYS13xftKpWr15Sq9kTqGUBUQXeT OMBnw7Rbr61rjzMxKoORi29mQAGqPfA1MvEbjiKtCnngUDT9n0HtrmXOeheKMaPcnx6N jKDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yTl7CnxscX3tM8Q2WvPQUxdf1oA0EUFe77KHAeexXLo=; b=mvuL1uWDrJklYvhxHisziwAbVSY9DIlViYrVlU3gVyuEyv2tyHLVl2FtLSiXPggTr2 S1SN1z6REV8JYqH8WheF3Nzf9ndr4UFEHLv6uGLoUiYQRhrEzzxw1v14AHs6bRIOVSyD MgNMM3vyAv6xWger0LSwUcf+O4PikwuVyrQBLfx1lh9jisrLBwMohYvlhY18IAE6LDkH /Fzh7e9FE60P6yNt6cvfDWPDb36vy/EmRitV6uCr7FkWpYF5ivSj3wJ5WShNwxljYzKd K8gVWqWxeI5heg/OsWROmVXvpfktMyaSG8KL8pokTADbcKoW2HxPO6xTLmHWGdXCG01t mvxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=guHAxSDl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k2-20020a170902c40200b00153b2d16420si14623085plk.40.2022.04.05.15.57.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 15:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=guHAxSDl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34525150406; Tue, 5 Apr 2022 15:39:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238420AbiDEJce (ORCPT + 99 others); Tue, 5 Apr 2022 05:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239502AbiDEIUI (ORCPT ); Tue, 5 Apr 2022 04:20:08 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99F55CE1 for ; Tue, 5 Apr 2022 01:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=yTl7CnxscX3tM8Q2WvPQUxdf1oA0EUFe77KHAeexXLo=; b=guHAxSDl6KUIlPMY1ymkDtNzkp MSAuTErMX9PQeS+yG/hoG1AhcfFZPtqdmtXOvqnNUMaRhmQcl+1lgOKocA8nxjxYx/TLCQsLFf4QZ ZKjjyVPtCDHtZlzcndhBvZmStUOlGq2Iq/bagX5h7UbargEmGMfuEPRAMzdhhKTHKIBsV6LJx2Hlu hiWTUUHKTRtUGbt15qMEAqbY4pyc26FTuMMKm0LUwB4MhqsHUsNwsnAmHYeJn7hO4HOmCJkAA+wsN C+F5y6g3+d1bi6SyvKmi8oTjxJNWtVrwlzKOARg3fO4dgoKT92dGz02nVz2V9stsu/uAs1U3dNjgU 97fbqbvw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbeKa-006UbN-7s; Tue, 05 Apr 2022 08:14:28 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id CF2B2986B5B; Tue, 5 Apr 2022 10:14:27 +0200 (CEST) Date: Tue, 5 Apr 2022 10:14:27 +0200 From: Peter Zijlstra To: Bharata B Rao Cc: Andy Lutomirski , Linux Kernel Mailing List , linux-mm@kvack.org, the arch/x86 maintainers , "Kirill A. Shutemov" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , shuah@kernel.org, Oleg Nesterov , ananth.narayan@amd.com Subject: Re: [RFC PATCH v0 0/6] x86/AMD: Userspace address tagging Message-ID: <20220405081427.GD30877@worktop.programming.kicks-ass.net> References: <20220310111545.10852-1-bharata@amd.com> <6a5076ad-405e-4e5e-af55-fe2a6b01467d@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Mar 23, 2022 at 01:18:41PM +0530, Bharata B Rao wrote: > On 3/22/2022 3:59 AM, Andy Lutomirski wrote: > > I hate to be a pain, but I'm really not convinced that this feature > > is suitable for Linux. There are a few reasons: > > > > Right now, the concept that the high bit of an address determines > > whether it's a user or a kernel address is fairly fundamental to the > > x86_64 (and x86_32!) code. It may not be strictly necessary to > > preserve this, but violating it would require substantial thought. > > With UAI enabled, kernel and user addresses are, functionally, > > interleaved. This makes things like access_ok checks, and more > > generally anything that operates on a range of addresses, behave > > potentially quite differently. A lot of auditing of existing code > > would be needed to make it safe. > > Ok got that. However can you point to me a few instances in the current > kernel code where such assumption of high bit being user/kernel address > differentiator exists so that I get some idea of what it takes to > audit all such cases? The fact that you have to ask and can't readily find them should be a big honking clue on its own, no? Anyway, see here: arch/x86/events/perf_event.h:static inline bool kernel_ip(unsigned long ip) arch/x86/events/perf_event.h:{ arch/x86/events/perf_event.h:#ifdef CONFIG_X86_32 arch/x86/events/perf_event.h: return ip > PAGE_OFFSET; arch/x86/events/perf_event.h:#else arch/x86/events/perf_event.h: return (long)ip < 0; arch/x86/events/perf_event.h:#endif arch/x86/events/perf_event.h:}