From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CAACC433F5 for ; Mon, 3 Oct 2022 22:49:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B3AE6B0071; Mon, 3 Oct 2022 18:49:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 164006B0073; Mon, 3 Oct 2022 18:49:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1FDA6B0074; Mon, 3 Oct 2022 18:49:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E00F56B0071 for ; Mon, 3 Oct 2022 18:49:28 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B6820A03A4 for ; Mon, 3 Oct 2022 22:49:28 +0000 (UTC) X-FDA: 79981131216.29.A0A811C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id 54B0A40005 for ; Mon, 3 Oct 2022 22:49:28 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 787FC61070; Mon, 3 Oct 2022 22:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E595C433C1; Mon, 3 Oct 2022 22:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664837366; bh=599phx3z//XkaqQjtagJzQ7sjVck2S3daFrsAp1kj9Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=QLv5iS0E6SRGs4sM9XRL0BBZLUhIfUxSR8v33w/0yNOjsS7/zaa/J5pRp02CjSW1X BJMmIOfTmxPEIqnjt+aqWykwg2+4xJbqMPdPXKyfUuQrLlVT1ZhT3mb/MXcsAfkSte j3jI7s5J5kSjDMCX5HEe/KOsS15VJT/TyubjkJG/I3/JGhaYvBsglab9Og9m+jnu0U Ql9W4Szdv0tI0KTMxSVIa2tkETjjmq+WAulpSZ3QbGTRtw0VEe3Qa7dnlLKTq7/fnw 8nibutltZhCHc6zp6nAtolnV5KXm5a6jRN7mxWkvh9XL3C9OVbLEuzmZ4UpZubrtXQ x+CKQnZ2NO2dg== Message-ID: Date: Mon, 3 Oct 2022 15:49:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2 22/39] mm: Don't allow write GUPs to shadow stack memory Content-Language: en-US To: Kees Cook , Rick Edgecombe Cc: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-23-rick.p.edgecombe@intel.com> <202210031134.B0B6B37@keescook> From: Andy Lutomirski In-Reply-To: <202210031134.B0B6B37@keescook> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664837368; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w3P7y9h3VIo1wE5vcVcK1pkxBHCnCSgYW2QVUeCO0Co=; b=Z4+oB9v1t/Jm06/Azgr5c5p/6ACPQhY5CGwU3Hl4SiobgDF5HDtvYl+hFaGga171uNaumz JK3Tl55IQPVBqOqiuig8yEUB70o2BZIs+C2RPqakxy3onMBYtyTyJlpNs2Wsk8RwcAVjY9 qc7Mr9EdkmbhJ/tfGJKfkrad4dnYpCk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QLv5iS0E; spf=pass (imf07.hostedemail.com: domain of luto@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=luto@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664837368; a=rsa-sha256; cv=none; b=TWmCXHeVZU/b3HUD7zumfQiC1mTlRSKuVClpl2Zc+O1gIzSzL0Aob1Ty3tlvL0JkYTgwEU NR8A1ZB+9++59FGa3CrO2/BoHN93h2OUTNNDQe5vVn7NgjowvEnEwZxpiM22rBxv3/VYIp 53MDYvEDmyJJyV/kFvUHjA8Jc/FYH/Y= X-Rspamd-Queue-Id: 54B0A40005 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=QLv5iS0E; spf=pass (imf07.hostedemail.com: domain of luto@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=luto@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: b66it8e4bg3bz9dcma8rauiqq31hdz4x X-HE-Tag: 1664837368-505263 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10/3/22 11:39, Kees Cook wrote: > On Thu, Sep 29, 2022 at 03:29:19PM -0700, Rick Edgecombe wrote: >> [...] >> Still allow FOLL_FORCE to write through shadow stack protections, as it >> does for read-only protections. > > As I asked in the cover letter: why do we need to add this for shstk? It > was a mistake for general memory. :P For debuggers, which use FOLL_FORCE, quite intentionally, to modify text. And once a debugger has ptrace write access to a target, shadow stacks provide exactly no protection -- ptrace can modify text and all registers. But /proc/.../mem may be a different story, and I'd be okay with having FOLL_PROC_MEM for legacy compatibility via /proc/.../mem and not allowing that to access shadow stacks. This does seem like it may not be very useful, though.