From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796234125; b=QMb3kbFC4+CGReMLl8suQykYmiH7W65vN5jl7sIjaj+rwUaQ/XfWT5RGjv+ujV/UPvmg eKNuc1T8GprX22ulnNtQ+01JQvsMaeJcxzQ6IYeS7l++4aQywgP14VtQE/4bOs8wCrHmV xPKe/+If7jZRhPZL/xDFV1xt23o7MeMnPNUSymu67r/G5uNUlODZdYsmn7C+w9+80qJlp 9icfgSc97YGk/nVJB6JGDV4xDtEZfAbEZ7y5greUzs4XSPDthBmBzRshn9HOSFvq4/g9y VU6DO5P7nM9BPY7dF3AwovvMW3Zs/HD74XCI45E9YCgVI0j5iCk8J9Vk60K/Syecpxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234125; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=er6n8NTqcmG9S7zEzjfKVFOQqevfIQ63FthjCWjVPtM=; b=S3suJaDznbLvGq6KvMd1xadiBgmZON1moRTru/iS/6TFwA0Ki4wSWxwRagMXZzZYRzcU 26JBFGsBwXXyQrkw7vruMhwxp906VhjB/5WqRRdZWrcAZKI5DUg+Xx1ABfCIkht35rk26 I0ZLtEjyyRBTv7abRiU9QTIyjPCAeq2tSOeRx1yhasTL41XDOuHD+VtRURpHO5eu5Ze4k VrEWWHv6cN5z7FRaO29doVXmyhqyw7pArjryOKjTocGv87xuWE8S590ahDGZOBRVvIPS4 lLSolwEEYuhy/4yMdyX7Ss1YtnanYUH9dY6Yk4GVBNLIQ180Z1wY5iWPPIE8JVJvS+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G7XbM4F8; arc=none smtp.remote-ip=209.85.128.53 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42184606A339 for ; Wed, 2 Dec 2026 17:55:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 42184606A339 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=G7XbM4F8 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4b79502c27aso136243025e9.1 for ; Wed, 02 Dec 2026 09:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796234124; x=1796838924; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=er6n8NTqcmG9S7zEzjfKVFOQqevfIQ63FthjCWjVPtM=; b=G7XbM4F8xKXbcBBqy/J/V3uMAjl48/fAW3swAoflcS8O55Xy8ya5eg7+fYE3m6rOd7 4atpByzLv7DmrjhVdrmRHXaT/0eLGkdFfUqq3dK6ubkaJrqRsAWtEXi7lCZwAsYSIfcb x1FpQU/JqeqCYpkk8HNai3MZlgyCQLD+vBDgvvrn4HuNexD1GEu1joS3HwRoP7g7c1lW Mgl5Utpb3EgFLYxwZ5MXg9TI8jh2zXIqAsmPb7mCzb+5QoNKuvd01Bkhstr0LI/AOBKp iQ77tYUWgA0fhLgekO7zY3WMFiPRUhxVpUdpGWo08tKNWqkj4/83V26PPgH/bEkP+V6A mpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796234124; x=1796838924; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=er6n8NTqcmG9S7zEzjfKVFOQqevfIQ63FthjCWjVPtM=; b=1Oqi8C1Rbz6ucGNpdD5cnAk6EHeWME1ZZvRAq0g+hfFX0vvvbDmtXQ8bvXkMB8ABRh aT4WbagKUTIwcnaOFMrkfHyp+2F+Gdw+Gn9FAACsI/3XMinCKPqAmuZ5uUy55fPXo287 TxD5nh4m4rg1iHd1lo+P8pBddBJbk4v3KLa/jtdt9QtIsUnKn+SD98tMdb79wZiHSEHa umxEK711baMrg+JVT7TRzu+yquvBPMF650Ra0GmQGddAMpqpZrgGPhh+jNKELcu93wJs 5Cg3Unf3PzwhVKa0J3epu9ayHOnrY0Ul1fOIrZYCNFUTnnOhKK5d91eyk5hlvUgJZJBJ o6fQ== X-Forwarded-Encrypted: i=1; AL+hErHZ+RFQVs0VhJknVffNzqL69IoMC1/GENozVHzjM9KYjiIq41hJJiOHs6R2ks1eNS+fb6I9cw2COI81s0MVxEzo2To=@vger.kernel.org X-Gm-Message-State: APuU4Z9Z5tRDG9M9orz8s+GwRUs+asp5cjVHWmwSmtA6B7fyYq2h+y6c 0Ep9pp2FiplyhUfivje9I22f0wQ5jXf54V/89HfjaUdFt2ZriyP5LVfI X-Gm-Gg: AZFdTZftXijRVBq5MpGDkcozdn99msZ0a66z5WMDpC4ilbeoKgUHqV530wmRddZSX/P KRp+pjGbS/jvsgXN3qGgGpNL5SERPWkCSBQWJRKVlqEb5+1oEeWH52nBVvgfZzHwRHIbe6V5Gzt 44LF8tbAI6LRStBo9hCGnDa4iqYVtRlaz5TMHOf9Q+2bI3HKBlvzyFoMRbm2BRZmJlRKXniNA0U V7JboK8PseS/B4pRcmX6QsJRm2SWWwlt7qFi69vISg552NjLDQ/Dl8NZ1vyH6q4MvZMGWojnHST 9hAAeVzrX9vHQc4y//GAOxMoypEAwTlda3y3TBN9XjHEhidfn/AcziCZM4S67nkgRYN4je62UHp pzsihUoD4xtLhhfshcB2r7JWC/WOK1Clra/ud3lWyb8v9SK5ejRBHR5NyzdWn6BWl7wUuYxBkc3 pR1ZC9ESdQ3nKtfLasZnuTrvAPWh6n5jR+fhP6CMYLGXhMM0Qh6yk3yjL4jFLlnkK3sUoTNcrzw YPkesaHqC6bL86a2tp6MMLVvjQTtr3mgdESzr3TM7W7jxgFDNIR8Krypyk3QJR32Ki7NxYgaHal KNdi+soz4O+jYSKICQJXmN6KUZ5/Y8leNy4gy3pjsdbIS30KdJc2V1nDZ1JMeMcqyLJJ1UsUTAd xn+JelZLqyA== X-Received: by 2002:a5d:5887:0:b0:4ac:84c:70df with SMTP id ffacd0b85a97d-4ac085bb48dmr76337620f8f.45.1796234123552; Wed, 02 Dec 2026 09:55:23 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4cedd6e042asm137461f8f.41.2026.12.02.09.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 09:55:23 -0800 (PST) Date: Wed, 2 Dec 2026 17:55:21 +0000 From: David Laight To: James Houghton Cc: Andrew Morton , Alexander Viro , Arnd Bergmann , Sean Christopherson , Paolo Bonzini , Jim Mattson , Jens Axboe , David Hildenbrand , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Madhavan Srinivasan , Chris Zankel , Max Filippov , Dinh Nguyen , Simon Schuster , David Sterba , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , KP Singh , Matt Bobrowski , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Steven Rostedt , Masami Hiramatsu , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, io-uring@vger.kernel.org Subject: Re: [PATCH v2 11/12] uaccess: Refuse and warn on masked user accesses without an mm Message-ID: <20261202175521.7e07b477@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> <20261202023920.595207-12-jthoughton@google.com> <20261202123552.32c99eef@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 2 Dec 2026 11:53:43 -0500 James Houghton wrote: > On Wed, Dec 2, 2026 at 7:36=E2=80=AFAM David Laight > wrote: > > > > On Wed, 2 Dec 2026 02:39:18 +0000 > > James Houghton wrote: > > =20 > > > With masked user access (x86-64 and powerpc), mask_user_address() and > > > masked_user_*_access_begin() take the place of access_ok(), so the > > > NULL current->mm check that the previous patch added to access_ok() > > > doesn't cover these paths. =20 > > > > Ugg... > > This adds a conditional branch to hot code paths that are pretty much > > carefully arranged to not contain one. > > > > The WARN_ON_ONCE() also add inline bloat (more so on some architectures > > than others). > > (The same is true for the previous patch.) > > > > Adding tests to the unusual call paths is one thing, but not to the > > normal paths which always run in the context of a system call for a > > normal user process. =20 >=20 > Thanks David, yeah I think I'll put the checks back into the copying > routines and leave them out of access_ok() and the masking routines. > Christophe and Dave had similar concerns[1]. >=20 > The WARN_ON_ONCE() bloat is real but doesn't seem that high; I > measured it[2]. Let me know if those results concern you. Try one of the architectures where it ends up being a real call. IIRC x86 manages to use an undefined instruction and then do all the work out of line in the trap handler. The issue with a real call is that it reduces the number of registers the compiler has for the enclosing function. David =20 >=20 > Thanks for the feedback! >=20 > [1] https://lore.kernel.org/kvm/b7a920dc-a150-468b-bee1-1c2c22dd75c5@inte= l.com/ > [2] https://lore.kernel.org/kvm/CADrL8HWVE7Zj+kFEZbrf16nmmdOONWpobZ7L0KBi= D4-AcysFkw@mail.gmail.com/