From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796233310; b=OMiDvUtNFquDNVl19o1QKpW8EwCAlPP7AwqykuZ5A7HzN5IRntheaydANq1DPoswUkQE 50rAxQOhRg0HXUZnyHG66bHd/l17l0W+ae73LL6YOREQgG1gPJyiElhdtmQMzXHfYxHWf mVRb231qpd1V/G2De3CC1sr2UEHNRgG2Bo8LmuE+k9Pd6W5m2VFOFnlD+qUpakmnoOeJA 6u4Gw7uaq5lr7pPKDZ7lUVLYQu0QgIhewK6fAJmGDISrrLD5VdFfaESILVZ08tI5P22Lp mwVRvzj4Em+ag7ONPIzyDh2k/s2nTbQm5lZpG+PZhcq/jDVl1TXSLCwODkP3EEIUmIQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796233310; 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=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=cCrh55WZnN+nprrBGiBpevRwFsXb3NF0pPZZBH9glGYCidRpBuiXB5IzmxxUdAafpUo/ 90HUyqeTrkyFqpdOniSNjfp2VD1gOUZ8/ByBfsz3/gAjo0Q1GRBp7W3iHat9XLcM8pBrl kRujfZNe2wOAFsO2RhgslmlgoyKm6sCnvVvjo2n21ELGTK58fdLXCSdCgQf+MJaQSIMjH 4DrE63M7WW/e3na7XVCz2JnKR2iWg1tBOEtcx13oeLervGEFVizIxRdInoPHGV85+suHk JILyEWd50s+mFMIVrSvyDkaaY2xCRWe5wjZjvM8CZ9tsm3SVU6HjYQLX1p5UI2c/4QA== 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=pouGG28L; arc=none smtp.remote-ip=209.85.221.42 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 CD323606A693 for ; Wed, 2 Dec 2026 17:41:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CD323606A693 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=pouGG28L Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-4a358881793so7168965f8f.0 for ; Wed, 02 Dec 2026 09:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796233308; x=1796838108; 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=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=pouGG28L4llvZhZpZFwbwAnKCVGvhAS9ealHSHVtZlXhbZONQ8cEZuxEqnQvBCP/8D /c04xjiho7d8XiUBsXmq0cYwPinr7IXjdDY7shazKRsFi2eaFpY2ggKmfE6HGbPWWsTR m0TMBeRg2Vo167MsW+7f37srM0ur1P+A65exiXVyyA0RUD2ONqZJuSc17f+58idfP4dm diXDcMgemMlPafTwGBsDwmI0F/6q5Qxs5F0ddvGAGc9773AThP3lL7ptyAbl4tgOMa8D TIpxOPF1Vx5UwDffoKLQOaZnu5UIuyv/jD4WZ6ijwdc39bEKSeX6skplvrmqZM+Hx1Nj eQUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796233308; x=1796838108; 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=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=1P2O5fEnVCUu7gpJ5IcvOVzOswGQzp+zpuoZURMXrOxdsEiCviFxNuoSQ3djw9tNbA jDyKsu5Q8YGwbN9DMQoYshx0yxuePUw8ULCrwxK9jv98L14DZiS87VKxZRcX1nA3d23k UDxkeFvN5Lg9L1lHPt5xR25lolGTlDsgymVr8l3X2vb95tQBkyBWbSWbW9mQsNDCcGHA VSMz1AWfjG9kEWnaitaW56Uw9ggOnoNf2YSEZM74TEleytb0A8X3QVczax3XoiG/m9Rq 9os7o4uGBfyZXPJ2Mpb5YiACNCFPuSWETwqbeM557zN8bv2pdiAn9J125VsrBADKfXcZ t1Pg== X-Forwarded-Encrypted: i=1; AL+hErEsikjHh4HGIEXuxHBMw+DuHpSFuvDX/Mru9day8vBlzAW2aBoHrAOTs3jOfBe22TgQ7zk=@vger.kernel.org X-Gm-Message-State: APuU4Z+gNYCdz4nNB8hGaa3mVxvUoWmkubbOf1lEMFBLfsH18Ac1r9G1 aoaoX/WE/STJsV82mjeo/1j1uL8O/j9X5rCO1p5YjfJ0dSquY+8liWiO X-Gm-Gg: AZFdTZcVDwH0t717o6pk446jeLsL9GhZykxoZCtQu56wEMnUG/txsJLg2vH4yKCQTeb hZfADS3SXixWyHm956r97ipwkqJBSWo9zYbn+e8p6AYs1cexeDNxeslmtwIzC+BzoH4CrQfVyTa M3KvytEJxxBelXtR0Y0yGPq1xrbvhNpAXsUhNld+xxejUvMtkJ2SjZORhfuveFrRcE7cxNLbH30 LM230EoyPXVdk91tebtxxIvTLwselSbDPtHfqAEURtMa0RO/gg/9DjTKgTWTC5rie4B8fYIxYGa xrzEsBXfJ7TjltHnVq/iBFpX61hyCgoYW3sap5OAkSURePZjnt9e0WsP4uHnagcFxX/2PdAUKF7 gqWL4SeaH7N1b7E8xP33JhIgrjfrp0NrGOPvNXoH5hiC/E9h1P4SiEy+Dw4Rk8Yqy12ZbF+8+gq nW/Pt8mkqi0obAfrilOoG0p0+s/ycLitTtAzQ6jAbjQKV8vmkIc2xr4rWY5qBnrqydwbrAfHv9V LyT9fLEhcxAmO5kOh3Mf0HbRCpG0NDj62LwbI9nsIDgXK3Mwn7Vs3YoMASjSQRmTeVbA/YkQfuu Mi8O4n3D7u+XfiZWGQSm42deZxJsNnrbdwMIgmnvgqhQV4pIE7SdpLJMyWtxFl0j X-Received: by 2002:a5d:64ef:0:b0:4b3:e605:15d6 with SMTP id ffacd0b85a97d-4b3e60516a7mr66762343f8f.55.1796233308128; Wed, 02 Dec 2026 09:41:48 -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-4b70c05b9desm54842436f8f.54.2026.12.02.09.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 09:41:47 -0800 (PST) Date: Wed, 2 Dec 2026 17:41:46 +0000 From: David Laight To: Dave Hansen Cc: "Christophe Leroy (CS GROUP)" , James Houghton , 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 00/12] uaccess: Refuse and warn on user accesses when current->mm is NULL Message-ID: <20261202174146.2a41aabb@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: bpf@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=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 2 Dec 2026 07:24:13 -0800 Dave Hansen wrote: > On 12/2/26 07:04, Christophe Leroy (CS GROUP) wrote: > > Also about the masked user access path, the principle of that path is to > > be branch-less, the whole purpose was the remove the test/branch from > > access_ok(). With your new check it is not anymore branch-less > > Branches themselves are OK. Sort of - unless they get mispredicted. They then cost ~40 cycles on my zen-5, and I suspect that is typical. Even without the spectre v1 issues the 'masked' variants are so much better. Oh, and then there is the cost of reading current->mm to consider. That might be a cache-line miss. > The problem branches are around access > checks because they potentially allow transient execution paths to skip > the checking. > > In this case, the new check forces a return before any accesses happen > or any bounds checks are done. If the new check was incorrectly > speculated, we'd just have transient execution doing what the > *architectural* path is allowed to do today. > > I _think_ that's OK, at least from a spectre v1 perspective. But it > could definitely use some more eyeballs on it. I think you'd need a user-controllable address that passes the access_ok() check but then reads from somewhere the user isn't allowed to access. Unlikely to be possible. David > > I do agree with you about the code size concerns. > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1384606A69C for ; Wed, 2 Dec 2026 17:41:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=H86Fbz9H; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=tH5lA7C1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=p8KTWkQzS/lfH9NQUi/Y9B7xWrOvDDsmCQfVcbH6fdY=; b=H86Fbz9HFg0jFdCDrVeuH66fNR oTz7pqJM6GFvTPHaHXQScvSefFj+0MRv8cKCYUH8OgKo/BIXX34vw2EImnppeaISNNjpXPvJYJfZP 3f3weNO78qMo5VSKptbiDGHbjjFp9Gt2IXRTCsQj32ahK9OoaMtTm2HKkXnLIwJ0/8TpNzsO3d+hS B975B6pGrr43OkkTAHSxKTxgoMR9nVeiwz8YfrcsSu5Z46K3in47U8h5EROrd56oXv3D+QuGJH7dc /ME6vSte9RVMkLcY00hkOzWLKlRg4vcaL+JpIlZWIusuLrsQbxHY1kd0RLWizVN0PduZPMpP9rYoq acKgKtWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYoL3-0000000CPcf-1F3Z; Wed, 02 Dec 2026 17:41:53 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYoL0-0000000CPbv-0AYc for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 17:41:51 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-49412eb1474so9009193f8f.3 for ; Wed, 02 Dec 2026 09:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796233308; x=1796838108; darn=lists.infradead.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=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=tH5lA7C1cCKTm5cuHIzw8KRwFPxZyo1yc24bYdCJ3H1Nn6nyCrBcZ4x4QHDuLujlD4 KZwBMXAJvBbHDCbVafebO5x6KR+VtSMs3SS7Y1jcZyJdTltTg9bDsHvl4WoU92BCNXk4 t+843IbSNjjPT1MWqPfP6m6aZSeOVdZqugOhFMSTvaYh1GDIeCjSvQxhK4E3CjXBSSoF 17424nlGds/B5su2T2mxkCjUngMgHyyNcFOGG4ZhwaxBo8ENIznLHTew+xpOo/ogIs2P V969R/foKq7GLioiJaI5pUNyF6ooDM3c1CvuajOLB7Ohd7vcdOs3lmlBlm2t9JIX/Pc0 PbZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796233308; x=1796838108; 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=pM28KMoe8Q0tPhUdyP4mXyIlBNFtRGaB+TycHkrIdF4=; b=ycdbAIc1EbR9gZEiRv4RCNWt48GTrbHgdZBtvRI4hvt6xuFcLwJULC1P7lk0N4eSZ9 TRPArB/HRRKGVZzHAOCpEWpXB1hSIo4WbjbdXrdup/LI6Fgx3reWhoK6LwPuMe7CX6jL 0QWK38xz3M9OXndGXdZf+Ro2N8D3PG266CQwHlPFSL4DR4Q65qbkDcn91MRK20YjPQfe nZsRWMsE8KbWiluBHGB2aEAfdPdgT2Ov8civ2s2Pt6dzCbaxN4v1lB74glES4jegOH1N Y1kPUifuKw+oehLktvGkUfEEBPmNnRcKIOwS9IbFSjyXQCAroH3TMV0A1hvjhCl9cuVW gNDQ== X-Forwarded-Encrypted: i=1; AL+hErFRxyK9KS9f6xpaSVqoAyTFtNqwOucj1WWfCOoksas8Q9T02mgQ/S9Deo0hBkqP0E53LFdvBvAMW8MCLA==@lists.infradead.org X-Gm-Message-State: APuU4Z/+CTT5X5xYm1WN/yXi8TVxP+sMAfCKTdzW/ChSBD3leE9Z0lAl B2VMwj2mldtUS78+RZUd/I6IPlhxJ86CfBNun1nYmtcc2GgiysvbPI3f X-Gm-Gg: AZFdTZcgU43euzTa4Hhjb9lUHGNpbZY1hFSsS2T46VXNdsi4+w/SKnLKff97BQ+lMm1 XjfPfyEJiQEsyW4omx3SvgRer+p3KBo+KqmrD0tfDefX3RmCMlqHT+meYsdnFuksukoVHGNOnMo TZSj/Y27uZBuDj8sY9Ot1X1fyUsjLu1158sBlK0Y2xfU4X6ywnlWOzOv2CfRQvG0a9S/5TJcRyc u1mOS87dIWyHhU5+1wK2499tTNRX1JaLXRzew/RKvGUtMIcBmabmROnATkDDVjtACkkocWuzk4d I4WJmazZWt1I8m+3JbmRtjoRgOUeWCHU9XWfTgiipPwSqrkaGoK01Ywad6uXdFi9UZiD87Mx1DE Q0o2Qj7BpiqVoiGJoxHL57NQLvz/GHGlUyLgm5sIH20gV8yZhED+wywOkkc2ZH++fD/+JWhCBGz h4hLO2ryOAn2NpW7AB09KMQazM2Q9IM9hdeXtmpX7p3MyO/LCQpc+cSNeBxtzN8HaGHZkPm+Zqm 1yE5UWWHQfEDeTc+25uGNDWic7A1TsgX57g26DRLDM2PX10WQYpwnyjLM1g3512S4dIhiGaSFK6 G1gaCvHcLGw8JkBrtrOQoYron6QiDh4jXE5fbLLPweZYiThWvXu7owpUxmxcMLeP X-Received: by 2002:a5d:64ef:0:b0:4b3:e605:15d6 with SMTP id ffacd0b85a97d-4b3e60516a7mr66762343f8f.55.1796233308128; Wed, 02 Dec 2026 09:41:48 -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-4b70c05b9desm54842436f8f.54.2026.12.02.09.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 09:41:47 -0800 (PST) Date: Wed, 2 Dec 2026 17:41:46 +0000 From: David Laight To: Dave Hansen Cc: "Christophe Leroy (CS GROUP)" , James Houghton , 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 00/12] uaccess: Refuse and warn on user accesses when current->mm is NULL Message-ID: <20261202174146.2a41aabb@pumpkin> In-Reply-To: References: <20261202023920.595207-1-jthoughton@google.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_094150_101857_7C4287E1 X-CRM114-Status: GOOD ( 19.71 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-1.3 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, 2 Dec 2026 07:24:13 -0800 Dave Hansen wrote: > On 12/2/26 07:04, Christophe Leroy (CS GROUP) wrote: > > Also about the masked user access path, the principle of that path is to > > be branch-less, the whole purpose was the remove the test/branch from > > access_ok(). With your new check it is not anymore branch-less > > Branches themselves are OK. Sort of - unless they get mispredicted. They then cost ~40 cycles on my zen-5, and I suspect that is typical. Even without the spectre v1 issues the 'masked' variants are so much better. Oh, and then there is the cost of reading current->mm to consider. That might be a cache-line miss. > The problem branches are around access > checks because they potentially allow transient execution paths to skip > the checking. > > In this case, the new check forces a return before any accesses happen > or any bounds checks are done. If the new check was incorrectly > speculated, we'd just have transient execution doing what the > *architectural* path is allowed to do today. > > I _think_ that's OK, at least from a spectre v1 perspective. But it > could definitely use some more eyeballs on it. I think you'd need a user-controllable address that passes the access_ok() check but then reads from somewhere the user isn't allowed to access. Unlikely to be possible. David > > I do agree with you about the code size concerns. > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv